no need to go through GUI to handle cert request / reply

This commit is contained in:
Yann Leboulanger 2010-08-11 08:44:49 +02:00
parent 08c854aefa
commit fb41b65368
2 changed files with 11 additions and 20 deletions

View file

@ -45,13 +45,13 @@ import common.xmpp
from common import helpers from common import helpers
from common import gajim from common import gajim
from common import exceptions from common import exceptions
from common import jingle_xtls
from common.commands import ConnectionCommands from common.commands import ConnectionCommands
from common.pubsub import ConnectionPubSub from common.pubsub import ConnectionPubSub
from common.pep import ConnectionPEP from common.pep import ConnectionPEP
from common.protocol.caps import ConnectionCaps from common.protocol.caps import ConnectionCaps
from common.protocol.bytestream import ConnectionSocks5Bytestream from common.protocol.bytestream import ConnectionSocks5Bytestream
import common.caps_cache as capscache import common.caps_cache as capscache
import common.jingle_xtls
if gajim.HAVE_FARSIGHT: if gajim.HAVE_FARSIGHT:
from common.jingle import ConnectionJingle from common.jingle import ConnectionJingle
@ -2243,16 +2243,17 @@ ConnectionCaps, ConnectionHandlersBase, ConnectionJingle):
df[i.getName()] = i.getData() df[i.getName()] = i.getData()
self.dispatch('SEARCH_FORM', (jid, df, False)) self.dispatch('SEARCH_FORM', (jid, df, False))
def _PubkeyGetCB(self, con, obj): def _PubkeyGetCB(self, con, iq_obj):
log.info('PubkeyGetCB') log.info('PubkeyGetCB')
jid_from = unicode(obj.getAttr('from')) jid_from = helpers.get_full_jid_from_iq(iq_obj)
sid = obj.getAttr('id') sid = iq_obj.getAttr('id')
self.dispatch('PUBKEY_REQUEST', (con, obj, jid_from, sid)) jingle_xtls.send_cert(con, jid_from, sid)
raise common.xmpp.NodeProcessed
def _PubkeyResultCB(self, con, obj): def _PubkeyResultCB(self, con, iq_obj):
log.info('PubkeyResultCB') log.info('PubkeyResultCB')
jid_from = unicode(obj.getAttr('from')) jid_from = helpers.get_full_jid_from_iq(iq_obj)
self.dispatch('PUBKEY_RESULT', (con, obj, jid_from)); jingle_xtls.handle_new_cert(con, iq_obj, jid_from)
def _StreamCB(self, con, obj): def _StreamCB(self, con, obj):
if obj.getTag('conflict'): if obj.getTag('conflict'):

View file

@ -2112,14 +2112,6 @@ class Interface:
if pm_ctrl and hasattr(pm_ctrl, "update_contact"): if pm_ctrl and hasattr(pm_ctrl, "update_contact"):
pm_ctrl.update_contact() pm_ctrl.update_contact()
def handle_event_pubkey_request(self, account, data):
con, obj, jid_from, sid = data
common.jingle_xtls.send_cert(con, jid_from, sid)
def handle_event_pubkey_result(self, account, data):
con, obj, jid_from = data
common.jingle_xtls.handle_new_cert(con, obj, jid_from)
def create_core_handlers_list(self): def create_core_handlers_list(self):
self.handlers = { self.handlers = {
'ROSTER': [self.handle_event_roster], 'ROSTER': [self.handle_event_roster],
@ -2212,8 +2204,6 @@ class Interface:
'JINGLE_ERROR': [self.handle_event_jingle_error], 'JINGLE_ERROR': [self.handle_event_jingle_error],
'PEP_RECEIVED': [self.handle_event_pep_received], 'PEP_RECEIVED': [self.handle_event_pep_received],
'CAPS_RECEIVED': [self.handle_event_caps_received], 'CAPS_RECEIVED': [self.handle_event_caps_received],
'PUBKEY_REQUEST': [self.handle_event_pubkey_request],
'PUBKEY_RESULT': [self.handle_event_pubkey_result],
} }
def register_core_handlers(self): def register_core_handlers(self):