Author: bct Date: 2007-06-01 20:19:19 +0200 (Fri, 01 Jun 2007) New Revision: 8189
Modified: branches/e2e_encryption/src/gajim.py branches/e2e_encryption/src/negotiation.py Log: reject a session negotiation request
Modified: branches/e2e_encryption/src/gajim.py =================================================================== --- branches/e2e_encryption/src/gajim.py 2007-06-01 17:22:33 UTC (rev 8188) +++ branches/e2e_encryption/src/gajim.py 2007-06-01 18:19:19 UTC (rev 8189) @@ -1658,6 +1658,8 @@ def handle_session_negotiation(self, account, data): jid, thread_id, form = data # XXX check negotiation state, etc. + + # XXX check if the user has chosen to autoaccept these values negotiation.FeatureNegotiationWindow(account, jid, thread_id, form)
def handle_event_privacy_lists_received(self, account, data):
Modified: branches/e2e_encryption/src/negotiation.py =================================================================== --- branches/e2e_encryption/src/negotiation.py 2007-06-01 17:22:33 UTC (rev 8188) +++ branches/e2e_encryption/src/negotiation.py 2007-06-01 18:19:19 UTC (rev 8189) @@ -2,6 +2,8 @@ import dataforms_widget
from common import dataforms +from common import gajim +from common import xmpp
class FeatureNegotiationWindow: '''FeatureNegotiotionWindow class''' @@ -9,6 +11,7 @@ self.account = account self.jid = jid self.form = form + self.thread_id = thread_id
self.xml = gtkgui_helpers.get_glade('data_form_window.glade', 'data_form_window') self.window = self.xml.get_widget('data_form_window') @@ -21,3 +24,23 @@
self.xml.signal_autoconnect(self) self.window.show_all() + + def on_cancel_button_clicked(self, widget): + # XXX determine whether to reveal presence + + rejection = xmpp.Message(self.jid) + rejection.setThread(self.thread_id) + feature = rejection.NT.feature + feature.setNamespace(xmpp.NS_FEATURE) + + x = xmpp.DataForm(typ='submit') + x.addChild(node=xmpp.DataField('FORM_TYPE', value='urn:xmpp:ssn')) + x.addChild(node=xmpp.DataField('accept', value='false', typ='boolean')) + + feature.addChild(node=x) + + # XXX optional <body/> + + gajim.connections[self.account].send_stanza(rejection) + + self.window.destroy()