From a639efa93ec3694fe211972c2dedf21ce51d3e21 Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 2 Aug 2017 21:57:48 +0800 Subject: [PATCH] relay: allow overriding tag_nicks per network Closes #494. (cherry picked from commit 1d6b692e1490e538f5c8d9c16542ff45feab1f9f) Conflicts: example-conf.yml --- example-conf.yml | 14 +++++++++----- plugins/relay.py | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/example-conf.yml b/example-conf.yml index 94863b6..3a09027 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -168,11 +168,6 @@ servers: # PyLink will disconnect with a ping timeout. This defaults to 90 if not set. #pingfreq: 90 - # If enabled, this opts this network out of relay IP sharing: this network - # will not have its users' IPs sent across the relay, and it will not see any - # IPs of other networks' users. - #relay_no_ips: true - # Sets the max nick length for the network. It is important that this is # set correctly, or PyLink might introduce a nick that is too long and # cause netsplits! This defaults to 30 if not set. @@ -209,6 +204,15 @@ servers: # This setting is EXPERIMENTAL as of PyLink 1.2.x. #encoding: utf-8 + # If enabled, this opts this network out of relay IP sharing: this network + # will not have its users' IPs sent across the relay, and it will not see any + # IPs of other networks' users. + #relay_no_ips: true + + # Determines whether relay will tag nicks on this network. This overrides the relay::tag_nicks + # option on a per network-basis. + #relay_tag_nicks: true + ts6net: ip: ::1 diff --git a/plugins/relay.py b/plugins/relay.py index c63ddc3..07fdb5c 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -100,7 +100,10 @@ def normalize_nick(irc, netname, nick, times_tagged=0, uid=''): # Figure out whether we tag nicks or not. if times_tagged == 0: - if conf.conf.get('relay', {}).get('tag_nicks', True): + # Check the following options in order, before falling back to True: + # 1) servers::::relay_tag_nicks + # 2) relay::tag_nicks + if irc.serverdata.get('relay_tag_nicks', conf.conf.get('relay', {}).get('tag_nicks', True)): times_tagged = 1 else: forcetag_nicks = conf.conf.get('relay', {}).get('forcetag_nicks', [])