Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dgw
Copy link
Contributor

@dgw dgw commented Oct 26, 2018

Added commands:

  • SetTrigger <string>: sets <string> as custom trigger phrase
  • SetTrigger: (no arguments) clears custom trigger phrase
  • ViewTrigger: shows current custom trigger phrase

If 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.

Added commands:

  SetTrigger <string>: sets <string> as custom trigger phrase
  SetTrigger: (no arguments) clears custom trigger phrase
  ViewTrigger: shows current custom trigger phrase
"type /msg NickServ IDENTIFY password") != CString::npos) &&
"type /msg NickServ IDENTIFY password") != CString::npos ||
sMessage.StripControls_n().find(
GetNV("CustomTrigger")) != CString::npos) &&
Copy link
Member

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?

Copy link
Contributor Author

@dgw dgw Oct 27, 2018

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.

Copy link
Contributor Author

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
Copy link

codecov bot commented Oct 27, 2018

Codecov Report

Merging #1612 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
modules/nickserv.cpp 4.67% <0%> (-0.95%) ⬇️
src/HTTPSock.cpp 41.73% <0%> (-0.81%) ⬇️
src/FileUtils.cpp 49.39% <0%> (-0.49%) ⬇️
src/ZNCString.cpp 78.01% <0%> (-0.1%) ⬇️
src/Utils.cpp 68.13% <0%> (+1.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b00cc30...2531c86. Read the comment docs.

modules/nickserv.cpp Show resolved Hide resolved
@dgw
Copy link
Contributor Author

dgw commented Nov 3, 2018

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 fixup commit…

@ilovelinux
Copy link

It doesn't seem to work with some phrases as trigger. I'll try to debug it on these days

@ilovelinux
Copy link

I no longer can test this. Can someone do tests? It's a very good feature to implement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to set custom identify request message on Nickserv module
3 participants