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
Rework MODE/RPL_CHANMODEIS handling for trailing args #1661
Conversation
|
There's always some problem : and also : IdleKick sets mode: +v :BrAvE`OuT ChanServ sets mode: +qo BrAvE |
|
@H7-25 Is this with my changes or without? |
|
@linuxdaemon sorry i'm wrong, i hadn't chekout the right branch, i've try just now but i've an error compiling it : [ 3%] Building CXX object src/CMakeFiles/znclib.dir/Chan.cpp.o |
|
@linuxdaemon it crash a first client connection attempt |
|
@H7-25 should be fixed |
|
@linuxdaemon look work fine, i'm using it just now for my network staff i let you know if i find issue |
Codecov Report
@@ Coverage Diff @@
## master #1661 +/- ##
==========================================
+ Coverage 38.31% 38.56% +0.24%
==========================================
Files 125 125
Lines 30148 30189 +41
Branches 93 93
==========================================
+ Hits 11551 11641 +90
+ Misses 18548 18499 -49
Partials 49 49
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1661 +/- ##
==========================================
+ Coverage 37.23% 37.24% +0.01%
==========================================
Files 127 127
Lines 31052 31084 +32
Branches 93 93
==========================================
+ Hits 11561 11577 +16
- Misses 19442 19458 +16
Partials 49 49
Continue to review full report at Codecov.
|
|
This should go to master, not to 1.7.x. It's too big change to be considered there |
include/znc/Chan.h
Outdated
| @@ -77,7 +77,9 @@ class CChan : private CCoreTranslationMixin { | |||
|
|
|||
| // Modes | |||
| void SetModes(const CString& s); | |||
| void SetModes(const VCString& vsModes); | |||
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.
Signature of this method indicates that every mode is in a separate string. How are parameters passed? e.g. which nick got +o and which mask got +b?
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.
This is a vector of {"+oosvb", "Op1", "Op2", "VoicedUser", "BannedUser!*@*"}, acting the same as SetModes(const CString&) but taking the arguments directly from the message instead of concating them and re-splitting them inside of SetModes as is currently done.
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.
Could you add a comment explaining that?
Also, since the first element is special, probably it belongs to a separate parameter
|
Any tests? |
src/Chan.cpp
Outdated
| CString sModeArg = sModes.Token(0); | ||
| CString sArgs = sModes.Token(1, true); | ||
| void CChan::ModeChange(const VCString& vsModes, const CNick* pOpNick) { | ||
| CString sModeArg = vsModes.at(0); |
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.
Can vsModes be empty?
|
I'm using this patch for my network staff. I confirm that there's always some problem with mode parsing, · ChanServ sets mode: +qo Simos :Simos This using Adiirc + ZNC (with @linuxdaemon patch) After a while (it can run for same days) ZNC crash, i've to enable core file generation but i've not found how. |
|
Debug enabled i'll share gdb back trace asap. |
Not currently, I will work on those when I can get back around to this |
Some servers may send a colon even if the last parameter doesn't need it, currently this leads to issues with permission/mode tracking, as the core doesn't handle the colon properly. This fix replaces reconstructing the parameter string with just passing a vector of the relevant parameters to CChan::SetModes() and adds overrides for CChan::SetModes() and CChan::ModeChange() that accept the vector instead.
The mode character string will be passed as the first argument, while the mode parameters are sent as a VCString as the second parameter
|
@linuxdaemon , can't compile : [ 0%] Built target copy_csocket_h |
|
@H7-25 Please can you set your locale to |
|
@linuxdaemon sorry i was not thinking to locale [ 0%] Built target copy_csocket_h |
|
@H7-25 I'm unable to replicate that issue, did you run make clean before rebuilding? |
|
@linuxdaemon yes i've try |
|
@linuxdaemon, compiled, i've had to make a new git clone, it wasn't like something after latest pull. |
|
@linuxdaemon there's still some issue : Quote get +Y when join a channel : |
|
@H7-25 Unable to replicate, but I have added tests for that case just in case. That might be a bug with your client |
|
@linuxdaemon, sorry, i confirm is a textual issue, not znc |
|
@DarthGandalf any other changes needed? |
|
As far as I can tell, this is ready to go. I'm unsure why CI failed, but the tests passed locally just fine |
test/MessageTest.cpp
Outdated
| EXPECT_THAT(CMessage("CMD").GetParamsSplit(1, 10), ContainerEq(VCString())); | ||
| EXPECT_THAT(CMessage("CMD").GetParamsSplit(-1, 10), ContainerEq(VCString())); | ||
|
|
||
| EXPECT_THAT(CMessage("CMD p1 :p2 p3").GetParamsSplit(0), ContainerEq(VCString({"p1", "p2 p3"}))); |
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.
ElementsAre("p1", "p2 p2") would be simpler; and the same for the rest of of this test
test/MessageTest.cpp
Outdated
| EXPECT_THAT(CMessage("CMD p1 :p2 p3").GetParamsSplit(-1), ContainerEq(VCString())); | ||
|
|
||
| EXPECT_THAT(CMessage("CMD p1 :p2 p3").GetParamsSplit(0, 0), ContainerEq(VCString())); | ||
| EXPECT_THAT(CMessage("CMD p1 :p2 p3").GetParamsSplit(1, 0), ContainerEq(VCString())); |
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.
IsEmpty()
|
And no, I didn't see any notification that there is a new commit after my last comments. Please say something here, otherwise it's not known that something was changed. |
|
All comments have been addressed |
Some servers may send a colon even if the last parameter doesn't need it, currently this leads to issues with permission/mode tracking, as the core doesn't handle the colon properly. This fix replaces reconstructing the parameter string with just passing a vector of the relevant parameters to CChan::SetModes() and adds overrides for CChan::SetModes() and CChan::ModeChange() that accept the vector instead. Clean up uses of old CModeMessage::GetModes() (cherry picked from commit 9536945)

Some servers may send a colon even if the last parameter doesn't need
it, currently this leads to issues with permission/mode tracking, as the
core doesn't handle the colon properly.
This fix replaces reconstructing the parameter string with just passing a vector of the relevant parameters to CChan::SetModes() and adds overrides for CChan::SetModes() and CChan::ModeChange() that accept the vector instead.
Fixes #1637
The text was updated successfully, but these errors were encountered: