Forcing calls to quit immediately rather than giving time to cancel to fix issues...
authorEd Page <eopage@byu.net>
Thu, 9 Dec 2010 01:38:45 +0000 (19:38 -0600)
committerEd Page <eopage@byu.net>
Thu, 9 Dec 2010 01:38:45 +0000 (19:38 -0600)
src/channel/call.py
src/channel/text.py
src/connection.py

index aefc598..bdd82dc 100644 (file)
@@ -103,10 +103,6 @@ class CallChannel(
                tp.ChannelTypeStreamedMedia.Close(self)
                self.remove_from_connection()
 
-               if self.__calledNumber is not None:
-                       le = gobject_utils.AsyncLinearExecution(self._conn.session.pool, self._cancel)
-                       le.start()
-
        @misc_utils.log_exception(_moduleLogger)
        def GetLocalPendingMembersWithInfo(self):
                info = dbus.Array([], signature="(uuus)")
@@ -179,30 +175,25 @@ class CallChannel(
                self.__calledNumber = contactNumber
                self.CallStateChanged(self.__contactHandle, telepathy.constants.CHANNEL_CALL_STATE_RINGING)
 
+               self._delayedClose.start(seconds=0)
+               self.CallStateChanged(self.__contactHandle, telepathy.constants.CHANNEL_CALL_STATE_FORWARDED)
+
                try:
                        result = yield (
                                self._conn.session.backend.call,
                                (contactNumber, ),
                                {},
                        )
-               except Exception:
+               except Exception, e:
                        _moduleLogger.exception("While placing call to %s" % (self.__calledNumber, ))
-                       return
-
-               self._delayedClose.start(seconds=0)
-               self.CallStateChanged(self.__contactHandle, telepathy.constants.CHANNEL_CALL_STATE_FORWARDED)
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _cancel(self):
-               _moduleLogger.debug("Cancelling call")
-               try:
-                       result = yield (
-                               self._conn.session.backend.cancel,
-                               (self.__calledNumber, ),
-                               {},
+                       self._conn.force_log_display()
+                       accountNumber = misc_utils.normalize_number(self._conn.session.backend.get_account_number())
+                       self._conn.log_to_user(
+                               __name__,
+                               "Error while placing call from %s to %s:\n%s" % (
+                                       accountNumber, self.__calledNumber, str(e)
+                               )
                        )
-               except Exception:
-                       _moduleLogger.exception("While canceling a call to %s" % (self.__calledNumber, ))
                        return
 
        @misc_utils.log_exception(_moduleLogger)
@@ -236,11 +227,9 @@ class CallChannel(
                if not Hold:
                        return
                _moduleLogger.debug("Closing without cancel to get out of users way")
-               self.__calledNumber = None
                self.close()
 
        @misc_utils.log_exception(_moduleLogger)
        def _on_close_requested(self, *args):
                _moduleLogger.debug("Cancel now disallowed")
-               self.__calledNumber = None
                self.close()
index 206299c..5212cd7 100644 (file)
@@ -129,7 +129,7 @@ class TextChannel(tp.ChannelTypeText):
                newConversations = list(newConversations)
                postSelfLen = len(newConversations)
                if postSelfLen < postUpdateLen:
-                       self._conn.log_to_user(__name__, "Dropped %s messages due to being from self" % (postUpdateLen - postSelfLen))
+                       _moduleLogger.info("Dropped %s messages due to being from self" % (postUpdateLen - postSelfLen))
                if not newConversations:
                        _moduleLogger.debug(
                                "New messages for %r are from yourself" % (self._contactKey, )
@@ -140,7 +140,7 @@ class TextChannel(tp.ChannelTypeText):
                newConversations = list(newConversations)
                postReadLen = len(newConversations)
                if postReadLen < postSelfLen:
-                       self._conn.log_to_user(__name__, "Dropped %s messages due to already being read" % (postSelfLen- postReadLen))
+                       _moduleLogger.info("Dropped %s messages due to already being read" % (postSelfLen- postReadLen))
                if not newConversations:
                        _moduleLogger.debug(
                                "New messages for %r have already been read externally" % (self._contactKey, )
index c967215..71e3920 100644 (file)
@@ -191,6 +191,15 @@ class TheOneRingConnection(
 
                return h
 
+       def force_log_display(self):
+               accountNumber = misc_utils.normalize_number(self.session.backend.get_account_number())
+               debugHandle = self.get_handle_by_name(
+                       telepathy.HANDLE_TYPE_CONTACT,
+                       accountNumber,
+               )
+               debugPromptProps = self.generate_props(telepathy.CHANNEL_TYPE_TEXT, debugHandle, False)
+               self.__channelManager.channel_for_props(debugPromptProps, signal=True)
+
        def log_to_user(self, component, message):
                for logger in self._loggers:
                        logger.log_message(component, message)