plugin text command, XEP-0045, XEP-0048, XEP-0249: removed feedBackWrongContext which is no more usefull with new _contextValid method

This commit is contained in:
Goffi 2015-03-19 14:30:08 +01:00
commit 9443b14c59

View file

@ -448,28 +448,24 @@ class XEP_0045(object):
# Text commands #
def cmd_nick(self, mess_data, profile):
"""change nickname"""
log.debug("Catched nick command")
if mess_data['type'] != "groupchat":
self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('nick', 'groupchat', mess_data, profile)
return False
"""change nickname
@command (group): new_nick
- new_nick: new nick to use
"""
nick = mess_data["unparsed"].strip()
room = mess_data["to"]
self.nick(room, nick, profile)
if nick:
room = mess_data["to"]
self.nick(room, nick, profile)
return False
def cmd_join(self, mess_data, profile):
"""join a new room (on the same service if full jid is not specified)"""
log.debug("Catched join command")
if mess_data['type'] != "groupchat":
self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('join', 'groupchat', mess_data, profile)
return False
"""join a new room
@command (group): JID
- JID: room to join (on the same service if full jid is not specified)
"""
if mess_data["unparsed"].strip():
room_jid = self.host.plugins[C.TEXT_CMDS].getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host)
nick = (self.getRoomNick(room_jid, profile) or
@ -479,13 +475,11 @@ class XEP_0045(object):
return False
def cmd_leave(self, mess_data, profile):
"""quit a room"""
log.debug("Catched leave command")
if mess_data['type'] != "groupchat":
self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('leave', 'groupchat', mess_data, profile)
return False
"""quit a room
@command (group): [ROOM_JID]
- ROOM_JID: jid of the room to live (current room if not specified)
"""
if mess_data["unparsed"].strip():
room = self.host.plugins[C.TEXT_CMDS].getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host)
else:
@ -496,21 +490,19 @@ class XEP_0045(object):
return False
def cmd_part(self, mess_data, profile):
"""just a synonym of /leave"""
"""just a synonym of /leave
@command (group): [ROOM_JID]
- ROOM_JID: jid of the room to live (current room if not specified)
"""
return self.cmd_leave(mess_data, profile)
def cmd_kick(self, mess_data, profile):
"""kick a room member
@command (group): (nick)
- nick: the nick of the person to kick
@command (group): ROOM_NICK
- ROOM_NICK: the nick of the person to kick
"""
log.debug("Catched kick command")
if mess_data['type'] != "groupchat":
self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('kick', 'groupchat', mess_data, profile)
return False
options = mess_data["unparsed"].strip().split()
try:
nick = options[0]
@ -537,12 +529,6 @@ class XEP_0045(object):
- JID: the JID of the entity to ban
- reason: the reason why this entity is being banned
"""
log.debug("Catched ban command")
if mess_data['type'] != "groupchat":
self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('ban', 'groupchat', mess_data, profile)
return False
options = mess_data["unparsed"].strip().split()
try:
jid_s = options[0]
@ -575,12 +561,6 @@ class XEP_0045(object):
- none: reset entity privileges
- outcast: ban entity
"""
log.debug("Catched affiliate command")
if mess_data['type'] != "groupchat":
self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('affiliate', 'groupchat', mess_data, profile)
return False
options = mess_data["unparsed"].strip().split()
try:
jid_s = options[0]
@ -607,13 +587,11 @@ class XEP_0045(object):
return d
def cmd_title(self, mess_data, profile):
"""change room's subject"""
log.debug("Catched title command")
if mess_data['type'] != "groupchat":
self.host.plugins[C.TEXT_CMDS].feedBackWrongContext('title', 'groupchat', mess_data, profile)
return False
"""change room's subject
@command (group): title
- title: new room subject
"""
subject = mess_data["unparsed"].strip()
if subject:
@ -623,7 +601,11 @@ class XEP_0045(object):
return False
def cmd_topic(self, mess_data, profile):
"""just a synonym of /title"""
"""just a synonym of /title
@command (group): title
- title: new room subject
"""
return self.cmd_title(mess_data, profile)
def _whois(self, whois_msg, mess_data, target_jid, profile):