ability to do jingle with zeroconf

This commit is contained in:
Yann Leboulanger 2010-03-14 22:12:10 +01:00
parent e5f95be6e9
commit 320157ec82
3 changed files with 9 additions and 4 deletions

View file

@ -68,8 +68,9 @@ class JingleSession(object):
self.connection = con # connection to use
# our full jid
#FIXME: Get rid of gajim here?
self.ourjid = gajim.get_jid_from_account(self.connection.name) + '/' + \
con.server_resource
self.ourjid = gajim.get_jid_from_account(self.connection.name)
if con.server_resource:
self.ourjid = self.ourjid + '/' + con.server_resource
self.peerjid = jid # jid we connect to
# jid we use as the initiator
self.initiator = weinitiate and self.ourjid or self.peerjid

View file

@ -319,6 +319,9 @@ class P2PClient(IdleObject):
common.xmpp.NS_BYTESTREAM)
self.RegisterHandler('iq', self._caller._DiscoverItemsGetCB, 'get',
common.xmpp.NS_DISCO_ITEMS)
self.RegisterHandler('iq', self._caller._JingleCB, 'result')
self.RegisterHandler('iq', self._caller._JingleCB, 'error')
self.RegisterHandler('iq', self._caller._JingleCB, 'set', common.xmpp.NS_JINGLE)
class P2PConnection(IdleObject, PlugIn):
def __init__(self, sock_hash, _sock, host=None, port=None, caller=None,
@ -765,7 +768,7 @@ class ClientZeroconf:
"""
Generate a random id
"""
''.join(Random().sample(string.letters + string.digits, 6))
return ''.join(Random().sample(string.letters + string.digits, 6))
def RegisterDisconnectHandler(self, handler):
"""

View file

@ -72,11 +72,12 @@ class ConnectionVcard(connection_handlers.ConnectionVcard):
class ConnectionHandlersZeroconf(ConnectionVcard,
ConnectionSocks5BytestreamZeroconf, ConnectionCommands, ConnectionPEP,
connection_handlers.ConnectionHandlersBase):
connection_handlers.ConnectionHandlersBase, connection_handlers.ConnectionJingle):
def __init__(self):
ConnectionVcard.__init__(self)
ConnectionSocks5BytestreamZeroconf.__init__(self)
ConnectionCommands.__init__(self)
connection_handlers.ConnectionJingle.__init__(self)
connection_handlers.ConnectionHandlersBase.__init__(self)
try: