Mercurial > libervia-backend
comparison src/core/xmpp.py @ 669:ffb716804580
core, bridge: extra parameter is saved in history:
- added extra data in getHistory return value
- extra data is saved in database
/!\ WARNING: DATABASE SCHEMA HAS CHANGED /!\
to update sqlite database: ALTER TABLE history ADD COLUMN extra BLOB;
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 07 Nov 2013 15:29:39 +0100 |
parents | 2a7185b8452c |
children | 0c84fb112d70 |
comparison
equal
deleted
inserted
replaced
668:7bb50096d225 | 669:ffb716804580 |
---|---|
136 _delay = delay.Delay.fromElement(filter(lambda elm: elm.name == 'delay', message.elements())[0]) | 136 _delay = delay.Delay.fromElement(filter(lambda elm: elm.name == 'delay', message.elements())[0]) |
137 timestamp = timegm(_delay.stamp.utctimetuple()) | 137 timestamp = timegm(_delay.stamp.utctimetuple()) |
138 data['extra']['archive'] = str(timestamp) | 138 data['extra']['archive'] = str(timestamp) |
139 if data['type'] != 'groupchat': # XXX: we don't save delayed messages in history for groupchats | 139 if data['type'] != 'groupchat': # XXX: we don't save delayed messages in history for groupchats |
140 #TODO: add delayed messages to history if they aren't already in it | 140 #TODO: add delayed messages to history if they aren't already in it |
141 self.host.memory.addToHistory(jid.JID(data['from']), jid.JID(data['to']), data['body'], data['type'], timestamp, profile=self.parent.profile) | 141 self.host.memory.addToHistory(jid.JID(data['from']), jid.JID(data['to']), data['body'], data['type'], data['extra'], timestamp, profile=self.parent.profile) |
142 except IndexError: | 142 except IndexError: |
143 self.host.memory.addToHistory(jid.JID(data['from']), jid.JID(data['to']), data['body'], data['type'], profile=self.parent.profile) | 143 self.host.memory.addToHistory(jid.JID(data['from']), jid.JID(data['to']), data['body'], data['type'], data['extra'], profile=self.parent.profile) |
144 self.host.bridge.newMessage(data['from'], data['body'], data['type'], data['to'], data['extra'], profile=self.parent.profile) | 144 self.host.bridge.newMessage(data['from'], data['body'], data['type'], data['to'], data['extra'], profile=self.parent.profile) |
145 | 145 |
146 post_treat.addCallback(after_treatments) | 146 post_treat.addCallback(after_treatments) |
147 post_treat.callback(data) | 147 post_treat.callback(data) |
148 | 148 |