diff options
| author | Adam <Adam@anope.org> | 2011-10-22 11:21:21 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-10-22 11:21:21 -0400 |
| commit | c8b3809fc93bfcccb354248c17467da9b69e0ebd (patch) | |
| tree | 68f2efa54b2ac5a949dcf1da7d03269ab26ad7df /modules/pseudoclients | |
| parent | ad2ef75cbed4804f9f1d24419b9bc77fbe75a27a (diff) | |
Added akill ids
Diffstat (limited to 'modules/pseudoclients')
| -rw-r--r-- | modules/pseudoclients/operserv.cpp | 143 |
1 files changed, 29 insertions, 114 deletions
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp index 6dfacd19f..d29c2c66e 100644 --- a/modules/pseudoclients/operserv.cpp +++ b/modules/pseudoclients/operserv.cpp @@ -20,19 +20,20 @@ class SGLineManager : public XLineManager public: SGLineManager(Module *creator) : XLineManager(creator, "xlinemanager/sgline", 'G') { } - XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason) + void OnMatch(User *u, XLine *x) { - XLine *x = new XLine(mask, creator, expires, reason); - - this->AddXLine(x); - - if (UplinkSock && Config->AkillOnAdd) - this->Send(NULL, x); - - return x; + if (u) + u->Kill(Config->OperServ, x->Reason); + this->Send(u, x); } - void Del(XLine *x) + void OnExpire(XLine *x) + { + if (Config->WallAkillExpire) + ircdproto->SendGlobops(OperServ, "AKILL on %s has expired", x->Mask.c_str()); + } + + void Send(User *u, XLine *x) { try { @@ -41,28 +42,15 @@ class SGLineManager : public XLineManager else if (x->GetUser() != "*") throw SocketException("Can not ZLine a username"); x->GetIP(); - ircdproto->SendSZLineDel(x); + ircdproto->SendSZLine(u, x); } catch (const SocketException &) { - ircdproto->SendAkillDel(x); + ircdproto->SendAkill(u, x); } } - void OnMatch(User *u, XLine *x) - { - if (u) - u->Kill(Config->OperServ, x->Reason); - this->Send(u, x); - } - - void OnExpire(XLine *x) - { - if (Config->WallAkillExpire) - ircdproto->SendGlobops(OperServ, "AKILL on %s has expired", x->Mask.c_str()); - } - - void Send(User *u, XLine *x) + void SendDel(XLine *x) { try { @@ -71,11 +59,11 @@ class SGLineManager : public XLineManager else if (x->GetUser() != "*") throw SocketException("Can not ZLine a username"); x->GetIP(); - ircdproto->SendSZLine(u, x); + ircdproto->SendSZLineDel(x); } catch (const SocketException &) { - ircdproto->SendAkill(u, x); + ircdproto->SendAkillDel(x); } } }; @@ -85,59 +73,6 @@ class SQLineManager : public XLineManager public: SQLineManager(Module *creator) : XLineManager(creator, "xlinemanager/sqline", 'Q') { } - XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason) - { - XLine *x = new XLine(mask, creator, expires, reason); - - this->AddXLine(x); - - if (Config->KillonSQline) - { - Anope::string rreason = "Q-Lined: " + reason; - - if (mask[0] == '#') - { - for (channel_map::const_iterator cit = ChannelList.begin(), cit_end = ChannelList.end(); cit != cit_end; ++cit) - { - Channel *c = cit->second; - - if (!Anope::Match(c->name, mask)) - continue; - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) - { - UserContainer *uc = *it; - ++it; - - if (uc->user->HasMode(UMODE_OPER) || uc->user->server == Me) - continue; - c->Kick(NULL, uc->user, "%s", reason.c_str()); - } - } - } - else - { - for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();) - { - User *user = it->second; - ++it; - - if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->nick, x->Mask)) - user->Kill(Config->ServerName, rreason); - } - } - } - - if (UplinkSock) - this->Send(NULL, x); - - return x; - } - - void Del(XLine *x) - { - ircdproto->SendSQLineDel(x); - } - void OnMatch(User *u, XLine *x) { if (u) @@ -160,6 +95,11 @@ class SQLineManager : public XLineManager ircdproto->SendSQLine(u, x); } + void SendDel(XLine *x) + { + ircdproto->SendSQLineDel(x); + } + bool CheckChannel(Channel *c) { if (ircd->chansqline) @@ -175,34 +115,6 @@ class SNLineManager : public XLineManager public: SNLineManager(Module *creator) : XLineManager(creator, "xlinemanager/snline", 'N') { } - XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason) - { - XLine *x = new XLine(mask, creator, expires, reason); - - this->AddXLine(x); - - if (Config->KillonSNline && !ircd->sglineenforce) - { - Anope::string rreason = "G-Lined: " + reason; - - for (Anope::insensitive_map<User *>::const_iterator it = UserListByNick.begin(); it != UserListByNick.end();) - { - User *user = it->second; - ++it; - - if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->Mask)) - user->Kill(Config->ServerName, rreason); - } - } - - return x; - } - - void Del(XLine *x) - { - ircdproto->SendSGLineDel(x); - } - void OnMatch(User *u, XLine *x) { if (u) @@ -224,18 +136,21 @@ class SNLineManager : public XLineManager ircdproto->SendSGLine(u, x); } + void SendDel(XLine *x) + { + ircdproto->SendSGLineDel(x); + } + XLine *Check(User *u) { - for (unsigned i = this->XLines.size(); i > 0; --i) + for (unsigned i = this->GetList().size(); i > 0; --i) { - XLine *x = this->XLines[i - 1]; + XLine *x = this->GetList()[i - 1]; if (x->Expires && x->Expires < Anope::CurTime) { this->OnExpire(x); - this->Del(x); - delete x; - this->XLines.erase(XLines.begin() + i - 1); + this->DelXLine(x); continue; } |
