diff options
author | Adam <Adam@anope.org> | 2010-12-18 19:41:13 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-18 19:41:13 -0500 |
commit | 0d20c4770350f30cfa5563c913464a37fdf9a067 (patch) | |
tree | 451a70e35cb0789f5935cbef5aba7f61de9561ea | |
parent | 7f9a5e01c69c7e7ede69c3799ff2be0402f6d7fa (diff) |
Don't send SXLines until after we start bursting with our uplink
-rw-r--r-- | include/operserv.h | 16 | ||||
-rw-r--r-- | modules/core/cs_access.cpp | 1 | ||||
-rw-r--r-- | src/init.cpp | 40 | ||||
-rw-r--r-- | src/operserv.cpp | 45 |
4 files changed, 84 insertions, 18 deletions
diff --git a/include/operserv.h b/include/operserv.h index 2711520cd..8bac11e76 100644 --- a/include/operserv.h +++ b/include/operserv.h @@ -97,6 +97,10 @@ class CoreExport XLineManager */ static std::pair<XLineManager *, XLine *> CheckAll(User *u); + /** Called on burst when all of our XLines should be bursted to the uplink + */ + static void Burst(); + /** Get the number of XLines in this XLineManager * @return The number of XLines */ @@ -176,6 +180,10 @@ class CoreExport XLineManager * @param x The xline */ virtual void OnExpire(XLine *x); + + /** Called to send an XLine to the IRCd + */ + virtual void Send(XLine *x) = 0; }; /* This is for AKILLS */ @@ -189,6 +197,8 @@ class SGLineManager : public XLineManager void OnMatch(User *u, XLine *x); void OnExpire(XLine *x); + + void Send(XLine *x); }; class SNLineManager : public XLineManager @@ -201,6 +211,8 @@ class SNLineManager : public XLineManager void OnMatch(User *u, XLine *x); void OnExpire(XLine *x); + + void Send(XLine *x); }; class SQLineManager : public XLineManager @@ -214,6 +226,8 @@ class SQLineManager : public XLineManager void OnExpire(XLine *x); + void Send(XLine *x); + static bool Check(Channel *c); }; @@ -227,6 +241,8 @@ class SZLineManager : public XLineManager void OnMatch(User *u, XLine *x); void OnExpire(XLine *x); + + void Send(XLine *x); }; #endif // OPERSERV_H diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp index 0f15b1ce5..fac34b263 100644 --- a/modules/core/cs_access.cpp +++ b/modules/core/cs_access.cpp @@ -80,7 +80,6 @@ class AccessViewCallback : public AccessListCallback static void DoList(CommandSource &source, unsigned Number, ChanAccess *access) { - User *u = source.u; ChannelInfo *ci = source.ci; Anope::string timebuf; if (ci->c && nc_on_chan(ci->c, access->nc)) diff --git a/src/init.cpp b/src/init.cpp index 81b9c2c36..3fb8f55a4 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -23,8 +23,28 @@ void introduce_user(const Anope::string &user) throw FatalException("introduce_user loop detected"); lasttime = now; - if (user.empty()) - ircdproto->SendBOB(); + if (!user.empty()) + { + User *u = finduser(user); + if (u) + { + ircdproto->SendClientIntroduction(u, ircd->pseudoclient_mode); + + BotInfo *bi = findbot(u->nick); + if (bi) + { + XLine x(bi->nick, "Reserved for services"); + ircdproto->SendSQLine(&x); + + for (UChannelList::const_iterator cit = bi->chans.begin(), cit_end = bi->chans.end(); cit != cit_end; ++cit) + ircdproto->SendJoin(bi, *cit); + } + } + + return; + } + + ircdproto->SendBOB(); for (unsigned i = 0; i < Me->GetLinks().size(); ++i) { @@ -41,7 +61,7 @@ void introduce_user(const Anope::string &user) { User *u = *it; - if (user.empty() || u->nick.equals_ci(user)) + if (u->nick.equals_ci(user)) { ircdproto->SendClientIntroduction(u, ircd->pseudoclient_mode); @@ -52,19 +72,17 @@ void introduce_user(const Anope::string &user) ircdproto->SendSQLine(&x); for (UChannelList::const_iterator cit = bi->chans.begin(), cit_end = bi->chans.end(); cit != cit_end; ++cit) - { ircdproto->SendJoin(bi, *cit); - } } } } - if (user.empty()) - { - /* Load MLock from the database now that we know what modes exist */ - for (registered_channel_map::iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it) - it->second->LoadMLock(); - } + /* Load MLock from the database now that we know what modes exist */ + for (registered_channel_map::iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it) + it->second->LoadMLock(); + + /* Add our SXLines */ + XLineManager::Burst(); } /*************************************************************************/ diff --git a/src/operserv.cpp b/src/operserv.cpp index 911384e79..46b09980d 100644 --- a/src/operserv.cpp +++ b/src/operserv.cpp @@ -252,6 +252,17 @@ std::pair<XLineManager *, XLine *> XLineManager::CheckAll(User *u) return ret; } +void XLineManager::Burst() +{ + for (std::list<XLineManager *>::iterator it = XLineManagers.begin(), it_end = XLineManagers.end(); it != it_end; ++it) + { + XLineManager *xlm = *it; + + for (std::vector<XLine *>::const_iterator it2 = xlm->GetList().begin(), it2_end = xlm->GetList().end(); it2 != it2_end; ++it2) + xlm->Send(*it2); + } +} + /** Get the number of XLines in this XLineManager * @return The number of XLines */ @@ -519,8 +530,8 @@ XLine *SGLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_ this->AddXLine(x); - if (Config->AkillOnAdd) - ircdproto->SendAkill(x); + if (UplinkSock && Config->AkillOnAdd) + this->Send(x); return x; } @@ -541,6 +552,11 @@ void SGLineManager::OnExpire(XLine *x) ircdproto->SendGlobops(OperServ, "AKILL on %s has expired", x->Mask.c_str()); } +void SGLineManager::Send(XLine *x) +{ + ircdproto->SendAkill(x); +} + XLine *SNLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason) { if (!mask.empty() && mask.find_first_not_of("*?") == Anope::string::npos) @@ -602,8 +618,7 @@ void SNLineManager::Del(XLine *x) void SNLineManager::OnMatch(User *u, XLine *x) { - ircdproto->SendSGLine(x); - + this->Send(x); Anope::string reason = "G-Lined: " + x->Reason; kill_user(Config->s_OperServ, u, reason); } @@ -614,6 +629,11 @@ void SNLineManager::OnExpire(XLine *x) ircdproto->SendGlobops(OperServ, "SNLINE on \2%s\2 has expired", x->Mask.c_str()); } +void SNLineManager::Send(XLine *x) +{ + ircdproto->SendSGLine(x); +} + XLine *SQLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason) { if (mask.find_first_not_of("*") == Anope::string::npos) @@ -694,7 +714,8 @@ XLine *SQLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_ } } - ircdproto->SendSQLine(x); + if (UplinkSock) + this->Send(x); return x; } @@ -718,6 +739,11 @@ void SQLineManager::OnExpire(XLine *x) ircdproto->SendGlobops(OperServ, "SQLINE on \2%s\2 has expired", x->Mask.c_str()); } +void SQLineManager::Send(XLine *x) +{ + ircdproto->SendSQLine(x); +} + bool SQLineManager::Check(Channel *c) { if (ircd->chansqline && SQLine) @@ -776,7 +802,8 @@ XLine *SZLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_ this->AddXLine(x); - ircdproto->SendSZLine(x); + if (UplinkSock) + this->Send(x); return x; } @@ -796,3 +823,9 @@ void SZLineManager::OnExpire(XLine *x) if (Config->WallSZLineExpire) ircdproto->SendGlobops(OperServ, "SZLINE on \2%s\2 has expired", x->Mask.c_str()); } + +void SZLineManager::Send(XLine *x) +{ + ircdproto->SendSZLine(x); +} + |