Forgot to add these changes which are needed by the addressbook
[theonering] / src / simple_presence.py
index 44e5c50..b309e14 100644 (file)
@@ -3,6 +3,9 @@ import logging
 import telepathy
 
 
+_moduleLogger = logging.getLogger("simple_presence")
+
+
 class TheOneRingPresence(object):
        ONLINE = 'available'
        BUSY = 'dnd'
@@ -13,7 +16,7 @@ class TheOneRingPresence(object):
        }
 
 
-class ButterflySimplePresence(telepathy.server.ConnectionInterfaceSimplePresence):
+class SimplePresenceMixin(telepathy.server.ConnectionInterfaceSimplePresence):
 
        def __init__(self):
                telepathy.server.ConnectionInterfaceSimplePresence.__init__(self)
@@ -22,6 +25,13 @@ class ButterflySimplePresence(telepathy.server.ConnectionInterfaceSimplePresence
 
                self._implement_property_get(dbus_interface, {'Statuses' : self._get_statuses})
 
+       @property
+       def gvoice_backend(self):
+               """
+               @abstract
+               """
+               raise NotImplementedError()
+
        def GetPresences(self, contacts):
                """
                @todo Figure out how to know when its self and get whether busy or not
@@ -44,12 +54,12 @@ class ButterflySimplePresence(telepathy.server.ConnectionInterfaceSimplePresence
                        raise telepathy.errors.InvalidArgument
 
                if status == TheOneRingPresence.ONLINE:
-                       self._conn.mark_dnd(True)
+                       self.gvoice_backend.mark_dnd(True)
                elif status == TheOneRingPresence.BUSY:
-                       self._conn.mark_dnd(False)
+                       self.gvoice_backend.mark_dnd(False)
                else:
                        raise telepathy.errors.InvalidArgument
-               logging.info("Setting Presence to '%s'" % status)
+               _moduleLogger.info("Setting Presence to '%s'" % status)
 
 
        def _get_statuses(self):