1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 17:03:12 +02:00

Track what "level" channel status modes are, which allows us to have chanserv/mode determine if a status mode can be set by users better

This commit is contained in:
Adam
2011-08-19 04:18:13 -04:00
parent 6401d93b8e
commit 4fcb371bc8
10 changed files with 91 additions and 52 deletions
+19
View File
@@ -688,6 +688,25 @@ class Inspircd20IRCdMessage : public InspircdIRCdMessage
Anope::string maxmodes(capab.begin() + 9, capab.end());
ircd->maxmodes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3;
}
else if (capab.find("PREFIX=") != Anope::string::npos)
{
Anope::string modes(capab.begin() + 8, capab.begin() + capab.find(')'));
Anope::string chars(capab.begin() + capab.find(')') + 1, capab.end());
unsigned short level = modes.length() - 1;
for (size_t t = 0, end = modes.length(); t < end; ++t)
{
ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[t]);
if (cm == NULL || cm->Type != MODE_STATUS)
{
Log() << "CAPAB PREFIX gave unknown channel status mode " << modes[t];
continue;
}
ChannelModeStatus *cms = debug_cast<ChannelModeStatus *>(cm);
cms->Level = level--;
}
}
}
}
else if (params[0].equals_cs("END"))