]> jfr.im git - irc/rizon/acid.git/blob - pyva/pyva/src/main/python/limitserv/sys_auth.py
Split pyva plugin into pyva.core and pyva.pyva
[irc/rizon/acid.git] / pyva / pyva / src / main / python / limitserv / sys_auth.py
1 from pseudoclient.sys_auth import AuthManager
2
3 class LimitServAuthManager(AuthManager):
4 def __init__(self, module):
5 AuthManager.__init__(self, module)
6
7 def onAccept(self, user, request, action, channel):
8 if action == 'news':
9 if self.module.channels.is_valid(channel):
10 self.module.channels.set(channel, 'news', True)
11 self.module.msg(user, 'Enabled news in @b%s@b.' % channel)
12 elif action == 'nonews':
13 if self.module.channels.is_valid(channel):
14 self.module.channels.set(channel, 'news', False)
15 self.module.msg(user, 'Disabled news in @b%s@b.' % channel)
16 else:
17 return False
18
19 return True
20
21 def reject_not_enough_users(self, user, channel):
22 self.reject(user, 'Channel @b%s@b does not have enough users to request %s.' % (channel, self.module.config.get('limitserv', 'nick')))