projects
/
theonering
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixing a bug with deny lists
[theonering]
/
src
/
handle.py
diff --git
a/src/handle.py
b/src/handle.py
index
5838517
..
5fc4e98
100644
(file)
--- a/
src/handle.py
+++ b/
src/handle.py
@@
-3,17
+3,20
@@
import weakref
import telepathy
import telepathy
+import tp
+import util.misc as util_misc
+
_moduleLogger = logging.getLogger("handle")
_moduleLogger = logging.getLogger("handle")
-class TheOneRingHandle(telepathy.server.Handle):
+class TheOneRingHandle(tp.Handle):
"""
Instances are memoized
"""
def __init__(self, connection, id, handleType, name):
"""
Instances are memoized
"""
def __init__(self, connection, id, handleType, name):
- telepathy.server.Handle.__init__(self, id, handleType, name)
+ tp.Handle.__init__(self, id, handleType, name)
self._conn = weakref.proxy(connection)
def __repr__(self):
self._conn = weakref.proxy(connection)
def __repr__(self):
@@
-21,9
+24,9
@@
class TheOneRingHandle(telepathy.server.Handle):
type(self).__name__, self.id, self.name
)
type(self).__name__, self.id, self.name
)
- id = property(telepathy.server.Handle.get_id)
- type = property(telepathy.server.Handle.get_type)
- name = property(telepathy.server.Handle.get_name)
+ id = property(tp.Handle.get_id)
+ type = property(tp.Handle.get_type)
+ name = property(tp.Handle.get_name)
class ConnectionHandle(TheOneRingHandle):
class ConnectionHandle(TheOneRingHandle):
@@
-38,20
+41,16
@@
class ConnectionHandle(TheOneRingHandle):
class ContactHandle(TheOneRingHandle):
class ContactHandle(TheOneRingHandle):
- def __init__(self, connection, id, contactId):
+ def __init__(self, connection, id, phoneNumber):
+ self._phoneNumber = util_misc.normalize_number(phoneNumber)
+
handleType = telepathy.HANDLE_TYPE_CONTACT
handleType = telepathy.HANDLE_TYPE_CONTACT
- handleName = contactId
+ handleName = self._phoneNumber
TheOneRingHandle.__init__(self, connection, id, handleType, handleName)
TheOneRingHandle.__init__(self, connection, id, handleType, handleName)
- self._contactId = contactId
-
- @property
- def contactID(self):
- return self._contactId
-
@property
@property
- def contactDetails(self):
- return self._conn.addressbook.get_contact_details(self._id)
+ def phoneNumber(self):
+ return self._phoneNumber
class ListHandle(TheOneRingHandle):
class ListHandle(TheOneRingHandle):
@@
-86,7
+85,7
@@
def create_handle_factory():
isNewHandle = True
connection._handles[handle.get_type(), handle.get_id()] = handle
handleStatus = "Is New!" if isNewHandle else "From Cache"
isNewHandle = True
connection._handles[handle.get_type(), handle.get_id()] = handle
handleStatus = "Is New!" if isNewHandle else "From Cache"
- _moduleLogger.info("Created Handle: %r (%s)" % (handle, handleStatus))
+ _moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus))
return handle
return create_handle
return handle
return create_handle