diff options
-rw-r--r-- | include/services.h | 2 | ||||
-rw-r--r-- | modules/core/db_plain.cpp | 365 | ||||
-rw-r--r-- | modules/core/ms_set.cpp | 26 | ||||
-rw-r--r-- | modules/extra/db_mysql.cpp | 4 |
4 files changed, 201 insertions, 196 deletions
diff --git a/include/services.h b/include/services.h index b5394287e..0ea6cb562 100644 --- a/include/services.h +++ b/include/services.h @@ -520,7 +520,7 @@ class Memo : public Flags<MemoFlag> struct CoreExport MemoInfo { - unsigned memomax; + int16 memomax; std::vector<Memo *> memos; std::vector<ci::string> ignores; diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp index 695738087..5d6bd3142 100644 --- a/modules/core/db_plain.cpp +++ b/modules/core/db_plain.cpp @@ -505,39 +505,46 @@ class DBPlain : public Module EventReturn OnDatabaseReadMetadata(NickCore *nc, const Anope::string &key, const std::vector<Anope::string> ¶ms) { - if (key.equals_ci("LANGUAGE")) - 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")) - nc->FromString(params); - else if (key.equals_ci("MI")) + try { - 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 (key.equals_ci("LANGUAGE")) + 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")) + nc->FromString(params); + else if (key.equals_ci("MI")) { - 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); + 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); } - m->text = params[params.size() - 1]; - nc->memos.memos.push_back(m); + else if (key.equals_ci("MIG")) + nc->memos.ignores.push_back(params[0].ci_str()); + } + catch (const ConvertException &ex) + { + throw DatabaseException(ex.GetReason()); } - else if (key.equals_ci("MIG")) - nc->memos.ignores.push_back(params[0].ci_str()); return EVENT_CONTINUE; } @@ -578,176 +585,176 @@ class DBPlain : public Module EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, const std::vector<Anope::string> ¶ms) { - if (key.equals_ci("BANTYPE")) - 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")) + try { - ci->founder = findcore(params[0]); - if (!ci->founder) + if (key.equals_ci("BANTYPE")) + 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; - reason << "Deleting founderless channel " << ci->name << " (founder: " << params[0] << ")"; - throw DatabaseException(reason.str()); + ci->founder = findcore(params[0]); + if (!ci->founder) + throw DatabaseException("Deleting founderless channel " + ci->name + " (founder: " + params[0] + ")"); } - } - 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")) - ci->FromString(params); - 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")) - { - 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(params[0], level, params[3], last_seen); - } - else if (key.equals_ci("AKICK")) - { - // 0 is the old stuck - bool Nick = params[1].equals_ci("NICK"); - NickCore *nc = NULL; - if (Nick) + 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")) + ci->FromString(params); + 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")) + { + 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(params[0], level, params[3], last_seen); + } + else if (key.equals_ci("AKICK")) { - nc = findcore(params[2]); - if (!nc) + // 0 is the old stuck + bool Nick = params[1].equals_ci("NICK"); + NickCore *nc = NULL; + if (Nick) { - std::stringstream reason; - reason << "Akick for nonexistant core " << params[2] << " on " << ci->name; - throw DatabaseException(reason.str()); + nc = findcore(params[2]); + if (!nc) + throw DatabaseException("Akick for nonexistant core " + params[2] + " on " + ci->name); } - } - 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 (Nick) - ak->SetFlag(AK_ISNICK); - } - else if (key.equals_ci("MLOCK_ON") || key.equals_ci("MLOCK_OFF")) - { - bool Set = key.equals_ci("MLOCK_ON"); + 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 (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); + /* 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])); + 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("MLP_OFF")) - { - std::vector<std::pair<Anope::string, Anope::string> > mlp; - ci->GetExtRegular("db_mlp_off", mlp); + /* 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("MLP_OFF")) + { + std::vector<std::pair<Anope::string, Anope::string> > mlp; + ci->GetExtRegular("db_mlp_off", mlp); - mlp.push_back(std::make_pair(params[0], params[1])); + 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_off", 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); + /* 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_off", new ExtensibleItemRegular<std::vector<std::pair<Anope::string, Anope::string> > >(mlp)); } - m->text = params[params.size() - 1]; - ci->memos.memos.push_back(m); - } - else if (key.equals_ci("MIG")) - ci->memos.ignores.push_back(params[0].ci_str()); - else if (key.equals_ci("BI")) - { - if (params[0].equals_ci("NAME")) - ci->bi = findbot(params[1]); - else if (params[0].equals_ci("FLAGS")) - ci->botflags.FromString(params); - else if (params[0].equals_ci("TTB")) + else if (key.equals_ci("MI")) { - for (unsigned j = 1, end = params.size(); j < end; j += 2) + 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("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[j].equals_ci("AMSGS")) - ci->ttb[9] = params[j + 1].is_pos_number_only() ? convertTo<int16>(params[j + 1]) : 0; + 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 (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")) + else if (key.equals_ci("MIG")) + ci->memos.ignores.push_back(params[0].ci_str()); + else if (key.equals_ci("BI")) { - 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); + if (params[0].equals_ci("NAME")) + ci->bi = findbot(params[1]); + else if (params[0].equals_ci("FLAGS")) + ci->botflags.FromString(params); + 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[j].equals_ci("AMSGS")) + ci->ttb[9] = 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); + } } } + catch (const ConvertException &ex) + { + throw DatabaseException(ex.GetReason()); + } return EVENT_CONTINUE; } diff --git a/modules/core/ms_set.cpp b/modules/core/ms_set.cpp index efeb59ba0..6fef15c2b 100644 --- a/modules/core/ms_set.cpp +++ b/modules/core/ms_set.cpp @@ -75,7 +75,7 @@ class CommandMSSet : public Command Anope::string p2 = params.size() > 2 ? params[2] : ""; Anope::string p3 = params.size() > 3 ? params[3] : ""; Anope::string user, chan; - int32 limit; + int16 limit; NickCore *nc = u->Account(); ChannelInfo *ci = NULL; bool is_servadmin = u->Account()->HasPriv("memoserv/set-limit"); @@ -114,7 +114,7 @@ class CommandMSSet : public Command p1 = p2; p2 = p3; } - else if (p1.empty() || (!isdigit(p1[0]) && !p1.equals_ci("NONE")) || (!p2.empty() && !p2.equals_ci("HARD"))) + else if (p1.empty() || (!p1.is_pos_number_only() && !p1.equals_ci("NONE")) || (!p2.empty() && !p2.equals_ci("HARD"))) { SyntaxError(source, "SET LIMIT", _("SET LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]")); return MOD_CONT; @@ -133,14 +133,12 @@ class CommandMSSet : public Command else nc->UnsetFlag(NI_MEMO_HARDMAX); } - limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1; - if (limit < 0 || limit > 32767) + limit = -1; + try { - source.Reply(_("Memo limit too large; limiting to %d instead."), 32767); - limit = 32767; + limit = convertTo<int16>(p1); } - if (p1.equals_ci("NONE")) - limit = -1; + catch (const ConvertException &) { } } else { @@ -159,7 +157,12 @@ class CommandMSSet : public Command source.Reply(_("You are not permitted to change your memo limit.")); return MOD_CONT; } - limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1; + limit = -1; + try + { + limit = convertTo<int16>(p1); + } + catch (const ConvertException &) { } /* The first character is a digit, but we could still go negative * from overflow... watch out! */ if (limit < 0 || (Config->MSMaxMemos > 0 && static_cast<unsigned>(limit) > Config->MSMaxMemos)) @@ -170,11 +173,6 @@ class CommandMSSet : public Command source.Reply(_("You cannot set your memo limit higher than %d."), Config->MSMaxMemos); return MOD_CONT; } - else if (limit > 32767) - { - source.Reply(_("Memo limit too large; limiting to %d instead."), 32767); - limit = 32767; - } } mi->memomax = limit; if (limit > 0) diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index 03515d239..833e547a2 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -268,7 +268,7 @@ class DBMySQL : public Module nc->language = r.Get(i, "language"); 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`"); @@ -414,7 +414,7 @@ class DBMySQL : public Module ci->forbidby = r.Get(i, "forbidby"); ci->forbidreason = r.Get(i, "forbidreason"); ci->bantype = r.Get(i, "bantype").is_number_only() ? convertTo<int>(r.Get(i, "bantype")) : 2; - 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->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; |