2011-09-15 02:30:22 -04:00
|
|
|
import sys
|
2021-03-23 17:36:43 -04:00
|
|
|
from .helpers import msg
|
2011-09-15 02:30:22 -04:00
|
|
|
|
|
|
|
# NickServ basic functions
|
|
|
|
_nickservfuncs = (
|
|
|
|
'register',
|
|
|
|
'group',
|
|
|
|
'glist',
|
|
|
|
'identify',
|
|
|
|
'access',
|
|
|
|
'drop',
|
|
|
|
'recover',
|
|
|
|
'release',
|
|
|
|
'sendpass',
|
|
|
|
'ghost',
|
|
|
|
'alist',
|
|
|
|
'info',
|
|
|
|
'list',
|
|
|
|
'logout',
|
|
|
|
'status',
|
|
|
|
'update'
|
|
|
|
)
|
|
|
|
|
|
|
|
# NickServ SET functions
|
|
|
|
_nickservsetfuncs = (
|
|
|
|
'display',
|
|
|
|
'password',
|
|
|
|
'language',
|
|
|
|
'url',
|
|
|
|
'email',
|
|
|
|
'icq',
|
|
|
|
'greet',
|
|
|
|
'kill',
|
|
|
|
'secure',
|
|
|
|
'private',
|
|
|
|
'hide',
|
|
|
|
'msg',
|
|
|
|
'autoop'
|
|
|
|
)
|
|
|
|
|
|
|
|
# ChanServ basic functions
|
|
|
|
_chanservfuncs = (
|
|
|
|
'register',
|
|
|
|
'identify',
|
|
|
|
'sop',
|
|
|
|
'aop',
|
|
|
|
'hop',
|
|
|
|
'vop',
|
|
|
|
'access',
|
|
|
|
'levels',
|
|
|
|
'akick',
|
|
|
|
'drop',
|
|
|
|
'sendpass',
|
|
|
|
'ban',
|
|
|
|
'unban',
|
|
|
|
'clear',
|
|
|
|
'owner',
|
|
|
|
'deowner',
|
|
|
|
'protect',
|
|
|
|
'deprotect',
|
|
|
|
'op',
|
|
|
|
'deop',
|
|
|
|
'halfop',
|
|
|
|
'dehalfop',
|
|
|
|
'voice',
|
|
|
|
'devoice',
|
|
|
|
'getkey',
|
|
|
|
'invite',
|
|
|
|
'kick',
|
|
|
|
'list',
|
|
|
|
'logout',
|
|
|
|
'topic',
|
|
|
|
'info',
|
|
|
|
'appendtopic',
|
|
|
|
'enforce'
|
|
|
|
)
|
|
|
|
|
|
|
|
_chanservsetfuncs = (
|
|
|
|
'founder',
|
|
|
|
'successor',
|
|
|
|
'password',
|
|
|
|
'desc',
|
|
|
|
'url',
|
|
|
|
'email',
|
|
|
|
'entrymsg',
|
|
|
|
'bantype',
|
|
|
|
'mlock',
|
|
|
|
'keeptopic',
|
|
|
|
'opnotice',
|
|
|
|
'peace',
|
|
|
|
'private',
|
|
|
|
'restricted',
|
|
|
|
'secure',
|
|
|
|
'secureops',
|
|
|
|
'securefounder',
|
|
|
|
'signkick',
|
|
|
|
'topiclock',
|
|
|
|
'xop'
|
|
|
|
)
|
|
|
|
|
|
|
|
def _addServ(serv, funcs, prefix=""):
|
|
|
|
def simplecmd(cmd_name):
|
|
|
|
if prefix:
|
|
|
|
cmd_name = prefix.upper() + " " + cmd_name
|
|
|
|
def f(cli, *args):
|
2021-03-23 17:36:43 -04:00
|
|
|
print(cmd_name, " ".join(args))
|
2011-09-15 02:30:22 -04:00
|
|
|
#cli.send(cmd_name, serv.name, *args)
|
|
|
|
return f
|
|
|
|
for t in funcs:
|
|
|
|
setattr(serv, t, simplecmd(t.upper()))
|
|
|
|
|
|
|
|
class NickServ(object):
|
2011-09-28 19:16:01 -04:00
|
|
|
def __init__(self, nick="NickServ"):
|
2011-09-15 02:30:22 -04:00
|
|
|
self.name = nick
|
|
|
|
_addServ(self, _nickservfuncs)
|
|
|
|
_addServ(self, _nickservsetfuncs, "set")
|
|
|
|
|
|
|
|
class ChanServ(object):
|
2011-09-28 19:16:01 -04:00
|
|
|
def __init__(self, nick="ChanServ"):
|
2011-09-15 02:30:22 -04:00
|
|
|
self.name = nick
|
|
|
|
_addServ(self, _chanservfuncs)
|
|
|
|
_addServ(self, _chanservsetfuncs, "set")
|