added input.mask. returns 'user@host'

This commit is contained in:
Luke Rogers 2012-03-22 17:04:48 +13:00
parent 0c3e78bdce
commit 3e5c2c94d9
3 changed files with 7 additions and 5 deletions

View file

@ -163,6 +163,7 @@ class IRC(object):
else:
prefix, command, params = irc_noprefix_rem(msg).groups()
nick, user, host = irc_netmask_rem(prefix).groups()
mask = user + "@" + host
paramlist = irc_param_ref(params)
lastparam = ""
if paramlist:
@ -170,7 +171,7 @@ class IRC(object):
paramlist[-1] = paramlist[-1][1:]
lastparam = paramlist[-1]
self.out.put([msg, prefix, command, params, nick, user, host,
paramlist, lastparam])
mask, paramlist, lastparam])
if command == "PING":
self.cmd("PONG", paramlist)
@ -225,6 +226,7 @@ class FakeIRC(IRC):
else:
prefix, command, params = irc_noprefix_rem(msg).groups()
nick, user, host = irc_netmask_rem(prefix).groups()
mask = user + "@" + host
paramlist = irc_param_ref(params)
lastparam = ""
if paramlist:
@ -232,7 +234,7 @@ class FakeIRC(IRC):
paramlist[-1] = paramlist[-1][1:]
lastparam = paramlist[-1]
self.out.put([msg, prefix, command, params, nick, user, host,
paramlist, lastparam])
mask, paramlist, lastparam])
if command == "PING":
self.cmd("PONG", [params])

View file

@ -7,7 +7,7 @@ thread.stack_size(1024 * 512) # reduce vm size
class Input(dict):
def __init__(self, conn, raw, prefix, command, params,
nick, user, host, paraml, msg):
nick, user, host, mask, paraml, msg):
chan = paraml[0].lower()
if chan == conn.nick.lower(): # is a PM
@ -35,7 +35,7 @@ class Input(dict):
conn.cmd('NOTICE', [nick, msg])
dict.__init__(self, conn=conn, raw=raw, prefix=prefix, command=command,
params=params, nick=nick, user=user, host=host,
params=params, nick=nick, user=user, host=host, mask=mask,
paraml=paraml, msg=msg, server=conn.server, chan=chan,
notice=notice, say=say, reply=reply, pm=pm, bot=bot,
me=me, set_nick=set_nick, lastparam=paraml[-1])

View file

@ -12,7 +12,7 @@ def help(inp, input=None, bot=None, say=None, notice=None):
for command, (func, args) in bot.commands.iteritems():
fn = re.match(r'^plugins.(.+).py$', func._filename)
if fn.group(1).lower() not in disabled:
if not args.get('adminonly', False) or input.nick in input.bot.config["admins"]:
if not args.get('adminonly', False) or input.mask in input.bot.config["admins"]:
if command not in disabled_comm:
if func.__doc__ is not None:
if func in funcs: