diff --git a/frontends/src/quick_frontend/quick_chat.py b/frontends/src/quick_frontend/quick_chat.py index 4de7e015..b6c9d9ae 100644 --- a/frontends/src/quick_frontend/quick_chat.py +++ b/frontends/src/quick_frontend/quick_chat.py @@ -55,6 +55,9 @@ class QuickChat(quick_widgets.QuickWidget): if type_ == C.CHAT_ONE2ONE: self.historyPrint(profile=self.profile) + # FIXME: has been introduced to temporarily fix http://bugs.goffi.org/show_bug.cgi?id=12 + self.initialised = False + def __str__(self): return u"Chat Widget [target: {}, type: {}, profile: {}]".format(self.target, self.type, self.profile) @@ -109,6 +112,8 @@ class QuickChat(quick_widgets.QuickWidget): def addUser(self, nick): """Add user if it is not in the group list""" + if not self.initialised: + return # FIXME: tmp fix for bug 12, do not flood the room with the messages when we've just entered it self.printInfo("=> %s has joined the room" % nick) def removeUser(self, nick): @@ -148,6 +153,7 @@ class QuickChat(quick_widgets.QuickWidget): target = self.target.bare def onHistory(history): + self.initialised = True # FIXME: tmp fix for bug 12 day_format = "%A, %d %b %Y" # to display the day change previous_day = datetime.now().strftime(day_format) for line in history: @@ -166,6 +172,7 @@ class QuickChat(quick_widgets.QuickWidget): def onHistoryError(err): log.error(_("Can't get history")) + self.initialised = False # FIXME: tmp fix for bug 12, here needed for :history and :search commands self.host.bridge.getHistory(unicode(self.host.profiles[profile].whoami.bare), unicode(target), size, True, search, profile, callback=onHistory, errback=onHistoryError) def _get_nick(self, entity): @@ -198,9 +205,15 @@ class QuickChat(quick_widgets.QuickWidget): timestamp = float(extra['timestamp']) except KeyError: timestamp = None + + if not self.initialised and self.type == C.CHAT_ONE2ONE: + return # FIXME: tmp fix for bug 12, do not display the first one2one message which is already in the local history + if type_ == C.MESS_TYPE_INFO: self.printInfo(msg, extra=extra) else: + self.initialised = True # FIXME: tmp fix for bug 12, do not discard any message from now + nick = self._get_nick(from_jid) if msg.startswith('/me '): self.printInfo('* %s %s' % (nick, msg[4:]), type_='me', extra=extra)