From f458a40e1c34f14136cc265cb2bd81b64afce251 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 27 Jun 2016 22:28:37 -0700 Subject: [PATCH] inspircd: new use_experimental_whois option, which forces PyLink to handle WHOIS requests locally --- example-conf.yml | 13 +++++++++++-- protocols/inspircd.py | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/example-conf.yml b/example-conf.yml index e181c2c..2634a0d 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -120,6 +120,13 @@ servers: # This setting defaults to sha256. #ssl_fingerprint_type: sha256 + # The following option is specific to InspIRCd networks: + + # Force PyLink to handle WHOIS requests locally for all its clients + # (experimental). This is required if you want custom WHOIS handlers + # implemented by plugins like relay to work. Defaults to false. + #use_experimental_whois: false + ts6net: ip: ::1 @@ -374,13 +381,15 @@ relay: show_ips: false # Determines whether NickServ login info should be shown in the /whois output for - # relay users. This works on most IRCds EXCEPT InspIRCd. + # relay users. For InspIRCd networks, this requires "use_experimental_whois" to be + # set. # Valid options include "all" (show this to everyone), "opers" (show only to # opers), and "none" (disabled). Defaults to none if not specified. whois_show_accounts: all # Determines whether the origin server should be shown in the /whois output for - # relay users. This works on most IRCds EXCEPT InspIRCd. + # relay users. For InspIRCd networks, this requires "use_experimental_whois" to be + # set. # Valid options include "all" (show this to everyone), "opers" (show only to # opers), and "none" (disabled). Defaults to none if not specified. whois_show_server: opers diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 6d1ede9..eba0f79 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -607,7 +607,14 @@ class InspIRCdProtocol(TS6BaseProtocol): # -> :1MLAAAAIG IDLE 70MAAAAAA 1433036797 319 sourceuser = numeric targetuser = args[0] - self._send(targetuser, 'IDLE %s %s 0' % (sourceuser, self.irc.users[targetuser].ts)) + + if self.irc.serverdata.get("use_experimental_whois"): + # EXPERIMENTAL HACK: make PyLink handle all WHOIS requests if configured to do so. + # This works by silently ignoring the idle time request, and sending our WHOIS data as + # raw numerics instead. + return {'target': args[0], 'parse_as': 'WHOIS'} + else: + self._send(targetuser, 'IDLE %s %s 0' % (sourceuser, self.irc.users[targetuser].ts)) def handle_ftopic(self, numeric, command, args): """Handles incoming FTOPIC (sets topic on burst)."""