summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-06 17:20:45 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-06 17:20:45 +0000
commit9596cc3ebfd798440e91923178a7468fb012e532 (patch)
treeea4e7c80ef34433f0d1928f747efea7ef0e01853
parent7ab25fcf47e0ec9c898c7ca9a52071d883127c6e (diff)
Extra check so that we dont get -O-s when doing:
MODE #chan +Osnt MODE #chan -O+n-s (the +n would get dropped, but the - and the s get put in the mode sequence) To fix, we store the last *successful* state change, as well as the last attempted state change. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6235 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/mode.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 11fecf06a..a7e8be620 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -380,11 +380,14 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
unsigned char handler_id = 0;
int parameter_counter = 2; /* Index of first parameter */
int parameter_count = 0;
+ bool last_successful_state_change = false;
/* A mode sequence that doesnt start with + or -. Assume +. - Thanks for the suggestion spike (bug#132) */
if ((*mode_sequence.begin() != '+') && (*mode_sequence.begin() != '-'))
mode_sequence.insert(0, "+");
+ last_successful_state_change = (mode_sequence[0] == '-');
+
for (std::string::const_iterator letter = mode_sequence.begin(); letter != mode_sequence.end(); letter++)
{
unsigned char modechar = *letter;
@@ -483,7 +486,11 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
{
/* We're about to output a valid mode letter - was there previously a pending state-change? */
if (state_change)
- output_sequence.append(adding ? "+" : "-");
+ {
+ if (adding != last_successful_state_change)
+ output_sequence.append(adding ? "+" : "-");
+ last_successful_state_change = adding;
+ }
/* Add the mode letter */
output_sequence.push_back(modechar);