Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDafydd Harries <daf@rhydd.org>2007-12-11 15:01:17 (GMT)
committer Dafydd Harries <daf@rhydd.org>2007-12-11 15:01:17 (GMT)
commitdf929245222fb2536bc738e83743faae9f4b97bc (patch)
treefc158fdd98070ea1d362a0c8e74da452ee81a1d4
parentfe80f9643adede3d5c634398cf1902ba691b419a (diff)
call SyncFriends on presence service when friends list changes
Patch by Guillaume Desmottes.
-rw-r--r--shell/model/Friends.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/shell/model/Friends.py b/shell/model/Friends.py
index 2b7d6bf..6fc3e97 100644
--- a/shell/model/Friends.py
+++ b/shell/model/Friends.py
@@ -14,6 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+import dbus
import os
from ConfigParser import ConfigParser
@@ -86,3 +87,28 @@ class Friends(gobject.GObject):
fileobject = open(self._path, 'w')
cp.write(fileobject)
fileobject.close()
+
+ self._sync_friends()
+
+ def _sync_friends(self):
+ # XXX: temporary hack
+ # remove this when the shell service has a D-Bus API for buddies
+
+ def friends_synced():
+ pass
+
+ def friends_synced_error(e):
+ logging.error("Error asking presence service to sync friends: %s"
+ % e)
+
+ keys = []
+ for friend in self:
+ keys.append(friend.get_key())
+
+ bus = dbus.SessionBus()
+ ps = bus.get_object('org.laptop.Sugar.Presence',
+ '/org/laptop/Sugar/Presence')
+ psi = dbus.Interface(ps, 'org.laptop.Sugar.Presence')
+ psi.SyncFriends(keys,
+ reply_handler=friends_synced,
+ error_handler=friends_synced_error)