mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-24 19:52:53 +01:00
protocols: migrate utils.wrapArguments, splitHostmask use to camel case (#523)
This commit is contained in:
parent
3e656cd943
commit
9e212fc0a4
@ -446,7 +446,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
||||
else:
|
||||
# Sender is a either a nick or a nick!user@host prefix. Split it into its relevant parts.
|
||||
try:
|
||||
nick, ident, host = utils.splitHostmask(sender)
|
||||
nick, ident, host = utils.split_hostmask(sender)
|
||||
except ValueError:
|
||||
ident = host = None # Set ident and host as null for now.
|
||||
nick = sender # Treat the sender prefix we received as a nick.
|
||||
@ -674,7 +674,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
||||
|
||||
# Handle userhost-in-names where available.
|
||||
if 'userhost-in-names' in self.ircv3_caps:
|
||||
nick, ident, host = utils.splitHostmask(nick)
|
||||
nick, ident, host = utils.split_hostmask(nick)
|
||||
else:
|
||||
ident = host = None
|
||||
|
||||
|
@ -252,7 +252,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
||||
|
||||
if nicks_to_send:
|
||||
# Use 13 args max per line: this is equal to the max of 15 minus the command name and target channel.
|
||||
for message in utils.wrapArguments(njoin_prefix, nicks_to_send, self.S2S_BUFSIZE, separator=',', max_args_per_line=13):
|
||||
for message in utils.wrap_arguments(njoin_prefix, nicks_to_send, self.S2S_BUFSIZE, separator=',', max_args_per_line=13):
|
||||
self.send(message)
|
||||
|
||||
if modes:
|
||||
|
@ -654,7 +654,7 @@ class P10Protocol(IRCS2SProtocol):
|
||||
# Wrap all users and send them to prevent cutoff. Subtract 4 off the maximum
|
||||
# buf size to account for user prefix data that may be re-added (e.g. ":ohv")
|
||||
for linenum, wrapped_msg in \
|
||||
enumerate(utils.wrapArguments(msgprefix, namelist, self.S2S_BUFSIZE-1-len(self.prefixmodes),
|
||||
enumerate(utils.wrap_arguments(msgprefix, namelist, self.S2S_BUFSIZE-1-len(self.prefixmodes),
|
||||
separator=',')):
|
||||
if linenum: # Implies "if linenum > 0"
|
||||
# XXX: Ugh, this postprocessing sucks, but we have to make sure that mode prefixes are accounted
|
||||
@ -688,12 +688,12 @@ class P10Protocol(IRCS2SProtocol):
|
||||
if bans or exempts:
|
||||
msgprefix += ':%' # Ban string starts with a % if there is anything
|
||||
if bans:
|
||||
for wrapped_msg in utils.wrapArguments(msgprefix, bans, self.S2S_BUFSIZE):
|
||||
for wrapped_msg in utils.wrap_arguments(msgprefix, bans, self.S2S_BUFSIZE):
|
||||
self.send(wrapped_msg)
|
||||
if exempts:
|
||||
# Now add exempts, which are separated from the ban list by a single argument "~".
|
||||
msgprefix += ' ~ '
|
||||
for wrapped_msg in utils.wrapArguments(msgprefix, exempts, self.S2S_BUFSIZE):
|
||||
for wrapped_msg in utils.wrap_arguments(msgprefix, exempts, self.S2S_BUFSIZE):
|
||||
self.send(wrapped_msg)
|
||||
|
||||
self.updateTS(server, channel, ts, changedmodes)
|
||||
|
@ -186,7 +186,7 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
msgprefix = ':{sid} BMASK {ts} {channel} {bmode} :'.format(sid=server, ts=ts,
|
||||
channel=channel, bmode=bmode)
|
||||
# Actually, we cut off at 17 arguments/line, since the prefix and command name don't count.
|
||||
for msg in utils.wrapArguments(msgprefix, bans, self.S2S_BUFSIZE, max_args_per_line=17):
|
||||
for msg in utils.wrap_arguments(msgprefix, bans, self.S2S_BUFSIZE, max_args_per_line=17):
|
||||
self.send(msg)
|
||||
|
||||
self.updateTS(server, channel, ts, changedmodes)
|
||||
|
@ -180,7 +180,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
||||
sjoin_prefix += " :"
|
||||
# Wrap arguments to the max supported S2S line length to prevent cutoff
|
||||
# (https://github.com/GLolol/PyLink/issues/378)
|
||||
for line in utils.wrapArguments(sjoin_prefix, itemlist, self.S2S_BUFSIZE):
|
||||
for line in utils.wrap_arguments(sjoin_prefix, itemlist, self.S2S_BUFSIZE):
|
||||
self.send(line)
|
||||
|
||||
self._channels[channel].users.update(uids)
|
||||
|
Loading…
Reference in New Issue
Block a user