diff --git a/sat/plugins/plugin_xep_0045.py b/sat/plugins/plugin_xep_0045.py index e8770f9b..2e99a01f 100644 --- a/sat/plugins/plugin_xep_0045.py +++ b/sat/plugins/plugin_xep_0045.py @@ -720,12 +720,16 @@ class XEP_0045(object): self.text_cmds.feedBack(client, feedback, mess_data) return False - d = self.kick(client, nick, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}) + reason = ' '.join(options[1:]) if len(options) > 1 else None + + d = self.kick(client, nick, mess_data["to"], {"reason": reason}) def cb(__): feedback_msg = _('You have kicked {}').format(nick) - if len(options) > 1: - feedback_msg += _(' for the following reason: {}').format(options[1]) + if reason is not None: + feedback_msg += _(' for the following reason: {reason}').format( + reason=reason + ) self.text_cmds.feedBack(client, feedback_msg, mess_data) return True d.addCallback(cb) @@ -744,17 +748,24 @@ class XEP_0045(object): entity_jid = jid.JID(jid_s).userhostJID() assert(entity_jid.user) assert(entity_jid.host) - except (RuntimeError, jid.InvalidFormat, AttributeError, IndexError, AssertionError): - feedback = _("You must provide a valid JID to ban, like in '/ban contact@example.net'") + except (RuntimeError, jid.InvalidFormat, AttributeError, IndexError, + AssertionError): + feedback = _( + "You must provide a valid JID to ban, like in '/ban contact@example.net'" + ) self.text_cmds.feedBack(client, feedback, mess_data) return False - d = self.ban(client, entity_jid, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}) + reason = ' '.join(options[1:]) if len(options) > 1 else None + + d = self.ban(client, entity_jid, mess_data["to"], {"reason": reason}) def cb(__): feedback_msg = _('You have banned {}').format(entity_jid) - if len(options) > 1: - feedback_msg += _(' for the following reason: {}').format(options[1]) + if reason is not None: + feedback_msg += _(' for the following reason: {reason}').format( + reason=reason + ) self.text_cmds.feedBack(client, feedback_msg, mess_data) return True d.addCallback(cb) @@ -791,7 +802,8 @@ class XEP_0045(object): d = self.affiliate(client, entity_jid, mess_data["to"], {'affiliation': affiliation}) def cb(__): - feedback_msg = _('New affiliation for %(entity)s: %(affiliation)s').format(entity=entity_jid, affiliation=affiliation) + feedback_msg = _('New affiliation for {entity}: {affiliation}').format( + entity=entity_jid, affiliation=affiliation) self.text_cmds.feedBack(client, feedback_msg, mess_data) return True d.addCallback(cb) @@ -837,7 +849,8 @@ class XEP_0045(object): elif client.muc_service is not None: service = client.muc_service else: - msg = D_("No known default MUC service".format(unparsed)) + msg = D_("No known default MUC service {unparsed}").format( + unparsed=unparsed) self.text_cmds.feedBack(client, msg, mess_data) return False except jid.InvalidFormat: