Skip to content

Initial HalfOps features#1825

Open
skralg wants to merge 6 commits into
znc:masterfrom
skralg:master
Open

Initial HalfOps features#1825
skralg wants to merge 6 commits into
znc:masterfrom
skralg:master

Conversation

@skralg

@skralg skralg commented Feb 26, 2022

Copy link
Copy Markdown

Almost entirely copy/paste with small edits to function names.
Added autohalfop module, nearly the same as the autoop module.

Comment thread include/znc/Modules.h Outdated
Comment thread include/znc/Modules.h Outdated
/** Called when a nick is dehalfopped on a channel */
virtual void OnDeHalfOp2(const CNick* pOpNick, const CNick& Nick,
CChan& Channel, bool bNoChange);
virtual void OnDeHalfOp(const CNick& OpNick, const CNick& Nick, CChan& Channel,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If adding new callbacks, need to update modperl and modpython

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modperl and modpython updated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've missed the function.in files.

Comment thread modules/autohalfop.cpp Outdated
Info.SetWikiPage("autohalfop");
}

NETWORKMODULEDEFS(CAutoHalfOpMod, t_s("Auto halfop the good people"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't copypaste/duplicate code like that. A better way would be to have a single module which supports ops, voices, halfops

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps that shall be my second contribution.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it shall.

I believe merging this PR can wait until that's done though.

@codecov

codecov Bot commented Feb 26, 2022

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 1.04167% with 665 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.91%. Comparing base (9be0cae) to head (4ff25a5).
⚠️ Report is 468 commits behind head on master.

Files with missing lines Patch % Lines
modules/autohalfop.cpp 0.78% 377 Missing ⚠️
modules/automode.cpp 1.12% 264 Missing ⚠️
src/Modules.cpp 0.00% 12 Missing ⚠️
src/Chan.cpp 9.09% 10 Missing ⚠️
modules/modperl/startup.pl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1825      +/-   ##
==========================================
- Coverage   41.87%   40.91%   -0.97%     
==========================================
  Files         122      124       +2     
  Lines       27799    28471     +672     
  Branches       33       33              
==========================================
+ Hits        11642    11649       +7     
- Misses      16132    16797     +665     
  Partials       25       25              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@skralg

skralg commented Feb 27, 2022

Copy link
Copy Markdown
Author

Ready for another look

@skralg

skralg commented Feb 28, 2022

Copy link
Copy Markdown
Author

I've added a new 'automode' module that can do automatic arbitrary mode changes.

@skralg

skralg commented Mar 3, 2022

Copy link
Copy Markdown
Author

@DarthGandalf Have you looked at the new automode module yet?

@DarthGandalf DarthGandalf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify: it doesn't check the key like autoop did?

Comment thread modules/automode.cpp
if (Nick.GetNick() == GetNetwork()->GetIRCNick().GetNick()) {
const map<CString, CNick>& msNicks = Channel.GetNicks();
for (const auto& it : msNicks) {
if (!it.second.HasPerm(CChan::HalfOp)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. That needs to become more robust.

Comment thread modules/automode.cpp
"[channels]"));
} else if (sMode != "q" && sMode != "a" && sMode != "o" &&
sMode != "h" && sMode != "v") {
PutModule("<mode> must be one of the following: qaohv");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed t_s

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work fine.. what is t_s anyway?

@skralg

skralg commented Mar 5, 2022

Copy link
Copy Markdown
Author

To clarify: it doesn't check the key like autoop did?

I removed the key mechanism altogether because I don't know a single person who doesn't just use NOKEY. Having to request it sort of defeats the purpose of calling it 'auto'...

@DarthGandalf

DarthGandalf commented Mar 5, 2022 via email

Copy link
Copy Markdown
Member

@DarthGandalf

DarthGandalf commented Mar 5, 2022 via email

Copy link
Copy Markdown
Member

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.

2 participants