diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-19 01:53:03 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-19 01:53:03 +0000 |
| commit | e514a3793d251409428caf53cbb75f0be90a6f38 (patch) | |
| tree | 349c4cfc9fc45735999fd81d39a515560ab0e083 /src/chanserv.c | |
| parent | 68381e69d94735010df986b22c8e758981b50995 (diff) | |
Changed the mode param handling code to be more into the general mode handling code, this cleans up and fixes some small problems with mlocking params. This also helps clarify that the ChannelInfo mode functions are for mlock only. Also, this adds the OnMLock and OnUnMLock events which can be used to control if something can be (un)mlocked
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2660 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/chanserv.c')
| -rw-r--r-- | src/chanserv.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/chanserv.c b/src/chanserv.c index 6413e468b..19ab774f1 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -483,27 +483,27 @@ void load_cs_dbase() { std::ostringstream limit; limit << tmp32; - ci->SetParam(CMODE_LIMIT, limit.str()); + ci->SetMLock(CMODE_LIMIT, true, limit.str()); } SAFE(read_string(&s, f)); if (s) { - ci->SetParam(CMODE_KEY, std::string(s)); + ci->SetMLock(CMODE_KEY, true, std::string(s)); delete [] s; } SAFE(read_string(&s, f)); if (s) { - ci->SetParam(CMODE_FLOOD, std::string(s)); + ci->SetMLock(CMODE_FLOOD, true, std::string(s)); delete [] s; } SAFE(read_string(&s, f)); if (s) { - ci->SetParam(CMODE_REDIRECT, std::string(s)); + ci->SetMLock(CMODE_REDIRECT, true, std::string(s)); delete [] s; } @@ -836,7 +836,7 @@ void check_modes(Channel * c) cm = it->second; /* If this channel does not have the mode and the mode is mlocked */ - if (!c->HasMode(cm->Name) && ci->HasMLock(cm->Name, true)) + if (cm->Type == MODE_REGULAR && !c->HasMode(cm->Name) && ci->HasMLock(cm->Name, true)) { modebuf += it->first; c->SetMode(cm->Name); @@ -853,18 +853,19 @@ void check_modes(Channel * c) } } } - /* If this is a param mode and its mlocked and is set negative */ - else if (cm->Type == MODE_PARAM && c->HasMode(cm->Name) && ci->HasMLock(cm->Name, true)) + /* If this is a param mode and its mlocked, check to ensure it is set and set to the correct value */ + else if (cm->Type == MODE_PARAM && ci->HasMLock(cm->Name, true)) { cmp = static_cast<ChannelModeParam *>(cm); c->GetParam(cmp->Name, ¶m); ci->GetParam(cmp->Name, &ciparam); - if (!param.empty() && !ciparam.empty() && param != ciparam) + /* If the channel doesnt have the mode, or it does and it isn't set correctly */ + if (!c->HasMode(cm->Name) || (!param.empty() && !ciparam.empty() && param != ciparam)) { modebuf += it->first; - c->SetParam(cmp->Name, ciparam); + c->SetMode(cmp->Name, ciparam); argbuf += " " + ciparam; } |
