diff 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
line wrap: on
line diff
--- a/src/sat.tac	Thu Feb 03 01:27:09 2011 +0100
+++ b/src/sat.tac	Thu Feb 03 01:27:57 2011 +0100
@@ -82,7 +82,8 @@
         self.host_app = host_app
 
     def _authd(self, xmlstream):
-        print "SatXMPPClient"
+        if not self.host_app.trigger.point("XML Initialized", xmlstream, self.profile):
+            return
         client.XMPPClient._authd(self, xmlstream)
         self.__connected=True
         info (_("********** [%s] CONNECTED **********") % self.profile)
@@ -93,8 +94,6 @@
     def streamInitialized(self):
         """Called after _authd"""
         debug (_("XML stream is initialized"))
-        if not self.host_app.trigger.point("XML Initialized", self.xmlstream, self.profile):
-            return
         self.keep_alife = task.LoopingCall(self.xmlstream.send, " ")  #Needed to avoid disconnection (specially with openfire)
         self.keep_alife.start(180)
         
@@ -102,12 +101,15 @@
         self.disco.setHandlerParent(self)
         self.discoHandler = disco.DiscoHandler()
         self.discoHandler.setHandlerParent(self)
+        
+        if not self.host_app.trigger.point("Disco Handled", self.profile):
+            return
 
         self.roster.requestRoster()
         
         self.presence.available()
        
-        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
+        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
 
     def initializationFailed(self, reason):
         print ("initializationFailed: %s" % reason)
@@ -345,7 +347,6 @@
         self.menus = {} #used to know which new menus are wanted by plugins
         
         self.memory=Memory(self)
-        self.server_features=[]  #XXX: temp dic, need to be transfered into self.memory in the future
 
         self.bridge=DBusBridge()
         self.bridge.register("getVersion", lambda: self.get_const('client_version'))
@@ -672,11 +673,11 @@
 
     ## callbacks ##
 
-    def serverDisco(self, disco):
+    def serverDisco(self, disco, profile):
         """xep-0030 Discovery Protocol."""
         for feature in disco.features:
             debug (_("Feature found: %s"),feature)
-            self.server_features.append(feature)
+            self.memory.addServerFeature(feature, profile)
         for cat, type in disco.identities:
             debug (_("Identity found: [%(category)s/%(type)s] %(identity)s") % {'category':cat, 'type':type, 'identity':disco.identities[(cat,type)]})