Ticket #644: jep70.2.patch
| File jep70.2.patch, 3.6 KB (added by asterix, 5 years ago) |
|---|
-
common/xmpp/protocol.py
70 70 NS_FILE ='http://jabber.org/protocol/si/profile/file-transfer' # JEP-0096 71 71 NS_FEATURE ='http://jabber.org/protocol/feature-neg' 72 72 NS_BYTESTREAM ='http://jabber.org/protocol/bytestreams' # JEP-0065 73 NS_DISCO ='http://jabber.org/protocol/disco#info' # JEP-0095 74 NS_STREAM ='http://affinix.com/jabber/stream' 73 NS_DISCO ='http://jabber.org/protocol/disco#info' # JEP-0095 74 NS_STREAM ='http://affinix.com/jabber/stream' 75 NS_HTTP_AUTH ='http://jabber.org/protocol/http-auth' # JEP-0070 75 76 76 77 xmpp_stream_error_conditions=""" 77 78 bad-format -- -- -- The entity has sent XML that cannot be processed. -
common/connection.py
127 127 'GC_SUBJECT': [], 'GC_CONFIG': [], 'BAD_PASSPHRASE': [], 128 128 'ROSTER_INFO': [], 'ERROR_ANSWER': [], 'BOOKMARKS': [], 'CON_TYPE': [], 129 129 'FILE_REQUEST': [], 'FILE_RCV_COMPLETED': [], 'FILE_PROGRESS': [], 130 'STANZA_ARRIVED': [] 130 'STANZA_ARRIVED': [], 'HTTP_AUTH': [] 131 131 } 132 132 self.name = name 133 133 self.connected = 0 # offline … … 859 859 #Preferences data 860 860 #http://www.jabber.org/jeps/jep-0049.html 861 861 #TODO: implement this 862 pass 862 pass 863 864 def _HttpAuthCB(self, con, iq_obj): 865 opt = gajim.config.get('http_auth') 866 iq = None 867 if opt == 'yes': 868 iq = iq_obj.buildReply('result') 869 elif opt == 'no': 870 iq = iq_obj.buildReply('error') 871 iq.setError('not-authorized', 401) 872 else: 873 method = iq_obj.getTagAttr('confirm', 'method') 874 url = iq_obj.getTagAttr('confirm', 'url') 875 self.dispatch('HTTP_AUTH', (method, url, iq_obj)); 876 if iq: 877 con.send(iq) 878 raise common.xmpp.NodeProcessed 863 879 864 880 def _ErrorCB(self, con, iq_obj): 865 881 errmsg = iq_obj.getError() … … 989 1005 common.xmpp.NS_ROSTER) 990 1006 con.RegisterHandler('iq', self._PrivateCB, 'result', 991 1007 common.xmpp.NS_PRIVATE) 1008 con.RegisterHandler('iq', self._HttpAuthCB, 'get', 1009 common.xmpp.NS_HTTP_AUTH) 992 1010 con.RegisterHandler('iq', self._ErrorCB, 'error') 993 1011 con.RegisterHandler('iq', self._StanzaArrivedCB) 994 1012 con.RegisterHandler('presence', self._StanzaArrivedCB) -
common/config.py
154 154 # try for 2 minutes before giving up (aka. timeout after those seconds) 155 155 'try_connecting_for_foo_secs': [ opt_int, 60 ], 156 156 'max_stanza_per_sec': [ opt_int, 5], 157 'http_auth': [opt_str, 'ask'], # yes, no, ask 157 158 }, {}), 158 159 'statusmsg': ({ 159 160 'message': [ opt_str, '' ], -
gajim.py
197 197 #('INFORMATION', account, (title_text, section_text)) 198 198 dialogs.InformationDialog(data[0], data[1]).get_response() 199 199 200 def handle_event_http_auth(self, account, data): 201 #('HTTP_AUTH', account, (method, url, iq_obj)) 202 dialog = dialogs.ConfirmationDialog(_('HTTP (%s) Authorization for %s') \ 203 % (array[0], array[1]), _('Do you accept this request?')) 204 if dialog.get_response() == gtk.RESPONSE_OK: 205 answer = 'yes' 206 else: 207 answer = 'no' 208 gajim.connections[account].build_http_auth_answer(data[2], answer) 209 200 210 def handle_event_error_answer(self, account, array): 201 211 id, jid_from, errmsg, errcode = array 202 212 if str(errcode) in ['403', '406'] and id:
