diff --git a/protocols/clientbot.py b/protocols/clientbot.py index e0a4d1a..6310e73 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -372,7 +372,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): tag = tag.replace(r'\:', ';') tagdata[idx] = tag - results = self.parseCapabilities(tagdata, fallback=None) + results = self.parse_isupport(tagdata, fallback=None) log.debug('(%s) parsed message tags %s', self.name, results) return results return {} @@ -387,14 +387,14 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): data = data[1:] try: - args = self.parsePrefixedArgs(data) + args = self.parse_prefixed_args(data) sender = args[0] command = args[1] args = args[2:] except IndexError: # Raw command without an explicit sender; assume it's being sent by our uplink. - args = self.parseArgs(data) + args = self.parse_args(data) idsource = sender = self.uplink command = args[0] args = args[1:] @@ -528,7 +528,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): # Server: CAP * LS * :cap-notify server-time example.org/dummy-cap=dummyvalue example.org/second-dummy-cap # Server: CAP * LS :userhost-in-names sasl=EXTERNAL,DH-AES,DH-BLOWFISH,ECDSA-NIST256P-CHALLENGE,PLAIN log.debug('(%s) Got new capabilities %s', self.name, args[-1]) - self.ircv3_caps_available.update(self.parseCapabilities(args[-1], None)) + self.ircv3_caps_available.update(self.parse_isupport(args[-1], None)) if args[2] != '*': self.requestNewCaps() @@ -554,7 +554,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): # Note: CAP NEW allows capabilities with values (e.g. sasl=mech1,mech2), while CAP DEL # does not. log.debug('(%s) Got new capabilities %s', self.name, args[-1]) - newcaps = self.parseCapabilities(args[-1], None) + newcaps = self.parse_isupport(args[-1], None) self.ircv3_caps_available.update(newcaps) self.requestNewCaps() @@ -582,7 +582,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): """ Handles 005 / RPL_ISUPPORT. """ - self.caps.update(self.parseCapabilities(args[1:-1])) + self.caps.update(self.parse_isupport(args[1:-1])) log.debug('(%s) handle_005: self.caps is %s', self.name, self.caps) if 'CHANMODES' in self.caps: @@ -599,7 +599,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): log.debug('(%s) handle_005: casemapping set to %s', self.name, self.casemapping) if 'PREFIX' in self.caps: - self.prefixmodes = prefixmodes = self.parsePrefixes(self.caps['PREFIX']) + self.prefixmodes = prefixmodes = self.parse_isupport_prefixes(self.caps['PREFIX']) log.debug('(%s) handle_005: prefix modes set to %s', self.name, self.prefixmodes) # Autodetect common prefix mode names. diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 2c67986..3eefe72 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -477,7 +477,7 @@ class InspIRCdProtocol(TS6BaseProtocol): # USERMODES=,,s,BHIRSWcghikorwx GLOBOPS=1 SVSPART=1 # First, turn the arguments into a dict - caps = self.parseCapabilities(args[-1]) + caps = self.parse_isupport(args[-1]) log.debug("(%s) capabilities list: %s", self.name, caps) # Check the protocol version @@ -508,7 +508,7 @@ class InspIRCdProtocol(TS6BaseProtocol): # Separate the prefixes field (e.g. "(Yqaohv)!~&@%+") into a # dict mapping mode characters to mode prefixes. - self.prefixmodes = self.parsePrefixes(caps['PREFIX']) + self.prefixmodes = self.parse_isupport_prefixes(caps['PREFIX']) log.debug('(%s) self.prefixmodes set to %r', self.name, self.prefixmodes) diff --git a/protocols/ircs2s_common.py b/protocols/ircs2s_common.py index 1d7efab..6c9c96d 100644 --- a/protocols/ircs2s_common.py +++ b/protocols/ircs2s_common.py @@ -20,7 +20,7 @@ class IRCCommonProtocol(IRCNetwork): assert type(port) == int and 0 < port < 65535, "Invalid port %r for network %s" % (port, self.name) @staticmethod - def parseArgs(args): + def parse_args(args): """ Parses a string or list of of RFC1459-style arguments, where ":" may be used for multi-word arguments that last until the end of a line. @@ -41,10 +41,10 @@ class IRCCommonProtocol(IRCNetwork): return real_args @classmethod - def parsePrefixedArgs(cls, args): - """Similar to parseArgs(), but stripping leading colons from the first argument + def parse_prefixed_args(cls, args): + """Similar to parse_args(), but stripping leading colons from the first argument of a line (usually the sender field).""" - args = cls.parseArgs(args) + args = cls.parse_args(args) args[0] = args[0].split(':', 1)[1] return args @@ -106,7 +106,7 @@ class IRCCommonProtocol(IRCNetwork): 'channeldata': old_channels} @staticmethod - def parseCapabilities(args, fallback=''): + def parse_isupport(args, fallback=''): """ Parses a string of capabilities in the 005 / RPL_ISUPPORT format. """ @@ -127,7 +127,7 @@ class IRCCommonProtocol(IRCNetwork): return caps @staticmethod - def parsePrefixes(args): + def parse_isupport_prefixes(args): """ Separates prefixes field like "(qaohv)~&@%+" into a dict mapping mode characters to mode prefixes. @@ -159,7 +159,7 @@ class IRCS2SProtocol(IRCCommonProtocol): the SID of the uplink server. """ data = data.split(" ") - args = self.parseArgs(data) + args = self.parse_args(data) sender = args[0] sender = sender.lstrip(':') diff --git a/protocols/p10.py b/protocols/p10.py index 1b963d1..96da4a0 100644 --- a/protocols/p10.py +++ b/protocols/p10.py @@ -586,7 +586,7 @@ class P10Protocol(IRCS2SProtocol): if linenum: # Implies "if linenum > 0" # XXX: Ugh, this postprocessing sucks, but we have to make sure that mode prefixes are accounted # for in the burst. - wrapped_args = self.parseArgs(wrapped_msg.split(" ")) + wrapped_args = self.parse_args(wrapped_msg.split(" ")) wrapped_namelist = wrapped_args[-1].split(',') log.debug('(%s) sjoin: wrapped args: %s (post-wrap fixing)', self.name, wrapped_args)