From 694e7b87f67961b894e3e40b18531990d507f611 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 24 Aug 2015 18:14:35 -0700 Subject: [PATCH] various: make the server description configurable Two options for this: bot::serverdesc, and server::::serverdesc, with the latter taking precedence if present. --- config.yml.example | 4 ++++ coreplugin.py | 2 +- protocols/inspircd.py | 5 +++-- protocols/ts6.py | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config.yml.example b/config.yml.example index 390c5c8..27c8e0f 100644 --- a/config.yml.example +++ b/config.yml.example @@ -8,6 +8,10 @@ bot: nick: pylink user: pylink 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 loglevel: DEBUG diff --git a/coreplugin.py b/coreplugin.py index 4872723..26f2740 100644 --- a/coreplugin.py +++ b/coreplugin.py @@ -52,7 +52,7 @@ def handle_whois(irc, source, command, args): # 311: sends nick!user@host information 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 - 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; # we'll only send it if the user has umode +o. if ('o', None) in user.modes: diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 652ca1a..d71e4af 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -329,8 +329,9 @@ def connect(irc): f('CAPAB START 1202') f('CAPAB CAPABILITIES :PROTOCOL=1202') f('CAPAB END') - f('SERVER {host} {Pass} 0 {sid} :PyLink Service'.format(host=irc.serverdata["hostname"], - Pass=irc.serverdata["sendpass"], sid=irc.sid)) + f('SERVER {host} {Pass} 0 {sid} :{sdesc}'.format(host=irc.serverdata["hostname"], + 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 ENDBURST' % (irc.sid)) diff --git a/protocols/ts6.py b/protocols/ts6.py index 25ffa1b..b9f88b5 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -345,7 +345,8 @@ def connect(irc): # and allows sending CHGHOST without ENCAP. 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): # PING: