home · contact · privacy
Fix message parser ignoring content of str-only tok args.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 20 Sep 2025 02:39:23 +0000 (04:39 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 20 Sep 2025 02:39:23 +0000 (04:39 +0200)
ircplom/msg_parse_expectations.py
test.txt

index bd6d29db69f7209bceef2e1120d7baa1c326ae8a..e91073170d9eadb9bf0828271a8578d212c59136 100644 (file)
@@ -104,9 +104,10 @@ class _MsgParseExpectation:
         nickuserhosts = []
         for ex_tok, cmp_tok in [(ex_tok, cmp_fields[idx])
                                 for idx, ex_tok in enumerate(ex_fields)]:
-            if (not isinstance(ex_tok.type_, str))\
-                    and ex_tok.type_ in validators\
-                    and (not validators[ex_tok.type_](cmp_tok)):
+            if isinstance(ex_tok.type_, str) and ex_tok.type_ != cmp_tok:
+                return None
+            if ex_tok.type_ in validators\
+                    and not validators[ex_tok.type_](cmp_tok):
                 return None
             if ex_tok.code or ex_tok.type_ is _MsgTok.NICK_USER_HOST:
                 value = (cmp_tok if (isinstance(ex_tok.type_, str)
index 5a72a4ccb1580d547ea572ce08d1b347cb8195b0..2ca0dd1f8a8f1aff7434f3903d8842a7e4a29a8a 100644 (file)
--- a/test.txt
+++ b/test.txt
@@ -90,8 +90,8 @@
 2 < :*.?.net CAP * LS : foo bar sasl=PLAIN,EXTERNAL baz
 2 > CAP REQ :sasl
 2 > CAP :LIST
-2 < :*.?.net CAP ? ACK :sasl
-2 < :*.?.net CAP ? LIST :cap-notify sasl
+2 < :*.?.net CAP * ACK :sasl
+2 < :*.?.net CAP * LIST :cap-notify sasl
 1,2 $ caps:bar:data set to: []
 1,2 $ caps:baz:data set to: []
 1,2 $ caps:foo:data set to: []