From e52ce9de93b9c1b73c3a0e697aae5665d487158d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 21 Feb 2007 07:06:45 -0500 Subject: [PATCH] Stub out more of the PS object --- services/presence2/presenceservice.py | 57 ++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/services/presence2/presenceservice.py b/services/presence2/presenceservice.py index 67fbe8a8..3a632870 100644 --- a/services/presence2/presenceservice.py +++ b/services/presence2/presenceservice.py @@ -14,13 +14,66 @@ # 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, dbus.service import gobject +import dbus, dbus.service, dbus.glib + + +_PRESENCE_SERVICE = "org.laptop.Sugar.Presence" +_PRESENCE_INTERFACE = "org.laptop.Sugar.Presence" +_PRESENCE_PATH = "/org/laptop/Sugar/Presence" + + +class NotFoundError(dbus.DBusException): + def __init__(self): + dbus.DBusException.__init__(self) + self._dbus_error_name = _PRESENCE_INTERFACE + '.NotFound' class PresenceService(dbus.service.Object): - pass + def __init__(self): + bus = dbus.SessionBus() + self._bus_name = dbus.service.BusName(_PRESENCE_SERVICE, bus=bus) + dbus.service.Object.__init__(self, self._bus_name, _PRESENCE_PATH) + @dbus.service.signal(_PRESENCE_INTERFACE, signature="o") + def ActivityAppeared(self, activity): + pass + + @dbus.service.signal(_PRESENCE_INTERFACE, signature="o") + def ActivityDisappeared(self, activity): + pass + + @dbus.service.signal(_PRESENCE_INTERFACE, signature="o") + def BuddyAppeared(self, buddy): + pass + + @dbus.service.signal(_PRESENCE_INTERFACE, signature="o") + def BuddyDisappeared(self, buddy): + pass + + @dbus.service.method(_PRESENCE_INTERFACE, out_signature="ao") + def GetActivities(self): + return [] + + @dbus.service.method(_PRESENCE_INTERFACE, in_signature="s", out_signature="o") + def GetActivityById(self, actid): + return NotFoundError("The activity was not found.") + + @dbus.service.method(_PRESENCE_INTERFACE, out_signature="ao") + def GetBuddies(self): + return [] + + @dbus.service.method(_PRESENCE_INTERFACE, in_signature="ay", out_signature="o") + def GetBuddyByPublicKey(self, key): + return NotFoundError("The buddy was not found.") + + @dbus.service.method(_PRESENCE_INTERFACE, out_signature="o") + def GetOwner(self): + return NotFoundError("The owner was not found.") + + @dbus.service.method(_PRESENCE_INTERFACE, in_signature="sssa{sv}", out_signature="o") + def ShareActivity(self, actid, atype, name, properties): + return NotImplemented("not implemented yet") def main():