mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
Irc: more parseArgs tweaks
- Make parsePrefixedArgs() a class method - Split the input if parseArgs() is given a raw string instead of a list
This commit is contained in:
parent
03fc16dd5a
commit
12bb59d257
11
classes.py
11
classes.py
@ -1329,9 +1329,13 @@ class Protocol():
|
||||
|
||||
@staticmethod
|
||||
def parseArgs(args):
|
||||
"""Parses a string of RFC1459-style arguments split into a list, where ":" may
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
if isinstance(args, str):
|
||||
args = args.split(' ')
|
||||
|
||||
real_args = []
|
||||
for idx, arg in enumerate(args):
|
||||
if arg.startswith(':') and idx != 0:
|
||||
@ -1432,10 +1436,11 @@ class Protocol():
|
||||
target = self.irc.nickToUid(target) or target
|
||||
return target
|
||||
|
||||
def parsePrefixedArgs(self, args):
|
||||
@classmethod
|
||||
def parsePrefixedArgs(cls, args):
|
||||
"""Similar to parseArgs(), but stripping leading colons from the first argument
|
||||
of a line (usually the sender field)."""
|
||||
args = self.parseArgs(args)
|
||||
args = cls.parseArgs(args)
|
||||
args[0] = args[0].split(':', 1)[1]
|
||||
return args
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user