mirror of https://github.com/jesopo/ircstates
add Emit.tokens, use it for CAP tokens
This commit is contained in:
parent
99a2a50d23
commit
b874aeb295
|
@ -6,7 +6,8 @@ class Emit(object):
|
|||
command: Optional[str] = None
|
||||
subcommand: Optional[str] = None
|
||||
|
||||
text: Optional[str] = None
|
||||
text: Optional[str] = None
|
||||
tokens: Optional[List[str]] = None
|
||||
|
||||
finished: Optional[bool] = None
|
||||
|
||||
|
|
|
@ -644,14 +644,18 @@ class Server(Named):
|
|||
multiline = line.params[2] == "*"
|
||||
caps = line.params[2 + (1 if multiline else 0)]
|
||||
|
||||
|
||||
tokens: Dict[str, Optional[str]] = {}
|
||||
tokens_str: List[str] = []
|
||||
for cap in filter(bool, caps.split(" ")):
|
||||
tokens_str.append(cap)
|
||||
key, _, value = cap.partition("=")
|
||||
tokens[key] = value or None
|
||||
|
||||
emit = self._emit()
|
||||
emit.subcommand = subcommand
|
||||
emit.finished = not multiline
|
||||
|
||||
tokens: Dict[str, Optional[str]] = {}
|
||||
for cap in filter(bool, caps.split(" ")):
|
||||
key, _, value = cap.partition("=")
|
||||
tokens[key] = value or None
|
||||
emit.tokens = tokens_str
|
||||
|
||||
if subcommand == "LS":
|
||||
self._temp_caps.update(tokens)
|
||||
|
|
Loading…
Reference in New Issue