mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 05:02:33 +01:00
core: configurable nicks for services (per-net and global)
Closes #220. Closes #229.
This commit is contained in:
parent
675489489a
commit
bbcddceaf9
@ -202,7 +202,21 @@ def spawn_service(irc, source, command, args):
|
|||||||
if not irc.connected.is_set():
|
if not irc.connected.is_set():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Service name
|
||||||
name = args['name']
|
name = args['name']
|
||||||
|
|
||||||
|
# Get the ServiceBot object.
|
||||||
|
sbot = world.services[name]
|
||||||
|
|
||||||
|
# Look up the nick or ident in the following order:
|
||||||
|
# 1) Network specific nick/ident settings for this service (servers::irc.name::servicename_nick)
|
||||||
|
# 2) Global settings for this service (servicename::nick)
|
||||||
|
# 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 irc.conf.get(name, {}).get('nick') or sbot.nick or name
|
||||||
|
ident = irc.serverdata.get("%s_ident" % name) or irc.conf.get(name, {}).get('ident') or sbot.ident or name
|
||||||
|
|
||||||
# TODO: make this configurable?
|
# TODO: make this configurable?
|
||||||
host = irc.serverdata["hostname"]
|
host = irc.serverdata["hostname"]
|
||||||
|
|
||||||
@ -215,9 +229,7 @@ def spawn_service(irc, source, command, args):
|
|||||||
modes.append((mode, None))
|
modes.append((mode, None))
|
||||||
|
|
||||||
# Track the service's UIDs on each network.
|
# Track the service's UIDs on each network.
|
||||||
sbot = world.services[name]
|
userobj = irc.proto.spawnClient(nick, ident, host, modes=modes, opertype="PyLink Service",
|
||||||
userobj = irc.proto.spawnClient(sbot.nick, sbot.ident,
|
|
||||||
host, modes=modes, opertype="PyLink Service",
|
|
||||||
manipulatable=sbot.manipulatable)
|
manipulatable=sbot.manipulatable)
|
||||||
|
|
||||||
sbot.uids[irc.name] = u = userobj.uid
|
sbot.uids[irc.name] = u = userobj.uid
|
||||||
|
@ -184,6 +184,13 @@ servers:
|
|||||||
# same IRCd version.
|
# same IRCd version.
|
||||||
#mixed_link: true
|
#mixed_link: true
|
||||||
|
|
||||||
|
# You can also define network-specific nicks and idents for various service
|
||||||
|
# bots, using the configuration options "servicename_nick" and "servicename_ident".
|
||||||
|
#pylink_nick: MagicServ
|
||||||
|
#pylink_ident: magicserv
|
||||||
|
#games_nick: MagicGames
|
||||||
|
#games_ident: magicgames
|
||||||
|
|
||||||
nefarious:
|
nefarious:
|
||||||
ip: 1.2.3.4
|
ip: 1.2.3.4
|
||||||
port: 45454
|
port: 45454
|
||||||
@ -372,3 +379,7 @@ relay:
|
|||||||
# Valid options include "all" (show this to everyone), "opers" (show only to
|
# Valid options include "all" (show this to everyone), "opers" (show only to
|
||||||
# opers), and "none" (disabled). Defaults to none if not specified.
|
# opers), and "none" (disabled). Defaults to none if not specified.
|
||||||
whois_show_server: opers
|
whois_show_server: opers
|
||||||
|
|
||||||
|
games:
|
||||||
|
# Sets the nick of the Games service, if you're using it.
|
||||||
|
nick: Games
|
||||||
|
Loading…
Reference in New Issue
Block a user