diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bots.cpp | 11 | ||||
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 5 | ||||
-rw-r--r-- | src/protocol.cpp | 1 | ||||
-rw-r--r-- | src/send.cpp | 10 | ||||
-rw-r--r-- | src/servers.cpp | 1 |
6 files changed, 26 insertions, 4 deletions
diff --git a/src/bots.cpp b/src/bots.cpp index e94691b05..3e9af64d5 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -20,6 +20,7 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A this->chancount = 0; this->lastmsg = this->created = Anope::CurTime; + this->introduced = false; BotListByNick[this->nick] = this; if (!this->uid.empty()) @@ -28,15 +29,16 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A // If we're synchronised with the uplink already, send the bot. if (Me && Me->IsSynced()) { + Anope::string tmodes = !this->botmodes.empty() ? ("+" + this->botmodes) : (ircd ? ircd->pseudoclient_mode : ""); + if (!tmodes.empty()) + this->SetModesInternal(tmodes.c_str()); + ircdproto->SendClientIntroduction(this); + this->introduced = true; XLine x(this->nick, "Reserved for services"); ircdproto->SendSQLine(NULL, &x); } - Anope::string tmodes = !this->botmodes.empty() ? ("+" + this->botmodes) : (ircd ? ircd->pseudoclient_mode : ""); - if (!tmodes.empty()) - this->SetModesInternal(tmodes.c_str()); - if (Config) for (unsigned i = 0; i < Config->LogInfos.size(); ++i) { @@ -70,6 +72,7 @@ BotInfo::~BotInfo() if (Me && Me->IsSynced()) { ircdproto->SendQuit(this, ""); + this->introduced = false; XLine x(this->nick); ircdproto->SendSQLineDel(&x); } diff --git a/src/init.cpp b/src/init.cpp index 0a218f099..49d9759a8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -32,6 +32,8 @@ void introduce_user(const Anope::string &user) BotInfo *bi = findbot(u->nick); if (bi) { + bi->introduced = true; + XLine x(bi->nick, "Reserved for services"); ircdproto->SendSQLine(NULL, &x); diff --git a/src/main.cpp b/src/main.cpp index df3d217dd..401431683 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,8 +127,13 @@ class UplinkSocket : public ConnectionSocket User *u = it->second; if (u->server == Me) + { /* Don't use quitmsg here, it may contain information you don't want people to see */ ircdproto->SendQuit(u, "Shutting down"); + BotInfo *bi = findbot(u->nick); + if (bi != NULL) + bi->introduced = false; + } } ircdproto->SendSquit(Config->ServerName, quitmsg); diff --git a/src/protocol.cpp b/src/protocol.cpp index 1c2ef4d7d..8517c73b6 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -331,6 +331,7 @@ bool IRCdMessage::OnKill(const Anope::string &source, const std::vector<Anope::s /* Recover if someone kills us. */ if (u->server == Me && (bi = dynamic_cast<BotInfo *>(u))) { + bi->introduced = false; introduce_user(bi->nick); bi->RejoinAll(); } diff --git a/src/send.cpp b/src/send.cpp index c7a0608f8..28c1ca08c 100644 --- a/src/send.cpp +++ b/src/send.cpp @@ -39,6 +39,16 @@ void send_cmd(const Anope::string &source, const char *fmt, ...) return; } + if (!source.empty() && source.find(".") == Anope::string::npos) + { + BotInfo *bi = findbot(source); + if (bi != NULL && bi->introduced == false) + { + Log(LOG_DEBUG) << "Attempted to send \"" << source << " " << buf << "\" with source not introduced"; + return; + } + } + if (!source.empty()) { UplinkSock->Write(":%s %s", source.c_str(), buf); diff --git a/src/servers.cpp b/src/servers.cpp index e63311eef..d1e20e515 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -82,6 +82,7 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A BotInfo *bi = findbot(u->nick); if (bi) { + bi->introduced = true; XLine x(bi->nick, "Reserved for services"); ircdproto->SendSQLine(NULL, &x); } |