Network: send whois requests using the original nick case

Fixes #1350. This works around an edge case in charybdis / ircd-seven where remote
whois requests to a UID are not accepted if it is given in a different case.
This commit is contained in:
James Lu 2019-10-05 16:40:37 -07:00
parent 8b2cbbc583
commit beb1000c7e

View File

@ -154,10 +154,10 @@ class Network(callbacks.Plugin):
""" """
self.Proxy(otherIrc, msg, commandAndArgs) self.Proxy(otherIrc, msg, commandAndArgs)
command = wrap(command, ['admin', ('networkIrc', True), many('something')]) command = wrap(command, ['admin', ('networkIrc', True), many('something')])
def cmdall(self, irc, msg, args, commandAndArgs): def cmdall(self, irc, msg, args, commandAndArgs):
"""<command> [<arg> ...] """<command> [<arg> ...]
Perform <command> (with its associated <arg>s) on all networks. Perform <command> (with its associated <arg>s) on all networks.
""" """
ircs = world.ircs ircs = world.ircs
@ -225,11 +225,9 @@ class Network(callbacks.Plugin):
only necessary if the network is different than the network the command only necessary if the network is different than the network the command
is sent on. is sent on.
""" """
# The double nick here is necessary because single-nick WHOIS only works # Here we use a remote server whois (double nick) to get idle/signon time.
# if the nick is on the same server (*not* the same network) as the user
# giving the command. Yeah, it made me say wtf too.
nick = ircutils.toLower(nick)
otherIrc.queueMsg(ircmsgs.whois(nick, nick)) otherIrc.queueMsg(ircmsgs.whois(nick, nick))
nick = ircutils.toLower(nick)
self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whois') self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whois')
whois = wrap(whois, ['networkIrc', 'nick']) whois = wrap(whois, ['networkIrc', 'nick'])
@ -241,11 +239,9 @@ class Network(callbacks.Plugin):
only necessary if the network is different than the network the command only necessary if the network is different than the network the command
is sent on. is sent on.
""" """
# The double nick here is necessary because single-nick WHOIS only works # Here we use a remote server whois (double nick) to get idle/signon time.
# if the nick is on the same server (*not* the same network) as the user
# giving the command. Yeah, it made me say wtf too.
nick = ircutils.toLower(nick)
otherIrc.queueMsg(ircmsgs.whowas(nick, nick)) otherIrc.queueMsg(ircmsgs.whowas(nick, nick))
nick = ircutils.toLower(nick)
self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whowas') self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whowas')
whowas = wrap(whowas, ['networkIrc', 'nick']) whowas = wrap(whowas, ['networkIrc', 'nick'])
@ -301,7 +297,7 @@ class Network(callbacks.Plugin):
@internationalizeDocstring @internationalizeDocstring
def uptime(self, irc, msg, args, otherIrc): def uptime(self, irc, msg, args, otherIrc):
"""[<network>] """[<network>]
Returns the time duration since the connection was established. Returns the time duration since the connection was established.
""" """
network = otherIrc.network network = otherIrc.network