#!/usr/bin/python
+# @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
+
+from __future__ import with_statement
import logging
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()
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, util_misc.strip_number(conversation.number)
+ key = conversation.contactId, util_misc.normalize_number(conversation.number)
try:
mergedConversations = self._conversations[key]
except KeyError:
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),