From 9cd8788400dc7a4802e6233512dcb20a741f87b2 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 20 Aug 2016 00:12:59 +0200 Subject: Implement XEP-0070 using the confirmtab --- poezio/core/handlers.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'poezio/core/handlers.py') diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index ea605b2a..bc94129d 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -1249,6 +1249,38 @@ SHA-512 of the new certificate: %s if not config.silent_set('certificate', sha2_found_cert): self.core.information('Unable to write in the config file', 'Error') + def http_confirm(self, stanza): + confirm = stanza['confirm'] + def cb(result): + if result: + reply = stanza.reply() + else: + reply = stanza.reply() + reply.enable('error') + reply['error']['type'] = 'auth' + reply['error']['code'] = '401' + reply['error']['condition'] = 'not-authorized' + reply.append(stanza['confirm']) + reply.send() + + c_id, c_url, c_method = confirm['id'], confirm['url'], confirm['method'] + confirm_tab = tabs.ConfirmTab(self.core, + 'HTTP Verification', + """ +Someone (maybe you) has requested an identity verification regarding +using method "%s" for the url "%s". + +The transaction id is: %s +And the XMPP address of the verification service is %s. + +""" % (c_method, c_url, c_id, stanza['from'].full), + 'An HTTP verification was requested', + cb, + critical=False) + self.core.add_tab(confirm_tab, False) + self.core.refresh_window() + self.core.doupdate() + ### Ad-hoc commands def next_adhoc_step(self, iq, adhoc_session): -- cgit v1.2.3