diff sat.tac @ 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 8147b4f40809
line wrap: on
line diff
--- a/sat.tac	Sat Jan 30 16:17:33 2010 +1100
+++ b/sat.tac	Sun Jan 31 15:57:03 2010 +1100
@@ -81,7 +81,7 @@
         print "SatXMPPClient"
         client.XMPPClient._authd(self, xmlstream)
         self.__connected=True
-        print "********** CONNECTED **********"
+        print "********** [%s] CONNECTED **********" % self.profile
         self.streamInitialized()
         self.host_app.bridge.connected() #we send the signal to the clients
 
@@ -107,7 +107,7 @@
     
     def connectionLost(self, connector, unused_reason):
         self.__connected=False
-        print "********** DISCONNECTED **********"
+        print "********** [%s] DISCONNECTED **********" % self.profile
         try:
             self.keep_alife.stop()
         except AttributeError:
@@ -164,14 +164,14 @@
         if item.name:
             item_attr['name'] = item.name
         info ("new contact in roster list: %s", item.jid.full())
-        self.host.memory.addContact(item.jid, item_attr, item.groups)
+        self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile)
         self.host.bridge.newContact(item.jid.full(), item_attr, item.groups)
     
     def onRosterRemove(self, entity):
         """Called when a roster removal event is received"""
         #TODO: send a signal to frontends
         print "removing %s from roster list" % entity.full()
-        self.host.memory.delContact(entity)
+        self.host.memory.delContact(entity, self.parent.profile)
 
 class SatPresenceProtocol(xmppim.PresenceClientProtocol):
 
@@ -187,7 +187,7 @@
             del statuses[None]
 
         self.host.memory.addPresenceStatus(entity, show or "",
-                int(priority), statuses)
+                int(priority), statuses, self.parent.profile)
 
         #now it's time to notify frontends
         self.host.bridge.presenceUpdate(entity.full(),  show or "",
@@ -197,7 +197,7 @@
         if statuses and statuses.has_key(None):   #we only want string keys
             statuses["default"] = statuses[None]
             del statuses[None]
-        self.host.memory.addPresenceStatus(entity, "unavailable", 0, statuses)
+        self.host.memory.addPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile)
 
         #now it's time to notify frontends
         self.host.bridge.presenceUpdate(entity.full(), "unavailable", 0, statuses)
@@ -211,22 +211,22 @@
     
     def subscribedReceived(self, entity):
         debug ("subscription approved for [%s]" % entity.userhost())
-        self.host.memory.delWaitingSub(entity.userhost())
+        self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
         self.host.bridge.subscribe('subscribed', entity.userhost())
 
     def unsubscribedReceived(self, entity):
         debug ("unsubscription confirmed for [%s]" % entity.userhost())
-        self.host.memory.delWaitingSub(entity.userhost())
+        self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
         self.host.bridge.subscribe('unsubscribed', entity.userhost())
 
     def subscribeReceived(self, entity):
         debug ("subscription request for [%s]" % entity.userhost())
-        self.host.memory.addWaitingSub('subscribe', entity.userhost())
+        self.host.memory.addWaitingSub('subscribe', entity.userhost(), self.parent.profile)
         self.host.bridge.subscribe('subscribe', entity.userhost())
 
     def unsubscribeReceived(self, entity):
         debug ("unsubscription asked for [%s]" % entity.userhost())
-        self.host.memory.addWaitingSub('unsubscribe', entity.userhost())
+        self.host.memory.addWaitingSub('unsubscribe', entity.userhost(), self.parent.profile)
         self.host.bridge.subscribe('unsubscribe', entity.userhost())
 
 class SatDiscoProtocol(disco.DiscoClientProtocol):