diff options
author | Adam <Adam@anope.org> | 2012-10-01 01:56:57 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-10-01 01:56:57 -0400 |
commit | 89428a9d1032e3c2a6e397629a32862b3e58d708 (patch) | |
tree | d507904b3fa1cc084f0f3e688c839bcdd47f79d7 /src/servers.cpp | |
parent | b937d6310d9a7c0e2434200306b63d513cb2ae61 (diff) |
Cleanup of all of the protocol modules, rewrote message handling system to be a bit more C++ ish
Diffstat (limited to 'src/servers.cpp')
-rw-r--r-- | src/servers.cpp | 57 |
1 files changed, 16 insertions, 41 deletions
diff --git a/src/servers.cpp b/src/servers.cpp index 650625cdb..d89757996 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -52,7 +52,8 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it) { BotInfo *bi = it->second; - Anope::string modes = !bi->botmodes.empty() ? ("+" + bi->botmodes) : ircd->pseudoclient_mode; + Anope::string modes = !bi->botmodes.empty() ? ("+" + bi->botmodes) : ircdproto->DefaultPseudoclientModes; + bi->SetModesInternal(modes.c_str()); for (unsigned i = 0; i < bi->botchannels.size(); ++i) { @@ -70,7 +71,10 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A if (cm == NULL) cm = ModeManager::FindChannelModeByChar(ModeManager::GetStatusChar(want_modes[j])); if (cm && cm->Type == MODE_STATUS) - c->SetModeInternal(bi, cm, bi->nick); + { + MessageSource ms = bi; + c->SetModeInternal(ms, cm, bi->nick); + } } } } @@ -113,6 +117,8 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A } } } + + FOREACH_MOD(I_OnNewServer, OnNewServer(this)); } /** Destructor @@ -157,6 +163,7 @@ Server::~Server() void Server::Delete(const Anope::string &reason) { this->QReason = reason; + FOREACH_MOD(I_OnServerQuit, OnServerQuit(this)); delete this; } @@ -205,7 +212,10 @@ void Server::SetSID(const Anope::string &sid) */ const Anope::string &Server::GetSID() const { - return this->SID; + if (!this->SID.empty()) + return this->SID; + else + return this->Name; } /** Get the list of links this server has, or NULL if it has none @@ -395,42 +405,7 @@ Server *Server::Find(const Anope::string &name, Server *s) /*************************************************************************/ -/** - * Handle adding the server to the Server struct - * @param source Name of the uplink if any - * @param servername Name of the server being linked - * @param hops Number of hops to reach this server - * @param descript Description of the server - * @param numeric Server Numberic/SUID - * @return void - */ -void do_server(const Anope::string &source, const Anope::string &servername, unsigned int hops, const Anope::string &descript, const Anope::string &numeric) -{ - if (source.empty()) - Log(LOG_DEBUG) << "Server " << servername << " introduced"; - else - Log(LOG_DEBUG) << "Server introduced (" << servername << ")" << " from " << source; - - Server *s = NULL; - - if (!source.empty()) - { - s = Server::Find(source); - - if (!s) - throw CoreException("Recieved a server from a nonexistant uplink?"); - } - else - s = Me; - - /* Create a server structure. */ - Server *newserver = new Server(s, servername, hops, descript, numeric); - - /* Let modules know about the connection */ - FOREACH_MOD(I_OnNewServer, OnNewServer(newserver)); -} - -static inline char nextID(char &c) +static inline char& nextID(char &c) { if (c == 'Z') c = '0'; @@ -446,7 +421,7 @@ static inline char nextID(char &c) */ const Anope::string ts6_uid_retrieve() { - if (!ircd || !ircd->ts6) + if (!ircdproto || !ircdproto->RequiresID) return ""; static Anope::string current_uid = "AAAAAA"; @@ -465,7 +440,7 @@ const Anope::string ts6_uid_retrieve() */ const Anope::string ts6_sid_retrieve() { - if (!ircd || !ircd->ts6) + if (!ircdproto || !ircdproto->RequiresID) return ""; static Anope::string current_sid; |