1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 09:36:38 +02:00

Made auto* chanserv privileges not hard coded.

Made cs_statusupdate not remove status on users if they still match other entries.
Move privilege descriptions out of the config
This commit is contained in:
Adam
2013-04-08 00:19:07 -05:00
parent fb7fef7a84
commit 1a37e1c048
11 changed files with 136 additions and 139 deletions
+33
View File
@@ -25,6 +25,9 @@ std::vector<UserMode *> ModeManager::UserModes;
static std::map<Anope::string, ChannelMode *> ChannelModesByName;
static std::map<Anope::string, UserMode *> UserModesByName;
/* Sorted by status */
static std::vector<ChannelModeStatus *> ChannelModesByStatus;
/* Number of generic modes we support */
unsigned ModeManager::GenericChannelModes = 0, ModeManager::GenericUserModes = 0;
@@ -349,6 +352,8 @@ bool ModeManager::AddChannelMode(ChannelMode *cm)
if (want >= ModeManager::ChannelModes.size())
ModeManager::ChannelModes.resize(want + 1);
ModeManager::ChannelModes[want] = cms;
RebuildStatusModes();
}
ChannelModesByName[cm->name] = cm;
@@ -406,6 +411,8 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm)
return;
ModeManager::ChannelModes[want] = NULL;
RebuildStatusModes();
}
ChannelModesByName.erase(cm->name);
@@ -470,6 +477,32 @@ const std::vector<UserMode *> &ModeManager::GetUserModes()
return UserModes;
}
const std::vector<ChannelModeStatus *> &ModeManager::GetStatusChannelModesByRank()
{
return ChannelModesByStatus;
}
static struct StatusSort
{
bool operator()(ChannelModeStatus *cm1, ChannelModeStatus *cm2) const
{
return cm1->level > cm2->level;
}
} statuscmp;
void ModeManager::RebuildStatusModes()
{
ChannelModesByStatus.clear();
for (unsigned j = 0; j < ModeManager::GetChannelModes().size(); ++j)
{
ChannelMode *cm = ModeManager::GetChannelModes()[j];
if (cm && cm->type == MODE_STATUS && std::find(ChannelModesByStatus.begin(), ChannelModesByStatus.end(), cm) == ChannelModesByStatus.end())
ChannelModesByStatus.push_back(anope_dynamic_static_cast<ChannelModeStatus *>(cm));
}
std::sort(ChannelModesByStatus.begin(), ChannelModesByStatus.end(), statuscmp);
}
void ModeManager::StackerAdd(const BotInfo *bi, Channel *c, ChannelMode *cm, bool Set, const Anope::string &Param)
{
StackerInfo *s = GetInfo(ChannelStackerObjects, c);