7 import gvoice.state_machine as state_machine
10 _moduleLogger = logging.getLogger('presence')
13 class PresenceMixin(telepathy.server.ConnectionInterfacePresence, simple_presence.TheOneRingPresence):
16 telepathy.server.ConnectionInterfacePresence.__init__(self)
17 simple_presence.TheOneRingPresence.__init__(self)
19 @gtk_toolbox.log_exception(_moduleLogger)
20 def GetStatuses(self):
21 # the arguments are in common to all on-line presences
25 (localType, (telepathyType, True, True, arguments))
26 for (localType, telepathyType) in self.TO_PRESENCE_TYPE.iteritems()
29 @gtk_toolbox.log_exception(_moduleLogger)
30 def RequestPresence(self, contactIds):
31 presences = self.__get_presences(contactIds)
32 self.PresenceUpdate(presences)
34 @gtk_toolbox.log_exception(_moduleLogger)
35 def GetPresence(self, contactIds):
36 return self.__get_presences(contactIds)
38 @gtk_toolbox.log_exception(_moduleLogger)
39 def SetStatus(self, statuses):
40 assert len(statuses) == 1
41 status, arguments = statuses.items()[0]
42 assert len(arguments) == 0
43 self.set_presence(status)
45 def __get_presences(self, contacts):
48 (h, (0, {presence: arguments}))
49 for (h, (presenceType, presence)) in self.get_presences(contacts).iteritems()