3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

coreplugin: support bot and hidechans umodes

Closes #214.
This commit is contained in:
James Lu 2016-05-20 20:57:27 -07:00
parent 4cfc262bfb
commit 98003318cd

View File

@ -85,7 +85,10 @@ def handle_whois(irc, source, command, args):
# 311: sends nick!user@host information
f(server, 311, source, "%s %s %s * :%s" % (nick, user.ident, user.host, user.realname))
# 319: RPL_WHOISCHANNELS, shows public channel list of target
# 319: RPL_WHOISCHANNELS; Show public channels of the target, respecting
# hidechans umodes for non-oper callers.
isHideChans = (irc.umodes.get('hidechans'), None) in user.modes
if (not isHideChans) or (isHideChans and sourceisOper):
public_chans = []
for chan in user.channels:
c = irc.channels[chan]
@ -146,6 +149,10 @@ def handle_whois(irc, source, command, args):
# <- 317 GL GL 15 1437632859 :seconds idle, signon time
f(server, 317, source, "%s 0 %s :seconds idle, signon time" % (nick, user.ts))
if (irc.umodes.get('bot'), None) in user.modes:
# Show botmode info in WHOIS.
f(server, 335, source, "%s :is a bot" % nick)
# Call custom WHOIS handlers via the PYLINK_CUSTOM_WHOIS hook.
irc.callHooks([source, 'PYLINK_CUSTOM_WHOIS', {'target': target, 'server': server}])