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

allow realname to be specified the same way

This commit is contained in:
Mitchell Cooper 2017-07-12 18:53:02 -04:00
parent 33630e8f9d
commit a1dfa14d20
2 changed files with 14 additions and 7 deletions

View File

@ -28,11 +28,15 @@ def spawn_service(irc, source, command, args):
# 3) The preferred nick/ident combination defined by the plugin (sbot.nick / sbot.ident) # 3) The preferred nick/ident combination defined by the plugin (sbot.nick / sbot.ident)
# 4) The literal service name. # 4) The literal service name.
# settings, and then falling back to 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 sbconf = conf.conf.get(name, {})
ident = irc.serverdata.get("%s_ident" % name) or conf.conf.get(name, {}).get('ident') or sbot.ident or 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. # Determine host the same way as above, except fall back to server hostname.
host = irc.serverdata.get("%s_host" % name) or conf.conf.get(name, {}).get('host') or irc.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 # Spawning service clients with these umodes where supported. servprotect usage is a
# configuration option. # configuration option.
@ -56,7 +60,7 @@ def spawn_service(irc, source, command, args):
else: else:
log.debug('(%s) spawn_service: Spawning new client %s', irc.name, nick) log.debug('(%s) spawn_service: Spawning new client %s', irc.name, nick)
userobj = irc.spawn_client(nick, ident, host, modes=modes, opertype="PyLink Service", 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. # Store the service name in the User object for easier access.
userobj.service = name userobj.service = name

View File

@ -278,10 +278,12 @@ servers:
# bots, using the configuration options "servicename_nick", etc. # bots, using the configuration options "servicename_nick", etc.
#pylink_nick: MagicServ #pylink_nick: MagicServ
#pylink_ident: magicserv #pylink_ident: magicserv
#pylink_host: pylink.mynet.net #pylink_host: magicserv.mynet.net
#pylink_realname: Magic Link Service
#games_nick: MagicGames #games_nick: MagicGames
#games_ident: magicgames #games_ident: magicgames
#games_host: games.mynet.net #games_host: games.mynet.net
#games_realname: Magic Games Service
nefarious: nefarious:
ip: somenet.ddns.local 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. # Sets the nick of the Games service, if you're using it. This defaults to "games" if not defined.
nick: Games 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 #ident: games
#host: play.games #host: play.games
#realname: Games Service
# Defines a fantasy prefix for the Games bot. # Defines a fantasy prefix for the Games bot.
prefix: "./" prefix: "./"