3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

Merge branch 'devel' into wip/rework-endburst

This commit is contained in:
James Lu 2017-08-31 12:20:58 -07:00
commit e02393c22b
5 changed files with 12 additions and 9 deletions

View File

@ -155,7 +155,7 @@ def _get_channel_pair(irc, source, chanpair, perm=None):
channel = '#' + channel
channel = irc.to_lower(channel)
assert utils.isChannel(channel), "Invalid channel name %s." % channel
assert irc.is_channel(channel), "Invalid channel name %s." % channel
if network:
ircobj = world.networkobjects.get(network)

View File

@ -94,7 +94,7 @@ def joinclient(irc, source, args):
prefixes = channel[:len(channel)-len(real_channel)]
joinmodes = ''.join(prefix_to_mode[prefix] for prefix in prefixes)
if not utils.isChannel(real_channel):
if not irc.is_channel(real_channel):
irc.error("Invalid channel name %r." % real_channel)
return
@ -186,7 +186,7 @@ def part(irc, source, args):
return
for channel in clist:
if not utils.isChannel(channel):
if not irc.is_channel(channel):
irc.error("Invalid channel name %r." % channel)
return
irc.part(u, channel, reason)
@ -227,7 +227,7 @@ def msg(irc, source, args):
irc.error('No text given.')
return
if not utils.isChannel(target):
if not irc.is_channel(target):
# Convert nick of the message target to a UID, if the target isn't a channel
real_target = irc.nick_to_uid(target)
if real_target is None: # Unknown target user, if target isn't a valid channel name

View File

@ -20,7 +20,7 @@ def hook_privmsg(irc, source, command, args):
# irc.pseudoclient stores the User object of the main PyLink client.
# (i.e. the user defined in the bot: section of the config)
if utils.isChannel(channel) and irc.pseudoclient.nick in text:
if irc.is_channel(channel) and irc.pseudoclient.nick in text:
irc.msg(channel, 'hi there!')
# log.debug, log.info, log.warning, log.error, log.exception (within except: clauses)
# and log.critical are supported here.

View File

@ -676,7 +676,10 @@ def relay_joins(irc, channel, users, ts, **kwargs):
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
if remotechan in remoteirc.channels:
ts = remoteirc.channels[remotechan].ts
else:
ts = int(time.time())
else:
ts = irc.channels[channel].ts
prefixes = get_prefix_modes(irc, remoteirc, channel, user)
@ -954,7 +957,7 @@ def get_supported_cmodes(irc, remoteirc, channel, modes):
else:
mode_parse_aborted = True
else:
if name in ('ban', 'banexception', 'invex', 'quiet') and not utils.isHostmask(arg):
if name in ('ban', 'banexception', 'invex', 'quiet') and not remoteirc.is_hostmask(arg):
# Don't add unsupported bans that don't match n!u@h syntax.
log.debug("(%s) relay.get_supported_cmodes: skipping unsupported extban/mode (%r, %r) because it doesn't match nick!user@host.",
irc.name, modechar, arg)

View File

@ -60,7 +60,7 @@ def cb_relay_core(irc, source, command, args):
real_command = 'ACTION'
elif not utils.isChannel(args['target']):
elif not irc.is_channel(args['target']):
# Target is a user; handle this accordingly.
if relay_conf.get('allow_clientbot_pms'):
real_command = 'PNOTICE' if args.get('is_notice') else 'PM'
@ -112,7 +112,7 @@ def cb_relay_core(irc, source, command, args):
# Figure out where the message is destined to.
target = args.get('channel') or args.get('target')
if target is None or not (utils.isChannel(target) or private):
if target is None or not (irc.is_channel(target) or private):
# Non-channel specific message (e.g. QUIT or NICK). If this isn't a PM, figure out
# all channels that the sender shares over the relay, and relay them to those
# channels.