Commit ff2fab73 authored by Philipp Hörist's avatar Philipp Hörist

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
parent 3e4cf4a0
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment