3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

relay: add configurable list of nick globs to always tag

Closes #276.
This commit is contained in:
James Lu 2016-07-26 16:01:42 -07:00
parent 7d0cd1d454
commit fa1ce45bf3
2 changed files with 18 additions and 4 deletions

View File

@ -283,7 +283,7 @@ plugins:
# to a template string, as they connect. This requires the changehost: block
# to be configured correctly below.
#- changehost
# Automode plugin: allows assigning channel access to specific hostmasks or
# exttargets. See https://github.com/GLolol/PyLink/blob/master/docs/automode.md
# for a usage guide.
@ -413,6 +413,11 @@ relay:
# experimental.
tag_nicks: true
# If tag_nicks is False, this specifies a list of NICK globs that network
# tags should be added for anyways (e.g. for network services).
forcetag_nicks:
- "*Serv"
games:
# Sets the nick of the Games service, if you're using it.
nick: Games

View File

@ -101,9 +101,18 @@ def normalizeNick(irc, netname, nick, times_tagged=0, uid=''):
separator = irc.serverdata.get('separator') or \
conf.conf.get('relay', {}).get('separator') or "/"
# Figure out whether we tag nicks by default or not.
if times_tagged == 0 and conf.conf.get('relay', {}).get('tag_nicks', True):
times_tagged = 1
# Figure out whether we tag nicks or not.
if times_tagged == 0:
if conf.conf.get('relay', {}).get('tag_nicks', True):
times_tagged = 1
else:
forcetag_nicks = conf.conf.get('relay', {}).get('forcetag_nicks', [])
log.debug('(%s) relay.normalizeNick: checking if globs %s match %s.', irc.name, forcetag_nicks, nick)
for glob in forcetag_nicks:
if irc.matchHost(glob, nick):
# User matched a nick to force tag nicks for. Tag them.
times_tagged = 1
break
log.debug('(%s) relay.normalizeNick: using %r as separator.', irc.name, separator)
orig_nick = nick