Mercurial > libervia-backend
diff 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 |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py Sun Aug 28 20:24:25 2016 +0200 +++ b/frontends/src/quick_frontend/quick_chat.py Sun Aug 28 21:00:53 2016 +0200 @@ -71,6 +71,7 @@ if self.parent.nick.lower() in m.lower(): self._mention = True break + self.handleMe() self.widgets = set() # widgets linked to this message @property @@ -139,6 +140,28 @@ for w in self.widgets: w.updated(["status"]) + def handleMe(self): + """Check if messages starts with "/me " and change them if it is the case + + if several messages (different languages) are presents, they all need to start with "/me " + """ + # TODO: XHTML-IM /me are not handled + me = False + # we need to check /me for every message + for m in self.message.itervalues(): + if m.startswith(u"/me "): + me = True + else: + me = False + break + if me: + self.type = C.MESS_TYPE_INFO + self.extra['info_type'] = 'me' + nick = self.nick + for lang, mess in self.message.iteritems(): + self.message[lang] = u"* " + nick + mess[3:] + + class Occupant(object): """Occupant metadata"""