def SetAliases(self, aliases):
_moduleLogger.debug("Called SetAliases")
# first validate that no other handle types are included
+ handleId, alias = None, None
for handleId, alias in aliases.iteritems():
h = self.get_handle_by_id(telepathy.HANDLE_TYPE_CONTACT, handleId)
if isinstance(h, handle.ConnectionHandle):
import logging
-import gobject
import telepathy
try:
@misc_utils.log_exception(_moduleLogger)
def _on_delayed_disconnect(self):
- if not self.session.is_logged_in():
+ if not self._connRef().session.is_logged_in():
_moduleLogger.info("Received connection change event when not logged in")
return
try:
@note Hildon specific
"""
try:
- self._connRef().disconnect(telepathy.CONNECTION_STATUS_REASON_REQUEST)
+ self._connRef().disconnect(telepathy.CONNECTION_STATUS_REASON_REQUESTED)
except Exception:
_moduleLogger.exception("Error durring disconnect")
telepathy.constants.FILE_TRANSFER_STATE_CHANGE_REASON_NONE,
)
- sockittome = socket.socket(socket.AF_UNIT, socket.SOCK_STREAM)
+ sockittome = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sockittome.connect(accessControlParam)
try:
sockittome.send(self._log)
_moduleLogger.info("RequestChannel Object Path (%s): %s" % (type.rsplit(".", 1)[-1], path))
return path
- def generate_props(self, channelType, handle, suppressHandler, initiatorHandle=None):
- targetHandle = 0 if handle is None else handle.get_id()
- targetHandleType = telepathy.HANDLE_TYPE_NONE if handle is None else handle.get_type()
+ def generate_props(self, channelType, handleObj, suppressHandler, initiatorHandle=None):
+ targetHandle = 0 if handleObj is None else handleObj.get_id()
+ targetHandleType = telepathy.HANDLE_TYPE_NONE if handleObj is None else handleObj.get_type()
props = {
telepathy.CHANNEL_INTERFACE + '.ChannelType': channelType,
telepathy.CHANNEL_INTERFACE + '.TargetHandle': targetHandle,
"""
Terminates all connections. Must be called upon quit
"""
- for connection in self._connections:
- connection.Disconnect()
+ for conn in self._connections:
+ conn.Disconnect()
_moduleLogger.info("Connection manager quitting")
@misc_utils.log_exception(_moduleLogger)
# To throttle checking with the server, use a 30s cache
newTime = time.time()
if self._lastDndCheck + 30 < newTime:
- self._lasDndCheck = newTime
+ self._lastDndCheck = newTime
self._cachedIsDnd = self._backend.is_dnd()
return self._cachedIsDnd
import logging
-import gobject
-
import util.go_utils as gobject_utils
import util.coroutines as coroutines
import util.misc as misc_utils
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:
_moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus))
return handle
- return create_handle
+ return _create_handle
create_handle = create_handle_factory()
raise
@gobject_utils.async
- def quit():
+ def on_quit():
manager.quit()
mainloop.quit()
def timeout_cb():
if len(manager._connections) == 0:
logging.info('No connection received - quitting')
- quit()
+ on_quit()
return False
if persist:
shutdown_callback = None
else:
gobject_utils.timeout_add_seconds(IDLE_TIMEOUT, timeout_cb)
- shutdown_callback = quit
+ shutdown_callback = on_quit
- signal.signal(signal.SIGTERM, lambda: quit)
+ signal.signal(signal.SIGTERM, lambda: on_quit)
try:
manager = connection_manager.TheOneRingConnectionManager(shutdown_func=shutdown_callback)
import logging
-import gobject
import dbus
import telepathy
class WasMissedCall(object):
def __init__(self, bus, conn, chan, on_success, on_error):
- self._on_success = on_success
- self._on_error = on_error
+ self.__on_success = on_success
+ self.__on_error = on_error
self._requested = None
self._didMembersChange = False
self._didClose = False
self._didReport = False
- self._onTimeout = misc.Timeout(self._on_timeout)
+ self._onTimeout = gobject_utils.Timeout(self._on_timeout)
self._onTimeout.start(seconds=10)
chan[telepathy.interfaces.CHANNEL_INTERFACE_GROUP].connect_to_signal(
chan[DBUS_PROPERTIES].GetAll(
telepathy.interfaces.CHANNEL_INTERFACE,
reply_handler = self._on_got_all,
- error_handler = self._on_got_all,
+ error_handler = self._on_error,
)
def cancel(self):
assert not self._didReport
self._didReport = True
self._onTimeout.cancel()
- self._on_success(self)
+ self.__on_success(self)
def _report_error(self, reason):
assert not self._didReport
self._didReport = True
self._onTimeout.cancel()
- self._on_error(self, reason)
+ self.__on_error(self, reason)
@misc.log_exception(_moduleLogger)
def _on_got_all(self, properties):