X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Fautogv.py;h=346f48ce52a9ecdda3e7a9625ae991bf15d4a1fa;hp=1955e8b4166f3fc387bf332bc4097642a40367d7;hb=2c2ce248dc09bd5662f70714d673e590afa8280c;hpb=1c892d1b9bf14b28eb54ce3590ed2ee29d5e3d25 diff --git a/src/autogv.py b/src/autogv.py index 1955e8b..346f48c 100644 --- a/src/autogv.py +++ b/src/autogv.py @@ -1,6 +1,5 @@ import logging -import gobject import telepathy try: @@ -20,9 +19,10 @@ import util.coroutines as coroutines import util.go_utils as gobject_utils import util.tp_utils as telepathy_utils import util.misc as misc_utils +import gvoice -_moduleLogger = logging.getLogger("autogv") +_moduleLogger = logging.getLogger(__name__) class NewGVConversations(object): @@ -69,12 +69,11 @@ class NewGVConversations(object): # Maemo 4.1's RTComm opens a window for a chat regardless if a # message is received or not, so we need to do some filtering here mergedConv = conv.get_conversation(phoneNumber) - unreadConvs = [ - conversation - for conversation in mergedConv.conversations - if not conversation.isRead and not conversation.isArchived - ] - if not unreadConvs: + newConversations = mergedConv.conversations + newConversations = gvoice.conversations.filter_out_read(newConversations) + newConversations = gvoice.conversations.filter_out_self(newConversations) + newConversations = list(newConversations) + if not newConversations: continue chan = self._connRef()._channel_manager.channel_for_props(props, signal=True) @@ -181,7 +180,7 @@ class AutoDisconnect(object): @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: @@ -228,6 +227,6 @@ class DisconnectOnShutdown(object): @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")