changeset 426:ae446194c20c

core: don't save anymore delayed message in history
author Goffi <goffi@goffi.org>
date Tue, 08 Nov 2011 22:21:58 +0100
parents e4e9187e3b5b
children bb0236633da5
files src/core/xmpp.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/xmpp.py	Tue Nov 08 01:08:11 2011 +0100
+++ b/src/core/xmpp.py	Tue Nov 08 22:21:58 2011 +0100
@@ -105,13 +105,14 @@
     def onMessage(self, message):
       debug (_(u"got message from: %s"), message["from"])
       if not self.host.trigger.point("MessageReceived",message, profile=self.parent.profile):
-        return
+          return
       for e in message.elements():
-        if e.name == "body":
-          mess_type = message['type'] if message.hasAttribute('type') else 'normal'
-          self.host.bridge.newMessage(message["from"], e.children[0], mess_type, message['to'], profile=self.parent.profile)
-          self.host.memory.addToHistory(jid.JID(message["from"]), jid.JID(message["to"]), e.children[0], profile=self.parent.profile)
-          break
+          if e.name == "body":
+              mess_type = message['type'] if message.hasAttribute('type') else 'normal'
+              self.host.bridge.newMessage(message["from"], e.children[0], mess_type, message['to'], profile=self.parent.profile)
+              if not u"delay" in [elem.name for elem in message.elements()]: #we don't save delayed messages in history
+                  self.host.memory.addToHistory(jid.JID(message["from"]), jid.JID(message["to"]), e.children[0], profile=self.parent.profile)
+              break
     
 class SatRosterProtocol(xmppim.RosterClientProtocol):