import telepathy
+import gtk_toolbox
+
+
+_moduleLogger = logging.getLogger("simple_presence")
+
class TheOneRingPresence(object):
ONLINE = 'available'
}
-class TheOneRingSimplePresence(telepathy.server.ConnectionInterfaceSimplePresence):
+class SimplePresenceMixin(telepathy.server.ConnectionInterfaceSimplePresence):
def __init__(self):
telepathy.server.ConnectionInterfaceSimplePresence.__init__(self)
self._implement_property_get(dbus_interface, {'Statuses' : self._get_statuses})
+ @property
+ def session(self):
+ """
+ @abstract
+ """
+ raise NotImplementedError()
+
+ @property
+ def handle(self):
+ """
+ @abstract
+ """
+ raise NotImplementedError("Abstract property called")
+
+ @gtk_toolbox.log_exception(_moduleLogger)
def GetPresences(self, contacts):
"""
@todo Figure out how to know when its self and get whether busy or not
presences[handle] = (presenceType, presence, personalMessage)
return presences
+ @gtk_toolbox.log_exception(_moduleLogger)
def SetPresence(self, status, message):
if message:
- raise telepathy.errors.InvalidArgument
+ raise telepathy.errors.InvalidArgument("Messages aren't supported")
if status == TheOneRingPresence.ONLINE:
- self._conn.mark_dnd(True)
+ self.gvoice_backend.mark_dnd(True)
elif status == TheOneRingPresence.BUSY:
- self._conn.mark_dnd(False)
+ raise telepathy.errors.NotAvailable("DnD support not yet added to TheOneRing")
+ self.gvoice_backend.mark_dnd(False)
else:
- raise telepathy.errors.InvalidArgument
- logging.info("Setting Presence to '%s'" % status)
+ raise telepathy.errors.InvalidArgument("Unsupported status: %r" % status)
+ _moduleLogger.info("Setting Presence to '%s'" % status)
def _get_statuses(self):