changeset 1890:0a45bc8e7cf4

plugin XEP-0045: fixed feedback for /kick /ban and /afficiliate commands which should not be public
author Goffi <goffi@goffi.org>
date Mon, 07 Mar 2016 13:50:57 +0100
parents be61c5c5e474
children b91c8637c656
files src/plugins/plugin_xep_0045.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py	Mon Mar 07 13:49:13 2016 +0100
+++ b/src/plugins/plugin_xep_0045.py	Mon Mar 07 13:50:57 2016 +0100
@@ -545,9 +545,10 @@
         d = self.kick(nick, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}, profile)
 
         def cb(dummy):
-            mess_data['message'] = _('%s has been kicked') % nick
+            feedback_msg = _(u'You have kicked {}').format(nick)
             if len(options) > 1:
-                mess_data['message'] += _(' for the following reason: %s') % options[1]
+                feedback_msg += _(u' for the following reason: {}').format(options[1])
+            self.host.plugins[C.TEXT_CMDS].feedBack(feedback_msg, mess_data, profile)
             return True
         d.addCallback(cb)
         return d
@@ -573,9 +574,10 @@
         d = self.ban(entity_jid, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}, profile)
 
         def cb(dummy):
-            mess_data['message'] = _('%s has been banned') % entity_jid
+            feedback_msg = _(u'You have banned {}').format(entity_jid)
             if len(options) > 1:
-                mess_data['message'] += _(' for the following reason: %s') % options[1]
+                feedback_msg += _(u' for the following reason: {}').format(options[1])
+            self.host.plugins[C.TEXT_CMDS].feedBack(feedback_msg, mess_data, profile)
             return True
         d.addCallback(cb)
         return d
@@ -611,7 +613,8 @@
         d = self.affiliate(entity_jid, mess_data["to"], {'affiliation': affiliation}, profile)
 
         def cb(dummy):
-            mess_data['message'] = _('New affiliation for %(entity)s: %(affiliation)s') % {'entity': entity_jid, 'affiliation': affiliation}
+            feedback_msg = _(u'New affiliation for %(entity)s: %(affiliation)s').format(entity=entity_jid, affiliation=affiliation)
+            self.host.plugins[C.TEXT_CMDS].feedBack(feedback_msg, mess_data, profile)
             return True
         d.addCallback(cb)
         return d