projects
/
theonering
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleaned up presence and cleaned up the exceptions
[theonering]
/
src
/
simple_presence.py
diff --git
a/src/simple_presence.py
b/src/simple_presence.py
index
44e5c50
..
29deb88
100644
(file)
--- a/
src/simple_presence.py
+++ b/
src/simple_presence.py
@@
-2,6
+2,11
@@
import logging
import telepathy
import telepathy
+import gtk_toolbox
+
+
+_moduleLogger = logging.getLogger("simple_presence")
+
class TheOneRingPresence(object):
ONLINE = 'available'
class TheOneRingPresence(object):
ONLINE = 'available'
@@
-13,7
+18,7
@@
class TheOneRingPresence(object):
}
}
-class ButterflySimplePresence(telepathy.server.ConnectionInterfaceSimplePresence):
+class SimplePresenceMixin(telepathy.server.ConnectionInterfaceSimplePresence):
def __init__(self):
telepathy.server.ConnectionInterfaceSimplePresence.__init__(self)
def __init__(self):
telepathy.server.ConnectionInterfaceSimplePresence.__init__(self)
@@
-22,6
+27,21
@@
class ButterflySimplePresence(telepathy.server.ConnectionInterfaceSimplePresence
self._implement_property_get(dbus_interface, {'Statuses' : self._get_statuses})
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
def GetPresences(self, contacts):
"""
@todo Figure out how to know when its self and get whether busy or not
@@
-39,17
+59,19
@@
class ButterflySimplePresence(telepathy.server.ConnectionInterfaceSimplePresence
presences[handle] = (presenceType, presence, personalMessage)
return presences
presences[handle] = (presenceType, presence, personalMessage)
return presences
+ @gtk_toolbox.log_exception(_moduleLogger)
def SetPresence(self, status, message):
if message:
def SetPresence(self, status, message):
if message:
- raise telepathy.errors.InvalidArgument
+ raise telepathy.errors.InvalidArgument("Messages aren't supported")
if status == TheOneRingPresence.ONLINE:
if status == TheOneRingPresence.ONLINE:
- self._conn.mark_dnd(True)
+ self.gvoice_backend.mark_dnd(True)
elif status == TheOneRingPresence.BUSY:
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:
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):
def _get_statuses(self):