From 1ef89560e2fe5fd382eb32a3602f130b0624f7d6 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 29 Jul 2016 20:15:31 -0700 Subject: [PATCH] core: rename IrcUser.identified attribute to IrcUser.account --- classes.py | 6 +++--- coremods/corecommands.py | 2 +- coremods/exttargets.py | 2 +- plugins/commands.py | 4 ++-- plugins/networks.py | 4 ++-- world.py | 4 +++- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/classes.py b/classes.py index 4befcec..3dbb610 100644 --- a/classes.py +++ b/classes.py @@ -911,7 +911,7 @@ class Irc(): if uid in self.users: if allowOper and ("o", None) in self.users[uid].modes: return True - elif allowAuthed and self.users[uid].identified: + elif allowAuthed and self.users[uid].account: return True return False @@ -1001,12 +1001,12 @@ class IrcUser(): self.modes = set() # Tracks user modes # Tracks PyLink identification status - self.identified = '' + self.account = '' # Tracks oper type (for display only) self.opertype = opertype - # Tracks services identification status + # Tracks external services identification status self.services_account = '' # Tracks channels the user is in diff --git a/coremods/corecommands.py b/coremods/corecommands.py index 42afc85..8616b77 100644 --- a/coremods/corecommands.py +++ b/coremods/corecommands.py @@ -33,7 +33,7 @@ def identify(irc, source, args): # Usernames are case-insensitive, passwords are NOT. if username.lower() == conf.conf['login']['user'].lower() and password == conf.conf['login']['password']: realuser = conf.conf['login']['user'] - irc.users[source].identified = realuser + irc.users[source].account = realuser irc.reply('Successfully logged in as %s.' % realuser) log.info("(%s) Successful login to %r by %s", irc.name, username, irc.getHostmask(source)) diff --git a/coremods/exttargets.py b/coremods/exttargets.py index aa88a9c..032a1bf 100644 --- a/coremods/exttargets.py +++ b/coremods/exttargets.py @@ -134,7 +134,7 @@ def pylinkacc(irc, host, uid): $pylinkacc -> Returns True if the target is logged in to PyLink. $pylinkacc:accountname -> Returns True if the target's PyLink login matches the one given. """ - login = irc.toLower(irc.users[uid].identified) + login = irc.toLower(irc.users[uid].account) groups = list(map(irc.toLower, host.split(':'))) log.debug('(%s) exttargets.pylinkacc: groups to match: %s', irc.name, groups) diff --git a/plugins/commands.py b/plugins/commands.py index 1712b17..0701c9a 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -9,7 +9,7 @@ def status(irc, source, args): """takes no arguments. Returns your current PyLink login status.""" - identified = irc.users[source].identified + identified = irc.users[source].account if identified: irc.reply('You are identified as \x02%s\x02.' % identified) else: @@ -57,7 +57,7 @@ def showuser(irc, source, args): channels = sorted(userobj.channels) f('\x02Channels\x02: %s' % (' '.join(channels) or _none)) f('\x02PyLink identification\x02: %s; \x02Services account\x02: %s; \x02Away status\x02: %s' % \ - ((userobj.identified or _none), (userobj.services_account or _none), userobj.away or _none)) + ((userobj.account or _none), (userobj.services_account or _none), userobj.away or _none)) @utils.add_cmd diff --git a/plugins/networks.py b/plugins/networks.py index fce690d..b9b6d9a 100644 --- a/plugins/networks.py +++ b/plugins/networks.py @@ -75,12 +75,12 @@ def remote(irc, source, args): remoteirc.called_in = remoteirc.called_by = remoteirc.pseudoclient.uid # Set PyLink's identification to admin. - remoteirc.pseudoclient.identified = "" + remoteirc.pseudoclient.account = "" try: # Remotely call the command (use the PyLink client as a dummy user). remoteirc.callCommand(remoteirc.pseudoclient.uid, cmd_args) finally: # Remove the identification override after we finish. - remoteirc.pseudoclient.identified = '' + remoteirc.pseudoclient.account = '' irc.reply("Done.") diff --git a/world.py b/world.py index 55e4daf..9e20c9e 100644 --- a/world.py +++ b/world.py @@ -5,7 +5,7 @@ world.py: Stores global variables for PyLink, including lists of active IRC obje from collections import defaultdict import threading -# This indicates whether we're running in tests modes. What it actually does +# This indicates whether we're running in tests mode. What it actually does # though is control whether IRC connections should be threaded or not. testing = False @@ -19,8 +19,10 @@ services = {} # Registered extarget handlers. This maps exttarget names (strings) to handling functions. exttarget_handlers = {} +# Trigger to be set when all IRC objects are initially created. started = threading.Event() +# Source address. source = "https://github.com/GLolol/PyLink" # CHANGE THIS IF YOU'RE FORKING!! # Fallback hostname used in various places internally when hostname isn't configured.