Applying a fix for some peoples login issue
[theonering] / src / handle.py
index 69b782e..057ddf3 100644 (file)
@@ -4,6 +4,9 @@ import weakref
 import telepathy
 
 
+_moduleLogger = logging.getLogger("handle")
+
+
 class MetaMemoize(type):
        """
        Allows a class to cache off instances for reuse
@@ -13,7 +16,7 @@ class MetaMemoize(type):
                obj, newlyCreated = cls.__new__(cls, connection, *args)
                if newlyCreated:
                        obj.__init__(connection, connection.get_handle_id(), *args)
-                       logging.info("New Handle %r" % obj)
+                       _moduleLogger.info("New Handle %r" % obj)
                return obj
 
 
@@ -61,35 +64,22 @@ class ConnectionHandle(TheOneRingHandle):
                self.profile = connection.username
 
 
-def field_join(fields):
-       """
-       >>> field_join("1", "First Name")
-       '1#First Name'
-       """
-       return "#".join(fields)
-
-
-def field_split(fields):
-       """
-       >>> field_split('1#First Name')
-       ['1', 'First Name']
-       """
-       return fields.split("#")
-
-
 class ContactHandle(TheOneRingHandle):
 
-       def __init__(self, connection, id, contactId, contactAccount):
+       def __init__(self, connection, id, contactId):
                handleType = telepathy.HANDLE_TYPE_CONTACT
-               handleName = field_join(contactId, contactAccount)
+               handleName = contactId
                TheOneRingHandle.__init__(self, connection, id, handleType, handleName)
 
-               self.account = contactAccount
                self._id = contactId
 
        @property
-       def contact(self):
-               return self._conn.gvoice_client.get_contact_details(self._id)
+       def contactID(self):
+               return self._id
+
+       @property
+       def contactDetails(self):
+               return self._conn.addressbook.get_contact_details(self._id)
 
 
 class ListHandle(TheOneRingHandle):
@@ -100,19 +90,10 @@ class ListHandle(TheOneRingHandle):
                TheOneRingHandle.__init__(self, connection, id, handleType, handleName)
 
 
-class GroupHandle(TheOneRingHandle):
-
-       def __init__(self, connection, id, groupName):
-               handleType = telepathy.HANDLE_TYPE_GROUP
-               handleName = groupName
-               TheOneRingHandle.__init__(self, connection, id, handleType, handleName)
-
-
 _HANDLE_TYPE_MAPPING = {
        'connection': ConnectionHandle,
        'contact': ContactHandle,
        'list': ListHandle,
-       'group': GroupHandle,
 }