home · contact · privacy
Minor refactoring.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 19 Aug 2025 12:53:49 +0000 (14:53 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 19 Aug 2025 12:53:49 +0000 (14:53 +0200)
ircplom/client.py

index 9bd182972f4184ef0f5d802c64ee4f82537d086e..05c84e3da3970b01cb23ba9c60138dcb9a4e5110 100644 (file)
@@ -598,7 +598,6 @@ class Client(ABC, ClientQueueMixin):
                         and ('.' not in msg_tok or set('@!') & set(msg_tok)):
                     break
                 key_nick = 'sender' if not idx else 'nickname'
-                key_nick_me = f'{key_nick}_me'
                 if ex_tok is _MsgTok.CHANNEL:
                     if msg_tok[0] != '#':
                         break
@@ -608,10 +607,6 @@ class Client(ABC, ClientQueueMixin):
                     if msg_tok[0] in '~&@%+# ':
                         break
                     to_return[key_nick] = msg_tok
-                    if ex_tok is _MsgTok.NICKNAME_ME:
-                        if msg_tok != self._db.nickname:
-                            break
-                        to_return[key_nick_me] = to_return[key_nick]
                 elif ex_tok in {_MsgTok.USER_ADDRESS, _MsgTok.USER_ADDRESS_ME}:
                     toks = msg_tok.split('!')
                     if len(toks) != 2:
@@ -620,12 +615,12 @@ class Client(ABC, ClientQueueMixin):
                     if len(toks) != 3:
                         break
                     to_return[key_nick] = toks[0]
-                    if ex_tok is _MsgTok.USER_ADDRESS_ME:
-                        if not self._db.nickname == toks[0]:
-                            break
-                        to_return[key_nick_me] = to_return[key_nick]
-                elif ex_tok is _MsgTok.ANY:
+:               elif ex_tok is _MsgTok.ANY:
                     to_return['any'] = msg_tok
+                if ex_tok in {_MsgTok.NICKNAME_ME, _MsTok.USER_ADDRESS_ME}:
+                    if to_return[key_nick] != self._db.nickname:
+                        break
+                    to_return[f'{key_nick}_me'] = to_return[key_nick]
                 passing = True
             if passing:
                 return to_return