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
This commit is contained in:
Philipp Hörist 2018-07-07 19:20:28 +02:00
parent 3e4cf4a07d
commit ff2fab73a1
1 changed files with 8 additions and 1 deletions

View File

@ -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):