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

plugins, coremods: remove usage of irc.conf (#273)

This commit is contained in:
James Lu 2016-07-27 17:02:04 -07:00
parent af21063834
commit 8047186c58
4 changed files with 11 additions and 11 deletions

View File

@ -10,7 +10,7 @@ import sys
import importlib
from . import control
from pylinkirc import utils, world
from pylinkirc import utils, world, conf
from pylinkirc.log import log
# Essential, core commands go here so that the "commands" plugin with less-important,
@ -31,8 +31,8 @@ def identify(irc, source, args):
irc.reply('Error: Not enough arguments.')
return
# Usernames are case-insensitive, passwords are NOT.
if username.lower() == irc.conf['login']['user'].lower() and password == irc.conf['login']['password']:
realuser = irc.conf['login']['user']
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.reply('Successfully logged in as %s.' % realuser)
log.info("(%s) Successful login to %r by %s",

View File

@ -23,8 +23,8 @@ def spawn_service(irc, source, command, args):
# 3) The preferred nick/ident combination defined by the plugin (sbot.nick / sbot.ident)
# 4) The literal service name.
# settings, and then falling back to the literal service name.
nick = irc.serverdata.get("%s_nick" % name) or irc.conf.get(name, {}).get('nick') or sbot.nick or name
ident = irc.serverdata.get("%s_ident" % name) or irc.conf.get(name, {}).get('ident') or sbot.ident or name
nick = irc.serverdata.get("%s_nick" % name) or conf.conf.get(name, {}).get('nick') or sbot.nick or name
ident = irc.serverdata.get("%s_ident" % name) or conf.conf.get(name, {}).get('ident') or sbot.ident or name
# TODO: make this configurable?
host = irc.serverdata["hostname"]

View File

@ -1,7 +1,7 @@
"""
Changehost plugin - automatically changes the hostname of matching users.
"""
from pylinkirc import utils, world
from pylinkirc import utils, world, conf
from pylinkirc.log import log
import string
@ -14,7 +14,7 @@ import ircmatch
allowed_chars = string.ascii_letters + '-./:' + string.digits
def _changehost(irc, target, args):
changehost_conf = irc.conf.get("changehost")
changehost_conf = conf.conf.get("changehost")
if not changehost_conf:
log.warning("(%s) Missing 'changehost:' configuration block; "

View File

@ -324,7 +324,7 @@ def spawnRelayUser(irc, remoteirc, user, times_tagged=0):
# /lusers and various /stats
hideoper_mode = remoteirc.umodes.get('hideoper')
try:
use_hideoper = irc.conf['relay']['hideoper']
use_hideoper = conf.conf['relay']['hideoper']
except KeyError:
use_hideoper = True
if hideoper_mode and use_hideoper:
@ -332,7 +332,7 @@ def spawnRelayUser(irc, remoteirc, user, times_tagged=0):
rsid = getRemoteSid(remoteirc, irc)
try:
showRealIP = irc.conf['relay']['show_ips'] and not \
showRealIP = conf.conf['relay']['show_ips'] and not \
irc.serverdata.get('relay_no_ips') and not \
remoteirc.serverdata.get('relay_no_ips')
except KeyError:
@ -822,7 +822,7 @@ def handle_relay_whois(irc, source, command, args):
"""
Returns whether we should send the given info line in WHOIS. This validates the
corresponding configuration option for being either "all" or "opers"."""
setting = irc.conf.get('relay', {}).get(infoline, '').lower()
setting = conf.conf.get('relay', {}).get(infoline, '').lower()
if setting == 'all':
return True
elif setting == 'opers' and irc.isOper(source, allowAuthed=False):
@ -917,7 +917,7 @@ def handle_squit(irc, numeric, command, args):
log.debug('(%s) relay.handle_squit: sending handle_quit on %s', irc.name, user)
try: # Allow netsplit hiding to be toggled
show_splits = irc.conf['relay']['show_netsplits']
show_splits = conf.conf['relay']['show_netsplits']
except KeyError:
show_splits = False