Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_app.py @ 513:8ee9113d307b
core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:
- new "extra" parameter in newMessage signal
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 20 Oct 2012 17:23:56 +0200 |
parents | 886754295efe |
children | 0bb595eff25b |
comparison
equal
deleted
inserted
replaced
512:862c0d6ab974 | 513:8ee9113d307b |
---|---|
233 return | 233 return |
234 entity=JID(JabberId) | 234 entity=JID(JabberId) |
235 _groups = list(groups) | 235 _groups = list(groups) |
236 self.contact_list.replace(entity, _groups, attributes) | 236 self.contact_list.replace(entity, _groups, attributes) |
237 | 237 |
238 def _newMessage(self, from_jid_s, msg, _type, to_jid_s, profile): | 238 def _newMessage(self, from_jid_s, msg, _type, to_jid_s, extra, profile): |
239 """newMessage premanagement: a dirty hack to manage private messages | 239 """newMessage premanagement: a dirty hack to manage private messages |
240 if a private MUC message is detected, from_jid or to_jid is prefixed and resource is escaped""" | 240 if a private MUC message is detected, from_jid or to_jid is prefixed and resource is escaped""" |
241 if not self.check_profile(profile): | 241 if not self.check_profile(profile): |
242 return | 242 return |
243 from_jid = JID(from_jid_s) | 243 from_jid = JID(from_jid_s) |
257 else: | 257 else: |
258 from_jid = new_jid | 258 from_jid = new_jid |
259 if new_jid not in self.contact_list: | 259 if new_jid not in self.contact_list: |
260 self.contact_list.add(new_jid) | 260 self.contact_list.add(new_jid) |
261 | 261 |
262 self.newMessage(from_jid, to_jid, msg, _type, profile) | 262 self.newMessage(from_jid, to_jid, msg, _type, extra, profile) |
263 | 263 |
264 def newMessage(self, from_jid, to_jid, msg, _type, profile): | 264 def newMessage(self, from_jid, to_jid, msg, _type, extra, profile): |
265 from_me = from_jid.short == self.profiles[profile]['whoami'].short | 265 from_me = from_jid.short == self.profiles[profile]['whoami'].short |
266 win = to_jid if from_me else from_jid | 266 win = to_jid if from_me else from_jid |
267 | 267 |
268 self.current_action_ids = set() | 268 self.current_action_ids = set() |
269 self.current_action_ids_cb = {} | 269 self.current_action_ids_cb = {} |
270 | 270 |
271 self.chat_wins[win.short].printMessage(from_jid, msg, profile) | 271 timestamp = extra.get('archive') |
272 self.chat_wins[win.short].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '') | |
272 | 273 |
273 def sendMessage(self, to_jid, message, subject='', mess_type="auto", profile_key="@DEFAULT@"): | 274 def sendMessage(self, to_jid, message, subject='', mess_type="auto", profile_key="@DEFAULT@"): |
274 if to_jid.startswith(const_PRIVATE_PREFIX): | 275 if to_jid.startswith(const_PRIVATE_PREFIX): |
275 to_jid = unescapePrivate(to_jid) | 276 to_jid = unescapePrivate(to_jid) |
276 mess_type = "chat" | 277 mess_type = "chat" |