4 import util.misc as misc_utils
8 _moduleLogger = logging.getLogger(__name__)
11 class PresenceMixin(tp.ConnectionInterfacePresence, simple_presence.TheOneRingPresence):
14 tp.ConnectionInterfacePresence.__init__(self)
15 simple_presence.TheOneRingPresence.__init__(self)
17 @misc_utils.log_exception(_moduleLogger)
18 def GetStatuses(self):
19 # the arguments are in common to all on-line presences
23 (localType, (telepathyType, True, True, arguments))
24 for (localType, telepathyType) in self.TO_PRESENCE_TYPE.iteritems()
27 @misc_utils.log_exception(_moduleLogger)
28 def RequestPresence(self, contactIds):
29 presences = self.__get_presences(contactIds)
30 self.PresenceUpdate(presences)
32 @misc_utils.log_exception(_moduleLogger)
33 def GetPresence(self, contactIds):
34 return self.__get_presences(contactIds)
36 @misc_utils.log_exception(_moduleLogger)
37 def SetStatus(self, statuses):
38 assert len(statuses) == 1
39 status, arguments = statuses.items()[0]
40 assert len(arguments) == 0
41 self.set_presence(status)
43 def __get_presences(self, contacts):
46 (h, (0, {presence: arguments}))
47 for (h, (presenceType, presence)) in self.get_presences(contacts).iteritems()