diff options
| author | Adam <Adam@Anope.org> | 2010-05-24 23:36:40 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-06-18 21:04:05 -0400 |
| commit | 2fba686904e6f78ebab35df171c5757afeebf05d (patch) | |
| tree | 523782bccc479606206f271cd6708b2f70fe8278 /src | |
| parent | 3a2c2a916a26f4fa1844e71a9f1c2fc25337fd2b (diff) | |
Burned slist, rewrote operservs XLine code
Diffstat (limited to 'src')
45 files changed, 1877 insertions, 2498 deletions
diff --git a/src/Makefile b/src/Makefile index 04d33b040..e7c8ba2fb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,14 +1,14 @@ OBJS = actions.o base64.o bots.o botserv.o channels.o chanserv.o command.o commands.o compat.o \ config.o configreader.o encrypt.o hashcomp.o hostserv.o init.o ircd.o language.o log.o mail.o main.o \ memory.o memoserv.o messages.o misc.o modes.o modules.o module.o modulemanager.o nickalias.o \ - nickcore.o nickserv.o operserv.o process.o protocol.o regchannel.o send.o servers.o sessions.o slist.o \ + nickcore.o nickserv.o operserv.o process.o protocol.o regchannel.o send.o servers.o sessions.o \ sockets.o threadengine.o threadengine_pthread.o timers.o opertype.o users.o wildcard.o INCLUDES = ../include/commands.h ../include/language.h \ ../include/sysconf.h ../include/config.h \ ../include/services.h ../include/regchannel.h \ ../include/timers.h ../include/extern.h \ - ../include/modules.h ../include/slist.h ../include/hashcomp.h \ + ../include/modules.h ../include/operserv.h ../include/hashcomp.h \ ../include/threadengine.h ../include/mail.h MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \ diff --git a/src/actions.c b/src/actions.c index e3f199e80..00ed01100 100644 --- a/src/actions.c +++ b/src/actions.c @@ -70,46 +70,6 @@ void kill_user(const std::string &source, const std::string &user, const std::st /*************************************************************************/ /** - * Check and enforce SQlines - * @param mask of the sqline - * @param reason for the sqline - * @return void - */ -void sqline(const std::string &mask, const std::string &reason) -{ - if (ircd->chansqline) - { - if (mask[0] == '#') - { - ircdproto->SendSQLine(mask, reason); - - for (channel_map::const_iterator cit = ChannelList.begin(); cit != ChannelList.end(); ++cit) - { - Channel *c = cit->second; - - if (!Anope::Match(c->name, mask, false)) - continue; - for (CUserList::iterator it = c->users.begin(); it != c->users.end();) - { - UserContainer *uc = *it; - ++it; - - if (is_oper(uc->user)) - continue; - c->Kick(NULL, uc->user, "%s", reason.c_str()); - } - } - } - else - ircdproto->SendSQLine(mask, reason); - } - else - ircdproto->SendSQLine(mask, reason); -} - -/*************************************************************************/ - -/** * Unban the nick from a channel * @param ci channel info for the channel * @param nick to remove the ban for diff --git a/src/bots.cpp b/src/bots.cpp index 034472774..3c23da7d4 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -68,7 +68,8 @@ BotInfo::BotInfo(const std::string &nnick, const std::string &nuser, const std:: if (Me && Me->GetUplink()->IsSynced()) { ircdproto->SendClientIntroduction(this->nick, this->user, this->host, this->real, ircd->pseudoclient_mode, this->uid); - ircdproto->SendSQLine(this->nick, "Reserved for services"); + XLine x(this->nick.c_str(), "Reserved for services"); + ircdproto->SendSQLine(&x); } } diff --git a/src/config.c b/src/config.c index 1dd312723..a1264abce 100644 --- a/src/config.c +++ b/src/config.c @@ -738,11 +738,11 @@ int ServerConfig::Read(bool bail) {"operserv", "logmaxusers", "no", new ValueContainerBool(&Config.LogMaxUsers), DT_BOOLEAN, NoValidation}, {"operserv", "autokillexpiry", "0", new ValueContainerTime(&Config.AutokillExpiry), DT_TIME, ValidateNotZero}, {"operserv", "chankillexpiry", "0", new ValueContainerTime(&Config.ChankillExpiry), DT_TIME, ValidateNotZero}, - {"operserv", "sglineexpiry", "0", new ValueContainerTime(&Config.SGLineExpiry), DT_TIME, ValidateNotZero}, + {"operserv", "snlineexpiry", "0", new ValueContainerTime(&Config.SNLineExpiry), DT_TIME, ValidateNotZero}, {"operserv", "sqlineexpiry", "0", new ValueContainerTime(&Config.SQLineExpiry), DT_TIME, ValidateNotZero}, {"operserv", "szlineexpiry", "0", new ValueContainerTime(&Config.SZLineExpiry), DT_TIME, ValidateNotZero}, {"operserv", "akillonadd", "no", new ValueContainerBool(&Config.AkillOnAdd), DT_BOOLEAN, NoValidation}, - {"operserv", "killonsgline", "no", new ValueContainerBool(&Config.KillonSGline), DT_BOOLEAN, NoValidation}, + {"operserv", "killonsnline", "no", new ValueContainerBool(&Config.KillonSNline), DT_BOOLEAN, NoValidation}, {"operserv", "killonsqline", "no", new ValueContainerBool(&Config.KillonSQline), DT_BOOLEAN, NoValidation}, {"operserv", "notifications", "", new ValueContainerString(&OSNotifications), DT_STRING, NoValidation}, {"operserv", "limitsessions", "no", new ValueContainerBool(&Config.LimitSessions), DT_BOOLEAN, NoValidation}, @@ -1633,8 +1633,8 @@ int read_config(int reload) } } - Config.WallOper = Config.WallBadOS = Config.WallOSGlobal = Config.WallOSMode = Config.WallOSClearmodes = Config.WallOSKick = Config.WallOSAkill = Config.WallOSSGLine = Config.WallOSSQLine = - Config.WallOSSZLine = Config.WallOSNoOp = Config.WallOSJupe = Config.WallAkillExpire = Config.WallSGLineExpire = Config.WallSQLineExpire = Config.WallSZLineExpire = Config.WallExceptionExpire = Config.WallGetpass = Config.WallSetpass = Config.WallForbid = + Config.WallOper = Config.WallBadOS = Config.WallOSGlobal = Config.WallOSMode = Config.WallOSClearmodes = Config.WallOSKick = Config.WallOSAkill = Config.WallOSSNLine = Config.WallOSSQLine = + Config.WallOSSZLine = Config.WallOSNoOp = Config.WallOSJupe = Config.WallAkillExpire = Config.WallSNLineExpire = Config.WallSQLineExpire = Config.WallSZLineExpire = Config.WallExceptionExpire = Config.WallGetpass = Config.WallSetpass = Config.WallForbid = Config.WallDrop = false; if (!OSNotifications.empty()) { spacesepstream notifications(OSNotifications); @@ -1647,13 +1647,13 @@ int read_config(int reload) else if (notice == "osclearmodes") Config.WallOSClearmodes = true; else if (notice == "oskick") Config.WallOSKick = true; else if (notice == "osakill") Config.WallOSAkill = true; - else if (notice == "ossgline") Config.WallOSSGLine = true; + else if (notice == "ossnline") Config.WallOSSNLine = true; else if (notice == "ossqline") Config.WallOSSQLine = true; else if (notice == "osszline") Config.WallOSSZLine = true; else if (notice == "osnoop") Config.WallOSNoOp = true; else if (notice == "osjupe") Config.WallOSJupe = true; else if (notice == "akillexpire") Config.WallAkillExpire = true; - else if (notice == "sglineexpire") Config.WallSGLineExpire = true; + else if (notice == "snlineexpire") Config.WallSNLineExpire = true; else if (notice == "sqlineexpire") Config.WallSQLineExpire = true; else if (notice == "szlineexpire") Config.WallSZLineExpire = true; else if (notice == "exceptionexpire") Config.WallExceptionExpire = true; diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c index d8cb3db6d..2c5888554 100644 --- a/src/core/bs_bot.c +++ b/src/core/bs_bot.c @@ -242,7 +242,8 @@ class CommandBSBot : public Command the old nick. */ if (ircd->sqline) { - ircdproto->SendSQLineDel(bi->nick); + XLine x(bi->nick.c_str()); + ircdproto->SendSQLineDel(&x); } /* We check whether user with this nick is online, and kill it if so */ @@ -251,9 +252,11 @@ class CommandBSBot : public Command if (user) ircdproto->SendQuit(bi, "Quit: Be right back"); - else { + else + { ircdproto->SendChangeBotNick(bi, nick); - ircdproto->SendSQLine(bi->nick, "Reserved for services"); + XLine x(bi->nick.c_str(), "Reserved for services"); + ircdproto->SendSQLine(&x); } if (bi->nick != nick) @@ -273,7 +276,8 @@ class CommandBSBot : public Command bi->uid = ts6_uid_retrieve(); } ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, ircd->pseudoclient_mode, bi->uid); - ircdproto->SendSQLine(bi->nick, "Reserved for services"); + XLine x(bi->nick.c_str(), "Reserved for services"); + ircdproto->SendSQLine(&x); bi->RejoinAll(); } @@ -309,7 +313,8 @@ class CommandBSBot : public Command FOREACH_MOD(I_OnBotDelete, OnBotDelete(bi)); ircdproto->SendQuit(bi, "Quit: Help! I'm being deleted by %s!", u->nick.c_str()); - ircdproto->SendSQLineDel(bi->nick); + XLine x(bi->nick.c_str()); + ircdproto->SendSQLineDel(&x); delete bi; notice_lang(Config.s_BotServ, u, BOT_BOT_DELETED, nick); diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c index baae58026..afeb522a9 100644 --- a/src/core/cs_drop.c +++ b/src/core/cs_drop.c @@ -66,7 +66,8 @@ class CommandCSDrop : public Command if (ircd->chansqline && (ci->HasFlag(CI_FORBIDDEN))) { - ircdproto->SendSQLineDel(ci->name.c_str()); + XLine x(ci->name.c_str()); + ircdproto->SendSQLineDel(&x); } Alog() << Config.s_ChanServ << ": Channel " << ci->name << " dropped by " << u->GetMask() << " (founder: " diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c index 06447c800..141865bf7 100644 --- a/src/core/cs_forbid.c +++ b/src/core/cs_forbid.c @@ -87,7 +87,8 @@ class CommandCSForbid : public Command if (ircd->chansqline) { - ircdproto->SendSQLine(ci->name, reason ? reason : "Forbidden"); + XLine x(chan, "Forbidden"); + ircdproto->SendSQLine(&x); } Alog() << Config.s_ChanServ << ": " << u->nick << " set FORBID for channel " << ci->name; diff --git a/src/core/db_plain.cpp b/src/core/db_plain.cpp index 710d4eb50..98212539e 100644 --- a/src/core/db_plain.cpp +++ b/src/core/db_plain.cpp @@ -458,31 +458,42 @@ static void LoadOperInfo(const std::vector<std::string> ¶ms) maxusercnt = atol(params[1].c_str()); maxusertime = strtol(params[2].c_str(), NULL, 10); } - else if (params[0] == "SGLINE" || params[0] == "SQLINE" || params[0] == "SZLINE") + else if (params[0] == "SNLINE" || params[0] == "SQLINE" || params[0] == "SZLINE") { - SXLine *sx = new SXLine; - sx->mask = sstrdup(params[1].c_str()); - sx->by = sstrdup(params[2].c_str()); - sx->seton = atol(params[3].c_str()); - sx->expires = atol(params[4].c_str()); - sx->reason = sstrdup(params[5].c_str()); - if (params[0] == "SGLINE") - slist_add(&sglines, sx); - else if (params[0] == "SQLINE") - slist_add(&sqlines, sx); - else if (params[0] == "SZLINE") - slist_add(&szlines, sx); + ci::string mask = params[1].c_str(); + ci::string by = params[2].c_str(); + time_t seton = atol(params[3].c_str()); + time_t expires = atol(params[4].c_str()); + std::string reason = params[5]; + + XLine *x = NULL; + if (params[0] == "SNLINE" && SNLine) + x = SNLine->Add(NULL, NULL, mask, expires, reason); + else if (params[0] == "SQLINE" && SQLine) + x = SQLine->Add(NULL, NULL, mask, expires, reason); + else if (params[0] == "SZLINE" && SZLine) + x = SZLine->Add(NULL, NULL, mask, expires, reason); + if (x) + { + x->By = by; + x->Created = seton; + } } - else if (params[0] == "AKILL") + else if (params[0] == "AKILL" && SGLine) { - Akill *ak = new Akill; - ak->user = sstrdup(params[1].c_str()); - ak->host = sstrdup(params[2].c_str()); - ak->by = sstrdup(params[3].c_str()); - ak->seton = atol(params[4].c_str()); - ak->expires = atol(params[5].c_str()); - ak->reason = sstrdup(params[6].c_str()); - slist_add(&akills, ak); + ci::string user = params[1].c_str(); + ci::string host = params[2].c_str(); + ci::string by = params[3].c_str(); + time_t seton = atol(params[4].c_str()); + time_t expires = atol(params[5].c_str()); + std::string reason = params[6]; + + XLine *x = SGLine->Add(NULL, NULL, user + "@" + host, expires, reason); + if (x) + { + x->By = by; + x->Created = seton; + } } else if (params[0] == "EXCEPTION") { @@ -1133,7 +1144,7 @@ class DBPlain : public Module } db << "MD BI TTB BOLDS " << ci->ttb[0] << " COLORS " << ci->ttb[1] << " REVERSES " << ci->ttb[2] << " UNDERLINES " << ci->ttb[3] << " BADWORDS " << ci->ttb[4] << " CAPS " << ci->ttb[5] << " FLOOD " << ci->ttb[6] << " REPEAT " << ci->ttb[7] << endl; if (ci->capsmin) - db << "MD BI CAPSMINS " << ci->capsmin << endl; + db << "MD BI CAPSMIN " << ci->capsmin << endl; if (ci->capspercent) db << "MD BI CAPSPERCENT " << ci->capspercent << endl; if (ci->floodlines) @@ -1153,28 +1164,42 @@ class DBPlain : public Module FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteMetadata, ci)); } - for (int i = 0; i < akills.count; ++i) + db << "OS STATS " << maxusercnt << " " << maxusertime << endl; + + if (SGLine) { - Akill *ak = static_cast<Akill *>(akills.list[i]); - db << "OS AKILL " << ak->user << " " << ak->host << " " << ak->by << " " << ak->seton << " " << ak->expires << " :" << ak->reason << endl; + for (unsigned i = 0; i < SGLine->GetCount(); ++i) + { + XLine *x = SGLine->GetEntry(i); + db << "OS AKILL " << x->GetUser() << " " << x->GetHost() << " " << x->By << " " << x->Created << " " << x->Expires << " :" << x->Reason << endl; + } } - db << "OS STATS " << maxusercnt << " " << maxusertime << endl; - SXLine *sx; - for (int i = 0; i < sglines.count; ++i) + if (SNLine) { - sx = static_cast<SXLine *>(sglines.list[i]); - db << "OS SGLINE " << sx->mask << " " << sx->by << " " << sx->seton << " " << sx->expires << " :" << sx->reason << endl; + for (unsigned i = 0; i < SNLine->GetCount(); ++i) + { + XLine *x = SNLine->GetEntry(i); + db << "OS SNLINE " << x->Mask << " " << x->By << " " << x->Created << " " << x->Expires << " :" << x->Reason << endl; + } } - for (int i = 0; i < sqlines.count; ++i) + + if (SQLine) { - sx = static_cast<SXLine *>(sqlines.list[i]); - db << "OS SQLINE " << sx->mask << " " << sx->by << " " << sx->seton << " " << sx->expires << " :" << sx->reason << endl; + for (unsigned i = 0; i < SQLine->GetCount(); ++i) + { + XLine *x = SQLine->GetEntry(i); + db << "OS SQLINE " << x->Mask << " " << x->By << " " << x->Created << " " << x->Expires << " :" << x->Reason << endl; + } } - for (int i = 0; i < szlines.count; ++i) + + if (SZLine) { - sx = static_cast<SXLine *>(szlines.list[i]); - db << "OS SZLINE " << sx->mask << " " << sx->by << " " << sx->seton << " " << sx->expires << " :" << sx->reason << endl; + for (unsigned i = 0; i < SZLine->GetCount(); ++i) + { + XLine *x = SZLine->GetEntry(i); + db << "OS SZLINE " << x->Mask << " " << x->By << " " << x->Created << " " << x->Expires << " :" << x->Reason << endl; + } } for (int i = 0; i < nexceptions; i++) diff --git a/src/core/hs_delall.c b/src/core/hs_delall.c index 05c67660d..aaab9b6e1 100644 --- a/src/core/hs_delall.c +++ b/src/core/hs_delall.c @@ -23,10 +23,8 @@ class CommandHSDelAll : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - int i; const char *nick = params[0].c_str(); NickAlias *na; - NickCore *nc; if ((na = findnick(nick))) { if (na->HasFlag(NS_FORBIDDEN)) @@ -35,10 +33,10 @@ class CommandHSDelAll : public Command return MOD_CONT; } FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na)); - nc = na->nc; - for (i = 0; i < nc->aliases.count; ++i) + NickCore *nc = na->nc; + for (std::list<NickAlias *>::iterator it = nc->aliases.begin(); it != nc->aliases.end(); ++it) { - na = static_cast<NickAlias *>(nc->aliases.list[i]); + na = *it; na->hostinfo.RemoveVhost(); } Alog() << "vHosts for all nicks in group \002" << nc->display << "\002 deleted by oper \002" << u->nick << "\002"; diff --git a/src/core/ns_drop.c b/src/core/ns_drop.c index 72f99cf7a..16c73f04a 100644 --- a/src/core/ns_drop.c +++ b/src/core/ns_drop.c @@ -69,7 +69,10 @@ class CommandNSDrop : public Command notice_lang(Config.s_NickServ, u, READ_ONLY_MODE); if (ircd->sqline && (na->HasFlag(NS_FORBIDDEN))) - ircdproto->SendSQLineDel(na->nick); + { + XLine x(na->nick); + ircdproto->SendSQLineDel(&x); + } Alog() << Config.s_NickServ << ": " << u->GetMask() << " dropped nickname " << na->nick << " (group " << na->nc->display << ") (e-mail: " << (na->nc->email ? na->nc->email : "none") << ")"; delete na; diff --git a/src/core/ns_forbid.c b/src/core/ns_forbid.c index e4c179243..70943ceeb 100644 --- a/src/core/ns_forbid.c +++ b/src/core/ns_forbid.c @@ -69,7 +69,10 @@ class CommandNSForbid : public Command if (ircd->sqline) - ircdproto->SendSQLine(na->nick, reason ? reason : "Forbidden"); + { + XLine x(na->nick, reason ? reason : "Forbidden"); + ircdproto->SendSQLine(&x); + } if (Config.WallForbid) ircdproto->SendGlobops(NickServ, "\2%s\2 used FORBID on \2%s\2", u->nick.c_str(), nick); diff --git a/src/core/ns_group.c b/src/core/ns_group.c index 10478f8a1..dd6f9b3be 100644 --- a/src/core/ns_group.c +++ b/src/core/ns_group.c @@ -80,7 +80,7 @@ class CommandNSGroup : public Command notice_lang(Config.s_NickServ, u, NICK_GROUP_SAME, target->nick); else if (na && na->nc != u->Account()) notice_lang(Config.s_NickServ, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ); - else if (Config.NSMaxAliases && (target->nc->aliases.count >= Config.NSMaxAliases) && !target->nc->IsServicesOper()) + else if (Config.NSMaxAliases && (target->nc->aliases.size() >= Config.NSMaxAliases) && !target->nc->IsServicesOper()) notice_lang(Config.s_NickServ, u, NICK_GROUP_TOO_MANY, target->nick, Config.s_NickServ, Config.s_NickServ); else if (enc_check_password(pass, target->nc->pass) != 1) { @@ -163,7 +163,7 @@ class CommandNSUngroup : public Command const char *nick = params.size() ? params[0].c_str() : NULL; NickAlias *na = nick ? findnick(nick) : findnick(u->nick); - if (u->Account()->aliases.count == 1) + if (u->Account()->aliases.size() == 1) notice_lang(Config.s_NickServ, u, NICK_UNGROUP_ONE_NICK); else if (!na) notice_lang(Config.s_NickServ, u, NICK_X_NOT_REGISTERED, nick ? nick : u->nick.c_str()); @@ -173,14 +173,19 @@ class CommandNSUngroup : public Command { NickCore *oldcore = na->nc; - slist_remove(&oldcore->aliases, na); + std::list<NickAlias *>::iterator it = std::find(oldcore->aliases.begin(), oldcore->aliases.end(), na); + if (it != oldcore->aliases.end()) + { + oldcore->aliases.erase(it); + } + if (!stricmp(oldcore->display, na->nick)) { change_core_display(oldcore); } na->nc = new NickCore(na->nick); - slist_add(&na->nc->aliases, na); + na->nc->aliases.push_back(na); na->nc->pass = oldcore->pass; if (oldcore->email) @@ -224,7 +229,6 @@ class CommandNSGList : public Command const char *nick = params.size() ? params[0].c_str() : NULL; NickCore *nc = u->Account(); - int i; if (nick && (stricmp(nick, u->nick.c_str()) && !u->Account()->IsServicesOper())) notice_lang(Config.s_NickServ, u, ACCESS_DENIED, Config.s_NickServ); @@ -238,9 +242,9 @@ class CommandNSGList : public Command int wont_expire; notice_lang(Config.s_NickServ, u, nick ? NICK_GLIST_HEADER_X : NICK_GLIST_HEADER, nc->display); - for (i = 0; i < nc->aliases.count; ++i) + for (std::list<NickAlias *>::iterator it = nc->aliases.begin(); it != nc->aliases.end(); ++it) { - NickAlias *na2 = static_cast<NickAlias *>(nc->aliases.list[i]); + NickAlias *na2 = *it; if (!(wont_expire = na2->HasFlag(NS_NO_EXPIRE))) { @@ -250,7 +254,7 @@ class CommandNSGList : public Command } notice_lang(Config.s_NickServ, u, wont_expire ? NICK_GLIST_REPLY_NOEXPIRE : NICK_GLIST_REPLY, na2->nick, buf); } - notice_lang(Config.s_NickServ, u, NICK_GLIST_FOOTER, nc->aliases.count); + notice_lang(Config.s_NickServ, u, NICK_GLIST_FOOTER, nc->aliases.size()); } return MOD_CONT; } diff --git a/src/core/ns_saset.c b/src/core/ns_saset.c index 3bedbd301..7117ffab7 100644 --- a/src/core/ns_saset.c +++ b/src/core/ns_saset.c @@ -20,8 +20,6 @@ private: CommandReturn DoSetDisplay(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) { ci::string param = params.size() > 2 ? params[2] : ""; - int i; - NickAlias *na; if (param.empty()) { @@ -30,17 +28,9 @@ private: } /* First check whether param is a valid nick of the group */ - for (i = 0; i < nc->aliases.count; ++i) - { - na = static_cast<NickAlias *>(nc->aliases.list[i]); - if (na->nick == param) - { - param = na->nick; /* Because case may differ */ - break; - } - } + NickAlias *na = findnick(param); - if (i == nc->aliases.count) + if (!na || na->nc != nc) { notice_lang(Config.s_NickServ, u, NICK_SASET_DISPLAY_INVALID, nc->display); return MOD_CONT; diff --git a/src/core/ns_set.c b/src/core/ns_set.c index 79561af76..1325f6b32 100644 --- a/src/core/ns_set.c +++ b/src/core/ns_set.c @@ -27,21 +27,9 @@ class CommandNSSet : public Command return MOD_CONT; } - int i; - NickAlias *na; - - /* First check whether param is a valid nick of the group */ - for (i = 0; i < nc->aliases.count; ++i) - { - na = static_cast<NickAlias *>(nc->aliases.list[i]); - if (na->nick == param) - { - param = na->nick; /* Because case may differ */ - break; - } - } - - if (i == nc->aliases.count) + NickAlias *na = findnick(param); + + if (!na || na->nc != nc) { notice_lang(Config.s_NickServ, u, NICK_SET_DISPLAY_INVALID); return MOD_CONT; diff --git a/src/core/ns_suspend.c b/src/core/ns_suspend.c index 1f0b885a4..94408adac 100644 --- a/src/core/ns_suspend.c +++ b/src/core/ns_suspend.c @@ -23,11 +23,10 @@ class CommandNSSuspend : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - NickAlias *na, *na2; + NickAlias *na; User *u2; const char *nick = params[0].c_str(); const char *reason = params[1].c_str(); - int i; if (readonly) { @@ -61,9 +60,10 @@ class CommandNSSuspend : public Command na->nc->UnsetFlag(NI_KILL_QUICK); na->nc->UnsetFlag(NI_KILL_IMMED); - for (i = 0; i < na->nc->aliases.count; ++i) + for (std::list<NickAlias *>::iterator it = na->nc->aliases.begin(); it != na->nc->aliases.end(); ++it) { - na2 = static_cast<NickAlias *>(na->nc->aliases.list[i]); + NickAlias *na2 = *it; + if (na2->nc == na->nc) { if (na2->last_quit) diff --git a/src/core/os_akill.c b/src/core/os_akill.c index 590767bbe..47a2b9dd1 100644 --- a/src/core/os_akill.c +++ b/src/core/os_akill.c @@ -14,24 +14,123 @@ #include "module.h" -int akill_view_callback(SList *slist, int number, void *item, va_list args); -int akill_list_callback(SList *slist, int number, void *item, va_list args); -int akill_view(int number, Akill *ak, User *u, int *sent_header); -int akill_list(int number, Akill *ak, User *u, int *sent_header); +class AkillDelCallback : public NumberList +{ |
