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
This commit is contained in:
souliane 2014-04-30 16:34:09 +02:00
commit 42b1b6c4ed

View file

@ -379,10 +379,8 @@ class XEP_0045(object):
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 @@ class XEP_0045(object):
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 @@ class XEP_0045(object):
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 @@ class XEP_0045(object):
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()