Autoop/Autovoice not triggering on rename #867

Open
opened 2026-10-05 04:49:20 +02:00 by adam · 7 comments
Owner
AddUser test nickname!ident@host __NOKEY__ #test

When using autoop in nokey-mode and a netsplit is happening, you often get disconnected (lose your op), then reconnect with the alternative nick nickname_ while your real nick nickname is still unavailable.
Then you rename (on manual or with the help of keepnick module).
But autoop is only giving op on rejoin, not on rename.

It often happens with autoop on efnet, where multiple netspits happen.
Autoop (and Autovoice) should also trigger on rename.

``` AddUser test nickname!ident@host __NOKEY__ #test ``` When using autoop in nokey-mode and a netsplit is happening, you often get disconnected (lose your op), then reconnect with the alternative nick `nickname_` while your real nick `nickname` is still unavailable. Then you rename (on manual or with the help of keepnick module). But autoop is only giving op on rejoin, not on rename. It often happens with autoop on efnet, where multiple netspits happen. Autoop (and Autovoice) should also trigger on rename. <!-- github-sync-id:355329719 -->
Author
Owner

either remove the nickname from the pattern so the ident@host will match or add nickname*!ident@host ..
the pattern should match for the mask.

example:
adding "ex!ex@example.com" will only match if all 3 variables are the same.
nick: ex
ident: ex
host: example.com

if you add it like this:
ex*!ex@example.com
then it will work for nick "ex_" as well.

either remove the nickname from the pattern so the ident@host will match or add nickname*!ident@host .. the pattern should match for the mask. example: adding "ex!ex@example.com" will only match if all 3 variables are the same. nick: ex ident: ex host: example.com if you add it like this: ex*!ex@example.com then it will work for nick "ex_" as well. <!-- github-comment-id:421246416 -->
Author
Owner

In terms of safety your solution is worse. I know also my solution is not the safest one 😉
It also not really solves the main problem. Why not just let it also reevaluate all rules on the rename-event?
What could be the problem, when doing this?

In terms of safety your solution is worse. I know also my solution is not the safest one 😉 It also not really solves the main problem. Why not just let it also reevaluate all rules on the rename-event? What could be the problem, when doing this? <!-- github-comment-id:421253580 -->
Author
Owner

i have set my autoop to
nick*!*ident@host
and with a key.

idk why you say its not secure. :D

i have set my autoop to nick*!*ident@host and with a key. idk why you say its not secure. :D <!-- github-comment-id:421335607 -->
Author
Owner

Of course it's secure with a key. But if you just trust static ip + nick (f.e. on efnet, where the ip is shown) and don't use a key, then nick*wildcard is less secure.

In addition someone might have a total different nick as alternative nick. You'll never know.
F.e. I use a prefixed nick as alternative nick. Not nickname_

Nevertheless: this is not the issue here. Why can't autoop/autovoice react on rename?

Of course it's secure with a key. But if you just trust static ip + nick (f.e. on efnet, where the ip is shown) and don't use a key, then nick*wildcard is less secure. In addition someone might have a total different nick as alternative nick. You'll never know. F.e. I use a prefixed nick as alternative nick. Not nickname_ Nevertheless: this is not the issue here. Why can't autoop/autovoice react on rename? <!-- github-comment-id:421474743 -->
Author
Owner

@keigel2001 patch welcome...

@keigel2001 patch welcome... <!-- github-comment-id:421531872 -->
Author
Owner

Anyone who wants to implement this: The OnNickMessage hook is what you'll want to use. (@keigel2001, maybe you'd like to give it a shot?)

Anyone who wants to implement this: The `OnNickMessage` hook is what you'll want to use. (@keigel2001, maybe you'd like to give it a shot?) <!-- github-comment-id:421532900 -->
Author
Owner

I just made this, no testing other than what you see below so run at own risk. Most likely better ways to write this.

