Removing un-needed interfaces
authorEd Page <eopage@byu.net>
Sat, 26 Sep 2009 23:25:52 +0000 (18:25 -0500)
committerEd Page <eopage@byu.net>
Sat, 26 Sep 2009 23:25:52 +0000 (18:25 -0500)
src/aliasing.py [deleted file]
src/avatars.py [deleted file]
src/presence.py [deleted file]

diff --git a/src/aliasing.py b/src/aliasing.py
deleted file mode 100644 (file)
index 3f2cc25..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-import logging
-
-import telepathy
-
-import handle
-
-
-class ButterflyAliasing(telepathy.server.ConnectionInterfaceAliasing):
-
-       def __init__(self):
-               telepathy.server.ConnectionInterfaceAliasing.__init__(self)
-
-       def GetAliasFlags(self):
-               return telepathy.constants.CONNECTION_ALIAS_FLAG_USER_SET
-
-       def RequestAliases(self, contacts):
-               logging.debug("Called RequestAliases")
-               return [self._get_alias(handleId) for handleId in contacts]
-
-       def GetAliases(self, contacts):
-               logging.debug("Called GetAliases")
-
-               result = {}
-               for contact in contacts:
-                       result[contact] = self._get_alias(contact)
-               return result
-
-       def SetAliases(self, aliases):
-               for handleId, alias in aliases.iteritems():
-                       h = self.handle(telepathy.HANDLE_TYPE_CONTACT, handleId)
-                       if h != handle.create_handle(self, 'self'):
-                               if alias == h.name:
-                                       alias = u""
-                               contact = h.contact
-                               if contact is None:
-                                       h.pending_alias = alias
-                                       continue
-                               infos = {}
-                               self.gvoice_client.update_contact_infos(contact, infos)
-                       else:
-                               self.gvoice_client.profile.display_name = alias.encode('utf-8')
-                               logging.info("Self alias changed to '%s'" % alias)
-                               self.AliasesChanged(((handle.create_handle(self, 'self'), alias), ))
diff --git a/src/avatars.py b/src/avatars.py
deleted file mode 100644 (file)
index c623e1a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-import logging
-
-import telepathy
-
-
-class ButterflyAvatars(telepathy.server.ConnectionInterfaceAvatars):
-
-       def __init__(self):
-               self._avatar_known = False
-               telepathy.server.ConnectionInterfaceAvatars.__init__(self)
-
-       def GetAvatarRequirements(self):
-               mime_types = ("image/png","image/jpeg","image/gif")
-               return (mime_types, 96, 96, 192, 192, 500 * 1024)
-
-       def GetKnownAvatarTokens(self, contacts):
-               result = {}
-               for handle_id in contacts:
-                       handle = self.handle(telepathy.HANDLE_TYPE_CONTACT, handle_id)
-                       if handle == self.GetSelfHandle():
-                               contact = handle.profile
-                       else:
-                               contact = handle.contact
-
-                       if contact is not None:
-                               msn_object = contact.msn_object
-                       else:
-                               msn_object = None
-
-                       if msn_object is not None:
-                               result[handle] = msn_object._data_sha.encode("hex")
-                       elif self._avatar_known:
-                               result[handle] = ""
-               return result
-
-       def RequestAvatars(self, contacts):
-               for handle_id in contacts:
-                       handle = self.handle(telepathy.HANDLE_TYPE_CONTACT, handle_id)
-                       if handle == self.GetSelfHandle():
-                               msn_object = self.msn_client.profile.msn_object
-                               self._msn_object_retrieved(msn_object, handle)
-                       else:
-                               contact = handle.contact
-                               if contact is not None:
-                                       msn_object = contact.msn_object
-                               else:
-                                       msn_object = None
-                               if msn_object is not None:
-                                       self.msn_client.msn_object_store.request(msn_object,\
-                                                       (self._msn_object_retrieved, handle))
-
-       def SetAvatar(self, avatar, mime_type):
-               self._avatar_known = True
-               if not isinstance(avatar, str):
-                       avatar = "".join([chr(b) for b in avatar])
-               avatarToken = 0
-               logging.info("Setting self avatar to %s" % avatarToken)
-               return avatarToken
-
-       def ClearAvatar(self):
-               self.msn_client.profile.msn_object = None
-               self._avatar_known = True
diff --git a/src/presence.py b/src/presence.py
deleted file mode 100644 (file)
index 8350e71..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-import logging
-
-import telepathy
-
-import simple_presence
-
-
-class ButterflyPresence(telepathy.server.ConnectionInterfacePresence):
-
-       def __init__(self):
-               telepathy.server.ConnectionInterfacePresence.__init__(self)
-
-       def GetStatuses(self):
-               # the arguments are in common to all on-line presences
-               arguments = {'message' : 's'}
-
-               # you get one of these for each status
-               # {name:(type, self, exclusive, {argument:types}}
-               return {
-                       simple_presence.ButterflyPresenceMapping.ONLINE:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_AVAILABLE,
-                               True, True, arguments),
-                       simple_presence.ButterflyPresenceMapping.AWAY:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_AWAY,
-                               True, True, arguments),
-                       simple_presence.ButterflyPresenceMapping.BUSY:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_AWAY,
-                               True, True, arguments),
-                       simple_presence.ButterflyPresenceMapping.IDLE:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY,
-                               True, True, arguments),
-                       simple_presence.ButterflyPresenceMapping.BRB:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_AWAY,
-                               True, True, arguments),
-                       simple_presence.ButterflyPresenceMapping.PHONE:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_AWAY,
-                               True, True, arguments),
-                       simple_presence.ButterflyPresenceMapping.LUNCH:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY,
-                               True, True, arguments),
-                       simple_presence.ButterflyPresenceMapping.INVISIBLE:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_HIDDEN,
-                               True, True, {}),
-                       simple_presence.ButterflyPresenceMapping.OFFLINE:(
-                               telepathy.CONNECTION_PRESENCE_TYPE_OFFLINE,
-                               True, True, {})
-               }
-
-       def RequestPresence(self, contacts):
-               presences = self.get_presences(contacts)
-               self.PresenceUpdate(presences)
-
-       def GetPresence(self, contacts):
-               return self.get_presences(contacts)
-
-       def SetStatus(self, statuses):
-               status, arguments = statuses.items()[0]
-               if status == simple_presence.ButterflyPresenceMapping.OFFLINE:
-                       self.Disconnect()
-
-               presence = simple_presence.ButterflyPresenceMapping.to_pymsn[status]
-               message = arguments.get('message', u'').encode("utf-8")
-
-               logging.info("Setting Presence to '%s'" % presence)
-               logging.info("Setting Personal message to '%s'" % message)
-
-               if self._status != telepathy.CONNECTION_STATUS_CONNECTED:
-                       self._initial_presence = presence
-                       self._initial_personal_message = message
-               else:
-                       self.msn_client.profile.personal_message = message
-                       self.msn_client.profile.presence = presence
-
-       def get_presences(self, contacts):
-               presences = {}
-               for handleId in contacts:
-                       h = self.handle(telepathy.HANDLE_TYPE_CONTACT, handleId)
-                       try:
-                               contact = h.contact
-                       except AttributeError:
-                               contact = h.profile
-
-                       if contact is not None:
-                               presence = simple_presence.ButterflyPresenceMapping.to_telepathy[contact.presence]
-                               personal_message = unicode(contact.personal_message, "utf-8")
-                       else:
-                               presence = simple_presence.ButterflyPresenceMapping.OFFLINE
-                               personal_message = u""
-
-                       arguments = {}
-                       if personal_message:
-                               arguments = {'message' : personal_message}
-
-                       presences[h] = (0, {presence : arguments}) # TODO: Timestamp
-               return presences