add Emit.tokens, use it for CAP tokens

This commit is contained in:
jesopo 2020-04-01 23:18:22 +01:00
parent 99a2a50d23
commit b874aeb295
2 changed files with 11 additions and 6 deletions

View File

@ -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

View File

@ -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)