can now accept a session negotiation
This commit is contained in:
parent
32804eed1c
commit
d696f79c55
2 changed files with 31 additions and 2 deletions
16
src/gajim.py
16
src/gajim.py
|
@ -1658,8 +1658,22 @@ class Interface:
|
||||||
def handle_session_negotiation(self, account, data):
|
def handle_session_negotiation(self, account, data):
|
||||||
jid, thread_id, form = data
|
jid, thread_id, form = data
|
||||||
# XXX check negotiation state, etc.
|
# 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):
|
def handle_event_privacy_lists_received(self, account, data):
|
||||||
|
|
|
@ -25,6 +25,21 @@ class FeatureNegotiationWindow:
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
self.window.show_all()
|
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):
|
def on_cancel_button_clicked(self, widget):
|
||||||
# XXX determine whether to reveal presence
|
# XXX determine whether to reveal presence
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue