From 3e5c2c94d97aeb32870cfd3558102854447c5a5a Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Thu, 22 Mar 2012 17:04:48 +1300 Subject: [PATCH] added input.mask. returns 'user@host' --- core/irc.py | 6 ++++-- core/main.py | 4 ++-- plugins/help.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/irc.py b/core/irc.py index b14c828..ff9a45f 100755 --- a/core/irc.py +++ b/core/irc.py @@ -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]) diff --git a/core/main.py b/core/main.py index 041d67e..93f53c4 100755 --- a/core/main.py +++ b/core/main.py @@ -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]) diff --git a/plugins/help.py b/plugins/help.py index bde3d17..70ac3be 100755 --- a/plugins/help.py +++ b/plugins/help.py @@ -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: