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

classes: migrate to conf.conf['pylink']

This commit is contained in:
James Lu 2017-07-14 05:50:07 -07:00
parent a164924ce5
commit b88830ba25

View File

@ -41,7 +41,7 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
def __init__(self, netname): def __init__(self, netname):
self.deprecated_attributes = { self.deprecated_attributes = {
'conf': 'Deprecated since 1.2; consider switching to conf.conf', 'conf': 'Deprecated since 1.2; consider switching to conf.conf',
'botdata': "Deprecated since 1.2; consider switching to conf.conf['bot']", 'botdata': "Deprecated since 1.2; consider switching to conf.conf['pylink']",
} }
self.loghandlers = [] self.loghandlers = []
@ -49,7 +49,7 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
self.conf = conf.conf self.conf = conf.conf
self.sid = None self.sid = None
self.serverdata = conf.conf['servers'][netname] self.serverdata = conf.conf['servers'][netname]
self.botdata = conf.conf['bot'] self.botdata = conf.conf['pylink']
self.protoname = self.__class__.__module__.split('.')[-1] # Remove leading pylinkirc.protocols. self.protoname = self.__class__.__module__.split('.')[-1] # Remove leading pylinkirc.protocols.
self.proto = self.irc = self # Backwards compat self.proto = self.irc = self # Backwards compat
@ -248,7 +248,7 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
""" """
if private is None: if private is None:
# Allow using private replies as the default, if no explicit setting was given. # Allow using private replies as the default, if no explicit setting was given.
private = conf.conf['bot'].get("prefer_private_replies") private = conf.conf['pylink'].get("prefer_private_replies")
# Private reply is enabled, or the caller was originally a PM # Private reply is enabled, or the caller was originally a PM
if private or (self.called_in in self.users): if private or (self.called_in in self.users):
@ -1259,7 +1259,7 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
self.servers[self.sid] = Server(None, host, internal=True, self.servers[self.sid] = Server(None, host, internal=True,
desc=self.serverdata.get('serverdesc') desc=self.serverdata.get('serverdesc')
or conf.conf['bot']['serverdesc']) or conf.conf['pylink']['serverdesc'])
log.info('(%s) Starting ping schedulers....', self.name) log.info('(%s) Starting ping schedulers....', self.name)
self._schedule_ping() self._schedule_ping()