3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

core: rename IrcUser.identified attribute to IrcUser.account

This commit is contained in:
James Lu 2016-07-29 20:15:31 -07:00
parent afb035ae6b
commit 1ef89560e2
6 changed files with 12 additions and 10 deletions

View File

@ -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

View File

@ -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))

View File

@ -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)

View File

@ -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

View File

@ -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 = "<PyLink networks.remote override>"
remoteirc.pseudoclient.account = "<PyLink networks.remote override>"
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.")

View File

@ -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.