Philipp Hörist pushed to branch master at gajim / gajim

Commits:
ff2fab73 by Philipp Hörist at 2018-07-07T19:20:28+02:00
Parse input sent via XMLConsole

This allows us to show the user an error if the stanza is invalid.
Until now the server would instantly disconnect us.

Also this fixes the problem that XMLConsole input was not counted for
streammanagement.

Fixes #8563

- - - - -


1 changed file:

- gajim/dialogs.py


Changes:

=====================================
gajim/dialogs.py
=====================================
--- a/gajim/dialogs.py
+++ b/gajim/dialogs.py
@@ -3503,7 +3503,14 @@ class XMLConsoleWindow(Gtk.Window):
         begin_iter, end_iter = buffer_.get_bounds()
         stanza = buffer_.get_text(begin_iter, end_iter, True)
         if stanza:
-            app.connections[self.account].send_stanza(stanza)
+            try:
+                node = nbxmpp.Protocol(node=stanza)
+                if node.getNamespace() == 
'http://www.gajim.org/xmlns/undeclared':
+                    node.setNamespace(nbxmpp.NS_CLIENT)
+            except Exception as error:
+                ErrorDialog(_('Invalid Node'), str(error))
+                return
+            app.connections[self.account].connection.send(node)
             buffer_.set_text('')
 
     def on_input(self, button, *args):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/ff2fab73a15732511ba6d4490b35347e7be2167e

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/ff2fab73a15732511ba6d4490b35347e7be2167e
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to