X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Fgvoice%2Fconversations.py;h=8baf8b8f91b008a84a7a264918ffb05f551226f4;hp=7435da86da3fd3fbb8215507fb295ae170156ffe;hb=3d5f80ff4e1607d37b92566619f1c3d6180fd000;hpb=1bd375495719117939fa0ac384835001485eeef7 diff --git a/src/gvoice/conversations.py b/src/gvoice/conversations.py index 7435da8..8baf8b8 100644 --- a/src/gvoice/conversations.py +++ b/src/gvoice/conversations.py @@ -1,9 +1,14 @@ #!/usr/bin/python +# @bug Its inconsistent as to whether messages from contacts come as from the +# contact or just a raw number. It seems GV is inconsistent about populating the contact id, so we might have to pull from the addressbook +# @bug False positives on startup. Luckily the object path for the channel is +# unique, so can use that to cache some of the data out to file import logging import util.coroutines as coroutines +import util.misc as util_misc _moduleLogger = logging.getLogger("gvoice.conversations") @@ -11,8 +16,8 @@ _moduleLogger = logging.getLogger("gvoice.conversations") class Conversations(object): - def __init__(self, backend): - self._backend = backend + def __init__(self, getter): + self._get_raw_conversations = getter self._conversations = {} self.updateSignalHandler = coroutines.CoTee() @@ -24,10 +29,10 @@ class Conversations(object): oldConversationIds = set(self._conversations.iterkeys()) updateConversationIds = set() - conversations = list(self._backend.get_conversations()) + conversations = list(self._get_raw_conversations()) conversations.sort() for conversation in conversations: - key = conversation.contactId, conversation.number + key = conversation.contactId, util_misc.strip_number(conversation.number) try: mergedConversations = self._conversations[key] except KeyError: @@ -114,7 +119,7 @@ class MergedConversations(object): for newMessage in newConversationMessages if newMessage not in relatedConversation.messages ] - _moduleLogger.info("Found %d new messages in conversation %s (%d/%d)" % ( + _moduleLogger.debug("Found %d new messages in conversation %s (%d/%d)" % ( len(newConversationMessages) - len(newConversation.messages), newConversation.id, len(newConversation.messages),