Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0045.py @ 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 | 8e2c831073a6 |
children | b91c8637c656 |
comparison
equal
deleted
inserted
replaced
1889:be61c5c5e474 | 1890:0a45bc8e7cf4 |
---|---|
543 return False | 543 return False |
544 | 544 |
545 d = self.kick(nick, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}, profile) | 545 d = self.kick(nick, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}, profile) |
546 | 546 |
547 def cb(dummy): | 547 def cb(dummy): |
548 mess_data['message'] = _('%s has been kicked') % nick | 548 feedback_msg = _(u'You have kicked {}').format(nick) |
549 if len(options) > 1: | 549 if len(options) > 1: |
550 mess_data['message'] += _(' for the following reason: %s') % options[1] | 550 feedback_msg += _(u' for the following reason: {}').format(options[1]) |
551 self.host.plugins[C.TEXT_CMDS].feedBack(feedback_msg, mess_data, profile) | |
551 return True | 552 return True |
552 d.addCallback(cb) | 553 d.addCallback(cb) |
553 return d | 554 return d |
554 | 555 |
555 def cmd_ban(self, mess_data, profile): | 556 def cmd_ban(self, mess_data, profile): |
571 return False | 572 return False |
572 | 573 |
573 d = self.ban(entity_jid, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}, profile) | 574 d = self.ban(entity_jid, mess_data["to"], {} if len(options) == 1 else {'reason': options[1]}, profile) |
574 | 575 |
575 def cb(dummy): | 576 def cb(dummy): |
576 mess_data['message'] = _('%s has been banned') % entity_jid | 577 feedback_msg = _(u'You have banned {}').format(entity_jid) |
577 if len(options) > 1: | 578 if len(options) > 1: |
578 mess_data['message'] += _(' for the following reason: %s') % options[1] | 579 feedback_msg += _(u' for the following reason: {}').format(options[1]) |
580 self.host.plugins[C.TEXT_CMDS].feedBack(feedback_msg, mess_data, profile) | |
579 return True | 581 return True |
580 d.addCallback(cb) | 582 d.addCallback(cb) |
581 return d | 583 return d |
582 | 584 |
583 def cmd_affiliate(self, mess_data, profile): | 585 def cmd_affiliate(self, mess_data, profile): |
609 return False | 611 return False |
610 | 612 |
611 d = self.affiliate(entity_jid, mess_data["to"], {'affiliation': affiliation}, profile) | 613 d = self.affiliate(entity_jid, mess_data["to"], {'affiliation': affiliation}, profile) |
612 | 614 |
613 def cb(dummy): | 615 def cb(dummy): |
614 mess_data['message'] = _('New affiliation for %(entity)s: %(affiliation)s') % {'entity': entity_jid, 'affiliation': affiliation} | 616 feedback_msg = _(u'New affiliation for %(entity)s: %(affiliation)s').format(entity=entity_jid, affiliation=affiliation) |
617 self.host.plugins[C.TEXT_CMDS].feedBack(feedback_msg, mess_data, profile) | |
615 return True | 618 return True |
616 d.addCallback(cb) | 619 d.addCallback(cb) |
617 return d | 620 return d |
618 | 621 |
619 def cmd_title(self, mess_data, profile): | 622 def cmd_title(self, mess_data, profile): |