mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
coremods, plugins: migrate to snake case
This commit is contained in:
parent
a4e321522b
commit
10bca676fc
@ -18,12 +18,12 @@ def _login(irc, source, username):
|
||||
irc.users[source].account = username
|
||||
irc.reply('Successfully logged in as %s.' % username)
|
||||
log.info("(%s) Successful login to %r by %s",
|
||||
irc.name, username, irc.getHostmask(source))
|
||||
irc.name, username, irc.get_hostmask(source))
|
||||
|
||||
def _loginfail(irc, source, username):
|
||||
"""Internal function to process login failures."""
|
||||
irc.error('Incorrect credentials.')
|
||||
log.warning("(%s) Failed login to %r from %s", irc.name, username, irc.getHostmask(source))
|
||||
log.warning("(%s) Failed login to %r from %s", irc.name, username, irc.get_hostmask(source))
|
||||
|
||||
@utils.add_cmd
|
||||
def identify(irc, source, args):
|
||||
@ -86,7 +86,7 @@ def load(irc, source, args):
|
||||
if name in world.plugins:
|
||||
irc.reply("Error: %r is already loaded." % name)
|
||||
return
|
||||
log.info('(%s) Loading plugin %r for %s', irc.name, name, irc.getHostmask(source))
|
||||
log.info('(%s) Loading plugin %r for %s', irc.name, name, irc.get_hostmask(source))
|
||||
try:
|
||||
world.plugins[name] = pl = utils.loadPlugin(name)
|
||||
except ImportError as e:
|
||||
@ -119,7 +119,7 @@ def unload(irc, source, args):
|
||||
modulename = utils.PLUGIN_PREFIX + name
|
||||
|
||||
if name in world.plugins:
|
||||
log.info('(%s) Unloading plugin %r for %s', irc.name, name, irc.getHostmask(source))
|
||||
log.info('(%s) Unloading plugin %r for %s', irc.name, name, irc.get_hostmask(source))
|
||||
pl = world.plugins[name]
|
||||
log.debug('sys.getrefcount of plugin %s is %s', pl, sys.getrefcount(pl))
|
||||
|
||||
|
@ -41,10 +41,10 @@ def account(irc, host, uid):
|
||||
homenet, realuid)
|
||||
return False
|
||||
|
||||
slogin = irc.toLower(userobj.services_account)
|
||||
slogin = irc.to_lower(userobj.services_account)
|
||||
|
||||
# Split the given exttarget host into parts, so we know how many to look for.
|
||||
groups = list(map(irc.toLower, host.split(':')))
|
||||
groups = list(map(irc.to_lower, host.split(':')))
|
||||
log.debug('(%s) exttargets.account: groups to match: %s', irc.name, groups)
|
||||
|
||||
if len(groups) == 1:
|
||||
@ -74,10 +74,10 @@ def ircop(irc, host, uid):
|
||||
|
||||
if len(groups) == 1:
|
||||
# 1st scenario.
|
||||
return irc.isOper(uid, allowAuthed=False)
|
||||
return irc.is_oper(uid, allowAuthed=False)
|
||||
else:
|
||||
# 2nd scenario. Use matchHost (ircmatch) to match the opertype glob to the opertype.
|
||||
return irc.matchHost(groups[1], irc.users[uid].opertype)
|
||||
# 2nd scenario. Use match_host (ircmatch) to match the opertype glob to the opertype.
|
||||
return irc.match_host(groups[1], irc.users[uid].opertype)
|
||||
|
||||
@bind
|
||||
def server(irc, host, uid):
|
||||
@ -93,10 +93,10 @@ def server(irc, host, uid):
|
||||
log.debug('(%s) exttargets.server: groups to match: %s', irc.name, groups)
|
||||
|
||||
if len(groups) >= 2:
|
||||
sid = irc.getServer(uid)
|
||||
sid = irc.get_server(uid)
|
||||
query = groups[1]
|
||||
# Return True if the SID matches the query or the server's name glob matches it.
|
||||
return sid == query or irc.matchHost(query, irc.getFriendlyName(sid))
|
||||
return sid == query or irc.match_host(query, irc.get_friendly_name(sid))
|
||||
# $server alone is invalid. Don't match anything.
|
||||
return False
|
||||
|
||||
@ -134,8 +134,8 @@ def pylinkacc(irc, host, uid):
|
||||
$pylinkacc -> Returns True if the target is logged in to PyLink.
|
||||
$pylinkacc:accountname -> Returns True if the target's PyLink login matches the one given.
|
||||
"""
|
||||
login = irc.toLower(irc.users[uid].account)
|
||||
groups = list(map(irc.toLower, host.split(':')))
|
||||
login = irc.to_lower(irc.users[uid].account)
|
||||
groups = list(map(irc.to_lower, host.split(':')))
|
||||
log.debug('(%s) exttargets.pylinkacc: groups to match: %s', irc.name, groups)
|
||||
|
||||
if len(groups) == 1:
|
||||
@ -187,6 +187,6 @@ def exttarget_and(irc, host, uid):
|
||||
targets = targets[1:-1]
|
||||
targets = list(filter(None, targets.split('+')))
|
||||
log.debug('exttargets_and: using raw subtargets list %r (original query=%r)', targets, host)
|
||||
# Wrap every subtarget into irc.matchHost and return True if all subtargets return True.
|
||||
return all(map(lambda sub_exttarget: irc.matchHost(sub_exttarget, uid), targets))
|
||||
# Wrap every subtarget into irc.match_host and return True if all subtargets return True.
|
||||
return all(map(lambda sub_exttarget: irc.match_host(sub_exttarget, uid), targets))
|
||||
world.exttarget_handlers['and'] = exttarget_and
|
||||
|
@ -14,7 +14,7 @@ def handle_whois(irc, source, command, args):
|
||||
f = lambda num, source, text: irc.numeric(irc.sid, num, source, text)
|
||||
|
||||
# Get the server that the target is on.
|
||||
server = irc.getServer(target)
|
||||
server = irc.get_server(target)
|
||||
|
||||
if user is None: # User doesn't exist
|
||||
# <- :42X 401 7PYAAAAAB GL- :No such nick/channel
|
||||
@ -22,7 +22,7 @@ def handle_whois(irc, source, command, args):
|
||||
f(401, source, "%s :No such nick/channel" % nick)
|
||||
else:
|
||||
nick = user.nick
|
||||
sourceisOper = ('o', None) in irc.users[source].modes
|
||||
sourceis_oper = ('o', None) in irc.users[source].modes
|
||||
sourceisBot = (irc.umodes.get('bot'), None) in irc.users[source].modes
|
||||
|
||||
# Get the full network name.
|
||||
@ -35,7 +35,7 @@ def handle_whois(irc, source, command, args):
|
||||
# 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):
|
||||
if (not isHideChans) or (isHideChans and sourceis_oper):
|
||||
public_chans = []
|
||||
for chan in user.channels:
|
||||
c = irc.channels[chan]
|
||||
@ -44,7 +44,7 @@ def handle_whois(irc, source, command, args):
|
||||
|
||||
if ((irc.cmodes.get('secret'), None) in c.modes or \
|
||||
(irc.cmodes.get('private'), None) in c.modes) \
|
||||
and not (sourceisOper or source in c.users):
|
||||
and not (sourceis_oper or source in c.users):
|
||||
continue
|
||||
|
||||
# Show the highest prefix mode like a regular IRCd does, if there are any.
|
||||
@ -74,7 +74,7 @@ def handle_whois(irc, source, command, args):
|
||||
# 2) +H is set, but the caller is oper
|
||||
# 3) +H is set, but whois_use_hideoper is disabled in config
|
||||
isHideOper = (irc.umodes.get('hideoper'), None) in user.modes
|
||||
if (not isHideOper) or (isHideOper and sourceisOper) or \
|
||||
if (not isHideOper) or (isHideOper and sourceis_oper) or \
|
||||
(isHideOper and not conf.conf['bot'].get('whois_use_hideoper', True)):
|
||||
# Let's be gramatically correct. (If the opertype starts with a vowel,
|
||||
# write "an Operator" instead of "a Operator")
|
||||
@ -84,9 +84,9 @@ def handle_whois(irc, source, command, args):
|
||||
|
||||
# 379: RPL_WHOISMODES, used by UnrealIRCd and InspIRCd to show user modes.
|
||||
# Only show this to opers!
|
||||
if sourceisOper:
|
||||
if sourceis_oper:
|
||||
f(378, source, "%s :is connecting from %s@%s %s" % (nick, user.ident, user.realhost, user.ip))
|
||||
f(379, source, '%s :is using modes %s' % (nick, irc.joinModes(user.modes, sort=True)))
|
||||
f(379, source, '%s :is using modes %s' % (nick, irc.join_modes(user.modes, sort=True)))
|
||||
|
||||
# 301: used to show away information if present
|
||||
away_text = user.away
|
||||
@ -101,7 +101,7 @@ def handle_whois(irc, source, command, args):
|
||||
# Call custom WHOIS handlers via the PYLINK_CUSTOM_WHOIS hook, unless the
|
||||
# caller is marked a bot and the whois_show_extensions_to_bots option is False
|
||||
if (sourceisBot and conf.conf['bot'].get('whois_show_extensions_to_bots')) or (not sourceisBot):
|
||||
irc.callHooks([source, 'PYLINK_CUSTOM_WHOIS', {'target': target, 'server': server}])
|
||||
irc.call_hooks([source, 'PYLINK_CUSTOM_WHOIS', {'target': target, 'server': server}])
|
||||
else:
|
||||
log.debug('(%s) coremods.handlers.handle_whois: skipping custom whois handlers because '
|
||||
'caller %s is marked as a bot', irc.name, source)
|
||||
@ -116,15 +116,15 @@ def handle_mode(irc, source, command, args):
|
||||
modes = args['modes']
|
||||
# If the sender is not a PyLink client, and the target IS a protected
|
||||
# client, revert any forced deoper attempts.
|
||||
if irc.isInternalClient(target) and not irc.isInternalClient(source):
|
||||
if ('-o', None) in modes and (target == irc.pseudoclient.uid or not irc.isManipulatableClient(target)):
|
||||
if irc.is_internal_client(target) and not irc.is_internal_client(source):
|
||||
if ('-o', None) in modes and (target == irc.pseudoclient.uid or not irc.is_manipulatable_client(target)):
|
||||
irc.mode(irc.sid, target, {('+o', None)})
|
||||
utils.add_hook(handle_mode, 'MODE')
|
||||
|
||||
def handle_operup(irc, source, command, args):
|
||||
"""Logs successful oper-ups on networks."""
|
||||
otype = args.get('text', 'IRC Operator')
|
||||
log.debug("(%s) Successful oper-up (opertype %r) from %s", irc.name, otype, irc.getHostmask(source))
|
||||
log.debug("(%s) Successful oper-up (opertype %r) from %s", irc.name, otype, irc.get_hostmask(source))
|
||||
irc.users[source].opertype = otype
|
||||
|
||||
utils.add_hook(handle_operup, 'CLIENT_OPERED')
|
||||
|
@ -60,22 +60,22 @@ def checkPermissions(irc, uid, perms, also_show=[]):
|
||||
"""
|
||||
# For old (< 1.1 login blocks):
|
||||
# If the user is logged in, they automatically have all permissions.
|
||||
if irc.matchHost('$pylinkacc', uid) and conf.conf['login'].get('user'):
|
||||
if irc.match_host('$pylinkacc', uid) and conf.conf['login'].get('user'):
|
||||
log.debug('permissions: overriding permissions check for old-style admin user %s',
|
||||
irc.getHostmask(uid))
|
||||
irc.get_hostmask(uid))
|
||||
return True
|
||||
|
||||
# Iterate over all hostmask->permission list mappings.
|
||||
for host, permlist in permissions.copy().items():
|
||||
log.debug('permissions: permlist for %s: %s', host, permlist)
|
||||
if irc.matchHost(host, uid):
|
||||
if irc.match_host(host, uid):
|
||||
# Now, iterate over all the perms we are looking for.
|
||||
for perm in permlist:
|
||||
# Use irc.matchHost to expand globs in an IRC-case insensitive and wildcard
|
||||
# Use irc.match_host to expand globs in an IRC-case insensitive and wildcard
|
||||
# friendly way. e.g. 'xyz.*.#Channel\' will match 'xyz.manage.#channel|' on IRCds
|
||||
# using the RFC1459 casemapping.
|
||||
log.debug('permissions: checking if %s glob matches anything in %s', perm, permlist)
|
||||
if any(irc.matchHost(perm, p) for p in perms):
|
||||
if any(irc.match_host(perm, p) for p in perms):
|
||||
return True
|
||||
raise utils.NotAuthorizedError("You are missing one of the following permissions: %s" %
|
||||
(', '.join(perms+also_show)))
|
||||
|
@ -14,7 +14,7 @@ def spawn_service(irc, source, command, args):
|
||||
# Service name
|
||||
name = args['name']
|
||||
|
||||
if name != 'pylink' and not irc.hasCap('can-spawn-clients'):
|
||||
if name != 'pylink' and not irc.has_cap('can-spawn-clients'):
|
||||
log.debug("(%s) Not spawning service %s because the server doesn't support spawning clients",
|
||||
irc.name, name)
|
||||
return
|
||||
@ -49,8 +49,8 @@ def spawn_service(irc, source, command, args):
|
||||
|
||||
# Track the service's UIDs on each network.
|
||||
log.debug('(%s) spawn_service: Using nick %s for service %s', irc.name, nick, name)
|
||||
u = irc.nickToUid(nick)
|
||||
if u and irc.isInternalClient(u): # If an internal client exists, reuse it.
|
||||
u = irc.nick_to_uid(nick)
|
||||
if u and irc.is_internal_client(u): # If an internal client exists, reuse it.
|
||||
log.debug('(%s) spawn_service: Using existing client %s/%s', irc.name, u, nick)
|
||||
userobj = irc.users[u]
|
||||
else:
|
||||
@ -101,7 +101,7 @@ def handle_kill(irc, source, command, args):
|
||||
"""Handle KILLs to PyLink service bots, respawning them as needed."""
|
||||
target = args['target']
|
||||
userdata = args.get('userdata')
|
||||
sbot = irc.getServiceBot(target)
|
||||
sbot = irc.get_service_bot(target)
|
||||
servicename = None
|
||||
|
||||
if userdata and hasattr(userdata, 'service'): # Look for the target's service name attribute
|
||||
@ -118,7 +118,7 @@ def handle_kick(irc, source, command, args):
|
||||
"""Handle KICKs to the PyLink service bots, rejoining channels as needed."""
|
||||
kicked = args['target']
|
||||
channel = args['channel']
|
||||
sbot = irc.getServiceBot(kicked)
|
||||
sbot = irc.get_service_bot(kicked)
|
||||
if sbot:
|
||||
sbot.join(irc, channel)
|
||||
utils.add_hook(handle_kick, 'KICK')
|
||||
@ -128,7 +128,7 @@ def handle_commands(irc, source, command, args):
|
||||
target = args['target']
|
||||
text = args['text']
|
||||
|
||||
sbot = irc.getServiceBot(target)
|
||||
sbot = irc.get_service_bot(target)
|
||||
if sbot:
|
||||
sbot.call_cmd(irc, source, text)
|
||||
|
||||
|
@ -58,7 +58,7 @@ def checkAccess(irc, uid, channel, command):
|
||||
# - automode.<command>.#channel: ability to <command> automode on the given channel.
|
||||
# - automode.savedb: ability to save the automode DB.
|
||||
log.debug('(%s) Automode: checking access for %s/%s for %s capability on %s', irc.name, uid,
|
||||
irc.getHostmask(uid), command, channel)
|
||||
irc.get_hostmask(uid), command, channel)
|
||||
|
||||
baseperm = 'automode.%s' % command
|
||||
try:
|
||||
@ -99,7 +99,7 @@ def match(irc, channel, uids=None):
|
||||
|
||||
for mask, modes in dbentry.items():
|
||||
for uid in uids:
|
||||
if irc.matchHost(mask, uid):
|
||||
if irc.match_host(mask, uid):
|
||||
# User matched a mask. Filter the mode list given to only those that are valid
|
||||
# prefix mode characters.
|
||||
outgoing_modes += [('+'+mode, uid) for mode in modes if mode in irc.prefixmodes]
|
||||
@ -116,7 +116,7 @@ def match(irc, channel, uids=None):
|
||||
irc.mode(modebot_uid, channel, outgoing_modes)
|
||||
|
||||
# Create a hook payload to support plugins like relay.
|
||||
irc.callHooks([modebot_uid, 'AUTOMODE_MODE',
|
||||
irc.call_hooks([modebot_uid, 'AUTOMODE_MODE',
|
||||
{'target': channel, 'modes': outgoing_modes, 'parse_as': 'MODE'}])
|
||||
|
||||
def handle_join(irc, source, command, args):
|
||||
@ -124,7 +124,7 @@ def handle_join(irc, source, command, args):
|
||||
Automode JOIN listener. This sets modes accordingly if the person joining matches a mask in the
|
||||
ACL.
|
||||
"""
|
||||
channel = irc.toLower(args['channel'])
|
||||
channel = irc.to_lower(args['channel'])
|
||||
match(irc, channel, args['users'])
|
||||
|
||||
utils.add_hook(handle_join, 'JOIN')
|
||||
@ -153,7 +153,7 @@ def getChannelPair(irc, source, chanpair, perm=None):
|
||||
except ValueError:
|
||||
raise ValueError("Invalid channel pair %r" % chanpair)
|
||||
channel = '#' + channel
|
||||
channel = irc.toLower(channel)
|
||||
channel = irc.to_lower(channel)
|
||||
|
||||
assert utils.isChannel(channel), "Invalid channel name %s." % channel
|
||||
|
||||
@ -202,7 +202,7 @@ def setacc(irc, source, args):
|
||||
|
||||
modes = modes.lstrip('+') # remove extraneous leading +'s
|
||||
dbentry[mask] = modes
|
||||
log.info('(%s) %s set modes +%s for %s on %s', ircobj.name, irc.getHostmask(source), modes, mask, channel)
|
||||
log.info('(%s) %s set modes +%s for %s on %s', ircobj.name, irc.get_hostmask(source), modes, mask, channel)
|
||||
reply(irc, "Done. \x02%s\x02 now has modes \x02+%s\x02 in \x02%s\x02." % (mask, modes, channel))
|
||||
|
||||
# Join the Automode bot to the channel if not explicitly told to.
|
||||
@ -233,7 +233,7 @@ def delacc(irc, source, args):
|
||||
|
||||
if mask in dbentry:
|
||||
del dbentry[mask]
|
||||
log.info('(%s) %s removed modes for %s on %s', ircobj.name, irc.getHostmask(source), mask, channel)
|
||||
log.info('(%s) %s removed modes for %s on %s', ircobj.name, irc.get_hostmask(source), mask, channel)
|
||||
reply(irc, "Done. Removed the Automode access entry for \x02%s\x02 in \x02%s\x02." % (mask, channel))
|
||||
else:
|
||||
error(irc, "No Automode access entry for \x02%s\x02 exists in \x02%s\x02." % (mask, channel))
|
||||
@ -299,7 +299,7 @@ def syncacc(irc, source, args):
|
||||
else:
|
||||
ircobj, channel = getChannelPair(irc, source, chanpair, perm='sync')
|
||||
|
||||
log.info('(%s) %s synced modes on %s', ircobj.name, irc.getHostmask(source), channel)
|
||||
log.info('(%s) %s synced modes on %s', ircobj.name, irc.get_hostmask(source), channel)
|
||||
match(ircobj, channel)
|
||||
|
||||
reply(irc, 'Done.')
|
||||
@ -324,7 +324,7 @@ def clearacc(irc, source, args):
|
||||
|
||||
if db.get(ircobj.name+channel):
|
||||
del db[ircobj.name+channel]
|
||||
log.info('(%s) %s cleared modes on %s', ircobj.name, irc.getHostmask(source), channel)
|
||||
log.info('(%s) %s cleared modes on %s', ircobj.name, irc.get_hostmask(source), channel)
|
||||
reply(irc, "Done. Removed all Automode access entries for \x02%s\x02." % channel)
|
||||
else:
|
||||
error(irc, "No Automode access entries exist for \x02%s\x02." % channel)
|
||||
|
@ -33,21 +33,21 @@ def quit(irc, source, args):
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1-2: nick, reason (optional).")
|
||||
return
|
||||
if irc.pseudoclient.uid == irc.nickToUid(nick):
|
||||
if irc.pseudoclient.uid == irc.nick_to_uid(nick):
|
||||
irc.error("Cannot quit the main PyLink client!")
|
||||
return
|
||||
|
||||
u = irc.nickToUid(nick)
|
||||
u = irc.nick_to_uid(nick)
|
||||
|
||||
quitmsg = ' '.join(args[1:]) or 'Client Quit'
|
||||
|
||||
if not irc.isManipulatableClient(u):
|
||||
if not irc.is_manipulatable_client(u):
|
||||
irc.error("Cannot force quit a protected PyLink services client.")
|
||||
return
|
||||
|
||||
irc.quit(u, quitmsg)
|
||||
irc.reply("Done.")
|
||||
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_QUIT', {'text': quitmsg, 'parse_as': 'QUIT'}])
|
||||
irc.call_hooks([u, 'PYLINK_BOTSPLUGIN_QUIT', {'text': quitmsg, 'parse_as': 'QUIT'}])
|
||||
|
||||
def joinclient(irc, source, args):
|
||||
"""[<target>] <channel1>[,<channel2>,<channel3>,...]
|
||||
@ -63,9 +63,9 @@ def joinclient(irc, source, args):
|
||||
try:
|
||||
# Check if the first argument is an existing PyLink client. If it is not,
|
||||
# then assume that the first argument was actually the channels being joined.
|
||||
u = irc.nickToUid(args[0])
|
||||
u = irc.nick_to_uid(args[0])
|
||||
|
||||
if not irc.isInternalClient(u): # First argument isn't one of our clients
|
||||
if not irc.is_internal_client(u): # First argument isn't one of our clients
|
||||
raise IndexError
|
||||
|
||||
clist = args[1]
|
||||
@ -82,7 +82,7 @@ def joinclient(irc, source, args):
|
||||
irc.error("No valid channels given.")
|
||||
return
|
||||
|
||||
if not (irc.isManipulatableClient(u) or irc.getServiceBot(u)):
|
||||
if not (irc.is_manipulatable_client(u) or irc.get_service_bot(u)):
|
||||
irc.error("Cannot force join a protected PyLink services client.")
|
||||
return
|
||||
|
||||
@ -104,7 +104,7 @@ def joinclient(irc, source, args):
|
||||
irc.join(u, real_channel)
|
||||
|
||||
# Call a join hook manually so other plugins like relay can understand it.
|
||||
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_JOIN', {'channel': real_channel, 'users': [u],
|
||||
irc.call_hooks([u, 'PYLINK_BOTSPLUGIN_JOIN', {'channel': real_channel, 'users': [u],
|
||||
'modes': irc.channels[real_channel].modes,
|
||||
'parse_as': 'JOIN'}])
|
||||
irc.reply("Done.")
|
||||
@ -128,7 +128,7 @@ def nick(irc, source, args):
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1-2: nick (optional), newnick.")
|
||||
return
|
||||
u = irc.nickToUid(nick)
|
||||
u = irc.nick_to_uid(nick)
|
||||
|
||||
if newnick in ('0', u): # Allow /nick 0 to work
|
||||
newnick = u
|
||||
@ -137,14 +137,14 @@ def nick(irc, source, args):
|
||||
irc.error('Invalid nickname %r.' % newnick)
|
||||
return
|
||||
|
||||
elif not (irc.isManipulatableClient(u) or irc.getServiceBot(u)):
|
||||
elif not (irc.is_manipulatable_client(u) or irc.get_service_bot(u)):
|
||||
irc.error("Cannot force nick changes for a protected PyLink services client.")
|
||||
return
|
||||
|
||||
irc.nick(u, newnick)
|
||||
irc.reply("Done.")
|
||||
# Ditto above: manually send a NICK change hook payload to other plugins.
|
||||
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_NICK', {'newnick': newnick, 'oldnick': nick, 'parse_as': 'NICK'}])
|
||||
irc.call_hooks([u, 'PYLINK_BOTSPLUGIN_NICK', {'newnick': newnick, 'oldnick': nick, 'parse_as': 'NICK'}])
|
||||
|
||||
@utils.add_cmd
|
||||
def part(irc, source, args):
|
||||
@ -161,8 +161,8 @@ def part(irc, source, args):
|
||||
|
||||
# First, check if the first argument is an existing PyLink client. If it is not,
|
||||
# then assume that the first argument was actually the channels being parted.
|
||||
u = irc.nickToUid(nick)
|
||||
if not irc.isInternalClient(u): # First argument isn't one of our clients
|
||||
u = irc.nick_to_uid(nick)
|
||||
if not irc.is_internal_client(u): # First argument isn't one of our clients
|
||||
raise IndexError
|
||||
|
||||
except IndexError: # No nick was given; shift arguments one to the left.
|
||||
@ -180,7 +180,7 @@ def part(irc, source, args):
|
||||
irc.error("No valid channels given.")
|
||||
return
|
||||
|
||||
if not (irc.isManipulatableClient(u) or irc.getServiceBot(u)):
|
||||
if not (irc.is_manipulatable_client(u) or irc.get_service_bot(u)):
|
||||
irc.error("Cannot force part a protected PyLink services client.")
|
||||
return
|
||||
|
||||
@ -191,7 +191,7 @@ def part(irc, source, args):
|
||||
irc.part(u, channel, reason)
|
||||
|
||||
irc.reply("Done.")
|
||||
irc.callHooks([u, 'PYLINK_BOTSPLUGIN_PART', {'channels': clist, 'text': reason, 'parse_as': 'PART'}])
|
||||
irc.call_hooks([u, 'PYLINK_BOTSPLUGIN_PART', {'channels': clist, 'text': reason, 'parse_as': 'PART'}])
|
||||
|
||||
@utils.add_cmd
|
||||
def msg(irc, source, args):
|
||||
@ -208,8 +208,8 @@ def msg(irc, source, args):
|
||||
|
||||
# First, check if the first argument is an existing PyLink client. If it is not,
|
||||
# then assume that the first argument was actually the message TARGET.
|
||||
sourceuid = irc.nickToUid(msgsource)
|
||||
if not irc.isInternalClient(sourceuid): # First argument isn't one of our clients
|
||||
sourceuid = irc.nick_to_uid(msgsource)
|
||||
if not irc.is_internal_client(sourceuid): # First argument isn't one of our clients
|
||||
raise IndexError
|
||||
|
||||
if not text:
|
||||
@ -229,7 +229,7 @@ def msg(irc, source, args):
|
||||
|
||||
if not utils.isChannel(target):
|
||||
# Convert nick of the message target to a UID, if the target isn't a channel
|
||||
real_target = irc.nickToUid(target)
|
||||
real_target = irc.nick_to_uid(target)
|
||||
if real_target is None: # Unknown target user, if target isn't a valid channel name
|
||||
irc.error('Unknown user %r.' % target)
|
||||
return
|
||||
@ -238,5 +238,5 @@ def msg(irc, source, args):
|
||||
|
||||
irc.message(sourceuid, real_target, text)
|
||||
irc.reply("Done.")
|
||||
irc.callHooks([sourceuid, 'PYLINK_BOTSPLUGIN_MSG', {'target': real_target, 'text': text, 'parse_as': 'PRIVMSG'}])
|
||||
irc.call_hooks([sourceuid, 'PYLINK_BOTSPLUGIN_MSG', {'target': real_target, 'text': text, 'parse_as': 'PRIVMSG'}])
|
||||
utils.add_cmd(msg, 'say')
|
||||
|
@ -19,7 +19,7 @@ def _changehost(irc, target, args):
|
||||
|
||||
if target not in irc.users:
|
||||
return
|
||||
elif irc.isInternalClient(target):
|
||||
elif irc.is_internal_client(target):
|
||||
log.debug('(%s) Skipping changehost on internal client %s', irc.name, target)
|
||||
return
|
||||
|
||||
@ -48,7 +48,7 @@ def _changehost(irc, target, args):
|
||||
|
||||
for host_glob, host_template in changehost_hosts.items():
|
||||
log.debug('(%s) Changehost: checking mask %s', irc.name, host_glob)
|
||||
if irc.matchHost(host_glob, target, ip=match_ip, realhost=match_realhosts):
|
||||
if irc.match_host(host_glob, target, ip=match_ip, realhost=match_realhosts):
|
||||
log.debug('(%s) Changehost matched mask %s', irc.name, host_glob)
|
||||
# This uses template strings for simple substitution:
|
||||
# https://docs.python.org/3/library/string.html#template-strings
|
||||
@ -103,13 +103,13 @@ def handle_chghost(irc, sender, command, args):
|
||||
|
||||
target = args['target']
|
||||
|
||||
if (not irc.isInternalClient(sender)) and (not irc.isInternalServer(sender)):
|
||||
if (not irc.is_internal_client(sender)) and (not irc.is_internal_server(sender)):
|
||||
if irc.name in changehost_conf.get('enforced_nets', []):
|
||||
log.debug('(%s) Enforce for network is on, re-checking host for target %s/%s',
|
||||
irc.name, target, irc.getFriendlyName(target))
|
||||
irc.name, target, irc.get_friendly_name(target))
|
||||
|
||||
for ex in changehost_conf.get("enforce_exceptions", []):
|
||||
if irc.matchHost(ex, target):
|
||||
if irc.match_host(ex, target):
|
||||
log.debug('(%s) Skipping host change for target %s; they are exempted by mask %s',
|
||||
irc.name, target, ex)
|
||||
return
|
||||
|
@ -29,7 +29,7 @@ def status(irc, source, args):
|
||||
irc.reply('You are identified as \x02%s\x02.' % identified)
|
||||
else:
|
||||
irc.reply('You are not identified as anyone.')
|
||||
irc.reply('Operator access: \x02%s\x02' % bool(irc.isOper(source)))
|
||||
irc.reply('Operator access: \x02%s\x02' % bool(irc.is_oper(source)))
|
||||
|
||||
_none = '\x1D(none)\x1D'
|
||||
@utils.add_cmd
|
||||
@ -43,10 +43,10 @@ def showuser(irc, source, args):
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1: nick.")
|
||||
return
|
||||
u = irc.nickToUid(target) or target
|
||||
u = irc.nick_to_uid(target) or target
|
||||
# Only show private info if the person is calling 'showuser' on themselves,
|
||||
# or is an oper.
|
||||
verbose = irc.isOper(source) or u == source
|
||||
verbose = irc.is_oper(source) or u == source
|
||||
if u not in irc.users:
|
||||
irc.error('Unknown user %r.' % target)
|
||||
return
|
||||
@ -57,7 +57,7 @@ def showuser(irc, source, args):
|
||||
f('Showing information on user \x02%s\x02 (%s@%s): %s' % (userobj.nick, userobj.ident,
|
||||
userobj.host, userobj.realname))
|
||||
|
||||
sid = irc.getServer(u)
|
||||
sid = irc.get_server(u)
|
||||
serverobj = irc.servers[sid]
|
||||
ts = userobj.ts
|
||||
|
||||
@ -67,7 +67,7 @@ def showuser(irc, source, args):
|
||||
|
||||
if verbose: # Oper only data: user modes, channels on, account info, etc.
|
||||
|
||||
f('\x02User modes\x02: %s' % irc.joinModes(userobj.modes, sort=True))
|
||||
f('\x02User modes\x02: %s' % irc.join_modes(userobj.modes, sort=True))
|
||||
f('\x02Protocol UID\x02: %s; \x02Real host\x02: %s; \x02IP\x02: %s' % \
|
||||
(u, userobj.realhost, userobj.ip))
|
||||
channels = sorted(userobj.channels)
|
||||
@ -83,7 +83,7 @@ def showchan(irc, source, args):
|
||||
Shows information about <channel>."""
|
||||
permissions.checkPermissions(irc, source, ['commands.showchan'])
|
||||
try:
|
||||
channel = irc.toLower(args[0])
|
||||
channel = irc.to_lower(args[0])
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1: channel.")
|
||||
return
|
||||
@ -95,7 +95,7 @@ def showchan(irc, source, args):
|
||||
|
||||
c = irc.channels[channel]
|
||||
# Only show verbose info if caller is oper or is in the target channel.
|
||||
verbose = source in c.users or irc.isOper(source)
|
||||
verbose = source in c.users or irc.is_oper(source)
|
||||
secret = ('s', None) in c.modes
|
||||
if secret and not verbose:
|
||||
# Hide secret channels from normal users.
|
||||
@ -110,10 +110,10 @@ def showchan(irc, source, args):
|
||||
|
||||
# Mark TS values as untrusted on Clientbot and others (where TS is read-only or not trackable)
|
||||
f('\x02Channel creation time\x02: %s (%s)%s' % (ctime(c.ts), c.ts,
|
||||
' [UNTRUSTED]' if not irc.hasCap('has-ts') else ''))
|
||||
' [UNTRUSTED]' if not irc.has_cap('has-ts') else ''))
|
||||
|
||||
# Show only modes that aren't list-style modes.
|
||||
modes = irc.joinModes([m for m in c.modes if m[0] not in irc.cmodes['*A']], sort=True)
|
||||
modes = irc.join_modes([m for m in c.modes if m[0] not in irc.cmodes['*A']], sort=True)
|
||||
f('\x02Channel modes\x02: %s' % modes)
|
||||
if verbose:
|
||||
nicklist = []
|
||||
@ -179,7 +179,7 @@ def logout(irc, source, args):
|
||||
irc.error("You are not logged in!")
|
||||
return
|
||||
else:
|
||||
otheruid = irc.nickToUid(othernick)
|
||||
otheruid = irc.nick_to_uid(othernick)
|
||||
if not otheruid:
|
||||
irc.error("Unknown user %s." % othernick)
|
||||
return
|
||||
|
@ -34,7 +34,7 @@ def _exec(irc, source, args, locals_dict=None):
|
||||
return
|
||||
|
||||
log.info('(%s) Executing %r for %s', irc.name, args,
|
||||
irc.getHostmask(source))
|
||||
irc.get_hostmask(source))
|
||||
if locals_dict is None:
|
||||
locals_dict = locals()
|
||||
else:
|
||||
@ -86,7 +86,7 @@ def _eval(irc, source, args, locals_dict=None, pretty_print=False):
|
||||
locals_dict['args'] = args
|
||||
|
||||
log.info('(%s) Evaluating %r for %s', irc.name, args,
|
||||
irc.getHostmask(source))
|
||||
irc.get_hostmask(source))
|
||||
|
||||
result = eval(args, globals(), locals_dict)
|
||||
|
||||
@ -150,7 +150,7 @@ def raw(irc, source, args):
|
||||
return
|
||||
|
||||
log.debug('(%s) Sending raw text %r to IRC for %s', irc.name, args,
|
||||
irc.getHostmask(source))
|
||||
irc.get_hostmask(source))
|
||||
irc.send(args)
|
||||
|
||||
irc.reply("Done.")
|
||||
@ -170,5 +170,5 @@ def inject(irc, source, args):
|
||||
return
|
||||
|
||||
log.info('(%s) Injecting raw text %r into protocol module for %s', irc.name,
|
||||
args, irc.getHostmask(source))
|
||||
args, irc.get_hostmask(source))
|
||||
irc.reply(irc.runline(args))
|
||||
|
@ -12,7 +12,7 @@ def handle_fantasy(irc, source, command, args):
|
||||
channel = args['target']
|
||||
orig_text = args['text']
|
||||
|
||||
if utils.isChannel(channel) and not irc.isInternalClient(source):
|
||||
if utils.isChannel(channel) and not irc.is_internal_client(source):
|
||||
# The following conditions must be met for an incoming message for
|
||||
# fantasy to trigger:
|
||||
# 1) The message target is a channel.
|
||||
@ -42,7 +42,7 @@ def handle_fantasy(irc, source, command, args):
|
||||
|
||||
# If responding to nick is enabled, add variations of the current nick
|
||||
# to the prefix list: "<nick>," and "<nick>:"
|
||||
nick = irc.toLower(irc.users[servuid].nick)
|
||||
nick = irc.to_lower(irc.users[servuid].nick)
|
||||
|
||||
nick_prefixes = [nick+',', nick+':']
|
||||
if respondtonick:
|
||||
@ -52,7 +52,7 @@ def handle_fantasy(irc, source, command, args):
|
||||
# No prefixes were set, so skip.
|
||||
continue
|
||||
|
||||
lowered_text = irc.toLower(orig_text)
|
||||
lowered_text = irc.to_lower(orig_text)
|
||||
for prefix in filter(None, prefixes): # Cycle through the prefixes list we finished with.
|
||||
if lowered_text.startswith(prefix):
|
||||
|
||||
|
@ -20,12 +20,12 @@ def g(irc, source, args):
|
||||
for name, ircd in world.networkobjects.items():
|
||||
if ircd.connected.is_set(): # Only attempt to send to connected networks
|
||||
for channel in ircd.pseudoclient.channels:
|
||||
subst = {'sender': irc.getFriendlyName(source),
|
||||
subst = {'sender': irc.get_friendly_name(source),
|
||||
'network': irc.name,
|
||||
'fullnetwork': irc.getFullNetworkName(),
|
||||
'fullnetwork': irc.get_full_network_name(),
|
||||
'current_channel': channel,
|
||||
'current_network': ircd.name,
|
||||
'current_fullnetwork': ircd.getFullNetworkName(),
|
||||
'current_fullnetwork': ircd.get_full_network_name(),
|
||||
'text': message}
|
||||
|
||||
# Disable relaying or other plugins handling the global message.
|
||||
|
@ -27,10 +27,10 @@ def checkban(irc, source, args):
|
||||
|
||||
results = 0
|
||||
for uid, userobj in irc.users.copy().items():
|
||||
if irc.matchHost(banmask, uid):
|
||||
if irc.match_host(banmask, uid):
|
||||
if results < 50: # XXX rather arbitrary limit
|
||||
s = "\x02%s\x02 (%s@%s) [%s] {\x02%s\x02}" % (userobj.nick, userobj.ident,
|
||||
userobj.host, userobj.realname, irc.getFriendlyName(irc.getServer(uid)))
|
||||
userobj.host, userobj.realname, irc.get_friendly_name(irc.get_server(uid)))
|
||||
|
||||
# Always reply in private to prevent information leaks.
|
||||
irc.reply(s, private=True)
|
||||
@ -42,9 +42,9 @@ def checkban(irc, source, args):
|
||||
else:
|
||||
irc.msg(source, "No results found.", notice=True)
|
||||
else:
|
||||
# Target can be both a nick (of an online user) or a hostmask. irc.matchHost() handles this
|
||||
# Target can be both a nick (of an online user) or a hostmask. irc.match_host() handles this
|
||||
# automatically.
|
||||
if irc.matchHost(banmask, targetmask):
|
||||
if irc.match_host(banmask, targetmask):
|
||||
irc.reply('Yes, \x02%s\x02 matches \x02%s\x02.' % (targetmask, banmask))
|
||||
else:
|
||||
irc.reply('No, \x02%s\x02 does not match \x02%s\x02.' % (targetmask, banmask))
|
||||
@ -61,7 +61,7 @@ def jupe(irc, source, args):
|
||||
try:
|
||||
servername = args[0]
|
||||
reason = ' '.join(args[1:]) or "No reason given"
|
||||
desc = "Juped by %s: [%s]" % (irc.getHostmask(source), reason)
|
||||
desc = "Juped by %s: [%s]" % (irc.get_hostmask(source), reason)
|
||||
except IndexError:
|
||||
irc.error('Not enough arguments. Needs 1-2: servername, reason (optional).')
|
||||
return
|
||||
@ -72,7 +72,7 @@ def jupe(irc, source, args):
|
||||
|
||||
sid = irc.spawnServer(servername, desc=desc)
|
||||
|
||||
irc.callHooks([irc.pseudoclient.uid, 'OPERCMDS_SPAWNSERVER',
|
||||
irc.call_hooks([irc.pseudoclient.uid, 'OPERCMDS_SPAWNSERVER',
|
||||
{'name': servername, 'sid': sid, 'text': desc}])
|
||||
|
||||
irc.reply("Done.")
|
||||
@ -85,14 +85,14 @@ def kick(irc, source, args):
|
||||
Admin only. Kicks <user> from the specified channel."""
|
||||
permissions.checkPermissions(irc, source, ['opercmds.kick'])
|
||||
try:
|
||||
channel = irc.toLower(args[0])
|
||||
channel = irc.to_lower(args[0])
|
||||
target = args[1]
|
||||
reason = ' '.join(args[2:])
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 2-3: channel, target, reason (optional).")
|
||||
return
|
||||
|
||||
targetu = irc.nickToUid(target)
|
||||
targetu = irc.nick_to_uid(target)
|
||||
|
||||
if channel not in irc.channels: # KICK only works on channels that exist.
|
||||
irc.error("Unknown channel %r." % channel)
|
||||
@ -106,7 +106,7 @@ def kick(irc, source, args):
|
||||
sender = irc.pseudoclient.uid
|
||||
irc.kick(sender, channel, targetu, reason)
|
||||
irc.reply("Done.")
|
||||
irc.callHooks([sender, 'CHANCMDS_KICK', {'channel': channel, 'target': targetu,
|
||||
irc.call_hooks([sender, 'CHANCMDS_KICK', {'channel': channel, 'target': targetu,
|
||||
'text': reason, 'parse_as': 'KICK'}])
|
||||
|
||||
@utils.add_cmd
|
||||
@ -124,7 +124,7 @@ def kill(irc, source, args):
|
||||
|
||||
# Convert the source and target nicks to UIDs.
|
||||
sender = irc.pseudoclient.uid
|
||||
targetu = irc.nickToUid(target)
|
||||
targetu = irc.nick_to_uid(target)
|
||||
userdata = irc.users.get(targetu)
|
||||
|
||||
if targetu not in irc.users:
|
||||
@ -135,10 +135,10 @@ def kill(irc, source, args):
|
||||
irc.kill(sender, targetu, reason)
|
||||
|
||||
# Format the kill reason properly in hooks.
|
||||
reason = "Killed (%s (%s))" % (irc.getFriendlyName(sender), reason)
|
||||
reason = "Killed (%s (%s))" % (irc.get_friendly_name(sender), reason)
|
||||
|
||||
irc.reply("Done.")
|
||||
irc.callHooks([sender, 'CHANCMDS_KILL', {'target': targetu, 'text': reason,
|
||||
irc.call_hooks([sender, 'CHANCMDS_KILL', {'target': targetu, 'text': reason,
|
||||
'userdata': userdata, 'parse_as': 'KILL'}])
|
||||
|
||||
@utils.add_cmd
|
||||
@ -164,7 +164,7 @@ def mode(irc, source, args):
|
||||
irc.error("No valid modes were given.")
|
||||
return
|
||||
|
||||
parsedmodes = irc.parseModes(target, modes)
|
||||
parsedmodes = irc.parse_modes(target, modes)
|
||||
|
||||
if not parsedmodes:
|
||||
# Modes were given but they failed to parse into anything meaningful.
|
||||
@ -176,7 +176,7 @@ def mode(irc, source, args):
|
||||
irc.mode(irc.pseudoclient.uid, target, parsedmodes)
|
||||
|
||||
# Call the appropriate hooks for plugins like relay.
|
||||
irc.callHooks([irc.pseudoclient.uid, 'OPERCMDS_MODEOVERRIDE',
|
||||
irc.call_hooks([irc.pseudoclient.uid, 'OPERCMDS_MODEOVERRIDE',
|
||||
{'target': target, 'modes': parsedmodes, 'parse_as': 'MODE'}])
|
||||
|
||||
irc.reply("Done.")
|
||||
@ -201,6 +201,6 @@ def topic(irc, source, args):
|
||||
irc.topic(irc.pseudoclient.uid, channel, topic)
|
||||
|
||||
irc.reply("Done.")
|
||||
irc.callHooks([irc.pseudoclient.uid, 'CHANCMDS_TOPIC',
|
||||
irc.call_hooks([irc.pseudoclient.uid, 'CHANCMDS_TOPIC',
|
||||
{'channel': channel, 'text': topic, 'setter': source,
|
||||
'parse_as': 'TOPIC'}])
|
||||
|
108
plugins/relay.py
108
plugins/relay.py
@ -105,7 +105,7 @@ def normalize_nick(irc, netname, nick, times_tagged=0, uid=''):
|
||||
forcetag_nicks = conf.conf.get('relay', {}).get('forcetag_nicks', [])
|
||||
log.debug('(%s) relay.normalize_nick: checking if globs %s match %s.', irc.name, forcetag_nicks, nick)
|
||||
for glob in forcetag_nicks:
|
||||
if irc.matchHost(glob, nick):
|
||||
if irc.match_host(glob, nick):
|
||||
# User matched a nick to force tag nicks for. Tag them.
|
||||
times_tagged = 1
|
||||
break
|
||||
@ -117,7 +117,7 @@ def normalize_nick(irc, netname, nick, times_tagged=0, uid=''):
|
||||
# Charybdis, IRCu, etc. don't allow / in nicks, and will SQUIT with a protocol
|
||||
# violation if it sees one. Or it might just ignore the client introduction and
|
||||
# cause bad desyncs.
|
||||
protocol_allows_slashes = irc.hasCap('slash-in-nicks') or \
|
||||
protocol_allows_slashes = irc.has_cap('slash-in-nicks') or \
|
||||
irc.serverdata.get('relay_force_slashes')
|
||||
|
||||
if '/' not in separator or not protocol_allows_slashes:
|
||||
@ -153,7 +153,7 @@ def normalize_nick(irc, netname, nick, times_tagged=0, uid=''):
|
||||
if char not in allowed_chars:
|
||||
nick = nick.replace(char, fallback_separator)
|
||||
|
||||
while irc.nickToUid(nick) and irc.nickToUid(nick) != uid:
|
||||
while irc.nick_to_uid(nick) and irc.nick_to_uid(nick) != uid:
|
||||
# The nick we want exists: Increase the separator length by 1 if the user was already
|
||||
# tagged, but couldn't be created due to a nick conflict. This can happen when someone
|
||||
# steals a relay user's nick.
|
||||
@ -176,11 +176,11 @@ def normalize_host(irc, host):
|
||||
log.debug('(%s) relay.normalize_host: IRCd=%s, host=%s', irc.name, irc.protoname, host)
|
||||
|
||||
allowed_chars = string.ascii_letters + string.digits + '-.:'
|
||||
if irc.hasCap('slash-in-hosts'):
|
||||
if irc.has_cap('slash-in-hosts'):
|
||||
# UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames
|
||||
allowed_chars += '/'
|
||||
|
||||
if irc.hasCap('underscore-in-hosts'):
|
||||
if irc.has_cap('underscore-in-hosts'):
|
||||
# Most IRCds allow _ in hostnames, but hybrid/charybdis/ratbox IRCds do not.
|
||||
allowed_chars += '_'
|
||||
|
||||
@ -221,7 +221,7 @@ def spawn_relay_server(irc, remoteirc):
|
||||
suffix = suffix.strip('.')
|
||||
sid = irc.spawnServer('%s.%s' % (remoteirc.name, suffix),
|
||||
desc="PyLink Relay network - %s" %
|
||||
(remoteirc.getFullNetworkName()), endburst_delay=3)
|
||||
(remoteirc.get_full_network_name()), endburst_delay=3)
|
||||
except (RuntimeError, ValueError): # Network not initialized yet, or a server name conflict.
|
||||
log.exception('(%s) Failed to spawn server for %r (possible jupe?):',
|
||||
irc.name, remoteirc.name)
|
||||
@ -296,7 +296,7 @@ def spawn_relay_user(irc, remoteirc, user, times_tagged=0):
|
||||
else:
|
||||
opertype = 'IRC Operator'
|
||||
|
||||
opertype += ' (on %s)' % irc.getFullNetworkName()
|
||||
opertype += ' (on %s)' % irc.get_full_network_name()
|
||||
|
||||
# Set hideoper on remote opers, to prevent inflating
|
||||
# /lusers and various /stats
|
||||
@ -351,7 +351,7 @@ def get_remote_user(irc, remoteirc, user, spawn_if_missing=True, times_tagged=0)
|
||||
# Wait until the network is working before trying to spawn anything.
|
||||
if irc.connected.wait(TCONDITION_TIMEOUT):
|
||||
# Don't spawn clones for registered service bots.
|
||||
sbot = irc.getServiceBot(user)
|
||||
sbot = irc.get_service_bot(user)
|
||||
if sbot:
|
||||
return sbot.uids.get(remoteirc.name)
|
||||
|
||||
@ -538,8 +538,8 @@ def check_claim(irc, channel, sender, chanobj=None):
|
||||
return (not relay) or irc.name == relay[0] or not db[relay]['claim'] or \
|
||||
irc.name in db[relay]['claim'] or \
|
||||
any([mode in sender_modes for mode in ('y', 'q', 'a', 'o', 'h')]) \
|
||||
or irc.isInternalClient(sender) or \
|
||||
irc.isInternalServer(sender)
|
||||
or irc.is_internal_client(sender) or \
|
||||
irc.is_internal_server(sender)
|
||||
|
||||
def get_supported_umodes(irc, remoteirc, modes):
|
||||
"""Given a list of user modes, filters out all of those not supported by the
|
||||
@ -648,7 +648,7 @@ def relay_joins(irc, channel, users, ts, burst=True):
|
||||
|
||||
# Fetch the known channel TS and all the prefix modes for each user. This ensures
|
||||
# the different sides of the relay are merged properly.
|
||||
if not irc.hasCap('has-ts'):
|
||||
if not irc.has_cap('has-ts'):
|
||||
# Special hack for clientbot: just use the remote's modes so mode changes
|
||||
# take precendence. (TS is always outside the clientbot's control)
|
||||
ts = remoteirc.channels[remotechan].ts
|
||||
@ -677,7 +677,7 @@ def relay_joins(irc, channel, users, ts, burst=True):
|
||||
|
||||
for remoteirc, hookdata in joined_nets.items():
|
||||
# HACK: Announce this JOIN as a special hook on each network, for plugins like Automode.
|
||||
remoteirc.callHooks([remoteirc.sid, 'PYLINK_RELAY_JOIN', hookdata])
|
||||
remoteirc.call_hooks([remoteirc.sid, 'PYLINK_RELAY_JOIN', hookdata])
|
||||
|
||||
def relay_part(irc, channel, user):
|
||||
"""
|
||||
@ -783,7 +783,7 @@ def get_supported_cmodes(irc, remoteirc, channel, modes):
|
||||
"for network %r.",
|
||||
irc.name, modechar, arg, remoteirc.name)
|
||||
|
||||
if (not irc.hasCap('can-spawn-clients')) and irc.pseudoclient and arg == irc.pseudoclient.uid:
|
||||
if (not irc.has_cap('can-spawn-clients')) and irc.pseudoclient and arg == irc.pseudoclient.uid:
|
||||
# Skip modesync on the main PyLink client.
|
||||
log.debug("(%s) relay.get_supported_cmodes: filtering prefix change (%r, %r) on Clientbot relayer",
|
||||
irc.name, name, arg)
|
||||
@ -857,7 +857,7 @@ def handle_relay_whois(irc, source, command, args):
|
||||
setting = conf.conf.get('relay', {}).get(infoline, '').lower()
|
||||
if setting == 'all':
|
||||
return True
|
||||
elif setting == 'opers' and irc.isOper(source, allowAuthed=False):
|
||||
elif setting == 'opers' and irc.is_oper(source, allowAuthed=False):
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -867,7 +867,7 @@ def handle_relay_whois(irc, source, command, args):
|
||||
homenet, uid = origuser
|
||||
realirc = world.networkobjects[homenet]
|
||||
realuser = realirc.users[uid]
|
||||
netname = realirc.getFullNetworkName()
|
||||
netname = realirc.get_full_network_name()
|
||||
|
||||
wreply(320, ":is a remote user connected via PyLink Relay. Home network: %s; "
|
||||
"Home nick: %s" % (netname, realuser.nick))
|
||||
@ -876,9 +876,9 @@ def handle_relay_whois(irc, source, command, args):
|
||||
# Send account information if told to and the target is logged in.
|
||||
wreply(330, "%s :is logged in (on %s) as" % (realuser.services_account, netname))
|
||||
|
||||
if checkSendKey('whois_show_server') and realirc.hasCap('can-track-servers'):
|
||||
if checkSendKey('whois_show_server') and realirc.has_cap('can-track-servers'):
|
||||
wreply(320, ":is actually connected via the following server:")
|
||||
realserver = realirc.getServer(uid)
|
||||
realserver = realirc.get_server(uid)
|
||||
realserver = realirc.servers[realserver]
|
||||
wreply(312, "%s :%s" % (realserver.name, realserver.desc))
|
||||
|
||||
@ -888,7 +888,7 @@ def handle_operup(irc, numeric, command, args):
|
||||
"""
|
||||
Handles setting oper types on relay clients during oper up.
|
||||
"""
|
||||
newtype = '%s (on %s)' % (args['text'], irc.getFullNetworkName())
|
||||
newtype = '%s (on %s)' % (args['text'], irc.get_full_network_name())
|
||||
for netname, user in relayusers[(irc.name, numeric)].items():
|
||||
log.debug('(%s) relay.handle_opertype: setting OPERTYPE of %s/%s to %s',
|
||||
irc.name, user, netname, newtype)
|
||||
@ -935,7 +935,7 @@ def handle_join(irc, numeric, command, args):
|
||||
modes.append(('-%s' % modechar, user))
|
||||
|
||||
if modes:
|
||||
log.debug('(%s) relay.handle_join: reverting modes on BURST: %s', irc.name, irc.joinModes(modes))
|
||||
log.debug('(%s) relay.handle_join: reverting modes on BURST: %s', irc.name, irc.join_modes(modes))
|
||||
irc.mode(irc.sid, channel, modes)
|
||||
|
||||
relay_joins(irc, channel, users, ts, burst=False)
|
||||
@ -1017,11 +1017,11 @@ def handle_part(irc, numeric, command, args):
|
||||
if numeric == irc.pseudoclient.uid:
|
||||
# For clientbot: treat forced parts to the bot as clearchan, and attempt to rejoin only
|
||||
# if it affected a relay.
|
||||
if not irc.hasCap('can-spawn-clients'):
|
||||
if not irc.has_cap('can-spawn-clients'):
|
||||
for channel in [c for c in channels if get_relay((irc.name, c))]:
|
||||
for user in irc.channels[channel].users:
|
||||
if (not irc.isInternalClient(user)) and (not isRelayClient(irc, user)):
|
||||
irc.callHooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user,
|
||||
if (not irc.is_internal_client(user)) and (not isRelayClient(irc, user)):
|
||||
irc.call_hooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user,
|
||||
'text': 'Clientbot was force parted (Reason: %s)' % text or 'None',
|
||||
'parse_as': 'KICK'}])
|
||||
irc.join(irc.pseudoclient.uid, channel)
|
||||
@ -1045,7 +1045,7 @@ def handle_messages(irc, numeric, command, args):
|
||||
notice = (command in ('NOTICE', 'PYLINK_SELF_NOTICE'))
|
||||
target = args['target']
|
||||
text = args['text']
|
||||
if irc.isInternalClient(numeric) and irc.isInternalClient(target):
|
||||
if irc.is_internal_client(numeric) and irc.is_internal_client(target):
|
||||
# Drop attempted PMs between internal clients (this shouldn't happen,
|
||||
# but whatever).
|
||||
return
|
||||
@ -1089,8 +1089,8 @@ def handle_messages(irc, numeric, command, args):
|
||||
|
||||
# Skip "from:" formatting for servers; it's messy with longer hostnames.
|
||||
# Also skip this formatting for servicebot relaying.
|
||||
if numeric not in irc.servers and not irc.getServiceBot(numeric):
|
||||
displayedname = irc.getFriendlyName(numeric)
|
||||
if numeric not in irc.servers and not irc.get_service_bot(numeric):
|
||||
displayedname = irc.get_friendly_name(numeric)
|
||||
real_text = '<%s/%s> %s' % (displayedname, irc.name, text)
|
||||
else:
|
||||
real_text = text
|
||||
@ -1149,7 +1149,7 @@ def handle_messages(irc, numeric, command, args):
|
||||
return
|
||||
remoteirc = world.networkobjects[homenet]
|
||||
|
||||
if (not remoteirc.hasCap('can-spawn-clients')) and not conf.conf.get('relay', {}).get('allow_clientbot_pms'):
|
||||
if (not remoteirc.has_cap('can-spawn-clients')) and not conf.conf.get('relay', {}).get('allow_clientbot_pms'):
|
||||
irc.msg(numeric, 'Private messages to users connected via Clientbot have '
|
||||
'been administratively disabled.', notice=True)
|
||||
return
|
||||
@ -1180,17 +1180,17 @@ def handle_kick(irc, source, command, args):
|
||||
relay = get_relay((irc.name, channel))
|
||||
|
||||
# Special case for clientbot: treat kicks to the PyLink service bot as channel clear.
|
||||
if (not irc.hasCap('can-spawn-clients')) and irc.pseudoclient and target == irc.pseudoclient.uid:
|
||||
if (not irc.has_cap('can-spawn-clients')) and irc.pseudoclient and target == irc.pseudoclient.uid:
|
||||
for user in irc.channels[channel].users:
|
||||
if (not irc.isInternalClient(user)) and (not isRelayClient(irc, user)):
|
||||
reason = "Clientbot kicked by %s (Reason: %s)" % (irc.getFriendlyName(source), text)
|
||||
irc.callHooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user,
|
||||
if (not irc.is_internal_client(user)) and (not isRelayClient(irc, user)):
|
||||
reason = "Clientbot kicked by %s (Reason: %s)" % (irc.get_friendly_name(source), text)
|
||||
irc.call_hooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user,
|
||||
'text': reason, 'parse_as': 'KICK'}])
|
||||
|
||||
return
|
||||
|
||||
# Don't relay kicks to protected service bots.
|
||||
if relay is None or irc.getServiceBot(target):
|
||||
if relay is None or irc.get_service_bot(target):
|
||||
return
|
||||
|
||||
origuser = get_orig_user(irc, target)
|
||||
@ -1247,7 +1247,7 @@ def handle_kick(irc, source, command, args):
|
||||
# common channels with the target relay network.
|
||||
rsid = get_remote_sid(remoteirc, irc)
|
||||
log.debug('(%s) relay.handle_kick: Kicking %s from channel %s via %s on behalf of %s/%s', irc.name, real_target, remotechan, rsid, kicker, irc.name)
|
||||
if not irc.hasCap('can-spawn-clients'):
|
||||
if not irc.has_cap('can-spawn-clients'):
|
||||
# Special case for clientbot: no kick prefixes are needed.
|
||||
text = args['text']
|
||||
else:
|
||||
@ -1328,7 +1328,7 @@ def handle_mode(irc, numeric, command, args):
|
||||
rsid = rsid or remoteirc.sid
|
||||
remoteirc.mode(rsid, remotechan, supported_modes)
|
||||
else: # Mode change blocked by CLAIM.
|
||||
reversed_modes = irc.reverseModes(target, modes, oldobj=oldchan)
|
||||
reversed_modes = irc.reverse_modes(target, modes, oldobj=oldchan)
|
||||
log.debug('(%s) relay.handle_mode: Reversing mode changes of %r with %r (CLAIM).',
|
||||
irc.name, modes, reversed_modes)
|
||||
if reversed_modes:
|
||||
@ -1468,7 +1468,7 @@ def handle_services_login(irc, numeric, command, args):
|
||||
"""
|
||||
for netname, user in relayusers[(irc.name, numeric)].items():
|
||||
remoteirc = world.networkobjects[netname]
|
||||
remoteirc.callHooks([user, 'PYLINK_RELAY_SERVICES_LOGIN', args])
|
||||
remoteirc.call_hooks([user, 'PYLINK_RELAY_SERVICES_LOGIN', args])
|
||||
utils.add_hook(handle_services_login, 'CLIENT_SERVICES_LOGIN')
|
||||
|
||||
def handle_disconnect(irc, numeric, command, args):
|
||||
@ -1575,14 +1575,14 @@ def create(irc, source, args):
|
||||
|
||||
Opens up the given channel over PyLink Relay."""
|
||||
try:
|
||||
channel = irc.toLower(args[0])
|
||||
channel = irc.to_lower(args[0])
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1: channel.")
|
||||
return
|
||||
if not utils.isChannel(channel):
|
||||
irc.error('Invalid channel %r.' % channel)
|
||||
return
|
||||
if not irc.hasCap('can-host-relay'):
|
||||
if not irc.has_cap('can-host-relay'):
|
||||
irc.error('Clientbot networks cannot be used to host a relay.')
|
||||
return
|
||||
if source not in irc.channels[channel].users:
|
||||
@ -1598,7 +1598,7 @@ def create(irc, source, args):
|
||||
irc.error('Channel %r is already part of a relay.' % channel)
|
||||
return
|
||||
|
||||
creator = irc.getHostmask(source)
|
||||
creator = irc.get_hostmask(source)
|
||||
# Create the relay database entry with the (network name, channel name)
|
||||
# pair - this is just a dict with various keys.
|
||||
db[(irc.name, channel)] = {'claim': [irc.name], 'links': set(),
|
||||
@ -1622,11 +1622,11 @@ def destroy(irc, source, args):
|
||||
|
||||
Removes the given channel from the PyLink Relay, delinking all networks linked to it. If the home network is given and you are logged in as admin, this can also remove relay channels from other networks."""
|
||||
try: # Two args were given: first one is network name, second is channel.
|
||||
channel = irc.toLower(args[1])
|
||||
channel = irc.to_lower(args[1])
|
||||
network = args[0]
|
||||
except IndexError:
|
||||
try: # One argument was given; assume it's just the channel.
|
||||
channel = irc.toLower(args[0])
|
||||
channel = irc.to_lower(args[0])
|
||||
network = irc.name
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1-2: channel, network (optional).")
|
||||
@ -1649,7 +1649,7 @@ def destroy(irc, source, args):
|
||||
del db[entry]
|
||||
|
||||
log.info('(%s) relay: Channel %s destroyed by %s.', irc.name,
|
||||
channel, irc.getHostmask(source))
|
||||
channel, irc.get_hostmask(source))
|
||||
irc.reply('Done.')
|
||||
else:
|
||||
irc.error("No such channel %r exists. If you're trying to delink a channel from "
|
||||
@ -1703,8 +1703,8 @@ def link(irc, source, args):
|
||||
args = link_parser.parse_args(args)
|
||||
|
||||
# Normalize channel case
|
||||
channel = irc.toLower(args.channel)
|
||||
localchan = irc.toLower(args.localchannel or args.channel)
|
||||
channel = irc.to_lower(args.channel)
|
||||
localchan = irc.to_lower(args.localchannel or args.channel)
|
||||
remotenet = args.remotenet
|
||||
|
||||
for c in (channel, localchan):
|
||||
@ -1774,7 +1774,7 @@ def link(irc, source, args):
|
||||
|
||||
our_ts = irc.channels[localchan].ts
|
||||
their_ts = world.networkobjects[remotenet].channels[channel].ts
|
||||
if (our_ts < their_ts) and irc.hasCap('has-ts'):
|
||||
if (our_ts < their_ts) and irc.has_cap('has-ts'):
|
||||
log.debug('(%s) relay: Blocking link request %s%s -> %s%s due to bad TS (%s < %s)', irc.name,
|
||||
irc.name, localchan, remotenet, args.channel, our_ts, their_ts)
|
||||
irc.error("The channel creation date (TS) on %s (%s) is lower than the target "
|
||||
@ -1785,7 +1785,7 @@ def link(irc, source, args):
|
||||
|
||||
entry['links'].add((irc.name, localchan))
|
||||
log.info('(%s) relay: Channel %s linked to %s%s by %s.', irc.name,
|
||||
localchan, remotenet, args.channel, irc.getHostmask(source))
|
||||
localchan, remotenet, args.channel, irc.get_hostmask(source))
|
||||
initialize_channel(irc, localchan)
|
||||
irc.reply('Done.')
|
||||
link = utils.add_cmd(link, featured=True)
|
||||
@ -1796,7 +1796,7 @@ def delink(irc, source, args):
|
||||
Delinks the given channel from PyLink Relay. \x02network\x02 must and can only be specified if you are on the host network for the channel given, and allows you to pick which network to delink.
|
||||
To remove a relay channel entirely, use the 'destroy' command instead."""
|
||||
try:
|
||||
channel = irc.toLower(args[0])
|
||||
channel = irc.to_lower(args[0])
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1-2: channel, remote netname (optional).")
|
||||
return
|
||||
@ -1829,7 +1829,7 @@ def delink(irc, source, args):
|
||||
db[entry]['links'].remove((irc.name, channel))
|
||||
irc.reply('Done.')
|
||||
log.info('(%s) relay: Channel %s delinked from %s%s by %s.', irc.name,
|
||||
channel, entry[0], entry[1], irc.getHostmask(source))
|
||||
channel, entry[0], entry[1], irc.get_hostmask(source))
|
||||
else:
|
||||
irc.error('No such relay %r.' % channel)
|
||||
delink = utils.add_cmd(delink, featured=True)
|
||||
@ -1880,7 +1880,7 @@ def linked(irc, source, args):
|
||||
# Only show secret channels to opers or those in the channel, and tag them as
|
||||
# [secret].
|
||||
localchan = get_remote_channel(remoteirc, irc, channel)
|
||||
if irc.isOper(source) or (localchan and source in irc.channels[localchan].users):
|
||||
if irc.is_oper(source) or (localchan and source in irc.channels[localchan].users):
|
||||
s += '\x02[secret]\x02 '
|
||||
else:
|
||||
continue
|
||||
@ -1896,7 +1896,7 @@ def linked(irc, source, args):
|
||||
|
||||
irc.reply(s, private=True)
|
||||
|
||||
if irc.isOper(source):
|
||||
if irc.is_oper(source):
|
||||
s = ''
|
||||
|
||||
# If the caller is an oper, we can show the hostmasks of people
|
||||
@ -1927,7 +1927,7 @@ def linkacl(irc, source, args):
|
||||
|
||||
try:
|
||||
cmd = args[0].lower()
|
||||
channel = irc.toLower(args[1])
|
||||
channel = irc.to_lower(args[1])
|
||||
except IndexError:
|
||||
irc.error(missingargs)
|
||||
return
|
||||
@ -1974,7 +1974,7 @@ def showuser(irc, source, args):
|
||||
# No errors here; showuser from the commands plugin already does this
|
||||
# for us.
|
||||
return
|
||||
u = irc.nickToUid(target)
|
||||
u = irc.nick_to_uid(target)
|
||||
if u:
|
||||
irc.reply("Showing relay information on user \x02%s\x02:" % irc.users[u].nick, private=True)
|
||||
try:
|
||||
@ -1997,7 +1997,7 @@ def showuser(irc, source, args):
|
||||
relay = get_relay((irc.name, ch))
|
||||
if relay:
|
||||
relaychannels.append(''.join(relay))
|
||||
if relaychannels and (irc.isOper(source) or u == source):
|
||||
if relaychannels and (irc.is_oper(source) or u == source):
|
||||
irc.reply("\x02Relay channels\x02: %s" % ' '.join(relaychannels), private=True)
|
||||
|
||||
@utils.add_cmd
|
||||
@ -2006,7 +2006,7 @@ def showchan(irc, source, args):
|
||||
|
||||
Shows relay data about the given channel. This supplements the 'showchan' command in the 'commands' plugin, which provides more general information."""
|
||||
try:
|
||||
channel = irc.toLower(args[0])
|
||||
channel = irc.to_lower(args[0])
|
||||
except IndexError:
|
||||
return
|
||||
if channel not in irc.channels:
|
||||
@ -2017,7 +2017,7 @@ def showchan(irc, source, args):
|
||||
c = irc.channels[channel]
|
||||
|
||||
# Only show verbose info if caller is oper or is in the target channel.
|
||||
verbose = source in c.users or irc.isOper(source)
|
||||
verbose = source in c.users or irc.is_oper(source)
|
||||
secret = ('s', None) in c.modes
|
||||
if secret and not verbose:
|
||||
# Hide secret channels from normal users.
|
||||
@ -2055,7 +2055,7 @@ def claim(irc, source, args):
|
||||
as well).
|
||||
"""
|
||||
try:
|
||||
channel = irc.toLower(args[0])
|
||||
channel = irc.to_lower(args[0])
|
||||
except IndexError:
|
||||
irc.error("Not enough arguments. Needs 1-2: channel, list of networks (optional).")
|
||||
return
|
||||
|
@ -45,7 +45,7 @@ def cb_relay_core(irc, source, command, args):
|
||||
|
||||
if irc.pseudoclient and relay:
|
||||
try:
|
||||
sourcename = irc.getFriendlyName(source)
|
||||
sourcename = irc.get_friendly_name(source)
|
||||
except KeyError: # User has left due to /quit
|
||||
sourcename = args['userdata'].nick
|
||||
|
||||
@ -87,7 +87,7 @@ def cb_relay_core(irc, source, command, args):
|
||||
text_template = string.Template(text_template)
|
||||
|
||||
if text_template:
|
||||
if irc.getServiceBot(source):
|
||||
if irc.get_service_bot(source):
|
||||
# HACK: service bots are global and lack the relay state we look for.
|
||||
# just pretend the message comes from the current network.
|
||||
log.debug('(%s) relay_cb_core: Overriding network origin to local (source=%s)', irc.name, source)
|
||||
@ -131,7 +131,7 @@ def cb_relay_core(irc, source, command, args):
|
||||
|
||||
if source in irc.users:
|
||||
try:
|
||||
identhost = irc.getHostmask(source).split('!')[-1]
|
||||
identhost = irc.get_hostmask(source).split('!')[-1]
|
||||
except KeyError: # User got removed due to quit
|
||||
identhost = '%s@%s' % (args['olduser'].ident, args['olduser'].host)
|
||||
# This is specifically spaced so that ident@host is only shown for users that have
|
||||
@ -142,7 +142,7 @@ def cb_relay_core(irc, source, command, args):
|
||||
|
||||
# $target_nick: Convert the target for kicks, etc. from a UID to a nick
|
||||
if args.get("target") in irc.users:
|
||||
args["target_nick"] = irc.getFriendlyName(args['target'])
|
||||
args["target_nick"] = irc.get_friendly_name(args['target'])
|
||||
|
||||
args.update({'netname': netname, 'sender': sourcename, 'sender_identhost': identhost,
|
||||
'colored_sender': color_text(sourcename), 'colored_netname': color_text(netname)})
|
||||
@ -204,7 +204,7 @@ def rpm(irc, source, args):
|
||||
return
|
||||
|
||||
relay = world.plugins.get('relay')
|
||||
if irc.hasCap('can-spawn-clients'):
|
||||
if irc.has_cap('can-spawn-clients'):
|
||||
irc.error('This command is only supported on Clientbot networks. Try /msg %s <text>' % target)
|
||||
return
|
||||
elif relay is None:
|
||||
@ -218,7 +218,7 @@ def rpm(irc, source, args):
|
||||
'administratively disabled.')
|
||||
return
|
||||
|
||||
uid = irc.nickToUid(target)
|
||||
uid = irc.nick_to_uid(target)
|
||||
if not uid:
|
||||
irc.error('Unknown user %s.' % target)
|
||||
return
|
||||
@ -226,7 +226,7 @@ def rpm(irc, source, args):
|
||||
irc.error('%s is not a relay user.' % target)
|
||||
return
|
||||
else:
|
||||
assert not irc.isInternalClient(source), "rpm is not allowed from PyLink bots"
|
||||
assert not irc.is_internal_client(source), "rpm is not allowed from PyLink bots"
|
||||
# Send the message through relay by faking a hook for its handler.
|
||||
relay.handle_messages(irc, source, 'RELAY_CLIENTBOT_PRIVMSG', {'target': uid, 'text': text})
|
||||
irc.reply('Message sent.')
|
||||
|
@ -78,7 +78,7 @@ def _map(irc, source, args, show_relay=True):
|
||||
# This is a relay server - display the remote map of the network it represents
|
||||
relay_server = serverlist[leaf].remote
|
||||
remoteirc = world.networkobjects[relay_server]
|
||||
if remoteirc.hasCap('can-track-servers'):
|
||||
if remoteirc.has_cap('can-track-servers'):
|
||||
# Only ever show relay subservers once - this prevents infinite loops.
|
||||
showall(remoteirc, remoteirc.sid, hops=hops, is_relay_server=True)
|
||||
|
||||
|
@ -18,7 +18,7 @@ def handle_kill(irc, numeric, command, args):
|
||||
automatically disconnects from the network.
|
||||
"""
|
||||
|
||||
if (args['userdata'] and irc.isInternalServer(args['userdata'].server)) or irc.isInternalClient(args['target']):
|
||||
if (args['userdata'] and irc.is_internal_server(args['userdata'].server)) or irc.is_internal_client(args['target']):
|
||||
if killcache.setdefault(irc.name, 1) >= length:
|
||||
log.error('(%s) servprotect: Too many kills received, aborting!', irc.name)
|
||||
irc.disconnect()
|
||||
@ -33,7 +33,7 @@ def handle_save(irc, numeric, command, args):
|
||||
Tracks SAVEs (nick collision) against PyLink clients. If too many are received,
|
||||
automatically disconnects from the network.
|
||||
"""
|
||||
if irc.isInternalClient(args['target']):
|
||||
if irc.is_internal_client(args['target']):
|
||||
if savecache.setdefault(irc.name, 0) >= length:
|
||||
log.error('(%s) servprotect: Too many nick collisions, aborting!', irc.name)
|
||||
irc.disconnect()
|
||||
|
Loading…
Reference in New Issue
Block a user