summaryrefslogtreecommitdiff
path: root/plugins/admin.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-08-15 13:13:17 +0200
committermathieui <mathieui@mathieui.net>2018-08-15 13:13:17 +0200
commit6e13b8b73572f9c0ac9b5c683b98a475afbeab38 (patch)
tree7dae86588339a8cf144b2d98c9280f28646341a9 /plugins/admin.py
parentd1b624753bb5371cf287cc9d86bb685593a99315 (diff)
downloadpoezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.gz
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.bz2
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.xz
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.zip
yapf -rip on plugins
Diffstat (limited to 'plugins/admin.py')
-rw-r--r--plugins/admin.py93
1 files changed, 54 insertions, 39 deletions
diff --git a/plugins/admin.py b/plugins/admin.py
index 8c632532..7bbc01d6 100644
--- a/plugins/admin.py
+++ b/plugins/admin.py
@@ -50,11 +50,11 @@ For affiliations
"""
-
from poezio.plugin import BasePlugin
from poezio.tabs import MucTab
from poezio.core.structs import Completion
+
class Plugin(BasePlugin):
"""
Adds several convenient aliases to /affiliation and /role:
@@ -66,48 +66,66 @@ class Plugin(BasePlugin):
/admin
/noaffiliation
"""
+
def init(self):
- for role in ('visitor', 'participant' , 'moderator'):
- self.api.add_tab_command(MucTab, role, self.role(role),
- help='Set the role of a nick to %s' % role,
- usage= '<nick>',
- short='Set the role to %s' % role,
- completion=self.complete_nick)
+ for role in ('visitor', 'participant', 'moderator'):
+ self.api.add_tab_command(
+ MucTab,
+ role,
+ self.role(role),
+ help='Set the role of a nick to %s' % role,
+ usage='<nick>',
+ short='Set the role to %s' % role,
+ completion=self.complete_nick)
for aff in ('member', 'owner', 'admin'):
- self.api.add_tab_command(MucTab, aff, self.affiliation(aff),
- usage='<nick>',
- help='Set the affiliation of a nick to %s' % aff,
- short='Set the affiliation to %s' % aff,
- completion=self.complete_nick)
-
- self.api.add_tab_command(MucTab, 'noaffiliation', self.affiliation('none'),
- usage='<nick>',
- help='Set the affiliation of a nick to none.',
- short='Set the affiliation to none.',
- completion=self.complete_nick)
- self.api.add_tab_command(MucTab, 'voice', self.affiliation('member'),
- usage='<nick>',
- help='Set the affiliation of a nick to member.',
- short='Set the affiliation to member.',
- completion=self.complete_nick)
- self.api.add_tab_command(MucTab, 'op', self.role('moderator'),
- usage='<nick>',
- help='Set the role of a nick to moderator.',
- short='Set the role to moderator.',
- completion=self.complete_nick)
- self.api.add_tab_command(MucTab, 'mute', self.role('visitor'),
- usage='<nick>',
- help='Set the role of a nick to visitor.',
- short='Set the role to visitor.',
- completion=self.complete_nick)
+ self.api.add_tab_command(
+ MucTab,
+ aff,
+ self.affiliation(aff),
+ usage='<nick>',
+ help='Set the affiliation of a nick to %s' % aff,
+ short='Set the affiliation to %s' % aff,
+ completion=self.complete_nick)
+
+ self.api.add_tab_command(
+ MucTab,
+ 'noaffiliation',
+ self.affiliation('none'),
+ usage='<nick>',
+ help='Set the affiliation of a nick to none.',
+ short='Set the affiliation to none.',
+ completion=self.complete_nick)
+ self.api.add_tab_command(
+ MucTab,
+ 'voice',
+ self.affiliation('member'),
+ usage='<nick>',
+ help='Set the affiliation of a nick to member.',
+ short='Set the affiliation to member.',
+ completion=self.complete_nick)
+ self.api.add_tab_command(
+ MucTab,
+ 'op',
+ self.role('moderator'),
+ usage='<nick>',
+ help='Set the role of a nick to moderator.',
+ short='Set the role to moderator.',
+ completion=self.complete_nick)
+ self.api.add_tab_command(
+ MucTab,
+ 'mute',
+ self.role('visitor'),
+ usage='<nick>',
+ help='Set the role of a nick to visitor.',
+ short='Set the role to visitor.',
+ completion=self.complete_nick)
def role(self, role):
- return lambda args: self.api.current_tab().command_role(args+' '+role)
+ return lambda args: self.api.current_tab().command_role(args + ' ' + role)
def affiliation(self, affiliation):
- return lambda args: self.api.current_tab().command_affiliation(
- args+' '+affiliation)
+ return lambda args: self.api.current_tab().command_affiliation(args + ' ' + affiliation)
def complete_nick(self, the_input):
tab = self.api.current_tab()
@@ -115,6 +133,3 @@ class Plugin(BasePlugin):
word_list = [user.nick for user in sorted(tab.users, key=compare_users, reverse=True)\
if user.nick != tab.own_nick]
return Completion(the_input.auto_completion, word_list, '')
-
-
-