Mercurial > libervia-backend
diff src/plugins/plugin_xep_0045.py @ 1002:291eb8216f6e
plugins TEXT-COMMANDS, XEP-0045, XEP-0048, XEP-0249:
- give a feedback instead of sending the message when the command is invalid or used in a wrong context
- add command /join for XEP-0249
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 30 Apr 2014 16:34:09 +0200 |
parents | 301b342c697a |
children | a7d33c7a8277 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py Sun Apr 27 18:51:03 2014 +0200 +++ b/src/plugins/plugin_xep_0045.py Wed Apr 30 16:34:09 2014 +0200 @@ -379,10 +379,8 @@ log.debug("Catched nick command") if mess_data['type'] != "groupchat": - #/nick command does nothing if we are not on a group chat - log.info("Ignoring /nick command on a non groupchat message") - - return True + self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('nick', 'groupchat', mess_data, profile) + return False nick = mess_data["unparsed"].strip() room = mess_data["to"] @@ -396,9 +394,8 @@ log.debug("Catched join command") if mess_data['type'] != "groupchat": - #/leave command does nothing if we are not on a group chat - log.info("Ignoring /join command on a non groupchat message") - return True + self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('join', 'groupchat', mess_data, profile) + return False if mess_data["unparsed"].strip(): room = self.host.plugins[C.TEXT_CMDS].getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host) @@ -413,9 +410,8 @@ log.debug("Catched leave command") if mess_data['type'] != "groupchat": - #/leave command does nothing if we are not on a group chat - log.info("Ignoring /leave command on a non groupchat message") - return True + self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('leave', 'groupchat', mess_data, profile) + return False if mess_data["unparsed"].strip(): room = self.host.plugins[C.TEXT_CMDS].getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host) @@ -435,9 +431,8 @@ log.debug("Catched title command") if mess_data['type'] != "groupchat": - #/leave command does nothing if we are not on a group chat - log.info("Ignoring /title command on a non groupchat message") - return True + self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('title', 'groupchat', mess_data, profile) + return False subject = mess_data["unparsed"].strip()