reject a session negotiation request
This commit is contained in:
parent
654b3ff012
commit
32804eed1c
|
@ -1658,6 +1658,8 @@ class Interface:
|
|||
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):
|
||||
|
|
|
@ -2,6 +2,8 @@ import gtkgui_helpers
|
|||
import dataforms_widget
|
||||
|
||||
from common import dataforms
|
||||
from common import gajim
|
||||
from common import xmpp
|
||||
|
||||
class FeatureNegotiationWindow:
|
||||
'''FeatureNegotiotionWindow class'''
|
||||
|
@ -9,6 +11,7 @@ class FeatureNegotiationWindow:
|
|||
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 @@ class FeatureNegotiationWindow:
|
|||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue