[Peritus] handle confirmation requests sent via messages for XEP-0070. fixes #2995
This commit is contained in:
parent
1346ec39aa
commit
9c67eb961c
|
@ -1180,7 +1180,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
id = iq_obj.getTagAttr('confirm', 'id')
|
||||
method = iq_obj.getTagAttr('confirm', 'method')
|
||||
url = iq_obj.getTagAttr('confirm', 'url')
|
||||
self.dispatch('HTTP_AUTH', (method, url, id, iq_obj));
|
||||
msg = iq_obj.getTagData('body') # In case it's a message with a body
|
||||
self.dispatch('HTTP_AUTH', (method, url, id, iq_obj, msg));
|
||||
raise common.xmpp.NodeProcessed
|
||||
|
||||
def _ErrorCB(self, con, iq_obj):
|
||||
|
@ -1384,6 +1385,11 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
if msg.getTag('event') is not None:
|
||||
self._pubsubEventCB(con, msg)
|
||||
return
|
||||
# check if the message is a xep70-confirmation-request
|
||||
if msg.getTag('confirm') and msg.getTag('confirm').namespace == \
|
||||
common.xmpp.NS_HTTP_AUTH:
|
||||
self._HttpAuthCB(con, msg)
|
||||
return
|
||||
msgtxt = msg.getBody()
|
||||
msghtml = msg.getXHTML()
|
||||
mtype = msg.getType()
|
||||
|
|
|
@ -400,13 +400,16 @@ class Interface:
|
|||
gc_control.show_change_nick_input_dialog(title, prompt, proposed_nick)
|
||||
|
||||
def handle_event_http_auth(self, account, data):
|
||||
#('HTTP_AUTH', account, (method, url, transaction_id, iq_obj))
|
||||
#('HTTP_AUTH', account, (method, url, transaction_id, iq_obj, msg))
|
||||
def response(widget, account, iq_obj, answer):
|
||||
self.dialog.destroy()
|
||||
gajim.connections[account].build_http_auth_answer(iq_obj, answer)
|
||||
|
||||
sec_msg = _('Do you accept this request?')
|
||||
if data[4]:
|
||||
sec_msg = data[4] + '\n' + sec_msg
|
||||
self.dialog = dialogs.YesNoDialog(_('HTTP (%s) Authorization for %s (id: %s)') \
|
||||
% (data[0], data[1], data[2]), _('Do you accept this request?'),
|
||||
% (data[0], data[1], data[2]), sec_msg,
|
||||
on_response_yes = (response, account, data[3], 'yes'),
|
||||
on_response_no = (response, account, data[3], 'no'))
|
||||
|
||||
|
|
Loading…
Reference in New Issue