From: Christian Heller Date: Sat, 20 Sep 2025 02:39:23 +0000 (+0200) Subject: Fix message parser ignoring content of str-only tok args. X-Git-Url: https://plomlompom.com/repos/booking/processes?a=commitdiff_plain;h=3b26da599cd287a01320f55b6e885b9cf0787d4e;p=ircplom Fix message parser ignoring content of str-only tok args. --- diff --git a/ircplom/msg_parse_expectations.py b/ircplom/msg_parse_expectations.py index bd6d29d..e910731 100644 --- a/ircplom/msg_parse_expectations.py +++ b/ircplom/msg_parse_expectations.py @@ -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) diff --git a/test.txt b/test.txt index 5a72a4c..2ca0dd1 100644 --- 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: []