Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_chat.py @ 2055:ed33cd382bf9
plugin XEP-0245: removed plugin XEP-0245:
at the end it adds complications to handle XEP-0245 in backend (because edge cases must be handled: info type with group chat, history when message is info but for a group chat, etc) while it's trivial to handle it in frontend.
So /me detection is handled in QuickFrontend and cmd_me is back into plugin_misc_text_commands, it is the choice of the frontend to display or not the "/me" (for frontends based on QuickFrontend it remains automatic).
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Aug 2016 21:00:53 +0200 |
parents | 1dc3c7680ea0 |
children | a52a6ed7d48f |
comparison
equal
deleted
inserted
replaced
2054:24827e550991 | 2055:ed33cd382bf9 |
---|---|
69 if self.parent.type == C.CHAT_GROUP and not self.own_mess: | 69 if self.parent.type == C.CHAT_GROUP and not self.own_mess: |
70 for m in msg.itervalues(): | 70 for m in msg.itervalues(): |
71 if self.parent.nick.lower() in m.lower(): | 71 if self.parent.nick.lower() in m.lower(): |
72 self._mention = True | 72 self._mention = True |
73 break | 73 break |
74 self.handleMe() | |
74 self.widgets = set() # widgets linked to this message | 75 self.widgets = set() # widgets linked to this message |
75 | 76 |
76 @property | 77 @property |
77 def host(self): | 78 def host(self): |
78 return self.parent.host | 79 return self.parent.host |
136 @status.setter | 137 @status.setter |
137 def status(self, status): | 138 def status(self, status): |
138 self._status = status | 139 self._status = status |
139 for w in self.widgets: | 140 for w in self.widgets: |
140 w.updated(["status"]) | 141 w.updated(["status"]) |
142 | |
143 def handleMe(self): | |
144 """Check if messages starts with "/me " and change them if it is the case | |
145 | |
146 if several messages (different languages) are presents, they all need to start with "/me " | |
147 """ | |
148 # TODO: XHTML-IM /me are not handled | |
149 me = False | |
150 # we need to check /me for every message | |
151 for m in self.message.itervalues(): | |
152 if m.startswith(u"/me "): | |
153 me = True | |
154 else: | |
155 me = False | |
156 break | |
157 if me: | |
158 self.type = C.MESS_TYPE_INFO | |
159 self.extra['info_type'] = 'me' | |
160 nick = self.nick | |
161 for lang, mess in self.message.iteritems(): | |
162 self.message[lang] = u"* " + nick + mess[3:] | |
163 | |
141 | 164 |
142 | 165 |
143 class Occupant(object): | 166 class Occupant(object): |
144 """Occupant metadata""" | 167 """Occupant metadata""" |
145 | 168 |