projects
/
theonering
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reducing the timeout for closing the channel and cleaning up some code
[theonering]
/
src
/
handle.py
diff --git
a/src/handle.py
b/src/handle.py
index
02e5137
..
0db35fe
100644
(file)
--- a/
src/handle.py
+++ b/
src/handle.py
@@
-4,10
+4,10
@@
import weakref
import telepathy
import tp
import telepathy
import tp
-import util.misc as util_misc
+import util.misc as misc_utils
-_moduleLogger = logging.getLogger("handle")
+_moduleLogger = logging.getLogger(__name__)
class TheOneRingHandle(tp.Handle):
class TheOneRingHandle(tp.Handle):
@@
-42,7
+42,7
@@
class ConnectionHandle(TheOneRingHandle):
class ContactHandle(TheOneRingHandle):
def __init__(self, connection, id, phoneNumber):
class ContactHandle(TheOneRingHandle):
def __init__(self, connection, id, phoneNumber):
- self._phoneNumber = util_misc.normalize_number(phoneNumber)
+ self._phoneNumber = misc_utils.normalize_number(phoneNumber)
handleType = telepathy.HANDLE_TYPE_CONTACT
handleName = self._phoneNumber
handleType = telepathy.HANDLE_TYPE_CONTACT
handleName = self._phoneNumber
@@
-52,14
+52,6
@@
class ContactHandle(TheOneRingHandle):
def phoneNumber(self):
return self._phoneNumber
def phoneNumber(self):
return self._phoneNumber
- @property
- def contact_name(self):
- return self._conn.session.addressbook.get_contact_name(self.phoneNumber)
-
- @property
- def contactDetails(self):
- return self._conn.session.addressbook.get_phone_type(self.phoneNumber)
-
class ListHandle(TheOneRingHandle):
class ListHandle(TheOneRingHandle):
@@
-80,7
+72,7
@@
def create_handle_factory():
cache = weakref.WeakValueDictionary()
cache = weakref.WeakValueDictionary()
- def create_handle(connection, type, *args):
+ def _create_handle(connection, type, *args):
Handle = _HANDLE_TYPE_MAPPING[type]
key = Handle, connection.username, args
try:
Handle = _HANDLE_TYPE_MAPPING[type]
key = Handle, connection.username, args
try:
@@
-92,11
+84,12
@@
def create_handle_factory():
cache[key] = handle
isNewHandle = True
connection._handles[handle.get_type(), handle.get_id()] = handle
cache[key] = handle
isNewHandle = True
connection._handles[handle.get_type(), handle.get_id()] = handle
- handleStatus = "Is New!" if isNewHandle else "From Cache"
- _moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus))
+ if isNewHandle:
+ handleStatus = "Is New!" if isNewHandle else "From Cache"
+ _moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus))
return handle
return handle
- return create_handle
+ return _create_handle
create_handle = create_handle_factory()
create_handle = create_handle_factory()