Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_chat.py @ 2020:f67da1cab6d3
quick frontend, primitivus (chat, contact_list): fixed MUC private messages handling:
- occupants can be clicked again
- QuickChat.Occupant now keep room jid and real jid if available
- history messages are filtered correctly when requesting history for MUC room or private conversation
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 24 Jul 2016 18:07:45 +0200 |
parents | c0ff84243650 |
children | 88c41a195728 |
comparison
equal
deleted
inserted
replaced
2019:c0ff84243650 | 2020:f67da1cab6d3 |
---|---|
118 | 118 |
119 def __init__(self, parent, data, profile): | 119 def __init__(self, parent, data, profile): |
120 self.parent = parent | 120 self.parent = parent |
121 self.profile = profile | 121 self.profile = profile |
122 self.nick = data['nick'] | 122 self.nick = data['nick'] |
123 self.entity = data.get('entity') | 123 self._entity = data.get('entity') |
124 if not self.entity: | |
125 self.entity = jid.JID(u"{}/{}".format(parent.target.bare, self.nick)), | |
126 self.affiliation = data['affiliation'] | 124 self.affiliation = data['affiliation'] |
127 self.role = data['role'] | 125 self.role = data['role'] |
128 self.widgets = set() # widgets linked to this occupant | 126 self.widgets = set() # widgets linked to this occupant |
129 self._state = None | 127 self._state = None |
128 | |
129 @property | |
130 def jid(self): | |
131 """jid in the room""" | |
132 return jid.JID(u"{}/{}".format(self.parent.target.bare, self.nick)) | |
133 | |
134 @property | |
135 def real_jid(self): | |
136 """real jid if known else None""" | |
137 return self._entity | |
130 | 138 |
131 @property | 139 @property |
132 def host(self): | 140 def host(self): |
133 return self.parent.host | 141 return self.parent.host |
134 | 142 |
319 log_msg = _(u"now we print the history") | 327 log_msg = _(u"now we print the history") |
320 if size != C.HISTORY_LIMIT_DEFAULT: | 328 if size != C.HISTORY_LIMIT_DEFAULT: |
321 log_msg += _(u" ({} messages)".format(size)) | 329 log_msg += _(u" ({} messages)".format(size)) |
322 log.debug(log_msg) | 330 log.debug(log_msg) |
323 | 331 |
324 target = self.target.bare | 332 if self.type == C.CHAT_ONE2ONE: |
333 special = self.host.contact_lists[self.profile].getCache(self.target, C.CONTACT_SPECIAL) | |
334 if special == C.CONTACT_SPECIAL_GROUP: | |
335 # we have a private conversation | |
336 # so we need full jid for the history | |
337 # (else we would get history from group itself) | |
338 # and to filter out groupchat message | |
339 target = self.target | |
340 filters['not_types'] = C.MESS_TYPE_GROUPCHAT | |
341 else: | |
342 target = self.target.bare | |
343 else: | |
344 # groupchat | |
345 target = self.target.bare | |
346 # FIXME: info not handled correctly | |
347 filters['types'] = C.MESS_TYPE_GROUPCHAT | |
325 | 348 |
326 def _historyGetCb(history): | 349 def _historyGetCb(history): |
327 # day_format = "%A, %d %b %Y" # to display the day change | 350 # day_format = "%A, %d %b %Y" # to display the day change |
328 # previous_day = datetime.now().strftime(day_format) | 351 # previous_day = datetime.now().strftime(day_format) |
329 # message_day = datetime.fromtimestamp(timestamp).strftime(self.day_format) | 352 # message_day = datetime.fromtimestamp(timestamp).strftime(self.day_format) |