Mercurial > libervia-backend
diff src/plugins/plugin_misc_text_commands.py @ 587:952322b1d490
Remove trailing whitespaces.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 18 Jan 2013 17:55:34 +0100 |
parents | ca13633d3b6b |
children | beaf6bec2fcd |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_text_commands.py Fri Jan 18 17:55:27 2013 +0100 +++ b/src/plugins/plugin_misc_text_commands.py Fri Jan 18 17:55:34 2013 +0100 @@ -89,29 +89,29 @@ def cmd_nick(self, mess_data, profile): """change nickname""" debug("Catched nick command") - + if mess_data['type'] != "groupchat": #/nick command does nothing if we are not on a group chat info("Ignoring /nick command on a non groupchat message") - + return True - + nick = mess_data["unparsed"].strip() room = mess_data["to"] self.host.plugins["XEP-0045"].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)""" debug("Catched join command") - + if mess_data['type'] != "groupchat": #/leave command does nothing if we are not on a group chat info("Ignoring /join command on a non groupchat message") return True - + if mess_data["unparsed"].strip(): room = self._getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host) nick = (self.host.plugins["XEP-0045"].getRoomNick(mess_data["to"].userhost(), profile) or @@ -123,14 +123,14 @@ def cmd_leave(self, mess_data, profile): """quit a room""" debug("Catched leave command") - + if mess_data['type'] != "groupchat": #/leave command does nothing if we are not on a group chat info("Ignoring /leave command on a non groupchat message") return True - + if mess_data["unparsed"].strip(): - room = self._getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host) + room = self._getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host) else: room = mess_data["to"] @@ -145,14 +145,14 @@ def cmd_title(self, mess_data, profile): """change room's subject""" debug("Catched title command") - + if mess_data['type'] != "groupchat": #/leave command does nothing if we are not on a group chat info("Ignoring /title command on a non groupchat message") return True - + subject = mess_data["unparsed"].strip() - + if subject: room = mess_data["to"] self.host.plugins["XEP-0045"].subject(room, subject, profile) @@ -167,9 +167,9 @@ """activate Parrot mode between 2 entities, in both directions.""" #TODO: these commands must not be hardcoded, an interface should be made # to allow plugins to register simple commands like this. - + debug("Catched parrot command") - + try: link_left_jid = jid.JID(mess_data["unparsed"].strip()) if not link_left_jid.user or not link_left_jid.host: @@ -184,13 +184,13 @@ self.host.plugins["EXP-PARROT"].addParrot(link_right_jid, link_left_jid, profile) self._feedBack("Parrot mode activated for %s" % (unicode(link_left_jid),), mess_data, profile) - + return False def cmd_unparrot(self, mess_data, profile): """remove Parrot mode between 2 entities, in both directions.""" debug("Catched unparrot command") - + try: link_left_jid = jid.JID(mess_data["unparsed"].strip()) if not link_left_jid.user or not link_left_jid.host: @@ -205,7 +205,7 @@ self.host.plugins["EXP-PARROT"].removeParrot(link_right_jid, profile) self._feedBack("Parrot mode deactivated for %s and %s" % (unicode(link_left_jid), unicode(link_right_jid)), mess_data, profile) - + return False def cmd_help(self, mess_data, profile): @@ -213,7 +213,7 @@ commands=filter(lambda method: method.startswith('cmd_'), dir(self)) longuest = max([len(command) for command in commands]) help_cmds = [] - + for command in commands: method = getattr(self, command) try: @@ -223,7 +223,7 @@ spaces = (longuest - len(command)) * ' ' help_cmds.append(" /%s: %s %s" % (command[4:], spaces, help_str)) - help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds),) + help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds),) self._feedBack(help_mess, mess_data, profile) - +