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

Initial HalfOps features #1825

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

Initial HalfOps features #1825

wants to merge 6 commits into from

Conversation

skralg
Copy link

@skralg skralg commented Feb 26, 2022

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

include/znc/Modules.h Outdated Show resolved Hide resolved
/** 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
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
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
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.

Info.SetWikiPage("autohalfop");
}

NETWORKMODULEDEFS(CAutoHalfOpMod, t_s("Auto halfop the good people"))
Copy link
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
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
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
Copy link

codecov bot commented Feb 26, 2022

Codecov Report

Merging #1825 (4ff25a5) into master (9be0cae) will decrease coverage by 0.96%.
The diff coverage is 1.04%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
include/znc/Chan.h 54.71% <ø> (ø)
include/znc/Modules.h 62.60% <ø> (ø)
modules/modperl/module.h 40.00% <ø> (ø)
modules/modperl/startup.pl 33.46% <0.00%> (-0.14%) ⬇️
modules/modpython/module.h 61.84% <ø> (ø)
src/Modules.cpp 63.11% <0.00%> (-0.56%) ⬇️
modules/autohalfop.cpp 0.78% <0.78%> (ø)
modules/automode.cpp 1.12% <1.12%> (ø)
src/Chan.cpp 66.32% <9.09%> (-1.31%) ⬇️

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 9be0cae...4ff25a5. Read the comment docs.

@skralg
Copy link
Author

skralg commented Feb 27, 2022

Ready for another look

@skralg
Copy link
Author

skralg commented Feb 28, 2022

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

@skralg
Copy link
Author

skralg commented Mar 3, 2022

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

Copy link
Member

@DarthGandalf DarthGandalf left a comment

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?

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

"[channels]"));
} else if (sMode != "q" && sMode != "a" && sMode != "o" &&
sMode != "h" && sMode != "v") {
PutModule("<mode> must be one of the following: qaohv");
Copy link
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
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
Copy link
Author

skralg commented Mar 5, 2022

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

DarthGandalf commented Mar 5, 2022 via email

@DarthGandalf
Copy link
Member

DarthGandalf commented Mar 5, 2022 via email

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.

None yet

2 participants