Known issues:

  • Missing if (Channel.HasPerm(CChan::Op)) { ... } code. I don't know how to get that to work in this.
  • Does not check if you are already op. If you switch to another nick and back it will op you again.
    void OnNickMessage(CNickMessage& Message, const vector<CChan*>& vChans) override {
        const CNick& OldNick = Message.GetNick();

        const CString sNewNick = Message.GetNewNick();
        const CString sIdent = OldNick.GetIdent();
        const CString sMask = OldNick.GetHost();

        const CString someone_fix_this = sNewNick + "!" + sIdent + "@" + sMask;

        for (CChan* pChan : vChans) {
            CheckAutoOp(someone_fix_this, *pChan);
        }
    }
01:54:34 <KindOne> listusers
01:54:34 <*autoop> There are no users defined
01:54:39 <KindOne> adduser znc-linker znc-linker!kindone@127.0.0.1 __NOKEY__ #test
01:54:39 <*autoop> User znc-linker added with hostmask(s) znc-linker!kindone@127.0.0.1
01:54:44 <KindOne> listusers
01:54:44 <*autoop> +------------+------------------------------+-----------+----------+
01:54:44 <*autoop> | User       | Hostmasks                    | Key       | Channels |
01:54:44 <*autoop> +------------+------------------------------+-----------+----------+
01:54:44 <*autoop> | znc-linker | znc-linker!kindone@127.0.0.1 | __NOKEY__ | #test    |
01:54:44 <*autoop> +------------+------------------------------+-----------+----------+
01:54:57 -!- KindOne [kindone@127.0.0.1] has joined #test
01:54:57 -!- ServerMode/#test [+nt] by irc.foobar.net
01:55:03 -!- znc-linker_ [kindone@127.0.0.1] has joined #test
01:55:09 -!- znc-linker_ is now known as znc-linker
01:55:09 -!- KindOne sets mode: +o znc-linker
I just made this, no testing other than what you see below so run at own risk. Most likely better ways to write this. Known issues: - Missing ```if (Channel.HasPerm(CChan::Op)) { ... }``` code. I don't know how to get that to work in this. - Does not check if you are already op. If you switch to another nick and back it will op you again. ``` void OnNickMessage(CNickMessage& Message, const vector<CChan*>& vChans) override { const CNick& OldNick = Message.GetNick(); const CString sNewNick = Message.GetNewNick(); const CString sIdent = OldNick.GetIdent(); const CString sMask = OldNick.GetHost(); const CString someone_fix_this = sNewNick + "!" + sIdent + "@" + sMask; for (CChan* pChan : vChans) { CheckAutoOp(someone_fix_this, *pChan); } } ``` ``` 01:54:34 <KindOne> listusers 01:54:34 <*autoop> There are no users defined 01:54:39 <KindOne> adduser znc-linker znc-linker!kindone@127.0.0.1 __NOKEY__ #test 01:54:39 <*autoop> User znc-linker added with hostmask(s) znc-linker!kindone@127.0.0.1 01:54:44 <KindOne> listusers 01:54:44 <*autoop> +------------+------------------------------+-----------+----------+ 01:54:44 <*autoop> | User | Hostmasks | Key | Channels | 01:54:44 <*autoop> +------------+------------------------------+-----------+----------+ 01:54:44 <*autoop> | znc-linker | znc-linker!kindone@127.0.0.1 | __NOKEY__ | #test | 01:54:44 <*autoop> +------------+------------------------------+-----------+----------+ ``` ``` 01:54:57 -!- KindOne [kindone@127.0.0.1] has joined #test 01:54:57 -!- ServerMode/#test [+nt] by irc.foobar.net 01:55:03 -!- znc-linker_ [kindone@127.0.0.1] has joined #test 01:55:09 -!- znc-linker_ is now known as znc-linker 01:55:09 -!- KindOne sets mode: +o znc-linker ``` <!-- github-comment-id:421898432 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#867