Comment 34 for bug 549755

Revision history for this message
zd (andz) wrote :

Ha! Finally :)
I've fixed the "facebook-doesn't-show-notifications-but-twitter-does-bug" - at least at my pc ;)
Relevant debug message is in my post #33

There seems to go something wrong with couchdb
Relevant debug infos are displayed by changing the exception in the on_message_updated() method:

------------------------------------------

  def on_message_updated(self, monitor, id):
    #try:
      log.logger.debug("Message updated: %s", id)
      message = self.messages.get_record(id)
      self.new_message(message)
    #except:
      #log.logger.error("Message updated: %s, failed", id)

------------------------------------------

The Error Message is:

------------------------------------------

Gwibber Dispatcher: DEBUG Checking message 10000062*****_13141****** timestamp (2010-05-31 21:01:33.00) to see if it is newer than 2010-05-31 20:51:39.33
Gwibber Dispatcher: DEBUG Message 10000062*****_13141****** newer than 2010-05-31 20:51:39.33, notifying
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/gwibber/microblog/dispatcher.py", line 263, in on_message_updated
    self.new_message(message)
  File "/usr/lib/python2.6/dist-packages/gwibber/microblog/dispatcher.py", line 310, in new_message
    if indicate and message["to_me"]:
  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/record.py", line 389, in __getitem__
    return super(Record, self).__getitem__(key)
  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/record.py", line 130, in __getitem__
    value = self._data[key]
KeyError: 'to_me'
Gwibber Dispatcher: DEBUG <facebook:receive> Finished operation

------------------------------------------

Solution / Hack to show the notification before couchdb throws the exception:

change the "def new_message(self, message)" method in /usr/lib/python2.6/dist-packages/gwibber/microblog/dispatcher.py
( I've simply switched the order of "if message["id"] not in self.notified_items:" and "if indicate and message["to_me"]:" )

------------------------------------------

  def new_message(self, message):
    min_time = mx.DateTime.DateTimeFromTicks() - mx.DateTime.TimeDelta(minutes=10.0)
    log.logger.debug("Checking message %s timestamp (%s) to see if it is newer than %s", message["id"], mx.DateTime.DateTimeFromTicks(message["time"]).localtime(), min_time)
    if mx.DateTime.DateTimeFromTicks(message["time"]).localtime() > mx.DateTime.DateTimeFromTicks(min_time):
      log.logger.debug("Message %s newer than %s, notifying", message["id"], min_time)
      if message["id"] not in self.notified_items:
        self.notified_items.append(message["id"])
        self.show_notification_bubble(message)
      if indicate and message["to_me"]:
        if message["id"] not in self.indicator_items:
          log.logger.debug("Message %s is a reply, adding messaging indicator", message["id"])
          self.handle_indicator_item(message)
------------------------------------------

I've attached both changed files, facebook.py and dispatcher.py
Put both files into /usr/lib/python2.6/dist-packages/gwibber/microblog/ , restart gwibber-service and it should work :)