From 33630e8f9dc5152425622d885ff31a6201eef2c0 Mon Sep 17 00:00:00 2001 From: Mitchell Cooper Date: Wed, 12 Jul 2017 18:38:26 -0400 Subject: [PATCH 1/2] allow host to be specified in service bot block or per-network --- coremods/service_support.py | 4 ++-- example-conf.yml | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/coremods/service_support.py b/coremods/service_support.py index c352283..7c8ec54 100644 --- a/coremods/service_support.py +++ b/coremods/service_support.py @@ -31,8 +31,8 @@ def spawn_service(irc, source, command, args): 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.hostname() + # Determine host the same way as above, except fall back to hostname. + host = irc.serverdata.get("%s_host" % name) or conf.conf.get(name, {}).get('host') or irc.hostname() # Spawning service clients with these umodes where supported. servprotect usage is a # configuration option. diff --git a/example-conf.yml b/example-conf.yml index 777bd3a..534e33e 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -274,12 +274,14 @@ servers: protocol: "unreal" autoconnect: 5 - # You can also define network-specific nicks and idents for various service - # bots, using the configuration options "servicename_nick" and "servicename_ident". + # You can also define network-specific nicks, idents, and hosts for various service + # bots, using the configuration options "servicename_nick", etc. #pylink_nick: MagicServ #pylink_ident: magicserv + #pylink_host: pylink.mynet.net #games_nick: MagicGames #games_ident: magicgames + #games_host: games.mynet.net nefarious: ip: somenet.ddns.local @@ -718,6 +720,10 @@ automode: games: # Sets the nick of the Games service, if you're using it. This defaults to "games" if not defined. nick: Games + + # Ident and host can also be specified here, but they may be overriden per-network. + #ident: games + #host: play.games # Defines a fantasy prefix for the Games bot. prefix: "./" From a1dfa14d201a350dec38a0aa98cf86694cdcd4f0 Mon Sep 17 00:00:00 2001 From: Mitchell Cooper Date: Wed, 12 Jul 2017 18:53:02 -0400 Subject: [PATCH 2/2] allow realname to be specified the same way --- coremods/service_support.py | 14 +++++++++----- example-conf.yml | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/coremods/service_support.py b/coremods/service_support.py index 7c8ec54..24c43ce 100644 --- a/coremods/service_support.py +++ b/coremods/service_support.py @@ -28,12 +28,16 @@ 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 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 + sbconf = conf.conf.get(name, {}) + nick = irc.serverdata.get("%s_nick" % name) or sbconf.get('nick') or sbot.nick or name + ident = irc.serverdata.get("%s_ident" % name) or sbconf.get('ident') or sbot.ident or name - # Determine host the same way as above, except fall back to hostname. - host = irc.serverdata.get("%s_host" % name) or conf.conf.get(name, {}).get('host') or irc.hostname() + # Determine host the same way as above, except fall back to server hostname. + host = irc.serverdata.get("%s_host" % name) or sbconf.get('host') or irc.hostname() + # Determine realname the same way as above, except fall back to pylink:realname. + realname = irc.serverdata.get("%s_realname" % name) or sbconf.get('realname') or conf.conf['bot']['realname'] + # Spawning service clients with these umodes where supported. servprotect usage is a # configuration option. preferred_modes = ['oper', 'hideoper', 'hidechans', 'invisible', 'bot'] @@ -56,7 +60,7 @@ def spawn_service(irc, source, command, args): else: log.debug('(%s) spawn_service: Spawning new client %s', irc.name, nick) userobj = irc.spawn_client(nick, ident, host, modes=modes, opertype="PyLink Service", - manipulatable=sbot.manipulatable) + realname=realname, manipulatable=sbot.manipulatable) # Store the service name in the User object for easier access. userobj.service = name diff --git a/example-conf.yml b/example-conf.yml index 534e33e..11a3804 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -278,10 +278,12 @@ servers: # bots, using the configuration options "servicename_nick", etc. #pylink_nick: MagicServ #pylink_ident: magicserv - #pylink_host: pylink.mynet.net + #pylink_host: magicserv.mynet.net + #pylink_realname: Magic Link Service #games_nick: MagicGames #games_ident: magicgames #games_host: games.mynet.net + #games_realname: Magic Games Service nefarious: ip: somenet.ddns.local @@ -721,9 +723,10 @@ games: # Sets the nick of the Games service, if you're using it. This defaults to "games" if not defined. nick: Games - # Ident and host can also be specified here, but they may be overriden per-network. + # Ident, host, and realname can also be specified here, but they may be overriden per-network. #ident: games #host: play.games + #realname: Games Service # Defines a fantasy prefix for the Games bot. prefix: "./"