home · contact · privacy
For MsgParseExpection task path parsing, allow starting directly with uppercase-refer...
authorChristian Heller <c.heller@plomlompom.de>
Tue, 30 Sep 2025 17:50:09 +0000 (19:50 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 30 Sep 2025 17:50:09 +0000 (19:50 +0200)
src/ircplom/client.py
src/ircplom/msg_parse_expectations.py

index 8c65d1e4140c5a5a1457a4a5181b149372b02806..3ebbc111559132b5a044e8e5cf81358d4c3f8439 100644 (file)
@@ -922,8 +922,10 @@ class Client(ABC, ClientQueueMixin):
         for verb in ('setattr', 'do', 'doafter'):
             for task, tok_names in [t for t in ret['_tasks'].items()
                                     if t[0].verb == verb]:
-                node: Any = self
-                for step in task.path:
+                path = list(task.path)
+                node: Any = (ret[path.pop(0)]
+                             if task.path and path[0].isupper() else self)
+                for step in path:
                     key = ret[step] if step.isupper() else step
                     node = (node[key] if isinstance(node, Dict)
                             else (node(key) if callable(node)
@@ -992,8 +994,6 @@ class Client(ABC, ClientQueueMixin):
         elif ret['_verb'] == 'PONG':
             assert self._expected_pong == ret['reply']
             self._expected_pong = ''
-        elif ret['_verb'] == 'QUIT':
-            ret['quitter'].quit(ret['message'])
 
 
 ClientsDb = dict[str, Client]
index 4027fd3e34f7f6a9327dfacc9221641130949c4a..95fbc5f6ae836bb066fd62b5504a02665bde1b4a 100644 (file)
@@ -568,6 +568,6 @@ MSG_EXPECTATIONS: list[_MsgParseExpectation] = [
 
     _MsgParseExpectation(
         'QUIT',
-        (_MsgTok.NICK_USER_HOST, ':quitter'),
-        ((_MsgTok.ANY, ':message'),)),
+        (_MsgTok.NICK_USER_HOST, ':QUITTER'),
+        ((_MsgTok.ANY, 'do_QUITTER.quit:message'),)),
 ]