diff options
| author | Adam <Adam@anope.org> | 2013-01-21 22:31:16 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2013-01-21 22:31:16 -0500 |
| commit | ddaa001dafb5122e6e363e4acbbe6ce045b7b104 (patch) | |
| tree | 0364a76606ac6e2881ebd663601ce260f7c1101e /modules/pseudoclients | |
| parent | 51c049e1a738e9124bab3961f35b830906517421 (diff) | |
Merge usefulness of Flags and Extensible classes into Extensible, made most flags we have juse strings instead of defines/enums
Diffstat (limited to 'modules/pseudoclients')
| -rw-r--r-- | modules/pseudoclients/botserv.cpp | 26 | ||||
| -rw-r--r-- | modules/pseudoclients/chanserv.cpp | 8 | ||||
| -rw-r--r-- | modules/pseudoclients/global.cpp | 2 | ||||
| -rw-r--r-- | modules/pseudoclients/memoserv.cpp | 10 | ||||
| -rw-r--r-- | modules/pseudoclients/nickserv.cpp | 52 | ||||
| -rw-r--r-- | modules/pseudoclients/operserv.cpp | 14 |
6 files changed, 56 insertions, 56 deletions
diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp index 040d82613..40b0d502c 100644 --- a/modules/pseudoclients/botserv.cpp +++ b/modules/pseudoclients/botserv.cpp @@ -63,7 +63,7 @@ class BotServCore : public Module return; } - if (realbuf.empty() || !c->ci->botflags.HasFlag(BS_FANTASY)) + if (realbuf.empty() || !c->ci->HasExt("BS_FANTASY")) return; std::vector<Anope::string> params; @@ -119,7 +119,7 @@ class BotServCore : public Module } // Command requires registered users only - if (!cmd->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->Account()) + if (!cmd->AllowUnregistered() && !u->Account()) return; if (params.size() < cmd->min_params) @@ -173,7 +173,7 @@ class BotServCore : public Module * to has synced, or we'll get greet-floods when the net * recovers from a netsplit. -GD */ - if (c->FindUser(c->ci->bi) && c->ci->botflags.HasFlag(BS_GREET) && user->Account() && !user->Account()->greet.empty() && c->ci->AccessFor(user).HasPriv("GREET") && user->server->IsSynced()) + if (c->FindUser(c->ci->bi) && c->ci->HasExt("BS_GREET") && user->Account() && !user->Account()->greet.empty() && c->ci->AccessFor(user).HasPriv("GREET") && user->server->IsSynced()) { IRCD->SendPrivmsg(c->ci->bi, c->name, "[%s] %s", user->Account()->display.c_str(), user->Account()->greet.c_str()); c->ci->bi->lastmsg = Anope::CurTime; @@ -184,26 +184,26 @@ class BotServCore : public Module void OnLeaveChannel(User *u, Channel *c) anope_override { /* Channel is persistent, it shouldn't be deleted and the service bot should stay */ - if (c->HasFlag(CH_PERSIST) || (c->ci && c->ci->HasFlag(CI_PERSIST))) + if (c->HasExt("PERSIST") || (c->ci && c->ci->HasExt("PERSIST"))) return; /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly * We also don't part the bot here either, if necessary we will part it after the sync */ - if (c->HasFlag(CH_SYNCING)) + if (c->HasExt("SYNCING")) return; /* Additionally, do not delete this channel if ChanServ/a BotServ bot is inhabiting it */ - if (c->HasFlag(CH_INHABIT)) + if (c->HasExt("INHABIT")) return; if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->BSMinUsers && c->FindUser(c->ci->bi)) { - bool persist = c->HasFlag(CH_PERSIST); - c->SetFlag(CH_PERSIST); + bool persist = c->Shrink("PERSIST"); + c->Extend("PERSIST"); c->ci->bi->Part(c->ci->c); if (!persist) - c->UnsetFlag(CH_PERSIST); + c->Shrink("PERSIST"); } } @@ -255,15 +255,15 @@ class BotServCore : public Module "the following characters: %s"), Config->ChanServ.c_str(), Config->BSFantasyCharacter.c_str()); } - EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelModeName Name, const Anope::string ¶m) anope_override + EventReturn OnChannelModeSet(Channel *c, MessageSource &, const Anope::string &mname, const Anope::string ¶m) anope_override { - if (Config->BSSmartJoin && Name == CMODE_BAN && c->ci && c->ci->bi && c->FindUser(c->ci->bi)) + if (Config->BSSmartJoin && mname == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi)) { BotInfo *bi = c->ci->bi; - Entry ban(CMODE_BAN, param); + Entry ban("BAN", param); if (ban.Matches(bi)) - c->RemoveMode(bi, CMODE_BAN, param); + c->RemoveMode(bi, "BAN", param); } return EVENT_CONTINUE; diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp index 0beb610ee..ee8c08ed6 100644 --- a/modules/pseudoclients/chanserv.cpp +++ b/modules/pseudoclients/chanserv.cpp @@ -43,7 +43,7 @@ class ExpireCallback : public CallBack expire = true; } - if (ci->HasFlag(CI_NO_EXPIRE)) + if (ci->HasExt("NO_EXPIRE")) expire = false; FOREACH_MOD(I_OnPreChanExpire, OnPreChanExpire(ci, expire)); @@ -51,7 +51,7 @@ class ExpireCallback : public CallBack if (expire) { Anope::string extra; - if (ci->HasFlag(CI_SUSPENDED)) + if (ci->HasExt("SUSPENDED")) extra = "suspended "; Log(LOG_NORMAL, "chanserv/expire") << "Expiring " << extra << "channel " << ci->name << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << ")"; @@ -92,7 +92,7 @@ class ChanServCore : public Module EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override { - if (Config->CSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->ChanServ) + if (Config->CSOpersOnly && bi == ChanServ && !u->HasMode("OPER")) { u->SendMessage(bi, ACCESS_DENIED); return EVENT_STOP; @@ -164,7 +164,7 @@ class ChanServCore : public Module for (unsigned j = ci->GetAkickCount(); j > 0; --j) { const AutoKick *akick = ci->GetAkick(j - 1); - if (akick->HasFlag(AK_ISNICK) && akick->nc == nc) + if (akick->nc == nc) ci->EraseAkick(j - 1); } } diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp index 611ef7741..62a3d1609 100644 --- a/modules/pseudoclients/global.cpp +++ b/modules/pseudoclients/global.cpp @@ -18,7 +18,7 @@ class MyGlobalService : public GlobalService { void ServerGlobal(const BotInfo *sender, Server *s, const Anope::string &message) { - if (s != Me && !s->HasFlag(SERVER_JUPED)) + if (s != Me && !s->IsJuped()) s->Notice(sender, message); for (unsigned i = 0, j = s->GetLinks().size(); i < j; ++i) this->ServerGlobal(sender, s->GetLinks()[i], message); diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp index 536d39e08..17aaaa308 100644 --- a/modules/pseudoclients/memoserv.cpp +++ b/modules/pseudoclients/memoserv.cpp @@ -89,7 +89,7 @@ class MyMemoServService : public MemoServService m->sender = source; m->time = Anope::CurTime; m->text = message; - m->SetFlag(MF_UNREAD); + m->unread = true; FOREACH_MOD(I_OnMemoSend, OnMemoSend(source, target, mi, m)); @@ -105,7 +105,7 @@ class MyMemoServService : public MemoServService if (ci->AccessFor(cu->user).HasPriv("MEMO")) { - if (cu->user->Account() && cu->user->Account()->HasFlag(NI_MEMO_RECEIVE)) + if (cu->user->Account() && cu->user->Account()->HasExt("MEMO_RECEIVE")) cu->user->SendMessage(MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), ci->name.c_str(), mi->memos->size()); } } @@ -115,7 +115,7 @@ class MyMemoServService : public MemoServService { NickCore *nc = NickAlias::Find(target)->nc; - if (nc->HasFlag(NI_MEMO_RECEIVE)) + if (nc->HasExt("MEMO_RECEIVE")) { for (std::list<Serialize::Reference<NickAlias> >::const_iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;) { @@ -129,7 +129,7 @@ class MyMemoServService : public MemoServService } /* let's get out the mail if set in the nickcore - certus */ - if (nc->HasFlag(NI_MEMO_MAIL)) + if (nc->HasExt("MEMO_MAIL")) SendMemoMail(nc, mi, m); } @@ -144,7 +144,7 @@ class MyMemoServService : public MemoServService unsigned i = 0, end = nc->memos.memos->size(), newcnt = 0; for (; i < end; ++i) - if (nc->memos.GetMemo(i)->HasFlag(MF_UNREAD)) + if (nc->memos.GetMemo(i)->unread) ++newcnt; if (newcnt > 0) u->SendMessage(MemoServ, newcnt == 1 ? _("You have 1 new memo.") : _("You have %d new memos."), newcnt); diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp index c2c1e1060..55f8b07cd 100644 --- a/modules/pseudoclients/nickserv.cpp +++ b/modules/pseudoclients/nickserv.cpp @@ -74,7 +74,7 @@ class MyNickServService : public NickServService if (!na) return; - if (na->nc->HasFlag(NI_SUSPENDED)) + if (na->nc->HasExt("SUSPENDED")) { u->SendMessage(NickServ, NICK_X_SUSPENDED, u->nick.c_str()); u->Collide(na); @@ -89,7 +89,7 @@ class MyNickServService : public NickServService return; } - if (!na->nc->HasFlag(NI_SECURE) && u->IsRecognized()) + if (!na->nc->HasExt("SECURE") && u->IsRecognized()) { na->last_seen = Anope::CurTime; Anope::string last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost(); @@ -101,22 +101,22 @@ class MyNickServService : public NickServService if (Config->NoNicknameOwnership) return; - if (u->IsRecognized(false) || !na->nc->HasFlag(NI_KILL_IMMED)) + if (u->IsRecognized(false) || !na->nc->HasExt("KILL_IMMED")) { - if (na->nc->HasFlag(NI_SECURE)) + if (na->nc->HasExt("SECURE")) u->SendMessage(NickServ, NICK_IS_SECURE, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str()); else u->SendMessage(NickServ, NICK_IS_REGISTERED, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str()); } - if (na->nc->HasFlag(NI_KILLPROTECT) && !u->IsRecognized(false)) + if (na->nc->HasExt("KILLPROTECT") && !u->IsRecognized(false)) { - if (na->nc->HasFlag(NI_KILL_IMMED)) + if (na->nc->HasExt("KILL_IMMED")) { u->SendMessage(NickServ, FORCENICKCHANGE_NOW); u->Collide(na); } - else if (na->nc->HasFlag(NI_KILL_QUICK)) + else if (na->nc->HasExt("KILL_QUICK")) { u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(Config->NSKillQuick, u->Account()).c_str()); new NickServCollide(u, Config->NSKillQuick); @@ -134,8 +134,8 @@ class MyNickServService : public NickServService { const NickAlias *u_na = NickAlias::Find(user->nick); user->Login(na->nc); - if (u_na && *u_na->nc == *na->nc && !Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false) - user->SetMode(NickServ, UMODE_REGISTERED); + if (u_na && *u_na->nc == *na->nc && !Config->NoNicknameOwnership && na->nc->HasExt("UNCONFIRMED") == false) + user->SetMode(NickServ, "REGISTERED"); } }; @@ -155,17 +155,17 @@ class ExpireCallback : public CallBack ++it; User *u = User::Find(na->nick); - if (u && (na->nc->HasFlag(NI_SECURE) ? u->IsIdentified(true) : u->IsRecognized())) + if (u && (na->nc->HasExt("SECURE") ? u->IsIdentified(true) : u->IsRecognized())) na->last_seen = Anope::CurTime; bool expire = false; - if (na->nc->HasFlag(NI_UNCONFIRMED)) + if (na->nc->HasExt("UNCONFIRMED")) if (Config->NSUnconfirmedExpire && Anope::CurTime - na->time_registered >= Config->NSUnconfirmedExpire) expire = true; if (Config->NSExpire && Anope::CurTime - na->last_seen >= Config->NSExpire) expire = true; - if (na->HasFlag(NS_NO_EXPIRE)) + if (na->HasExt("NO_EXPIRE")) expire = false; FOREACH_MOD(I_OnPreNickExpire, OnPreNickExpire(na, expire)); @@ -173,7 +173,7 @@ class ExpireCallback : public CallBack if (expire) { Anope::string extra; - if (na->nc->HasFlag(NI_SUSPENDED)) + if (na->nc->HasExt("SUSPENDED")) extra = "suspended "; Log(LOG_NORMAL, "expire") << "Expiring " << extra << "nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")"; FOREACH_MOD(I_OnNickExpire, OnNickExpire(na)); @@ -219,7 +219,7 @@ class NickServCore : public Module if (u && u->Account() == na->nc) { IRCD->SendLogout(u); - u->RemoveMode(NickServ, UMODE_REGISTERED); + u->RemoveMode(NickServ, "REGISTERED"); u->Logout(); } } @@ -233,7 +233,7 @@ class NickServCore : public Module { User *user = *it++; IRCD->SendLogout(user); - user->RemoveMode(NickServ, UMODE_REGISTERED); + user->RemoveMode(NickServ, "REGISTERED"); user->Logout(); FOREACH_MOD(I_OnNickLogout, OnNickLogout(user)); } @@ -250,8 +250,8 @@ class NickServCore : public Module if (!Config->NoNicknameOwnership) { const NickAlias *this_na = NickAlias::Find(u->nick); - if (this_na && this_na->nc == u->Account() && u->Account()->HasFlag(NI_UNCONFIRMED) == false) - u->SetMode(NickServ, UMODE_REGISTERED); + if (this_na && this_na->nc == u->Account() && u->Account()->HasExt("UNCONFIRMED") == false) + u->SetMode(NickServ, "REGISTERED"); } if (Config->NSModeOnID) @@ -276,7 +276,7 @@ class NickServCore : public Module "any third-party person."), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str()); } - if (u->Account()->HasFlag(NI_UNCONFIRMED)) + if (u->Account()->HasExt("UNCONFIRMED")) { u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you when you registered.")); const NickAlias *this_na = NickAlias::Find(u->Account()->display); @@ -288,8 +288,8 @@ class NickServCore : public Module void OnNickGroup(User *u, NickAlias *target) anope_override { - if (target->nc->HasFlag(NI_UNCONFIRMED) == false) - u->SetMode(NickServ, UMODE_REGISTERED); + if (target->nc->HasExt("UNCONFIRMED") == false) + u->SetMode(NickServ, "REGISTERED"); } void OnNickUpdate(User *u) anope_override @@ -339,7 +339,7 @@ class NickServCore : public Module if (!na || na->nc != u->Account()) { /* Remove +r, but keep an account associated with the user */ - u->RemoveMode(NickServ, UMODE_REGISTERED); + u->RemoveMode(NickServ, "REGISTERED"); this->mynickserv.Validate(u); } @@ -347,8 +347,8 @@ class NickServCore : public Module { /* Reset +r and re-send account (even though it really should be set at this point) */ IRCD->SendLogin(u); - if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false) - u->SetMode(NickServ, UMODE_REGISTERED); + if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasExt("UNCONFIRMED") == false) + u->SetMode(NickServ, "REGISTERED"); Log(NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display; } @@ -356,10 +356,10 @@ class NickServCore : public Module old_na->OnCancel(u); } - void OnUserModeSet(User *u, UserModeName Name) anope_override + void OnUserModeSet(User *u, const Anope::string &mname) anope_override { - if (Name == UMODE_REGISTERED && !u->IsIdentified()) - u->RemoveMode(NickServ, Name); + if (mname == "REGISTERED" && !u->IsIdentified()) + u->RemoveMode(NickServ, mname); } EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp index 0a7b87ebb..7596ee9d6 100644 --- a/modules/pseudoclients/operserv.cpp +++ b/modules/pseudoclients/operserv.cpp @@ -209,7 +209,7 @@ class OperServCore : public Module EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override { - if (Config->OSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->OperServ) + if (Config->OSOpersOnly && !u->HasMode("OPER") && bi->nick == Config->OperServ) { u->SendMessage(bi, ACCESS_DENIED); Log(OperServ, "bados") << "Denied access to " << Config->OperServ << " from " << u->GetMask() << " (non-oper)"; @@ -221,19 +221,19 @@ class OperServCore : public Module void OnServerQuit(Server *server) anope_override { - if (server->HasFlag(SERVER_JUPED)) + if (server->IsJuped()) Log(server, "squit", OperServ) << "Received SQUIT for juped server " << server->GetName(); } - void OnUserModeSet(User *u, UserModeName Name) anope_override + void OnUserModeSet(User *u, const Anope::string &mname) anope_override { - if (Name == UMODE_OPER) + if (mname == "OPER") Log(u, "oper", OperServ) << "is now an IRC operator."; } - void OnUserModeUnset(User *u, UserModeName Name) anope_override + void OnUserModeUnset(User *u, const Anope::string &mname) anope_override { - if (Name == UMODE_OPER) + if (mname == "OPER") Log(u, "oper", OperServ) << "is no longer an IRC operator"; } @@ -245,7 +245,7 @@ class OperServCore : public Module void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override { - if (IRCD->CanSQLine && !u->HasMode(UMODE_OPER)) + if (IRCD->CanSQLine && !u->HasMode("OPER")) this->sqlines.CheckAllXLines(u); } |
