comparison plugins/plugin_xep_0100.py @ 65:d35c5edab53f

SàT: multi-profile: memory & dbus bridge's methods profile management /!\ profiles not managed yet for dbus signals
author Goffi <goffi@goffi.org>
date Sun, 31 Jan 2010 15:57:03 +1100
parents d46f849664aa
children 86f1f7f6d332
comparison
equal deleted inserted replaced
64:d46f849664aa 65:d35c5edab53f
41 41
42 def __init__(self, host): 42 def __init__(self, host):
43 info("Gateways plugin initialization") 43 info("Gateways plugin initialization")
44 self.host = host 44 self.host = host
45 self.__gateways = {} #dict used to construct the answer to findGateways. Key = target jid 45 self.__gateways = {} #dict used to construct the answer to findGateways. Key = target jid
46 host.bridge.addMethod("findGateways", ".communication", in_sign='s', out_sign='s', method=self.findGateways) 46 host.bridge.addMethod("findGateways", ".communication", in_sign='ss', out_sign='s', method=self.findGateways)
47 host.bridge.addMethod("gatewayRegister", ".request", in_sign='ssa(ss)', out_sign='s', method=self.gatewayRegister) 47 host.bridge.addMethod("gatewayRegister", ".request", in_sign='ssa(ss)', out_sign='s', method=self.gatewayRegister)
48 48
49 def __inc_handled_items(self, request_id): 49 def __inc_handled_items(self, request_id):
50 self.__gateways[request_id]['__handled_items']+=1 50 self.__gateways[request_id]['__handled_items']+=1
51 51
107 """Find gateways in the target JID, using discovery protocol 107 """Find gateways in the target JID, using discovery protocol
108 Return an id used for retrieving the list of gateways 108 Return an id used for retrieving the list of gateways
109 """ 109 """
110 client = self.host.getClient(profile_key) 110 client = self.host.getClient(profile_key)
111 assert(client) 111 assert(client)
112 print "target ===>", target
112 to_jid = jid.JID(target) 113 to_jid = jid.JID(target)
113 debug ("find gateways (target = %s)" % to_jid.full()) 114 debug ("find gateways (target = %s)" % to_jid.full())
114 request_id = self.host.get_next_id() 115 request_id = self.host.get_next_id()
115 client.disco.requestItems(to_jid).addCallback(self.discoItems, request_id=request_id, target = to_jid, client = client) 116 client.disco.requestItems(to_jid).addCallback(self.discoItems, request_id=request_id, target = to_jid, client = client)
116 return request_id 117 return request_id