mirror of
https://github.com/anope/anope.git
synced 2026-07-04 20:13:13 +02:00
Fixed /ms set limit none and made db_plain care less about convert exceptions
This commit is contained in:
+1
-1
@@ -485,7 +485,7 @@ class Memo : public Flags<MemoFlag>
|
|||||||
|
|
||||||
struct CoreExport MemoInfo
|
struct CoreExport MemoInfo
|
||||||
{
|
{
|
||||||
unsigned memomax;
|
int16 memomax;
|
||||||
std::vector<Memo *> memos;
|
std::vector<Memo *> memos;
|
||||||
|
|
||||||
unsigned GetIndex(Memo *m) const;
|
unsigned GetIndex(Memo *m) const;
|
||||||
|
|||||||
+207
-194
@@ -573,41 +573,48 @@ class DBPlain : public Module
|
|||||||
|
|
||||||
EventReturn OnDatabaseReadMetadata(NickCore *nc, const Anope::string &key, const std::vector<Anope::string> ¶ms)
|
EventReturn OnDatabaseReadMetadata(NickCore *nc, const Anope::string &key, const std::vector<Anope::string> ¶ms)
|
||||||
{
|
{
|
||||||
if (key.equals_ci("LANGUAGE"))
|
try
|
||||||
nc->language = params[0];
|
|
||||||
else if (key.equals_ci("MEMOMAX"))
|
|
||||||
nc->memos.memomax = params[0].is_pos_number_only() ? convertTo<int16>(params[0]) : 1;
|
|
||||||
else if (key.equals_ci("CHANCOUNT"))
|
|
||||||
nc->channelcount = params[0].is_pos_number_only() ? convertTo<uint16>(params[0]) : 0;
|
|
||||||
else if (key.equals_ci("EMAIL"))
|
|
||||||
nc->email = params[0];
|
|
||||||
else if (key.equals_ci("GREET"))
|
|
||||||
nc->greet = params[0];
|
|
||||||
else if (key.equals_ci("ACCESS"))
|
|
||||||
nc->AddAccess(params[0]);
|
|
||||||
else if (key.equals_ci("FLAGS"))
|
|
||||||
{
|
{
|
||||||
for (unsigned j = 0, end = params.size(); j < end; ++j)
|
if (key.equals_ci("LANGUAGE"))
|
||||||
for (int i = 0; NickCoreFlags[i].Flag != -1; ++i)
|
nc->language = params[0];
|
||||||
if (params[j].equals_ci(NickCoreFlags[i].Name))
|
else if (key.equals_ci("MEMOMAX"))
|
||||||
nc->SetFlag(NickCoreFlags[i].Flag);
|
nc->memos.memomax = params[0].is_pos_number_only() ? convertTo<int16>(params[0]) : -1;
|
||||||
}
|
else if (key.equals_ci("CHANCOUNT"))
|
||||||
else if (key.equals_ci("MI"))
|
nc->channelcount = params[0].is_pos_number_only() ? convertTo<uint16>(params[0]) : 0;
|
||||||
{
|
else if (key.equals_ci("EMAIL"))
|
||||||
Memo *m = new Memo;
|
nc->email = params[0];
|
||||||
m->time = params[0].is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
else if (key.equals_ci("GREET"))
|
||||||
m->sender = params[1];
|
nc->greet = params[0];
|
||||||
for (unsigned j = 2; params[j].equals_ci("UNREAD") || params[j].equals_ci("RECEIPT") || params[j].equals_ci("NOTIFYS"); ++j)
|
else if (key.equals_ci("ACCESS"))
|
||||||
|
nc->AddAccess(params[0]);
|
||||||
|
else if (key.equals_ci("FLAGS"))
|
||||||
{
|
{
|
||||||
if (params[j].equals_ci("UNREAD"))
|
for (unsigned j = 0, end = params.size(); j < end; ++j)
|
||||||
m->SetFlag(MF_UNREAD);
|
for (int i = 0; NickCoreFlags[i].Flag != -1; ++i)
|
||||||
else if (params[j].equals_ci("RECEIPT"))
|
if (params[j].equals_ci(NickCoreFlags[i].Name))
|
||||||
m->SetFlag(MF_RECEIPT);
|
nc->SetFlag(NickCoreFlags[i].Flag);
|
||||||
else if (params[j].equals_ci("NOTIFYS"))
|
|
||||||
m->SetFlag(MF_NOTIFYS);
|
|
||||||
}
|
}
|
||||||
m->text = params[params.size() - 1];
|
else if (key.equals_ci("MI"))
|
||||||
nc->memos.memos.push_back(m);
|
{
|
||||||
|
Memo *m = new Memo;
|
||||||
|
m->time = params[0].is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
||||||
|
m->sender = params[1];
|
||||||
|
for (unsigned j = 2; params[j].equals_ci("UNREAD") || params[j].equals_ci("RECEIPT") || params[j].equals_ci("NOTIFYS"); ++j)
|
||||||
|
{
|
||||||
|
if (params[j].equals_ci("UNREAD"))
|
||||||
|
m->SetFlag(MF_UNREAD);
|
||||||
|
else if (params[j].equals_ci("RECEIPT"))
|
||||||
|
m->SetFlag(MF_RECEIPT);
|
||||||
|
else if (params[j].equals_ci("NOTIFYS"))
|
||||||
|
m->SetFlag(MF_NOTIFYS);
|
||||||
|
}
|
||||||
|
m->text = params[params.size() - 1];
|
||||||
|
nc->memos.memos.push_back(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const CoreException &ex)
|
||||||
|
{
|
||||||
|
throw DatabaseException(ex.GetReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
return EVENT_CONTINUE;
|
return EVENT_CONTINUE;
|
||||||
@@ -649,183 +656,189 @@ class DBPlain : public Module
|
|||||||
|
|
||||||
EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, const std::vector<Anope::string> ¶ms)
|
EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, const std::vector<Anope::string> ¶ms)
|
||||||
{
|
{
|
||||||
if (key.equals_ci("BANTYPE"))
|
try
|
||||||
ci->bantype = params[0].is_pos_number_only() ? convertTo<int16>(params[0]) : Config->CSDefBantype;
|
|
||||||
else if (key.equals_ci("MEMOMAX"))
|
|
||||||
ci->memos.memomax = params[0].is_pos_number_only() ? convertTo<int16>(params[0]) : 1;
|
|
||||||
else if (key.equals_ci("FOUNDER"))
|
|
||||||
{
|
{
|
||||||
ci->founder = findcore(params[0]);
|
if (key.equals_ci("BANTYPE"))
|
||||||
if (!ci->founder)
|
ci->bantype = params[0].is_pos_number_only() ? convertTo<int16>(params[0]) : Config->CSDefBantype;
|
||||||
|
else if (key.equals_ci("MEMOMAX"))
|
||||||
|
ci->memos.memomax = params[0].is_pos_number_only() ? convertTo<int16>(params[0]) : -1;
|
||||||
|
else if (key.equals_ci("FOUNDER"))
|
||||||
{
|
{
|
||||||
std::stringstream reason;
|
ci->founder = findcore(params[0]);
|
||||||
reason << "Deleting founderless channel " << ci->name << " (founder: " << params[0] << ")";
|
if (!ci->founder)
|
||||||
throw DatabaseException(reason.str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("SUCCESSOR"))
|
|
||||||
ci->successor = findcore(params[0]);
|
|
||||||
else if (key.equals_ci("LEVELS"))
|
|
||||||
{
|
|
||||||
for (unsigned j = 0, end = params.size(); j < end; j += 2)
|
|
||||||
for (int i = 0; ChannelLevels[i].Level != -1; ++i)
|
|
||||||
if (params[j].equals_ci(ChannelLevels[i].Name))
|
|
||||||
ci->levels[ChannelLevels[i].Level] = params[j + 1].is_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("FLAGS"))
|
|
||||||
{
|
|
||||||
for (unsigned j = 0, end = params.size(); j < end; ++j)
|
|
||||||
for (int i = 0; ChannelInfoFlags[i].Flag != -1; ++i)
|
|
||||||
if (params[j].equals_ci(ChannelInfoFlags[i].Name))
|
|
||||||
ci->SetFlag(ChannelInfoFlags[i].Flag);
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("DESC"))
|
|
||||||
ci->desc = params[0];
|
|
||||||
else if (key.equals_ci("TOPIC"))
|
|
||||||
{
|
|
||||||
ci->last_topic_setter = params[0];
|
|
||||||
ci->last_topic_time = params[1].is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
|
||||||
ci->last_topic = params[2];
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("FORBID"))
|
|
||||||
{
|
|
||||||
ci->forbidby = params[0];
|
|
||||||
ci->forbidreason = params[1];
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("ACCESS"))
|
|
||||||
{
|
|
||||||
NickCore *nc = findcore(params[0]);
|
|
||||||
if (!nc)
|
|
||||||
{
|
|
||||||
std::stringstream reason;
|
|
||||||
reason << "Access entry for nonexistant core " << params[0] << " on " << ci->name;
|
|
||||||
throw DatabaseException(reason.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
int level = params[1].is_number_only() ? convertTo<int>(params[1]) : 0;
|
|
||||||
time_t last_seen = params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0;
|
|
||||||
ci->AddAccess(nc, level, params[3], last_seen);
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("AKICK"))
|
|
||||||
{
|
|
||||||
bool Stuck = params[0].equals_ci("STUCK");
|
|
||||||
bool Nick = params[1].equals_ci("NICK");
|
|
||||||
NickCore *nc = NULL;
|
|
||||||
if (Nick)
|
|
||||||
{
|
|
||||||
nc = findcore(params[2]);
|
|
||||||
if (!nc)
|
|
||||||
{
|
{
|
||||||
std::stringstream reason;
|
std::stringstream reason;
|
||||||
reason << "Akick for nonexistant core " << params[2] << " on " << ci->name;
|
reason << "Deleting founderless channel " << ci->name << " (founder: " << params[0] << ")";
|
||||||
throw DatabaseException(reason.str());
|
throw DatabaseException(reason.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AutoKick *ak;
|
else if (key.equals_ci("SUCCESSOR"))
|
||||||
if (Nick)
|
ci->successor = findcore(params[0]);
|
||||||
ak = ci->AddAkick(params[3], nc, params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0);
|
else if (key.equals_ci("LEVELS"))
|
||||||
else
|
|
||||||
ak = ci->AddAkick(params[3], params[2], params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0);
|
|
||||||
if (Stuck)
|
|
||||||
ak->SetFlag(AK_STUCK);
|
|
||||||
if (Nick)
|
|
||||||
ak->SetFlag(AK_ISNICK);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("MLOCK_ON") || key.equals_ci("MLOCK_OFF"))
|
|
||||||
{
|
|
||||||
bool Set = key.equals_ci("MLOCK_ON");
|
|
||||||
|
|
||||||
/* For now store mlock in extensible, Anope hasn't yet connected to the IRCd and doesn't know what modes exist */
|
|
||||||
ci->Extend(Set ? "db_mlock_modes_on" : "db_mlock_modes_off", new ExtensibleItemRegular<std::vector<Anope::string> >(params));
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("MLP"))
|
|
||||||
{
|
|
||||||
std::vector<std::pair<Anope::string, Anope::string> > mlp;
|
|
||||||
ci->GetExtRegular("db_mlp", mlp);
|
|
||||||
|
|
||||||
mlp.push_back(std::make_pair(params[0], params[1]));
|
|
||||||
|
|
||||||
/* For now store mlocked modes in extensible, Anope hasn't yet connected to the IRCd and doesn't know what modes exist */
|
|
||||||
ci->Extend("db_mlp", new ExtensibleItemRegular<std::vector<std::pair<Anope::string, Anope::string> > >(mlp));
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("MI"))
|
|
||||||
{
|
|
||||||
Memo *m = new Memo;
|
|
||||||
m->time = params[0].is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
|
||||||
m->sender = params[1];
|
|
||||||
for (unsigned j = 2; params[j].equals_ci("UNREAD") || params[j].equals_ci("RECEIPT") || params[j].equals_ci("NOTIFYS"); ++j)
|
|
||||||
{
|
{
|
||||||
if (params[j].equals_ci("UNREAD"))
|
for (unsigned j = 0, end = params.size(); j < end; j += 2)
|
||||||
m->SetFlag(MF_UNREAD);
|
for (int i = 0; ChannelLevels[i].Level != -1; ++i)
|
||||||
else if (params[j].equals_ci("RECEIPT"))
|
if (params[j].equals_ci(ChannelLevels[i].Name))
|
||||||
m->SetFlag(MF_RECEIPT);
|
ci->levels[ChannelLevels[i].Level] = params[j + 1].is_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
else if (params[j].equals_ci("NOTIFYS"))
|
|
||||||
m->SetFlag(MF_NOTIFYS);
|
|
||||||
}
|
}
|
||||||
m->text = params[params.size() - 1];
|
else if (key.equals_ci("FLAGS"))
|
||||||
ci->memos.memos.push_back(m);
|
|
||||||
}
|
|
||||||
else if (key.equals_ci("ENTRYMSG"))
|
|
||||||
ci->entry_message = params[0];
|
|
||||||
else if (key.equals_ci("BI"))
|
|
||||||
{
|
|
||||||
if (params[0].equals_ci("NAME"))
|
|
||||||
ci->bi = findbot(params[1]);
|
|
||||||
else if (params[0].equals_ci("FLAGS"))
|
|
||||||
{
|
{
|
||||||
for (unsigned j = 1, end = params.size(); j < end; ++j)
|
for (unsigned j = 0, end = params.size(); j < end; ++j)
|
||||||
for (int i = 0; BotFlags[i].Flag != -1; ++i)
|
for (int i = 0; ChannelInfoFlags[i].Flag != -1; ++i)
|
||||||
if (params[j].equals_ci(BotFlags[i].Name))
|
if (params[j].equals_ci(ChannelInfoFlags[i].Name))
|
||||||
ci->botflags.SetFlag(BotFlags[i].Flag);
|
ci->SetFlag(ChannelInfoFlags[i].Flag);
|
||||||
}
|
}
|
||||||
else if (params[0].equals_ci("TTB"))
|
else if (key.equals_ci("DESC"))
|
||||||
|
ci->desc = params[0];
|
||||||
|
else if (key.equals_ci("TOPIC"))
|
||||||
{
|
{
|
||||||
for (unsigned j = 1, end = params.size(); j < end; j += 2)
|
ci->last_topic_setter = params[0];
|
||||||
|
ci->last_topic_time = params[1].is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||||
|
ci->last_topic = params[2];
|
||||||
|
}
|
||||||
|
else if (key.equals_ci("FORBID"))
|
||||||
|
{
|
||||||
|
ci->forbidby = params[0];
|
||||||
|
ci->forbidreason = params[1];
|
||||||
|
}
|
||||||
|
else if (key.equals_ci("ACCESS"))
|
||||||
|
{
|
||||||
|
NickCore *nc = findcore(params[0]);
|
||||||
|
if (!nc)
|
||||||
{
|
{
|
||||||
if (params[j].equals_ci("BOLDS"))
|
std::stringstream reason;
|
||||||
ci->ttb[0] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
reason << "Access entry for nonexistant core " << params[0] << " on " << ci->name;
|
||||||
else if (params[j].equals_ci("COLORS"))
|
throw DatabaseException(reason.str());
|
||||||
ci->ttb[1] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
}
|
||||||
else if (params[j].equals_ci("REVERSES"))
|
|
||||||
ci->ttb[2] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
int level = params[1].is_number_only() ? convertTo<int>(params[1]) : 0;
|
||||||
else if (params[j].equals_ci("UNDERLINES"))
|
time_t last_seen = params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0;
|
||||||
ci->ttb[3] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
ci->AddAccess(nc, level, params[3], last_seen);
|
||||||
else if (params[j].equals_ci("BADWORDS"))
|
}
|
||||||
ci->ttb[4] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
else if (key.equals_ci("AKICK"))
|
||||||
else if (params[j].equals_ci("CAPS"))
|
{
|
||||||
ci->ttb[5] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
bool Stuck = params[0].equals_ci("STUCK");
|
||||||
else if (params[j].equals_ci("FLOOD"))
|
bool Nick = params[1].equals_ci("NICK");
|
||||||
ci->ttb[6] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
NickCore *nc = NULL;
|
||||||
else if (params[j].equals_ci("REPEAT"))
|
if (Nick)
|
||||||
ci->ttb[7] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
{
|
||||||
else if (params[j].equals_ci("ITALICS"))
|
nc = findcore(params[2]);
|
||||||
ci->ttb[8] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
if (!nc)
|
||||||
|
{
|
||||||
|
std::stringstream reason;
|
||||||
|
reason << "Akick for nonexistant core " << params[2] << " on " << ci->name;
|
||||||
|
throw DatabaseException(reason.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AutoKick *ak;
|
||||||
|
if (Nick)
|
||||||
|
ak = ci->AddAkick(params[3], nc, params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0);
|
||||||
|
else
|
||||||
|
ak = ci->AddAkick(params[3], params[2], params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0);
|
||||||
|
if (Stuck)
|
||||||
|
ak->SetFlag(AK_STUCK);
|
||||||
|
if (Nick)
|
||||||
|
ak->SetFlag(AK_ISNICK);
|
||||||
|
}
|
||||||
|
else if (key.equals_ci("MLOCK_ON") || key.equals_ci("MLOCK_OFF"))
|
||||||
|
{
|
||||||
|
bool Set = key.equals_ci("MLOCK_ON");
|
||||||
|
|
||||||
|
/* For now store mlock in extensible, Anope hasn't yet connected to the IRCd and doesn't know what modes exist */
|
||||||
|
ci->Extend(Set ? "db_mlock_modes_on" : "db_mlock_modes_off", new ExtensibleItemRegular<std::vector<Anope::string> >(params));
|
||||||
|
}
|
||||||
|
else if (key.equals_ci("MLP"))
|
||||||
|
{
|
||||||
|
std::vector<std::pair<Anope::string, Anope::string> > mlp;
|
||||||
|
ci->GetExtRegular("db_mlp", mlp);
|
||||||
|
|
||||||
|
mlp.push_back(std::make_pair(params[0], params[1]));
|
||||||
|
|
||||||
|
/* For now store mlocked modes in extensible, Anope hasn't yet connected to the IRCd and doesn't know what modes exist */
|
||||||
|
ci->Extend("db_mlp", new ExtensibleItemRegular<std::vector<std::pair<Anope::string, Anope::string> > >(mlp));
|
||||||
|
}
|
||||||
|
else if (key.equals_ci("MI"))
|
||||||
|
{
|
||||||
|
Memo *m = new Memo;
|
||||||
|
m->time = params[0].is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
|
||||||
|
m->sender = params[1];
|
||||||
|
for (unsigned j = 2; params[j].equals_ci("UNREAD") || params[j].equals_ci("RECEIPT") || params[j].equals_ci("NOTIFYS"); ++j)
|
||||||
|
{
|
||||||
|
if (params[j].equals_ci("UNREAD"))
|
||||||
|
m->SetFlag(MF_UNREAD);
|
||||||
|
else if (params[j].equals_ci("RECEIPT"))
|
||||||
|
m->SetFlag(MF_RECEIPT);
|
||||||
|
else if (params[j].equals_ci("NOTIFYS"))
|
||||||
|
m->SetFlag(MF_NOTIFYS);
|
||||||
|
}
|
||||||
|
m->text = params[params.size() - 1];
|
||||||
|
ci->memos.memos.push_back(m);
|
||||||
|
}
|
||||||
|
else if (key.equals_ci("ENTRYMSG"))
|
||||||
|
ci->entry_message = params[0];
|
||||||
|
else if (key.equals_ci("BI"))
|
||||||
|
{
|
||||||
|
if (params[0].equals_ci("NAME"))
|
||||||
|
ci->bi = findbot(params[1]);
|
||||||
|
else if (params[0].equals_ci("FLAGS"))
|
||||||
|
{
|
||||||
|
for (unsigned j = 1, end = params.size(); j < end; ++j)
|
||||||
|
for (int i = 0; BotFlags[i].Flag != -1; ++i)
|
||||||
|
if (params[j].equals_ci(BotFlags[i].Name))
|
||||||
|
ci->botflags.SetFlag(BotFlags[i].Flag);
|
||||||
|
}
|
||||||
|
else if (params[0].equals_ci("TTB"))
|
||||||
|
{
|
||||||
|
for (unsigned j = 1, end = params.size(); j < end; j += 2)
|
||||||
|
{
|
||||||
|
if (params[j].equals_ci("BOLDS"))
|
||||||
|
ci->ttb[0] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("COLORS"))
|
||||||
|
ci->ttb[1] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("REVERSES"))
|
||||||
|
ci->ttb[2] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("UNDERLINES"))
|
||||||
|
ci->ttb[3] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("BADWORDS"))
|
||||||
|
ci->ttb[4] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("CAPS"))
|
||||||
|
ci->ttb[5] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("FLOOD"))
|
||||||
|
ci->ttb[6] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("REPEAT"))
|
||||||
|
ci->ttb[7] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
else if (params[j].equals_ci("ITALICS"))
|
||||||
|
ci->ttb[8] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (params[0].equals_ci("CAPSMIN"))
|
||||||
|
ci->capsmin = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
||||||
|
else if (params[0].equals_ci("CAPSPERCENT"))
|
||||||
|
ci->capspercent = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
||||||
|
else if (params[0].equals_ci("FLOODLINES"))
|
||||||
|
ci->floodlines = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
||||||
|
else if (params[0].equals_ci("FLOODSECS"))
|
||||||
|
ci->floodsecs = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
||||||
|
else if (params[0].equals_ci("REPEATTIMES"))
|
||||||
|
ci->repeattimes = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
||||||
|
else if (params[0].equals_ci("BADWORD"))
|
||||||
|
{
|
||||||
|
BadWordType Type;
|
||||||
|
if (params[1].equals_ci("SINGLE"))
|
||||||
|
Type = BW_SINGLE;
|
||||||
|
else if (params[1].equals_ci("START"))
|
||||||
|
Type = BW_START;
|
||||||
|
else if (params[1].equals_ci("END"))
|
||||||
|
Type = BW_END;
|
||||||
|
else
|
||||||
|
Type = BW_ANY;
|
||||||
|
ci->AddBadWord(params[2], Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (params[0].equals_ci("CAPSMIN"))
|
}
|
||||||
ci->capsmin = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
catch (const CoreException &ex)
|
||||||
else if (params[0].equals_ci("CAPSPERCENT"))
|
{
|
||||||
ci->capspercent = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
throw DatabaseException(ex.GetReason());
|
||||||
else if (params[0].equals_ci("FLOODLINES"))
|
|
||||||
ci->floodlines = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
|
||||||
else if (params[0].equals_ci("FLOODSECS"))
|
|
||||||
ci->floodsecs = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
|
||||||
else if (params[0].equals_ci("REPEATTIMES"))
|
|
||||||
ci->repeattimes = params[1].is_pos_number_only() ? convertTo<int16>(params[1]) : 0;
|
|
||||||
else if (params[0].equals_ci("BADWORD"))
|
|
||||||
{
|
|
||||||
BadWordType Type;
|
|
||||||
if (params[1].equals_ci("SINGLE"))
|
|
||||||
Type = BW_SINGLE;
|
|
||||||
else if (params[1].equals_ci("START"))
|
|
||||||
Type = BW_START;
|
|
||||||
else if (params[1].equals_ci("END"))
|
|
||||||
Type = BW_END;
|
|
||||||
else
|
|
||||||
Type = BW_ANY;
|
|
||||||
ci->AddBadWord(params[2], Type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EVENT_CONTINUE;
|
return EVENT_CONTINUE;
|
||||||
|
|||||||
+12
-14
@@ -71,7 +71,7 @@ class CommandMSSet : public Command
|
|||||||
Anope::string p2 = params.size() > 2 ? params[2] : "";
|
Anope::string p2 = params.size() > 2 ? params[2] : "";
|
||||||
Anope::string p3 = params.size() > 3 ? params[3] : "";
|
Anope::string p3 = params.size() > 3 ? params[3] : "";
|
||||||
Anope::string user, chan;
|
Anope::string user, chan;
|
||||||
int32 limit;
|
int16 limit;
|
||||||
NickCore *nc = u->Account();
|
NickCore *nc = u->Account();
|
||||||
ChannelInfo *ci = NULL;
|
ChannelInfo *ci = NULL;
|
||||||
bool is_servadmin = u->Account()->HasPriv("memoserv/set-limit");
|
bool is_servadmin = u->Account()->HasPriv("memoserv/set-limit");
|
||||||
@@ -115,7 +115,7 @@ class CommandMSSet : public Command
|
|||||||
SyntaxError(MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX);
|
SyntaxError(MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX);
|
||||||
return MOD_CONT;
|
return MOD_CONT;
|
||||||
}
|
}
|
||||||
if ((!isdigit(p1[0]) && !p1.equals_ci("NONE")) || (!p2.empty() && !p2.equals_ci("HARD")))
|
if ((!p1.is_pos_number_only() && !p1.equals_ci("NONE")) || (!p2.empty() && !p2.equals_ci("HARD")))
|
||||||
{
|
{
|
||||||
SyntaxError(MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX);
|
SyntaxError(MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX);
|
||||||
return MOD_CONT;
|
return MOD_CONT;
|
||||||
@@ -134,14 +134,12 @@ class CommandMSSet : public Command
|
|||||||
else
|
else
|
||||||
nc->UnsetFlag(NI_MEMO_HARDMAX);
|
nc->UnsetFlag(NI_MEMO_HARDMAX);
|
||||||
}
|
}
|
||||||
limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1;
|
limit = -1;
|
||||||
if (limit < 0 || limit > 32767)
|
try
|
||||||
{
|
{
|
||||||
u->SendMessage(MemoServ, MEMO_SET_LIMIT_OVERFLOW, 32767);
|
limit = convertTo<int16>(p1);
|
||||||
limit = 32767;
|
|
||||||
}
|
}
|
||||||
if (p1.equals_ci("NONE"))
|
catch (const CoreException &) { }
|
||||||
limit = -1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -160,7 +158,12 @@ class CommandMSSet : public Command
|
|||||||
u->SendMessage(MemoServ, MEMO_SET_YOUR_LIMIT_FORBIDDEN);
|
u->SendMessage(MemoServ, MEMO_SET_YOUR_LIMIT_FORBIDDEN);
|
||||||
return MOD_CONT;
|
return MOD_CONT;
|
||||||
}
|
}
|
||||||
limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1;
|
limit = -1;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
limit = convertTo<int16>(p1);
|
||||||
|
}
|
||||||
|
catch (const CoreException &) { }
|
||||||
/* The first character is a digit, but we could still go negative
|
/* The first character is a digit, but we could still go negative
|
||||||
* from overflow... watch out! */
|
* from overflow... watch out! */
|
||||||
if (limit < 0 || (Config->MSMaxMemos > 0 && static_cast<unsigned>(limit) > Config->MSMaxMemos))
|
if (limit < 0 || (Config->MSMaxMemos > 0 && static_cast<unsigned>(limit) > Config->MSMaxMemos))
|
||||||
@@ -171,11 +174,6 @@ class CommandMSSet : public Command
|
|||||||
u->SendMessage(MemoServ, MEMO_SET_YOUR_LIMIT_TOO_HIGH, Config->MSMaxMemos);
|
u->SendMessage(MemoServ, MEMO_SET_YOUR_LIMIT_TOO_HIGH, Config->MSMaxMemos);
|
||||||
return MOD_CONT;
|
return MOD_CONT;
|
||||||
}
|
}
|
||||||
else if (limit > 32767)
|
|
||||||
{
|
|
||||||
u->SendMessage(MemoServ, MEMO_SET_LIMIT_OVERFLOW, 32767);
|
|
||||||
limit = 32767;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mi->memomax = limit;
|
mi->memomax = limit;
|
||||||
if (limit > 0)
|
if (limit > 0)
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ class DBMySQL : public Module
|
|||||||
|
|
||||||
nc->language = r.Get(i, "language");
|
nc->language = r.Get(i, "language");
|
||||||
nc->channelcount = r.Get(i, "channelcount").is_number_only() ? convertTo<int>(r.Get(i, "channelcount")) : 0;
|
nc->channelcount = r.Get(i, "channelcount").is_number_only() ? convertTo<int>(r.Get(i, "channelcount")) : 0;
|
||||||
nc->memos.memomax = r.Get(i, "memomax").is_number_only() ? convertTo<int>(r.Get(i, "memomax")) : 20;
|
nc->memos.memomax = r.Get(i, "memomax").is_number_only() ? convertTo<int16>(r.Get(i, "memomax")) : 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = SQL->RunQuery("SELECT * FROM `anope_ns_access`");
|
r = SQL->RunQuery("SELECT * FROM `anope_ns_access`");
|
||||||
@@ -608,7 +608,7 @@ class DBMySQL : public Module
|
|||||||
ci->forbidreason = r.Get(i, "forbidreason");
|
ci->forbidreason = r.Get(i, "forbidreason");
|
||||||
ci->bantype = r.Get(i, "bantype").is_number_only() ? convertTo<int>(r.Get(i, "bantype")) : 2;
|
ci->bantype = r.Get(i, "bantype").is_number_only() ? convertTo<int>(r.Get(i, "bantype")) : 2;
|
||||||
ci->entry_message = r.Get(i, "entry_message");
|
ci->entry_message = r.Get(i, "entry_message");
|
||||||
ci->memos.memomax = r.Get(i, "memomax").is_number_only() ? convertTo<int>(r.Get(i, "memomax")) : 20;
|
ci->memos.memomax = r.Get(i, "memomax").is_number_only() ? convertTo<int16>(r.Get(i, "memomax")) : 20;
|
||||||
ci->capsmin = r.Get(i, "capsmin").is_number_only() ? convertTo<int>(r.Get(i, "capsmin")) : 0;
|
ci->capsmin = r.Get(i, "capsmin").is_number_only() ? convertTo<int>(r.Get(i, "capsmin")) : 0;
|
||||||
ci->capspercent = r.Get(i, "capspercent").is_number_only() ? convertTo<int>(r.Get(i, "capspercent")) : 0;
|
ci->capspercent = r.Get(i, "capspercent").is_number_only() ? convertTo<int>(r.Get(i, "capspercent")) : 0;
|
||||||
ci->floodlines = r.Get(i, "floodlines").is_number_only() ? convertTo<int>(r.Get(i, "floodlines")) : 0;
|
ci->floodlines = r.Get(i, "floodlines").is_number_only() ? convertTo<int>(r.Get(i, "floodlines")) : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user