3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

various: make the server description configurable

Two options for this: bot::serverdesc, and server::<network>::serverdesc, with the latter taking precedence if present.
This commit is contained in:
James Lu 2015-08-24 18:14:35 -07:00
parent 8f09c35672
commit 694e7b87f6
4 changed files with 10 additions and 4 deletions

View File

@ -8,6 +8,10 @@ bot:
nick: pylink nick: pylink
user: pylink user: pylink
realname: PyLink Service Client realname: PyLink Service Client
# Server description (shown in /links, /whois, etc.)
serverdesc: PyLink Server
# Console log verbosity: see https://docs.python.org/3/library/logging.html#logging-levels # Console log verbosity: see https://docs.python.org/3/library/logging.html#logging-levels
loglevel: DEBUG loglevel: DEBUG

View File

@ -52,7 +52,7 @@ def handle_whois(irc, source, command, args):
# 311: sends nick!user@host information # 311: sends nick!user@host information
f(irc, server, 311, source, "%s %s %s * :%s" % (nick, user.ident, user.host, user.realname)) f(irc, server, 311, source, "%s %s %s * :%s" % (nick, user.ident, user.host, user.realname))
# 312: sends the server the target is on, and the name # 312: sends the server the target is on, and the name
f(irc, server, 312, source, "%s %s :PyLink Server" % (nick, irc.serverdata['hostname'])) f(irc, server, 312, source, "%s %s :%s" % (nick, irc.serverdata['hostname'], irc.serverdata.get('serverdesc') or irc.botdata['serverdesc']))
# 313: sends a string denoting the target's operator privilege; # 313: sends a string denoting the target's operator privilege;
# we'll only send it if the user has umode +o. # we'll only send it if the user has umode +o.
if ('o', None) in user.modes: if ('o', None) in user.modes:

View File

@ -329,8 +329,9 @@ def connect(irc):
f('CAPAB START 1202') f('CAPAB START 1202')
f('CAPAB CAPABILITIES :PROTOCOL=1202') f('CAPAB CAPABILITIES :PROTOCOL=1202')
f('CAPAB END') f('CAPAB END')
f('SERVER {host} {Pass} 0 {sid} :PyLink Service'.format(host=irc.serverdata["hostname"], f('SERVER {host} {Pass} 0 {sid} :{sdesc}'.format(host=irc.serverdata["hostname"],
Pass=irc.serverdata["sendpass"], sid=irc.sid)) Pass=irc.serverdata["sendpass"], sid=irc.sid,
sdesc=irc.serverdata.get('serverdesc') or irc.botdata['serverdesc']))
f(':%s BURST %s' % (irc.sid, ts)) f(':%s BURST %s' % (irc.sid, ts))
f(':%s ENDBURST' % (irc.sid)) f(':%s ENDBURST' % (irc.sid))

View File

@ -345,7 +345,8 @@ def connect(irc):
# and allows sending CHGHOST without ENCAP. # and allows sending CHGHOST without ENCAP.
f('CAPAB :QS ENCAP EX CHW IE KNOCK SAVE SERVICES TB EUID') f('CAPAB :QS ENCAP EX CHW IE KNOCK SAVE SERVICES TB EUID')
f('SERVER %s 0 :PyLink Service' % irc.serverdata["hostname"]) f('SERVER %s 0 :%s' % (irc.serverdata["hostname"],
irc.serverdata.get('serverdesc') or irc.botdata['serverdesc']))
def handle_ping(irc, source, command, args): def handle_ping(irc, source, command, args):
# PING: # PING: