mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 09:19:23 +01:00
Replace use of conf.conf['bot'] with conf.conf['pylink']
This commit is contained in:
parent
c40250330d
commit
9cdb224c02
@ -29,7 +29,7 @@ def handle_fantasy(irc, source, command, args):
|
|||||||
# 2) The global "pylink::respond_to_nick" option
|
# 2) The global "pylink::respond_to_nick" option
|
||||||
# 3) The (deprecated) global "bot::respondtonick" option.
|
# 3) The (deprecated) global "bot::respondtonick" option.
|
||||||
respondtonick = conf.conf.get(botname, {}).get('respond_to_nick',
|
respondtonick = conf.conf.get(botname, {}).get('respond_to_nick',
|
||||||
conf.conf['pylink'].get("respond_to_nick", conf.conf['bot'].get("respondtonick")))
|
conf.conf['pylink'].get("respond_to_nick", conf.conf['pylink'].get("respondtonick")))
|
||||||
|
|
||||||
log.debug('(%s) fantasy: checking bot %s', irc.name, botname)
|
log.debug('(%s) fantasy: checking bot %s', irc.name, botname)
|
||||||
servuid = sbot.uids.get(irc.name)
|
servuid = sbot.uids.get(irc.name)
|
||||||
@ -38,7 +38,7 @@ def handle_fantasy(irc, source, command, args):
|
|||||||
# Look up a string prefix for this bot in either its own configuration block, or
|
# Look up a string prefix for this bot in either its own configuration block, or
|
||||||
# in bot::prefixes::<botname>.
|
# in bot::prefixes::<botname>.
|
||||||
prefixes = [conf.conf.get(botname, {}).get('prefix',
|
prefixes = [conf.conf.get(botname, {}).get('prefix',
|
||||||
conf.conf['bot'].get('prefixes', {}).get(botname))]
|
conf.conf['pylink'].get('prefixes', {}).get(botname))]
|
||||||
|
|
||||||
# If responding to nick is enabled, add variations of the current nick
|
# If responding to nick is enabled, add variations of the current nick
|
||||||
# to the prefix list: "<nick>," and "<nick>:"
|
# to the prefix list: "<nick>," and "<nick>:"
|
||||||
|
@ -85,7 +85,7 @@ class HybridProtocol(TS6Protocol):
|
|||||||
f('CAPAB :TBURST DLN KNOCK UNDLN UNKLN KLN ENCAP IE EX HOPS CHW SVS CLUSTER EOB QS')
|
f('CAPAB :TBURST DLN KNOCK UNDLN UNKLN KLN ENCAP IE EX HOPS CHW SVS CLUSTER EOB QS')
|
||||||
|
|
||||||
f('SERVER %s 0 :%s' % (self.serverdata["hostname"],
|
f('SERVER %s 0 :%s' % (self.serverdata["hostname"],
|
||||||
self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']))
|
self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']))
|
||||||
|
|
||||||
# send endburst now
|
# send endburst now
|
||||||
self.send(':%s EOB' % (self.sid,))
|
self.send(':%s EOB' % (self.sid,))
|
||||||
@ -107,7 +107,7 @@ class HybridProtocol(TS6Protocol):
|
|||||||
uid = self.uidgen[server].next_uid()
|
uid = self.uidgen[server].next_uid()
|
||||||
|
|
||||||
ts = ts or int(time.time())
|
ts = ts or int(time.time())
|
||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['pylink']['realname']
|
||||||
realhost = realhost or host
|
realhost = realhost or host
|
||||||
raw_modes = self.join_modes(modes)
|
raw_modes = self.join_modes(modes)
|
||||||
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname,
|
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname,
|
||||||
|
@ -60,7 +60,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
uid = self.uidgen[server].next_uid()
|
uid = self.uidgen[server].next_uid()
|
||||||
|
|
||||||
ts = ts or int(time.time())
|
ts = ts or int(time.time())
|
||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['pylink']['realname']
|
||||||
realhost = realhost or host
|
realhost = realhost or host
|
||||||
raw_modes = self.join_modes(modes)
|
raw_modes = self.join_modes(modes)
|
||||||
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname,
|
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname,
|
||||||
@ -347,7 +347,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
name = name.lower()
|
name = name.lower()
|
||||||
|
|
||||||
# "desc" defaults to the configured server description.
|
# "desc" defaults to the configured server description.
|
||||||
desc = desc or self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
desc = desc or self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']
|
||||||
|
|
||||||
if sid is None: # No sid given; generate one!
|
if sid is None: # No sid given; generate one!
|
||||||
sid = self.sidgen.next_sid()
|
sid = self.sidgen.next_sid()
|
||||||
@ -419,7 +419,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
host = self.serverdata["hostname"]
|
host = self.serverdata["hostname"]
|
||||||
f('SERVER {host} {Pass} 0 {sid} :{sdesc}'.format(host=host,
|
f('SERVER {host} {Pass} 0 {sid} :{sdesc}'.format(host=host,
|
||||||
Pass=self.serverdata["sendpass"], sid=self.sid,
|
Pass=self.serverdata["sendpass"], sid=self.sid,
|
||||||
sdesc=self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']))
|
sdesc=self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']))
|
||||||
|
|
||||||
self._send_with_prefix(self.sid, 'BURST %s' % ts)
|
self._send_with_prefix(self.sid, 'BURST %s' % ts)
|
||||||
# InspIRCd sends VERSION data on link, instead of whenever requested by a client.
|
# InspIRCd sends VERSION data on link, instead of whenever requested by a client.
|
||||||
|
@ -85,7 +85,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
if not self.is_internal_server(server):
|
if not self.is_internal_server(server):
|
||||||
raise ValueError('Server %r is not a PyLink server!' % server)
|
raise ValueError('Server %r is not a PyLink server!' % server)
|
||||||
|
|
||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['pylink']['realname']
|
||||||
|
|
||||||
uid = self._uidgen.next_uid(prefix=nick)
|
uid = self._uidgen.next_uid(prefix=nick)
|
||||||
userobj = self.users[uid] = User(self, nick, ts or int(time.time()), uid, server, ident=ident, host=host, realname=realname,
|
userobj = self.users[uid] = User(self, nick, ts or int(time.time()), uid, server, ident=ident, host=host, realname=realname,
|
||||||
@ -114,7 +114,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
name = name.lower()
|
name = name.lower()
|
||||||
sid = self._sidgen.next_sid(prefix=name)
|
sid = self._sidgen.next_sid(prefix=name)
|
||||||
|
|
||||||
desc = desc or self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
desc = desc or self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']
|
||||||
|
|
||||||
if sid in self.servers:
|
if sid in self.servers:
|
||||||
raise ValueError('A server named %r already exists!' % sid)
|
raise ValueError('A server named %r already exists!' % sid)
|
||||||
|
@ -301,7 +301,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
# Fill in all the values we need
|
# Fill in all the values we need
|
||||||
ts = ts or int(time.time())
|
ts = ts or int(time.time())
|
||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['pylink']['realname']
|
||||||
realhost = realhost or host
|
realhost = realhost or host
|
||||||
raw_modes = self.join_modes(modes)
|
raw_modes = self.join_modes(modes)
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
# <- SERVER nefarious.midnight.vpn 1 1460673022 1460673239 J10 ABP]] +h6 :Nefarious2 test server
|
# <- SERVER nefarious.midnight.vpn 1 1460673022 1460673239 J10 ABP]] +h6 :Nefarious2 test server
|
||||||
uplink = uplink or self.sid
|
uplink = uplink or self.sid
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
desc = desc or self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
desc = desc or self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']
|
||||||
|
|
||||||
if sid is None: # No sid given; generate one!
|
if sid is None: # No sid given; generate one!
|
||||||
sid = self.sidgen.next_sid()
|
sid = self.sidgen.next_sid()
|
||||||
@ -833,7 +833,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
# Encode our SID using P10 Base64.
|
# Encode our SID using P10 Base64.
|
||||||
self.sid = sid = p10b64encode(self.serverdata["sid"])
|
self.sid = sid = p10b64encode(self.serverdata["sid"])
|
||||||
|
|
||||||
desc = self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
desc = self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']
|
||||||
|
|
||||||
self._flags = []
|
self._flags = []
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
# parameters: nickname, hopcount, nickTS, umodes, username,
|
# parameters: nickname, hopcount, nickTS, umodes, username,
|
||||||
# visible hostname, IP address, UID, real hostname, account name, gecos
|
# visible hostname, IP address, UID, real hostname, account name, gecos
|
||||||
ts = ts or int(time.time())
|
ts = ts or int(time.time())
|
||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['pylink']['realname']
|
||||||
raw_modes = self.join_modes(modes)
|
raw_modes = self.join_modes(modes)
|
||||||
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host,
|
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host,
|
||||||
realname=realname, realhost=realhost or host, ip=ip,
|
realname=realname, realhost=realhost or host, ip=ip,
|
||||||
@ -398,7 +398,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
f('CAPAB :QS ENCAP EX CHW IE KNOCK SAVE SERVICES TB EUID RSFNC EOPMOD SAVETS_100 KLN')
|
f('CAPAB :QS ENCAP EX CHW IE KNOCK SAVE SERVICES TB EUID RSFNC EOPMOD SAVETS_100 KLN')
|
||||||
|
|
||||||
f('SERVER %s 0 :%s' % (self.serverdata["hostname"],
|
f('SERVER %s 0 :%s' % (self.serverdata["hostname"],
|
||||||
self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']))
|
self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']))
|
||||||
|
|
||||||
# Finally, end all the initialization with a PING - that's Charybdis'
|
# Finally, end all the initialization with a PING - that's Charybdis'
|
||||||
# way of saying end-of-burst :)
|
# way of saying end-of-burst :)
|
||||||
|
@ -169,7 +169,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
|||||||
# -> :0AL SID test.server 1 0XY :some silly pseudoserver
|
# -> :0AL SID test.server 1 0XY :some silly pseudoserver
|
||||||
uplink = uplink or self.sid
|
uplink = uplink or self.sid
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
desc = desc or self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
desc = desc or self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']
|
||||||
|
|
||||||
if sid is None: # No sid given; generate one!
|
if sid is None: # No sid given; generate one!
|
||||||
sid = self.sidgen.next_sid()
|
sid = self.sidgen.next_sid()
|
||||||
|
@ -61,7 +61,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
uid = self.uidgen[server].next_uid()
|
uid = self.uidgen[server].next_uid()
|
||||||
|
|
||||||
ts = ts or int(time.time())
|
ts = ts or int(time.time())
|
||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['pylink']['realname']
|
||||||
realhost = realhost or host
|
realhost = realhost or host
|
||||||
|
|
||||||
# Add +xt so that vHost cloaking always works.
|
# Add +xt so that vHost cloaking always works.
|
||||||
@ -369,7 +369,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
# ESVID - Supports account names in services stamps instead of just the signon time.
|
# ESVID - Supports account names in services stamps instead of just the signon time.
|
||||||
# AFAIK this doesn't actually affect services' behaviour?
|
# AFAIK this doesn't actually affect services' behaviour?
|
||||||
f('PROTOCTL SJOIN SJ3 NOQUIT NICKv2 VL UMODE2 PROTOCTL NICKIP EAUTH=%s SID=%s VHP ESVID' % (self.serverdata["hostname"], self.sid))
|
f('PROTOCTL SJOIN SJ3 NOQUIT NICKv2 VL UMODE2 PROTOCTL NICKIP EAUTH=%s SID=%s VHP ESVID' % (self.serverdata["hostname"], self.sid))
|
||||||
sdesc = self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
sdesc = self.serverdata.get('serverdesc') or conf.conf['pylink']['serverdesc']
|
||||||
f('SERVER %s 1 U%s-h6e-%s :%s' % (host, self.proto_ver, self.sid, sdesc))
|
f('SERVER %s 1 U%s-h6e-%s :%s' % (host, self.proto_ver, self.sid, sdesc))
|
||||||
f('NETINFO 1 %s %s * 0 0 0 :%s' % (self.start_ts, self.proto_ver, self.serverdata.get("netname", self.name)))
|
f('NETINFO 1 %s %s * 0 0 0 :%s' % (self.start_ts, self.proto_ver, self.serverdata.get("netname", self.name)))
|
||||||
self._send_with_prefix(self.sid, 'EOS')
|
self._send_with_prefix(self.sid, 'EOS')
|
||||||
|
@ -215,7 +215,7 @@ class DataStore:
|
|||||||
log.debug('(DataStore:%s) using implementation %s', self.name, self.__class__.__name__)
|
log.debug('(DataStore:%s) using implementation %s', self.name, self.__class__.__name__)
|
||||||
log.debug('(DataStore:%s) database path set to %s', self.name, self.filename)
|
log.debug('(DataStore:%s) database path set to %s', self.name, self.filename)
|
||||||
|
|
||||||
self.save_frequency = save_frequency or conf.conf['bot'].get('save_delay', 300)
|
self.save_frequency = save_frequency or conf.conf['pylink'].get('save_delay', 300)
|
||||||
log.debug('(DataStore:%s) saving every %s seconds', self.name, self.save_frequency)
|
log.debug('(DataStore:%s) saving every %s seconds', self.name, self.save_frequency)
|
||||||
|
|
||||||
if default_db is not None:
|
if default_db is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user