diff options
| author | 2010-02-09 13:19:50 -0600 | |
|---|---|---|
| committer | 2010-08-03 17:32:35 -0400 | |
| commit | 146acdea12ca8a1631d0f98b595535241f6e438d (patch) | |
| tree | 8c81aa3288067241ff135157224d24709a56278b /src/mode.cpp | |
| parent | Remove duplication of some huge functions (diff) | |
Implement missing modechange constructors
Diffstat (limited to 'src/mode.cpp')
| -rw-r--r-- | src/mode.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index f2152566a..d1425ba24 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -213,6 +213,21 @@ void ModeWatcher::AfterMode(User*, User*, Channel*, const std::string&, bool, Mo { } +irc::modechange::modechange(const std::string& name, const std::string& param, bool add) + : adding(add), value(param) +{ + ModeHandler* mh = ServerInstance->Modes->FindMode(name); + if (mh) + mode = mh->id; +} + +irc::modechange::modechange(char modechar, ModeType type, const std::string& param, bool add) +{ + ModeHandler* mh = ServerInstance->Modes->FindMode(modechar, type); + if (mh) + mode = mh->id; +} + std::string irc::modestacker::popModeLine(bool use_uid) { char pm_now = '\0'; @@ -672,6 +687,9 @@ bool ModeParser::AddMode(ModeHandler* mh) if (FindMode(mh->GetModeChar(), mh->GetModeType())) return false; + if (FindMode(mh->name)) + return false; + for(int id = 1; id < MODE_ID_MAX; id++) { if (handlers[id]) @@ -788,7 +806,7 @@ ModeHandler* ModeParser::FindPrefix(unsigned const char pfxletter) return NULL; } -std::string ModeParser::GiveModeList(ModeMasks m) +std::string ModeParser::GiveModeList(ModeType m) { std::string type1; /* Listmodes EXCEPT those with a prefix */ std::string type2; /* Modes that take a param when adding or removing */ @@ -798,7 +816,7 @@ std::string ModeParser::GiveModeList(ModeMasks m) for(ModeIDIter id; id; id++) { ModeHandler* mh = FindMode(id); - if (mh) + if (mh && mh->GetModeType() == m) { if (mh->GetNumParams(true)) { @@ -1149,6 +1167,7 @@ struct builtin_modes void init(ModeParser* modes) { + b.init(); modes->AddMode(&s); modes->AddMode(&p); modes->AddMode(&m); |
