mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 21:22:36 +01:00
parent
4cfc262bfb
commit
98003318cd
@ -85,27 +85,30 @@ def handle_whois(irc, source, command, args):
|
|||||||
# 311: sends nick!user@host information
|
# 311: sends nick!user@host information
|
||||||
f(server, 311, source, "%s %s %s * :%s" % (nick, user.ident, user.host, user.realname))
|
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
|
||||||
public_chans = []
|
# hidechans umodes for non-oper callers.
|
||||||
for chan in user.channels:
|
isHideChans = (irc.umodes.get('hidechans'), None) in user.modes
|
||||||
c = irc.channels[chan]
|
if (not isHideChans) or (isHideChans and sourceisOper):
|
||||||
# Here, we'll want to hide secret/private channels from non-opers
|
public_chans = []
|
||||||
# who are not in them.
|
for chan in user.channels:
|
||||||
|
c = irc.channels[chan]
|
||||||
|
# Here, we'll want to hide secret/private channels from non-opers
|
||||||
|
# who are not in them.
|
||||||
|
|
||||||
if ((irc.cmodes.get('secret'), None) in c.modes or \
|
if ((irc.cmodes.get('secret'), None) in c.modes or \
|
||||||
(irc.cmodes.get('private'), None) in c.modes) \
|
(irc.cmodes.get('private'), None) in c.modes) \
|
||||||
and not (sourceisOper or source in c.users):
|
and not (sourceisOper or source in c.users):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Show prefix modes like a regular IRCd does.
|
# Show prefix modes like a regular IRCd does.
|
||||||
for prefixmode in c.getPrefixModes(target):
|
for prefixmode in c.getPrefixModes(target):
|
||||||
modechar = irc.cmodes[prefixmode]
|
modechar = irc.cmodes[prefixmode]
|
||||||
chan = irc.prefixmodes[modechar] + chan
|
chan = irc.prefixmodes[modechar] + chan
|
||||||
|
|
||||||
public_chans.append(chan)
|
public_chans.append(chan)
|
||||||
|
|
||||||
if public_chans: # Only send the line if the person is in any visible channels...
|
if public_chans: # Only send the line if the person is in any visible channels...
|
||||||
f(server, 319, source, '%s :%s' % (nick, ' '.join(public_chans)))
|
f(server, 319, source, '%s :%s' % (nick, ' '.join(public_chans)))
|
||||||
|
|
||||||
# 312: sends the server the target is on, and its server description.
|
# 312: sends the server the target is on, and its server description.
|
||||||
f(server, 312, source, "%s %s :%s" % (nick, irc.servers[server].name,
|
f(server, 312, source, "%s %s :%s" % (nick, irc.servers[server].name,
|
||||||
@ -146,6 +149,10 @@ def handle_whois(irc, source, command, args):
|
|||||||
# <- 317 GL GL 15 1437632859 :seconds idle, signon time
|
# <- 317 GL GL 15 1437632859 :seconds idle, signon time
|
||||||
f(server, 317, source, "%s 0 %s :seconds idle, signon time" % (nick, user.ts))
|
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.
|
# Call custom WHOIS handlers via the PYLINK_CUSTOM_WHOIS hook.
|
||||||
irc.callHooks([source, 'PYLINK_CUSTOM_WHOIS', {'target': target, 'server': server}])
|
irc.callHooks([source, 'PYLINK_CUSTOM_WHOIS', {'target': target, 'server': server}])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user