diff options
-rwxr-xr-x | Config | 8 | ||||
-rw-r--r-- | docs/Changes | 2 | ||||
-rw-r--r-- | include/operserv.h | 16 | ||||
-rw-r--r-- | include/version.cpp | 9 | ||||
-rw-r--r-- | modules/core/os_session.cpp | 2 | ||||
-rw-r--r-- | modules/extra/db_mysql.cpp | 10 | ||||
-rw-r--r-- | src/bots.cpp | 18 | ||||
-rw-r--r-- | src/init.cpp | 40 | ||||
-rw-r--r-- | src/operserv.cpp | 45 |
9 files changed, 122 insertions, 28 deletions
@@ -168,11 +168,11 @@ if [ ! "$NO_INTRO" ] ; then VERSION=`git describe --tags` VERSION_BUILD=`echo "$VERSION" | cut -d'-' -f2` VERSION_EXTRA=`echo "$VERSION" | cut -d'-' -f3` - if [ "$VERSION_BUILD" == "$VERSION_EXTRA" ] ; then - VERSION_EXTRA="" + # Only do this if we are not on a tag, src/version.sh will be all we need then. + if [ "$VERSION_BUILD" != "$VERSION_EXTRA" ] ; then + echo "#define VERSION_BUILD $VERSION_BUILD" > include/version.h + echo "#define VERSION_EXTRA \"$VERSION_EXTRA\"" >> include/version.h fi - echo "#define VERSION_BUILD $VERSION_BUILD" > include/version.h - echo "#define VERSION_EXTRA \"$VERSION_EXTRA\"" >> include/version.h fi cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER echo "" diff --git a/docs/Changes b/docs/Changes index 5e08d5f6a..83f84e072 100644 --- a/docs/Changes +++ b/docs/Changes @@ -7,6 +7,8 @@ A Ability for users with registrations pending to drop their registrations with A Added support for Plexus 3 A Readded in support for /cs op/deop/etc to op/deop you in all channels F Changed the GHOST command to not allow ghosting unidentified users if the RECOVER command exists +F Some failed logic in /operserv exception that prevents proper exceptions from being added +F Fixed the anope_os_sxlines MySQL table and code to work after restarting Anope Version 1.9.3 -------------------- 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/include/version.cpp b/include/version.cpp index ae3ee883e..9b8f38c45 100644 --- a/include/version.cpp +++ b/include/version.cpp @@ -54,12 +54,19 @@ int main(int argc, char *argv[]) std::string version_build = "#define VERSION_BUILD 1"; std::string build = "#define BUILD 1"; + std::string version_extra; if (fd.is_open()) { while (getline(fd, filebuf)) { if (!filebuf.find("#define VERSION_BUILD")) version_build = filebuf; + else if (!filebuf.find("#define VERSION_EXTRA")) + { + size_t q = filebuf.find('"'); + + version_extra = filebuf.substr(q + 1, filebuf.length() - q - 2); + } else if (!filebuf.find("#define BUILD")) { size_t tab = filebuf.find(' '); @@ -89,7 +96,7 @@ int main(int argc, char *argv[]) for (std::list<std::pair<std::string, std::string> >::iterator it = versions.begin(), it_end = versions.end(); it != it_end; ++it) { if (it->first == "EXTRA") - fd << "#define VERSION_EXTRA \"" << it->second << "\"" << std::endl; + fd << "#define VERSION_EXTRA \"" << (!version_extra.empty() ? version_extra : "") << it->second << "\"" << std::endl; else fd << "#define VERSION_" << it->first << " " << it->second << std::endl; } diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp index bde023aaa..8b2cb53af 100644 --- a/modules/core/os_session.cpp +++ b/modules/core/os_session.cpp @@ -256,7 +256,7 @@ class CommandOSException : public Command } else { - if (mask.find('!') == Anope::string::npos || mask.find('@') == Anope::string::npos) + if (mask.find('!') != Anope::string::npos || mask.find('@') != Anope::string::npos) { source.Reply(OPER_EXCEPTION_INVALID_HOSTMASK); return MOD_CONT; diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index 93f540be3..07135757c 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -890,15 +890,15 @@ class DBMySQL : public Module Anope::string by = r.Get(i, "xby"); Anope::string reason = r.Get(i, "reason"); time_t seton = r.Get(i, "seton").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "seton")) : Anope::CurTime; - time_t expires = r.Get(i, "expires").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "expires")) : Anope::CurTime; + time_t expires = r.Get(i, "expire").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "expire")) : Anope::CurTime; XLine *x = NULL; if (SNLine && r.Get(i, "type").equals_cs("SNLINE")) - SNLine->Add(NULL, NULL, mask, expires, reason); + x = SNLine->Add(NULL, NULL, mask, expires, reason); else if (SQLine && r.Get(i, "type").equals_cs("SQLINE")) - SQLine->Add(NULL, NULL, mask, expires, reason); + x = SQLine->Add(NULL, NULL, mask, expires, reason); else if (SZLine && r.Get(i, "type").equals_cs("SZLINE")) - SZLine->Add(NULL, NULL, mask, expires, reason); + x = SZLine->Add(NULL, NULL, mask, expires, reason); if (x) { x->By = by; @@ -1418,7 +1418,7 @@ class DBMySQL : public Module EventReturn OnAddXLine(User *, XLine *x, XLineType Type) { - this->RunQuery(Anope::string("INSERT INTO `anope_os_sxlines` (type, mask, xby, reason, seton, expire) VALUES('") + + this->RunQuery(Anope::string("INSERT INTO `anope_os_xlines` (type, mask, xby, reason, seton, expire) VALUES('") + (Type == X_SNLINE ? "SNLINE" : (Type == X_SQLINE ? "SQLINE" : "SZLINE")) + "', '" + this->Escape(x->Mask) + "', '" + this->Escape(x->By) + "', '" + this->Escape(x->Reason) + "', " + stringify(x->Created) + ", " + stringify(x->Expires) + ")"); diff --git a/src/bots.cpp b/src/bots.cpp index 098404ceb..87a646923 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -75,6 +75,24 @@ BotInfo::~BotInfo() BotListByNick.erase(this->nick); if (!this->uid.empty()) BotListByUID.erase(this->uid); + + if (this->HasFlag(BI_CORE)) + { + if (this == ChanServ) + ChanServ = NULL; + else if (this == BotServ) + BotServ = NULL; + else if (this == HostServ) + HostServ = NULL; + else if (this == OperServ) + OperServ = NULL; + else if (this == MemoServ) + MemoServ = NULL; + else if (this == NickServ) + NickServ = NULL; + else if (this == Global) + Global = NULL; + } } 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); +} + |