Updating bug notes
[theonering] / src / gvoice / conversations.py
index 7435da8..8baf8b8 100644 (file)
@@ -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),