diff sat.tac @ 60:9764e027ecc0

SàT: multi-profile parameters, first draft - new bridge methods getProfilesList and createProfile - param xml now use two types: general and individual, general are common parameters, individual parameters are linked to profiles - indidual xml are constructed from param xml and saved values /!\ params values are not saved yet
author Goffi <goffi@goffi.org>
date Thu, 28 Jan 2010 02:32:27 +1100
parents d660d1e5cee4
children 93cb45a7420f
line wrap: on
line diff
--- a/sat.tac	Sun Jan 10 18:40:45 2010 +1100
+++ b/sat.tac	Thu Jan 28 02:32:27 2010 +1100
@@ -21,7 +21,7 @@
 
 CONST = {
     'client_name' : u'SàT (Salut à toi)',
-    'client_version' : u'0.0.2',   #Please add 'D' at the end for dev versions
+    'client_version' : u'0.0.2D',   #Please add 'D' at the end for dev versions
     'local_dir' : '~/.sat'
 }
 
@@ -312,6 +312,8 @@
         self.server_features=[]  #XXX: temp dic, need to be transfered into self.memory in the future
 
         self.bridge=DBusBridge()
+        self.bridge.register("getProfilesList", self.memory.getProfilesList)
+        self.bridge.register("createProfile", self.memory.createProfile)
         self.bridge.register("registerNewAccount", self.registerNewAccount)
         self.bridge.register("connect", self.connect)
         self.bridge.register("disconnect", self.disconnect)
@@ -351,14 +353,19 @@
             self.plugins[plug_info['import_name']] = getattr(mod, plug_info['main'])(self)
             #TODO: test xmppclient presence and register handler parent
 
-    def connect(self):
+    def getJidFrProfile(self, profile):
+        """Return jid from source"""
+        if profile == "@DEFAULT@":
+            return  jid.JID(self.memory.getParamA("JabberID", "Connection"))
+
+    def connect(self, profile = '@DEFAULT@'):
         """Connect to jabber server"""
 
         if (self.isConnected()):
             info("already connected !")
             return
         print "connecting..."
-        self.me = jid.JID(self.memory.getParamA("JabberID", "Connection"))
+        self.me = self.getJidFrProfile(profile)
         self.xmppclient = SatXMPPClient(self.bridge, self.me, self.memory.getParamA("Password", "Connection"),
             self.memory.getParamA("Server", "Connection"), 5222)
         self.xmppclient.streamInitialized = self.streamInitialized