2007-04-15 05:38:21 +02:00
|
|
|
"""UI class to access system-level presence object"""
|
2007-04-09 20:40:56 +02:00
|
|
|
# Copyright (C) 2007, Red Hat, Inc.
|
2006-10-15 01:08:44 +02:00
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the
|
|
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
# Boston, MA 02111-1307, USA.
|
|
|
|
|
2006-07-25 22:52:45 +02:00
|
|
|
import dbus, dbus.glib, gobject
|
2007-04-13 22:27:58 +02:00
|
|
|
import logging
|
2006-06-13 21:25:54 +02:00
|
|
|
|
2007-04-15 05:38:21 +02:00
|
|
|
# XXX use absolute imports
|
|
|
|
# from sugar.presence import buddy, activity
|
|
|
|
# this *kind* of relative import is deprecated
|
|
|
|
# with an explicit relative import slated to be
|
|
|
|
# introduced (available in Python 2.5 with a __future__
|
|
|
|
# import), that would read as:
|
|
|
|
# from . import buddy, activity
|
|
|
|
# see PEP: http://docs.python.org/whatsnew/pep-328.html
|
2007-04-09 20:40:56 +02:00
|
|
|
import buddy, activity
|
2007-03-28 12:17:34 +02:00
|
|
|
|
2006-07-19 21:27:37 +02:00
|
|
|
class ObjectCache(object):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Path to Activity/Buddy object cache
|
|
|
|
|
|
|
|
On notification of a new object of either type the
|
|
|
|
PresenceService client stores the object's representation
|
|
|
|
in this object.
|
|
|
|
|
|
|
|
XXX Why not just sub-class dict? We're only adding two
|
|
|
|
methods then and we would have all of the other
|
|
|
|
standard operations on dictionaries.
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
def __init__(self):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Initialise the cache"""
|
2006-12-04 20:12:24 +01:00
|
|
|
self._cache = {}
|
2006-07-19 21:27:37 +02:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
def get(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieve specified object from the cache
|
|
|
|
|
|
|
|
object_path -- full dbus path to the object
|
|
|
|
|
|
|
|
returns a presence.buddy.Buddy or presence.activity.Activity
|
|
|
|
instance or None if the object_path is not yet cached.
|
|
|
|
|
|
|
|
XXX could be written as return self._cache.get( object_path )
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
try:
|
|
|
|
return self._cache[object_path]
|
|
|
|
except KeyError:
|
|
|
|
return None
|
2006-07-19 21:27:37 +02:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
def add(self, obj):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Adds given presence object to the cache
|
|
|
|
|
|
|
|
obj -- presence Buddy or Activity representation, the object's
|
|
|
|
object_path() method is used as the key for storage
|
|
|
|
|
|
|
|
returns None
|
|
|
|
|
|
|
|
XXX should raise an error on collisions, shouldn't it? or
|
|
|
|
return True/False to say whether the item was actually
|
|
|
|
added
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
op = obj.object_path()
|
|
|
|
if not self._cache.has_key(op):
|
|
|
|
self._cache[op] = obj
|
2006-07-19 21:27:37 +02:00
|
|
|
|
2006-12-04 20:12:24 +01:00
|
|
|
def remove(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Remove the given presence object from the cache
|
|
|
|
|
|
|
|
object_path -- full dbus path to the object
|
|
|
|
|
|
|
|
returns None
|
|
|
|
|
|
|
|
XXX does two checks instead of one with a try:except for the
|
|
|
|
keyerror, normal case of deleting existing penalised as
|
|
|
|
a result.
|
|
|
|
|
|
|
|
try:
|
|
|
|
return self._cache.pop( key )
|
|
|
|
except KeyError:
|
|
|
|
return None
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
if self._cache.has_key(object_path):
|
|
|
|
del self._cache[object_path]
|
2006-06-13 21:25:54 +02:00
|
|
|
|
2006-07-24 18:27:21 +02:00
|
|
|
|
2007-04-09 20:40:50 +02:00
|
|
|
DBUS_SERVICE = "org.laptop.Sugar.Presence"
|
|
|
|
DBUS_INTERFACE = "org.laptop.Sugar.Presence"
|
|
|
|
DBUS_PATH = "/org/laptop/Sugar/Presence"
|
2006-07-24 18:27:21 +02:00
|
|
|
|
|
|
|
|
2006-06-13 00:31:26 +02:00
|
|
|
class PresenceService(gobject.GObject):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""UI-side interface to the dbus presence service
|
|
|
|
|
|
|
|
This class provides UI programmers with simplified access
|
|
|
|
to the dbus service of the same name. It allows for observing
|
|
|
|
various events from the presence service as GObject events,
|
|
|
|
as well as some basic introspection queries.
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
__gsignals__ = {
|
|
|
|
'buddy-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT])),
|
|
|
|
'buddy-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT])),
|
2007-04-09 20:40:50 +02:00
|
|
|
'activity-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
2006-12-04 20:12:24 +01:00
|
|
|
([gobject.TYPE_PYOBJECT])),
|
2007-04-09 20:40:50 +02:00
|
|
|
'private-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT,
|
|
|
|
gobject.TYPE_PYOBJECT])),
|
2006-12-04 20:12:24 +01:00
|
|
|
'activity-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT])),
|
|
|
|
'activity-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
2007-04-13 22:27:58 +02:00
|
|
|
([gobject.TYPE_PYOBJECT])),
|
|
|
|
'activity-shared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT,
|
|
|
|
gobject.TYPE_PYOBJECT]))
|
2006-12-04 20:12:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_PS_BUDDY_OP = DBUS_PATH + "/Buddies/"
|
|
|
|
_PS_ACTIVITY_OP = DBUS_PATH + "/Activities/"
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Initialise the service and connect to events"""
|
2006-12-04 20:12:24 +01:00
|
|
|
gobject.GObject.__init__(self)
|
|
|
|
self._objcache = ObjectCache()
|
|
|
|
self._bus = dbus.SessionBus()
|
|
|
|
self._ps = dbus.Interface(self._bus.get_object(DBUS_SERVICE,
|
|
|
|
DBUS_PATH), DBUS_INTERFACE)
|
|
|
|
self._ps.connect_to_signal('BuddyAppeared', self._buddy_appeared_cb)
|
|
|
|
self._ps.connect_to_signal('BuddyDisappeared', self._buddy_disappeared_cb)
|
|
|
|
self._ps.connect_to_signal('ActivityAppeared', self._activity_appeared_cb)
|
|
|
|
self._ps.connect_to_signal('ActivityDisappeared', self._activity_disappeared_cb)
|
2007-04-09 20:40:50 +02:00
|
|
|
self._ps.connect_to_signal('ActivityInvitation', self._activity_invitation_cb)
|
|
|
|
self._ps.connect_to_signal('PrivateInvitation', self._private_invitation_cb)
|
2006-12-04 20:12:24 +01:00
|
|
|
|
|
|
|
def _new_object(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Turn new object path into (cached) Buddy/Activity instance
|
|
|
|
|
|
|
|
object_path -- full dbus path of the new object, must be
|
|
|
|
prefixed with either of _PS_BUDDY_OP or _PS_ACTIVITY_OP
|
|
|
|
|
|
|
|
Note that this method is called throughout the class whenever
|
|
|
|
the representation of the object is required, it is not only
|
|
|
|
called when the object is first discovered.
|
|
|
|
|
|
|
|
returns presence Buddy or Activity representation
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
obj = self._objcache.get(object_path)
|
|
|
|
if not obj:
|
2007-04-09 20:40:56 +02:00
|
|
|
if object_path.startswith(self._PS_BUDDY_OP):
|
2007-04-09 22:05:32 +02:00
|
|
|
obj = buddy.Buddy(self._bus, self._new_object,
|
2006-12-04 20:12:24 +01:00
|
|
|
self._del_object, object_path)
|
|
|
|
elif object_path.startswith(self._PS_ACTIVITY_OP):
|
2007-04-09 22:05:32 +02:00
|
|
|
obj = activity.Activity(self._bus, self._new_object,
|
2006-12-04 20:12:24 +01:00
|
|
|
self._del_object, object_path)
|
|
|
|
else:
|
|
|
|
raise RuntimeError("Unknown object type")
|
|
|
|
self._objcache.add(obj)
|
|
|
|
return obj
|
|
|
|
|
|
|
|
def _del_object(self, object_path):
|
|
|
|
# FIXME
|
|
|
|
pass
|
|
|
|
|
|
|
|
def _emit_buddy_appeared_signal(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Emit GObject event with presence.buddy.Buddy object"""
|
2006-12-04 20:12:24 +01:00
|
|
|
self.emit('buddy-appeared', self._new_object(object_path))
|
|
|
|
return False
|
|
|
|
|
|
|
|
def _buddy_appeared_cb(self, op):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Callback for dbus event (forwards to method to emit GObject event)"""
|
2006-12-04 20:12:24 +01:00
|
|
|
gobject.idle_add(self._emit_buddy_appeared_signal, op)
|
|
|
|
|
|
|
|
def _emit_buddy_disappeared_signal(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Emit GObject event with presence.buddy.Buddy object"""
|
2006-12-04 20:12:24 +01:00
|
|
|
self.emit('buddy-disappeared', self._new_object(object_path))
|
|
|
|
return False
|
|
|
|
|
|
|
|
def _buddy_disappeared_cb(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Callback for dbus event (forwards to method to emit GObject event)"""
|
2006-12-04 20:12:24 +01:00
|
|
|
gobject.idle_add(self._emit_buddy_disappeared_signal, object_path)
|
|
|
|
|
2007-04-09 20:40:56 +02:00
|
|
|
def _emit_activity_invitation_signal(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Emit GObject event with presence.activity.Activity object"""
|
2007-04-09 20:40:56 +02:00
|
|
|
self.emit('activity-invitation', self._new_object(object_path))
|
2006-12-04 20:12:24 +01:00
|
|
|
return False
|
|
|
|
|
2007-04-09 20:40:56 +02:00
|
|
|
def _activity_invitation_cb(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Callback for dbus event (forwards to method to emit GObject event)"""
|
2007-04-09 20:40:56 +02:00
|
|
|
gobject.idle_add(self._emit_activity_invitation_signal, object_path)
|
2006-12-04 20:12:24 +01:00
|
|
|
|
2007-04-09 20:40:56 +02:00
|
|
|
def _emit_private_invitation_signal(self, bus_name, connection, channel):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Emit GObject event with bus_name, connection and channel
|
|
|
|
|
|
|
|
XXX This seems to generate the wrong GObject event? It generates
|
|
|
|
'service-disappeared' instead of private-invitation for some
|
|
|
|
reason. That event doesn't even seem to be registered?
|
|
|
|
"""
|
2007-04-09 20:40:56 +02:00
|
|
|
self.emit('service-disappeared', bus_name, connection, channel)
|
2006-12-04 20:12:24 +01:00
|
|
|
return False
|
|
|
|
|
2007-04-09 20:40:56 +02:00
|
|
|
def _private_invitation_cb(self, bus_name, connection, channel):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Callback for dbus event (forwards to method to emit GObject event)"""
|
2007-04-09 20:40:56 +02:00
|
|
|
gobject.idle_add(self._emit_service_disappeared_signal, bus_name,
|
|
|
|
connection, channel)
|
2006-12-04 20:12:24 +01:00
|
|
|
|
|
|
|
def _emit_activity_appeared_signal(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Emit GObject event with presence.activity.Activity object"""
|
2006-12-04 20:12:24 +01:00
|
|
|
self.emit('activity-appeared', self._new_object(object_path))
|
|
|
|
return False
|
|
|
|
|
|
|
|
def _activity_appeared_cb(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Callback for dbus event (forwards to method to emit GObject event)"""
|
2006-12-04 20:12:24 +01:00
|
|
|
gobject.idle_add(self._emit_activity_appeared_signal, object_path)
|
|
|
|
|
|
|
|
def _emit_activity_disappeared_signal(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Emit GObject event with presence.activity.Activity object"""
|
2006-12-04 20:12:24 +01:00
|
|
|
self.emit('activity-disappeared', self._new_object(object_path))
|
|
|
|
return False
|
|
|
|
|
|
|
|
def _activity_disappeared_cb(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Callback for dbus event (forwards to method to emit GObject event)"""
|
2006-12-04 20:12:24 +01:00
|
|
|
gobject.idle_add(self._emit_activity_disappeared_signal, object_path)
|
|
|
|
|
|
|
|
def get(self, object_path):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieve given object path as a Buddy/Activity object
|
|
|
|
|
|
|
|
XXX This is basically just an alias for _new_object, i.e. it
|
|
|
|
just adds an extra function-call to the operation.
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
return self._new_object(object_path)
|
|
|
|
|
|
|
|
def get_activities(self):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieve set of all activities from service
|
|
|
|
|
|
|
|
returns list of Activity objects for all object paths
|
|
|
|
the service reports exist (using GetActivities)
|
|
|
|
"""
|
2007-04-09 20:40:56 +02:00
|
|
|
resp = self._ps.GetActivities()
|
2006-12-04 20:12:24 +01:00
|
|
|
acts = []
|
|
|
|
for item in resp:
|
|
|
|
acts.append(self._new_object(item))
|
|
|
|
return acts
|
|
|
|
|
|
|
|
def get_activity(self, activity_id):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieve single Activity object for the given unique id
|
|
|
|
|
|
|
|
activity_id -- unique ID for the activity
|
|
|
|
|
|
|
|
returns single Activity object or None if the activity
|
|
|
|
is not found using GetActivityById on the service
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
try:
|
2007-04-09 20:40:56 +02:00
|
|
|
act_op = self._ps.GetActivityById(activity_id)
|
2006-12-04 20:12:24 +01:00
|
|
|
except dbus.exceptions.DBusException:
|
|
|
|
return None
|
|
|
|
return self._new_object(act_op)
|
|
|
|
|
|
|
|
def get_buddies(self):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieve set of all buddies from service
|
|
|
|
|
|
|
|
returns list of Buddy objects for all object paths
|
|
|
|
the service reports exist (using GetBuddies)
|
|
|
|
"""
|
2007-04-09 22:05:32 +02:00
|
|
|
resp = self._ps.GetBuddies()
|
2006-12-04 20:12:24 +01:00
|
|
|
buddies = []
|
|
|
|
for item in resp:
|
|
|
|
buddies.append(self._new_object(item))
|
|
|
|
return buddies
|
|
|
|
|
2007-04-09 20:40:56 +02:00
|
|
|
def get_buddy(self, key):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieve single Buddy object for the given public key
|
|
|
|
|
|
|
|
key -- buddy's public encryption key
|
|
|
|
|
|
|
|
returns single Buddy object or None if the activity
|
|
|
|
is not found using GetBuddyByPublicKey on the
|
|
|
|
service
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
try:
|
2007-04-09 20:40:56 +02:00
|
|
|
buddy_op = self._ps.GetBuddyByPublicKey(dbus.ByteArray(key))
|
2006-12-04 20:12:24 +01:00
|
|
|
except dbus.exceptions.DBusException:
|
|
|
|
return None
|
|
|
|
return self._new_object(buddy_op)
|
|
|
|
|
|
|
|
def get_owner(self):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieves "owner" as a Buddy
|
|
|
|
|
|
|
|
XXX check that it really is a Buddy that's produced, what is
|
|
|
|
this the owner of? Shouldn't it be getting an activity
|
|
|
|
and then asking who the owner of that is?
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
try:
|
2007-04-09 20:40:56 +02:00
|
|
|
owner_op = self._ps.GetOwner()
|
2006-12-04 20:12:24 +01:00
|
|
|
except dbus.exceptions.DBusException:
|
|
|
|
return None
|
|
|
|
return self._new_object(owner_op)
|
|
|
|
|
2007-04-13 22:27:58 +02:00
|
|
|
def _share_activity_cb(self, activity, op):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Notify with GObject event of successful sharing of activity"""
|
2007-04-13 22:27:58 +02:00
|
|
|
self.emit("activity-shared", True, self._new_object(op), None)
|
|
|
|
|
|
|
|
def _share_activity_error_cb(self, activity, err):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Notify with GObject event of unsuccessful sharing of activity"""
|
2007-04-13 22:27:58 +02:00
|
|
|
logging.debug("Error sharing activity %s: %s" % (activity.get_id(), err))
|
|
|
|
self.emit("activity-shared", False, None, err)
|
|
|
|
|
2007-04-09 20:40:56 +02:00
|
|
|
def share_activity(self, activity, properties={}):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Ask presence service to ask the activity to share itself
|
|
|
|
|
|
|
|
Uses the ShareActivity method on the service to ask for the
|
|
|
|
sharing of the given activity. Arranges to emit activity-shared
|
|
|
|
event with:
|
|
|
|
|
|
|
|
(success, Activity, err)
|
|
|
|
|
|
|
|
on success/failure.
|
|
|
|
|
|
|
|
returns None
|
|
|
|
"""
|
2006-12-04 20:12:24 +01:00
|
|
|
actid = activity.get_id()
|
2007-04-09 20:40:56 +02:00
|
|
|
atype = activity.get_service_name()
|
|
|
|
name = activity.props.title
|
2007-04-13 22:27:58 +02:00
|
|
|
self._ps.ShareActivity(actid, atype, name, properties,
|
|
|
|
reply_handler=lambda *args: self._share_activity_cb(activity, *args),
|
|
|
|
error_handler=lambda *args: self._share_activity_error_cb(activity, *args))
|
2006-12-04 20:12:24 +01:00
|
|
|
|
2007-04-16 16:41:00 +02:00
|
|
|
def get_preferred_connection(self):
|
|
|
|
"""Gets the preferred telepathy connection object that an activity
|
|
|
|
should use when talking directly to telepathy
|
|
|
|
|
|
|
|
returns the bus name and the object path of the Telepathy connection"""
|
|
|
|
|
|
|
|
try:
|
|
|
|
bus_name, object_path = self._ps.GetPreferredConnection()
|
|
|
|
except dbus.exceptions.DBusException:
|
|
|
|
return None
|
|
|
|
|
|
|
|
return bus_name, object_path
|
|
|
|
|
2007-04-10 14:39:02 +02:00
|
|
|
|
|
|
|
class _MockPresenceService(gobject.GObject):
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Test fixture allowing testing of items that use PresenceService
|
|
|
|
|
|
|
|
See PresenceService for usage and purpose
|
|
|
|
"""
|
2007-04-10 14:39:02 +02:00
|
|
|
__gsignals__ = {
|
|
|
|
'buddy-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT])),
|
|
|
|
'buddy-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT])),
|
|
|
|
'activity-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT])),
|
|
|
|
'private-invitation': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT,
|
|
|
|
gobject.TYPE_PYOBJECT])),
|
|
|
|
'activity-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT])),
|
|
|
|
'activity-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
|
|
|
([gobject.TYPE_PYOBJECT]))
|
|
|
|
}
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
gobject.GObject.__init__(self)
|
|
|
|
|
|
|
|
def get_activities(self):
|
|
|
|
return []
|
|
|
|
|
|
|
|
def get_activity(self, activity_id):
|
|
|
|
return None
|
|
|
|
|
|
|
|
def get_buddies(self):
|
|
|
|
return []
|
|
|
|
|
|
|
|
def get_buddy(self, key):
|
|
|
|
return None
|
|
|
|
|
|
|
|
def get_owner(self):
|
|
|
|
return None
|
|
|
|
|
|
|
|
def share_activity(self, activity, properties={}):
|
|
|
|
return None
|
|
|
|
|
2006-08-23 17:38:56 +02:00
|
|
|
_ps = None
|
|
|
|
def get_instance():
|
2007-04-15 05:38:21 +02:00
|
|
|
"""Retrieve this process' view of the PresenceService"""
|
2006-12-04 20:12:24 +01:00
|
|
|
global _ps
|
|
|
|
if not _ps:
|
2007-04-10 20:49:14 +02:00
|
|
|
_ps = PresenceService()
|
2006-12-04 20:12:24 +01:00
|
|
|
return _ps
|
2007-04-10 14:39:02 +02:00
|
|
|
|