diff options
author | Brendan Taylor <bct@diffeq.com> | 2007-06-02 02:08:23 +0400 |
---|---|---|
committer | Brendan Taylor <bct@diffeq.com> | 2007-06-02 02:08:23 +0400 |
commit | d696f79c558343f8e9a31ad7221094487a472437 (patch) | |
tree | 84e1490f15402436dbae59248228995b0b9788ed | |
parent | 32804eed1c46e9ab25c31fbb44e883e8e00010c7 (diff) |
can now accept a session negotiation
-rwxr-xr-x | src/gajim.py | 18 | ||||
-rw-r--r-- | src/negotiation.py | 15 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/gajim.py b/src/gajim.py index 8ab4d7ad3..53ab20863 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1658,9 +1658,23 @@ class Interface: def handle_session_negotiation(self, account, data): jid, thread_id, form = data # XXX check negotiation state, etc. + # XXX check if we can autoaccept + + if form.getType() == 'form': + ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account) + if not ctrl: + resource = jid.getResource() + contact = gajim.contacts.get_contact(account, str(jid), resource) + if not contact: + connection = gajim.connections[account] + contact = gajim.contacts.create_contact(jid = jid.getStripped(), resource = resource, show = connection.get_status()) + self.roster.new_chat(contact, account, resource = resource) + + ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account) + + ctrl.set_thread_id(thread_id) - # XXX check if the user has chosen to autoaccept these values - negotiation.FeatureNegotiationWindow(account, jid, thread_id, form) + negotiation.FeatureNegotiationWindow(account, jid, thread_id, form) def handle_event_privacy_lists_received(self, account, data): # ('PRIVACY_LISTS_RECEIVED', account, list) diff --git a/src/negotiation.py b/src/negotiation.py index 9942f5dcc..32fbf0a3a 100644 --- a/src/negotiation.py +++ b/src/negotiation.py @@ -25,6 +25,21 @@ class FeatureNegotiationWindow: self.xml.signal_autoconnect(self) self.window.show_all() + def on_ok_button_clicked(self, widget): + acceptance = xmpp.Message(self.jid) + acceptance.setThread(self.thread_id) + feature = acceptance.NT.feature + feature.setNamespace(xmpp.NS_FEATURE) + + form = self.data_form_widget.data_form + form.setAttr('type', 'submit') + + feature.addChild(node=form) + + gajim.connections[self.account].send_stanza(acceptance) + + self.window.destroy() + def on_cancel_button_clicked(self, widget): # XXX determine whether to reveal presence |