Mercurial > libervia-backend
comparison src/sat.tac @ 282:6a0c6d8e119d
added plugin xep-0115: entity capabilities
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 03 Feb 2011 01:27:57 +0100 |
parents | 05caa87196e6 |
children | 2720536b5a22 |
comparison
equal
deleted
inserted
replaced
281:1e3e169955b2 | 282:6a0c6d8e119d |
---|---|
80 self.__connected=False | 80 self.__connected=False |
81 self.profile = profile | 81 self.profile = profile |
82 self.host_app = host_app | 82 self.host_app = host_app |
83 | 83 |
84 def _authd(self, xmlstream): | 84 def _authd(self, xmlstream): |
85 print "SatXMPPClient" | 85 if not self.host_app.trigger.point("XML Initialized", xmlstream, self.profile): |
86 return | |
86 client.XMPPClient._authd(self, xmlstream) | 87 client.XMPPClient._authd(self, xmlstream) |
87 self.__connected=True | 88 self.__connected=True |
88 info (_("********** [%s] CONNECTED **********") % self.profile) | 89 info (_("********** [%s] CONNECTED **********") % self.profile) |
89 self.streamInitialized() | 90 self.streamInitialized() |
90 self.host_app.bridge.connected(self.profile) #we send the signal to the clients | 91 self.host_app.bridge.connected(self.profile) #we send the signal to the clients |
91 | 92 |
92 | 93 |
93 def streamInitialized(self): | 94 def streamInitialized(self): |
94 """Called after _authd""" | 95 """Called after _authd""" |
95 debug (_("XML stream is initialized")) | 96 debug (_("XML stream is initialized")) |
96 if not self.host_app.trigger.point("XML Initialized", self.xmlstream, self.profile): | |
97 return | |
98 self.keep_alife = task.LoopingCall(self.xmlstream.send, " ") #Needed to avoid disconnection (specially with openfire) | 97 self.keep_alife = task.LoopingCall(self.xmlstream.send, " ") #Needed to avoid disconnection (specially with openfire) |
99 self.keep_alife.start(180) | 98 self.keep_alife.start(180) |
100 | 99 |
101 self.disco = SatDiscoProtocol(self) | 100 self.disco = SatDiscoProtocol(self) |
102 self.disco.setHandlerParent(self) | 101 self.disco.setHandlerParent(self) |
103 self.discoHandler = disco.DiscoHandler() | 102 self.discoHandler = disco.DiscoHandler() |
104 self.discoHandler.setHandlerParent(self) | 103 self.discoHandler.setHandlerParent(self) |
104 | |
105 if not self.host_app.trigger.point("Disco Handled", self.profile): | |
106 return | |
105 | 107 |
106 self.roster.requestRoster() | 108 self.roster.requestRoster() |
107 | 109 |
108 self.presence.available() | 110 self.presence.available() |
109 | 111 |
110 self.disco.requestInfo(jid.JID(self.host_app.memory.getParamA("Server", "Connection", profile_key=self.profile))).addCallback(self.host_app.serverDisco) #FIXME: use these informations | 112 self.disco.requestInfo(jid.JID(self.host_app.memory.getParamA("Server", "Connection", profile_key=self.profile))).addCallback(self.host_app.serverDisco, self.profile) #FIXME: use these informations |
111 | 113 |
112 def initializationFailed(self, reason): | 114 def initializationFailed(self, reason): |
113 print ("initializationFailed: %s" % reason) | 115 print ("initializationFailed: %s" % reason) |
114 self.host_app.bridge.connectionError("AUTH_ERROR", self.profile) | 116 self.host_app.bridge.connectionError("AUTH_ERROR", self.profile) |
115 try: | 117 try: |
343 self.profiles = {} | 345 self.profiles = {} |
344 self.plugins = {} | 346 self.plugins = {} |
345 self.menus = {} #used to know which new menus are wanted by plugins | 347 self.menus = {} #used to know which new menus are wanted by plugins |
346 | 348 |
347 self.memory=Memory(self) | 349 self.memory=Memory(self) |
348 self.server_features=[] #XXX: temp dic, need to be transfered into self.memory in the future | |
349 | 350 |
350 self.bridge=DBusBridge() | 351 self.bridge=DBusBridge() |
351 self.bridge.register("getVersion", lambda: self.get_const('client_version')) | 352 self.bridge.register("getVersion", lambda: self.get_const('client_version')) |
352 self.bridge.register("getProfileName", self.memory.getProfileName) | 353 self.bridge.register("getProfileName", self.memory.getProfileName) |
353 self.bridge.register("getProfilesList", self.memory.getProfilesList) | 354 self.bridge.register("getProfilesList", self.memory.getProfilesList) |
670 self.bridge.contactDeleted(to, profile) | 671 self.bridge.contactDeleted(to, profile) |
671 | 672 |
672 | 673 |
673 ## callbacks ## | 674 ## callbacks ## |
674 | 675 |
675 def serverDisco(self, disco): | 676 def serverDisco(self, disco, profile): |
676 """xep-0030 Discovery Protocol.""" | 677 """xep-0030 Discovery Protocol.""" |
677 for feature in disco.features: | 678 for feature in disco.features: |
678 debug (_("Feature found: %s"),feature) | 679 debug (_("Feature found: %s"),feature) |
679 self.server_features.append(feature) | 680 self.memory.addServerFeature(feature, profile) |
680 for cat, type in disco.identities: | 681 for cat, type in disco.identities: |
681 debug (_("Identity found: [%(category)s/%(type)s] %(identity)s") % {'category':cat, 'type':type, 'identity':disco.identities[(cat,type)]}) | 682 debug (_("Identity found: [%(category)s/%(type)s] %(identity)s") % {'category':cat, 'type':type, 'identity':disco.identities[(cat,type)]}) |
682 | 683 |
683 | 684 |
684 ## Generic HMI ## | 685 ## Generic HMI ## |