plugin XEP-0045: fixed feedback for /kick /ban and /afficiliate commands which should not be public

This commit is contained in:
Goffi 2016-03-07 13:50:57 +01:00
commit a99d593a35

View file

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