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).
This commit is contained in:
parent
f378675f78
commit
eb1dd1d177
1 changed files with 34 additions and 102 deletions
|
|
@ -71,6 +71,7 @@ class Message(object):
|
|||
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 @@ class Message(object):
|
|||
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"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue