-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] nickserv: add custom trigger phrase support #1612
base: master
Are you sure you want to change the base?
Conversation
Added commands: SetTrigger <string>: sets <string> as custom trigger phrase SetTrigger: (no arguments) clears custom trigger phrase ViewTrigger: shows current custom trigger phrase
modules/nickserv.cpp
Outdated
"type /msg NickServ IDENTIFY password") != CString::npos) && | ||
"type /msg NickServ IDENTIFY password") != CString::npos || | ||
sMessage.StripControls_n().find( | ||
GetNV("CustomTrigger")) != CString::npos) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if GetNV("CustomTrigger")
is an empty string? This would always match, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it would. That's annoying, but expected. I just ran out of time to test that case earlier.
GetNV("CustomTrigger")
can have a default value assigned in OnLoad()
if it's empty that replaces one of the existing checks, or I can abstract this check into a bool defined earlier that is set to false
if GetNV("CustomTrigger").empty()
… Both options feel messy for different reasons, but I can't think of another way to avoid this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just made the if statement even more ridiculous to fix this. 😹 See cc523d4…
Codecov Report
@@ Coverage Diff @@
## master #1612 +/- ##
==========================================
- Coverage 37.44% 37.42% -0.02%
==========================================
Files 127 127
Lines 31030 31048 +18
Branches 93 93
==========================================
+ Hits 11618 11620 +2
- Misses 19363 19379 +16
Partials 49 49
Continue to review full report at Codecov.
|
Suggested by @ilovelinux on GitHub — Thanks!
Updated to incorporate feedback from @ilovelinux. Control codes are now removed from custom trigger text before it is saved. When the time comes to squash this, let me know. The little tweaks I've made since opening this PR don't need their own commits, really—especially the |
It doesn't seem to work with some phrases as trigger. I'll try to debug it on these days |
I no longer can test this. Can someone do tests? It's a very good feature to implement |
Added commands:
SetTrigger <string>
: sets<string>
as custom trigger phraseSetTrigger
: (no arguments) clears custom trigger phraseViewTrigger
: shows current custom trigger phraseIf merged, will resolve #1611.
I'm opening this now to get feedback, but I'm not done with it. In particular, I haven't tested all edge cases yet (what happens when the custom trigger phrase is
""
, for example), but I'm out of time to work on this tonight. Feedback on what I have so far will help me decide whether to spend more time on this later.