Mercurial > libervia-backend
comparison src/core/xmpp.py @ 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 | 37285f2d37c8 |
comparison
equal
deleted
inserted
replaced
425:e4e9187e3b5b | 426:ae446194c20c |
---|---|
103 self.host = host | 103 self.host = host |
104 | 104 |
105 def onMessage(self, message): | 105 def onMessage(self, message): |
106 debug (_(u"got message from: %s"), message["from"]) | 106 debug (_(u"got message from: %s"), message["from"]) |
107 if not self.host.trigger.point("MessageReceived",message, profile=self.parent.profile): | 107 if not self.host.trigger.point("MessageReceived",message, profile=self.parent.profile): |
108 return | 108 return |
109 for e in message.elements(): | 109 for e in message.elements(): |
110 if e.name == "body": | 110 if e.name == "body": |
111 mess_type = message['type'] if message.hasAttribute('type') else 'normal' | 111 mess_type = message['type'] if message.hasAttribute('type') else 'normal' |
112 self.host.bridge.newMessage(message["from"], e.children[0], mess_type, message['to'], profile=self.parent.profile) | 112 self.host.bridge.newMessage(message["from"], e.children[0], mess_type, message['to'], profile=self.parent.profile) |
113 self.host.memory.addToHistory(jid.JID(message["from"]), jid.JID(message["to"]), e.children[0], profile=self.parent.profile) | 113 if not u"delay" in [elem.name for elem in message.elements()]: #we don't save delayed messages in history |
114 break | 114 self.host.memory.addToHistory(jid.JID(message["from"]), jid.JID(message["to"]), e.children[0], profile=self.parent.profile) |
115 break | |
115 | 116 |
116 class SatRosterProtocol(xmppim.RosterClientProtocol): | 117 class SatRosterProtocol(xmppim.RosterClientProtocol): |
117 | 118 |
118 def __init__(self, host): | 119 def __init__(self, host): |
119 xmppim.RosterClientProtocol.__init__(self) | 120 xmppim.RosterClientProtocol.__init__(self) |