X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fserver.cpp;h=f22cf1ad4a168f275a9c1d5e96a6debaea771616;hb=0053cf0d24ab60a474bd1b84060f96d7108d56d8;hp=ab53692315dd33f8325738ce10001d9c6c16289e;hpb=b071a6acd805bde6119a66481768be13102d1c2b;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/server.cpp b/src/server.cpp index ab5369231..f22cf1ad4 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -46,13 +46,9 @@ void InspIRCd::Exit(int status) #ifdef _WIN32 SetServiceStopped(status); #endif - if (this) - { - this->SendError("Exiting with status " + ConvToStr(status) + " (" + std::string(ExitCodes[status]) + ")"); - this->Cleanup(); - delete this; - ServerInstance = NULL; - } + this->Cleanup(); + ServerInstance = NULL; + delete this; exit (status); } @@ -193,41 +189,39 @@ void ISupportManager::Build() std::map::iterator extban = tokens.find("EXTBAN"); if (extban != tokens.end()) { - sort(extban->second.begin(), extban->second.end()); + std::sort(extban->second.begin(), extban->second.end()); extban->second.insert(0, ","); } // Transform the map into a list of lines, ready to be sent to clients - std::vector& lines = this->Lines; - std::string line; + Numeric::Numeric numeric(RPL_ISUPPORT); unsigned int token_count = 0; - lines.clear(); + cachedlines.clear(); for (std::map::const_iterator it = tokens.begin(); it != tokens.end(); ++it) { - line.append(it->first); + numeric.push(it->first); + std::string& token = numeric.GetParams().back(); // If this token has a value then append a '=' char after the name and then the value itself if (!it->second.empty()) - line.append(1, '=').append(it->second); + token.append(1, '=').append(it->second); - // Always append a space, even if it's the last token because all lines will be suffixed - line.push_back(' '); token_count++; if (token_count % 13 == 12 || it == --tokens.end()) { // Reached maximum number of tokens for this line or the current token // is the last one; finalize the line and store it for later use - line.append(":are supported by this server"); - lines.push_back(line); - line.clear(); + numeric.push("are supported by this server"); + cachedlines.push_back(numeric); + numeric.GetParams().clear(); } } } void ISupportManager::SendTo(LocalUser* user) { - for (std::vector::const_iterator i = this->Lines.begin(); i != this->Lines.end(); ++i) - user->WriteNumeric(RPL_ISUPPORT, *i); + for (std::vector::const_iterator i = cachedlines.begin(); i != cachedlines.end(); ++i) + user->WriteNumeric(*i); }