[form_handler] Adapt to Gajim changes

This commit is contained in:
lovetox
2020-04-30 21:48:50 +02:00
parent 5c9fbd6a88
commit 703d799bce

View File

@@ -20,7 +20,7 @@ from nbxmpp.modules.dataforms import extend_form
from gi.repository import Gtk from gi.repository import Gtk
from gajim.common import app from gajim.common import app
from gajim.common.connection_handlers_events import MessageOutgoingEvent from gajim.common.structs import OutgoingMessage
from gajim.gtk.dataform import DataFormWidget from gajim.gtk.dataform import DataFormWidget
@@ -52,11 +52,21 @@ class FormDialog(Gtk.ApplicationWindow):
def _on_send_clicked(self, _button): def _on_send_clicked(self, _button):
form = self._form_widget.get_submit_form() form = self._form_widget.get_submit_form()
app.nec.push_outgoing_event(MessageOutgoingEvent(None,
account=self._account, contact = app.contacts.get_contact(self._account, self._jid)
jid=self._jid, if contact is None:
form_node=form, return
is_loggable=False))
message = OutgoingMessage(account=self._account,
contact=contact,
message='Form sent',
type_='chat',
nodes=[form])
message.is_loggable = False
app.connections[self._account].send_message(message)
control = find_control(self._account, self._jid) control = find_control(self._account, self._jid)
if control is None: if control is None:
return return