diff options
31 files changed, 101 insertions, 107 deletions
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 530d84c57..36dcb0952 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -88,7 +88,7 @@ public: virtual int OnUserRegister(userrec* user) { - if ((allowpattern != "") && (ServerInstance->MatchText(user->nick,allowpattern))) + if ((!allowpattern.empty()) && (ServerInstance->MatchText(user->nick,allowpattern))) { user->Extend("sqlauthed"); return 0; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index a466eb66d..ce2239a42 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -128,7 +128,8 @@ class ModuleSSLGnuTLS : public Module for(int i = 0; i < Conf->Enumerate("bind"); i++) { // For each <bind> tag - if(((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadValue("bind", "ssl", i) == "gnutls")) + std::string x = Conf->ReadValue("bind", "type", i); + if(((x.empty()) || (x == "clients")) && (x == "gnutls")) { // Get the port we're meant to be listening on with SSL std::string port = Conf->ReadValue("bind", "port", i); @@ -171,16 +172,16 @@ class ModuleSSLGnuTLS : public Module dh_bits = Conf->ReadInteger("gnutls", "dhbits", 0, false); // Set all the default values needed. - if(cafile == "") + if (cafile.empty()) cafile = "ca.pem"; - if(crlfile == "") + if (crlfile.empty()) crlfile = "crl.pem"; - if(certfile == "") + if (certfile.empty()) certfile = "cert.pem"; - if(keyfile == "") + if (keyfile.empty()) keyfile = "key.pem"; if((dh_bits != 768) && (dh_bits != 1024) && (dh_bits != 2048) && (dh_bits != 3072) && (dh_bits != 4096)) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 7090f1a01..4ac684843 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -172,7 +172,8 @@ class ModuleSSLOpenSSL : public Module for (int i = 0; i < Conf->Enumerate("bind"); i++) { // For each <bind> tag - if (((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadValue("bind", "ssl", i) == "openssl")) + std::string x = Conf->ReadValue("bind", "type", i); + if (((x.empty()) || (x == "clients")) && (x == "openssl")) { // Get the port we're meant to be listening on with SSL std::string port = Conf->ReadValue("bind", "port", i); @@ -214,25 +215,22 @@ class ModuleSSLOpenSSL : public Module dhfile = Conf->ReadValue("openssl", "dhfile", 0); // Set all the default values needed. - if (cafile == "") + if (cafile.empty()) cafile = "ca.pem"; - if (certfile == "") + if (certfile.empty()) certfile = "cert.pem"; - if (keyfile == "") + if (keyfile.empty()) keyfile = "key.pem"; - if (dhfile == "") + if (dhfile.empty()) dhfile = "dhparams.pem"; // Prepend relative paths with the path to the config directory. if (cafile[0] != '/') cafile = confdir + cafile; - //if(crlfile[0] != '/') - // crlfile = confdir + crlfile; - if (certfile[0] != '/') certfile = confdir + certfile; diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index 1e9c32d26..e0b0afca6 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -419,13 +419,13 @@ class ModuleZLib : public Module return 0; else { - session->outbuf = ""; + session->outbuf.clear(); return 0; } } else { - session->outbuf = ""; + session->outbuf.clear(); return 0; } } @@ -441,7 +441,7 @@ class ModuleZLib : public Module if (session->status == IZIP_OPEN) { session->status = IZIP_CLOSED; - session->outbuf = ""; + session->outbuf.clear(); delete session->inbuf; } } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 2ac6ad55e..15a2928ee 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -101,7 +101,7 @@ class ModuleAlias : public Module int index = *(varname.begin()) - 48; varname.erase(varname.begin()); bool everything_after = (varname == "-"); - std::string word = ""; + std::string word; for (int j = 0; j < index; j++) word = ss.GetToken(); @@ -170,7 +170,7 @@ class ModuleAlias : public Module if ((Aliases[i].operonly) && (!IS_OPER(user))) return 0; - if (Aliases[i].requires != "") + if (!Aliases[i].requires.empty()) { u = ServerInstance->FindNick(Aliases[i].requires); if (!u) @@ -179,7 +179,7 @@ class ModuleAlias : public Module return 1; } } - if ((u != NULL) && (Aliases[i].requires != "") && (Aliases[i].uline)) + if ((u != NULL) && (!Aliases[i].requires.empty()) && (Aliases[i].uline)) { if (!ServerInstance->ULine(u->server)) { diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 16b692518..7e848245a 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -22,7 +22,7 @@ class cmd_alltime : public command_t cmd_alltime(InspIRCd *Instance) : command_t(Instance, "ALLTIME", 'o', 0) { this->source = "m_alltime.so"; - syntax = ""; + syntax.clear(); } CmdResult Handle(const char **parameters, int pcnt, userrec *user) diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 4e90b3f37..39a3ec126 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -126,7 +126,7 @@ class FounderProtectBase userrec* theuser = MyInstance->FindNick(parameter); if ((!theuser) || (!channel->HasUser(theuser))) { - parameter = ""; + parameter.clear(); return NULL; } return theuser; @@ -215,7 +215,7 @@ class ChanFounder : public ModeHandler, public FounderProtectBase { // whoops, someones being naughty! source->WriteServ("468 %s %s :Only servers may set channel mode +q",source->nick, channel->name); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index b5f8373fc..f729943b4 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -210,7 +210,7 @@ class CloakUser : public ModeHandler /* If we get here, yes it really is an ipv6 ip */ unsigned int iv[] = { key1, key2, key3, key4 }; std::vector<std::string> hashies; - std::string item = ""; + std::string item; int rounds = 0; /* Reset the Hash module and send it our IV */ @@ -225,7 +225,7 @@ class CloakUser : public ModeHandler /* Send the Hash module a different hex table for each octet group's Hash sum */ HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send(); hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8)); - item = ""; + item.clear(); } rounds++; } @@ -234,7 +234,7 @@ class CloakUser : public ModeHandler /* Send the Hash module a different hex table for each octet group's Hash sum */ HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send(); hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8)); - item = ""; + item.clear(); } /* Stick them all together */ return irc::stringjoiner(":", hashies, 0, hashies.size() - 1).GetJoined(); diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index d880853ad..f1cc8bc6b 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -65,7 +65,7 @@ class ModuleModesOnConnect : public Module if ((match(user->GetIPString(),hostn.c_str(),true)) || (match(user->host,hostn.c_str()))) { std::string ThisModes = Conf->ReadValue("connect","modes",j); - if (ThisModes != "") + if (!ThisModes.empty()) { std::string buf; stringstream ss(ThisModes); diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 5d32a0adb..7ff0fcdc3 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -231,11 +231,11 @@ class ModuleDNSBL : public Module { ServerInstance->WriteOpers("*** DNSBL(#%d): invalid bitmask",i); } - else if (e->name == "") + else if (e->name.empty()) { ServerInstance->WriteOpers("*** DNSBL(#%d): Invalid name",i); } - else if (e->domain == "") + else if (e->domain.empty()) { ServerInstance->WriteOpers("*** DNSBL(#%d): Invalid domain",i); } @@ -245,7 +245,7 @@ class ModuleDNSBL : public Module } else { - if (e->reason == "") + if (e->reason.empty()) { ServerInstance->WriteOpers("*** DNSBL(#%d): empty reason, using defaults",i); e->reason = "Your IP has been blacklisted."; diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 803ca8d92..cf5c5f96d 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -101,7 +101,7 @@ class ModuleHostChange : public Module { Host* h = (Host*)i->second; // host of new user matches a hostchange tag's mask - std::string newhost = ""; + std::string newhost; if (h->action == "set") { newhost = h->newhost; @@ -113,7 +113,7 @@ class ModuleHostChange : public Module else if (h->action == "addnick") { // first take their nick and strip out non-dns, leaving just [A-Z0-9\-] - std::string complete = ""; + std::string complete; std::string old = user->nick; for (unsigned int j = 0; j < old.length(); j++) { diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp index 2cb890a1e..4b31fadd7 100644 --- a/src/modules/m_http_client.cpp +++ b/src/modules/m_http_client.cpp @@ -302,7 +302,7 @@ bool HTTPSocket::OnDataReady() { this->status = HTTP_DATA; this->data += this->buffer; - this->buffer = ""; + this->buffer.clear(); break; } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 04ddb22c3..ed02c0a5c 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -233,7 +233,7 @@ class HttpServerSocket : public InspSocket if (headers.str().find("\r\n\r\n") != std::string::npos) { - if (request_type == "") + if (request_type.empty()) { headers >> request_type; headers >> uri; @@ -246,7 +246,7 @@ class HttpServerSocket : public InspSocket if ((InternalState == HTTP_SERVE_WAIT_REQUEST) && (request_type == "POST")) { /* Do we need to fetch postdata? */ - postdata = ""; + postdata.clear(); InternalState = HTTP_SERVE_RECV_POSTDATA; std::string header_item; while (headers >> header_item) diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 3bd27a2aa..57b0a6e27 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -113,7 +113,7 @@ class ModuleHttpStats : public Module data << "<table>"; for (int i = 0; i <= ServerInstance->GetModuleCount(); i++) { - if (ServerInstance->Config->module_names[i] != "") + if (!ServerInstance->Config->module_names[i].empty()) data << "<tr><td>" << ServerInstance->Config->module_names[i] << "</td></tr>"; } data << "</table>"; diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index bd5b186c0..b5cf0c02c 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -139,7 +139,7 @@ class JoinFlood : public ModeHandler if ((njoins<1) || (nsecs<1)) { source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } else diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index d936c4f82..c4c58bde5 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -34,7 +34,8 @@ class cmd_jumpserver : public command_t { this->source = "m_jumpserver.so"; syntax = "[<server> <port> <+/-a> :<reason>]"; - redirect_to = reason = ""; + redirect_to.clear(); + reason.clear(); port = 0; redirect_all_immediately = redirect_new_users = false; } @@ -57,12 +58,12 @@ class cmd_jumpserver : public command_t user->WriteServ("NOTICE %s :*** jumpserver was not enabled.", user->nick); port = 0; - redirect_to = ""; + redirect_to.clear(); return CMD_LOCALONLY; } port = 0; - redirect_to = ""; + redirect_to.clear(); for (const char* n = parameters[2]; *n; n++) { diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index a546a85ee..075064554 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -39,7 +39,7 @@ class cmd_knock : public command_t return CMD_FAILURE; } - std::string line = ""; + std::string line; if (c->IsModeSet('K')) { diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index cbc454778..89ac627de 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -34,7 +34,7 @@ public: : command_t(Instance, "LOCKSERV", 'o', 0), locked(lock) { this->source = "m_lockserv.so"; - syntax = ""; + syntax.clear(); } CmdResult Handle (const char** parameters, int pcnt, userrec *user) @@ -57,7 +57,7 @@ public: : command_t(Instance, "UNLOCKSERV", 'o', 0), locked(lock) { this->source = "m_lockserv.so"; - syntax = ""; + syntax.clear(); } CmdResult Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index e4510d155..432bfbb89 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -135,7 +135,7 @@ class MsgFlood : public ModeHandler if ((nlines<1) || (nsecs<1)) { source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } else @@ -167,7 +167,7 @@ class MsgFlood : public ModeHandler else { source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } } diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index c2524fb51..e617c47e0 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -53,7 +53,7 @@ class ModuleOperLog : public Module command_t* thiscommand = ServerInstance->Parser->GetHandler(command); if ((thiscommand) && (thiscommand->flags_needed = 'o')) { - std::string plist = ""; + std::string plist; for (int j = 0; j < pcnt; j++) plist.append(std::string(" ")+std::string(parameters[j])); diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index a720be522..ce1fcfb07 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -18,9 +18,9 @@ static FileReader *quotes = NULL; -std::string q_file = ""; -std::string prefix = ""; -std::string suffix = ""; +std::string q_file; +std::string prefix; +std::string suffix; /* $ModDesc: Provides random Quotes on Connect. */ @@ -39,7 +39,7 @@ class cmd_randquote : public command_t std::string str; int fsize; - if (q_file == "" || quotes->Exists()) + if (q_file.empty() || quotes->Exists()) { fsize = quotes->FileSize(); str = quotes->GetLine(rand() % fsize); @@ -92,7 +92,7 @@ class ModuleRandQuote : public Module mycommand = NULL; - if (q_file == "") + if (q_file.empty()) { RandquoteException e("m_randquote: Quotefile not specified - Please check your config."); throw(e); diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 0cbbf751a..97be309d8 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -48,7 +48,7 @@ class Redirect : public ModeHandler if (!ServerInstance->IsChannel(parameter.c_str())) { source->WriteServ("403 %s %s :Invalid channel name",source->nick, parameter.c_str()); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } @@ -61,7 +61,7 @@ class Redirect : public ModeHandler if ((c == channel) || (c->IsModeSet('L'))) { source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str()); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } else diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index c93fde452..bc2810da3 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -31,7 +31,7 @@ class cmd_setname : public command_t CmdResult Handle (const char** parameters, int pcnt, userrec *user) { - std::string line = ""; + std::string line; for (int i = 0; i < pcnt-1; i++) { line = line + std::string(parameters[i]) + " "; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 99041dc0d..573126ad3 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -979,7 +979,7 @@ void ModuleSpanningTree::OnUserPart(userrec* user, chanrec* channel, const std:: { std::deque<std::string> params; params.push_back(channel->name); - if (partmessage != "") + if (!partmessage.empty()) params.push_back(":"+partmessage); Utils->DoOneToMany(user->nick,"PART",params); } @@ -1073,7 +1073,7 @@ void ModuleSpanningTree::OnRemoteKill(userrec* source, userrec* dest, const std: void ModuleSpanningTree::OnRehash(userrec* user, const std::string ¶meter) { - if (parameter != "") + if (!parameter.empty()) { std::deque<std::string> params; params.push_back(parameter); diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 1eb1c7bfd..b5cac1802 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -31,9 +31,9 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance) : ServerInstance(Instance), Utils(Util) { Parent = NULL; - ServerName = ""; - ServerDesc = ""; - VersionString = ""; + ServerName.clear(); + ServerDesc.clear(); + VersionString.clear(); UserCount = OperCount = 0; rtt = LastPing = 0; Hidden = false; @@ -47,7 +47,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance) : Server TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc) : ServerInstance(Instance), ServerName(Name.c_str()), ServerDesc(Desc), Utils(Util) { Parent = NULL; - VersionString = ""; + VersionString.clear(); UserCount = ServerInstance->UserCount(); OperCount = ServerInstance->OperCount(); VersionString = ServerInstance->GetVersionString(); @@ -65,7 +65,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, TreeServer* Above, TreeSocket* Sock, bool Hide) : ServerInstance(Instance), Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util), Hidden(Hide) { - VersionString = ""; + VersionString.clear(); UserCount = OperCount = 0; this->SetNextPingTime(time(NULL) + 60); this->SetPingFlag(); diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index d1dad0914..168ca9e99 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -46,7 +46,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string ho { myhost = host; this->LinkState = LISTENER; - theirchallenge = ourchallenge = ""; + theirchallenge.clear(); + ourchallenge.clear(); if (listening && Hook) InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); } @@ -55,7 +56,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string ho : InspSocket(SI, host, port, listening, maxtime, bindto), Utils(Util), Hook(HookMod) { myhost = ServerName; - theirchallenge = ourchallenge = ""; + theirchallenge.clear(); + ourchallenge.clear(); this->LinkState = CONNECTING; if (Hook) InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); @@ -69,7 +71,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, cha : InspSocket(SI, newfd, ip), Utils(Util), Hook(HookMod) { this->LinkState = WAIT_AUTH_1; - theirchallenge = ourchallenge = ""; + theirchallenge.clear(); + ourchallenge.clear(); /* If we have a transport module hooked to the parent, hook the same module to this * socket, and set a timer waiting for handshake before we send CAPAB etc. */ @@ -274,7 +277,7 @@ void TreeSocket::SendServers(TreeServer* Current, TreeServer* s, int hops) std::string TreeSocket::MyCapabilities() { std::vector<std::string> modlist; - std::string capabilities = ""; + std::string capabilities; for (int i = 0; i <= this->Instance->GetModuleCount(); i++) { if (this->Instance->modules[i]->GetVersion().Flags & VF_COMMON) @@ -386,7 +389,7 @@ std::string TreeSocket::ListDifference(const std::string &one, const std::string { irc::commasepstream list_one(one); std::string item = "*"; - std::string result = ""; + std::string result; while ((item = list_one.GetToken()) != "") { if (!HasItem(two, item)) @@ -416,12 +419,12 @@ bool TreeSocket::Capab(const std::deque<std::string> ¶ms) } if (params[0] == "START") { - this->ModuleList = ""; + this->ModuleList.clear(); this->CapKeys.clear(); } else if (params[0] == "END") { - std::string reason = ""; + std::string reason; int ip6support = 0; #ifdef SUPPORT_IP6LINKS ip6support = 1; @@ -998,16 +1001,14 @@ void TreeSocket::SendFJoins(TreeServer* Current, chanrec* c) char list[MAXBUF]; std::string individual_halfops = std::string(":")+this->Instance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age); - Instance->Log(DEBUG,"Sending FJOINs for %s", c->name); - size_t dlen, curlen; dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",this->Instance->Config->ServerName,c->name,(unsigned long)c->age); int numusers = 0; char* ptr = list + dlen; CUList *ulist = c->GetUsers(); - std::string modes = ""; - std::string params = ""; + std::string modes; + std::string params; for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) { @@ -1021,7 +1022,6 @@ void TreeSocket::SendFJoins(TreeServer* Current, chanrec* c) if (curlen > (480-NICKMAX)) { - Instance->Log(DEBUG,"Flushing FJOIN buffer: %s", list); buffer.append(list).append("\r\n"); dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",this->Instance->Config->ServerName,c->name,(unsigned long)c->age); ptr = list + dlen; @@ -1030,13 +1030,8 @@ void TreeSocket::SendFJoins(TreeServer* Current, chanrec* c) } } - Instance->Log(DEBUG,"%d users remaining to be flushed", list); - if (numusers) - { - Instance->Log(DEBUG,"Flushing final FJOIN buffer: %s", list); buffer.append(list).append("\r\n"); - } buffer.append(":").append(this->Instance->Config->ServerName).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(c->ChanModes(true)).append("\r\n"); @@ -1055,8 +1050,8 @@ void TreeSocket::SendFJoins(TreeServer* Current, chanrec* c) { /* Wrap at MAXMODES */ buffer.append(":").append(this->Instance->Config->ServerName).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n"); - modes = ""; - params = ""; + modes.clear(); + params.clear(); linesize = 1; } } diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 7df022b85..02affd097 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -49,7 +49,7 @@ bool TreeSocket::Error(std::deque<std::string> ¶ms) { if (params.size() < 1) return false; - this->Instance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(InboundServerName != "" ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); + this->Instance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); /* we will return false to cause the socket to close. */ return false; } @@ -1182,7 +1182,7 @@ bool TreeSocket::ProcessLine(std::string &line) */ command = "MODE"; } - std::string target = ""; + std::string target; /* Yes, know, this is a mess. Its reasonably fast though as we're * working with std::string here. */ @@ -1254,7 +1254,7 @@ bool TreeSocket::ProcessLine(std::string &line) } else if (command == "PING") { - if (prefix == "") + if (prefix.empty()) prefix = this->GetName(); /* * We just got a ping from a server that's bursting. @@ -1276,7 +1276,7 @@ bool TreeSocket::ProcessLine(std::string &line) } else if (command == "PONG") { - if (prefix == "") + if (prefix.empty()) prefix = this->GetName(); /* * We just got a pong from a server that's bursting. @@ -1317,7 +1317,7 @@ bool TreeSocket::ProcessLine(std::string &line) } else if (command == "SVSNICK") { - if (prefix == "") + if (prefix.empty()) { prefix = this->GetName(); } @@ -1361,7 +1361,7 @@ bool TreeSocket::ProcessLine(std::string &line) delete chan; } } - if (this->InboundServerName != "") + if (!this->InboundServerName.empty()) { sourceserv = this->InboundServerName; } @@ -1369,7 +1369,7 @@ bool TreeSocket::ProcessLine(std::string &line) } else if (command == "SVSJOIN") { - if (prefix == "") + if (prefix.empty()) { prefix = this->GetName(); } @@ -1386,7 +1386,7 @@ bool TreeSocket::ProcessLine(std::string &line) else if (command == "OPERNOTICE") { std::string sourceserv = this->myhost; - if (this->InboundServerName != "") + if (!this->InboundServerName.empty()) sourceserv = this->InboundServerName; if (params.size() >= 1) Instance->WriteOpers("*** From " + sourceserv + ": " + params[0]); @@ -1395,7 +1395,7 @@ bool TreeSocket::ProcessLine(std::string &line) else if (command == "MODENOTICE") { std::string sourceserv = this->myhost; - if (this->InboundServerName != "") + if (!this->InboundServerName.empty()) sourceserv = this->InboundServerName; if (params.size() >= 2) { @@ -1406,7 +1406,7 @@ bool TreeSocket::ProcessLine(std::string &line) else if (command == "SNONOTICE") { std::string sourceserv = this->myhost; - if (this->InboundServerName != "") + if (!this->InboundServerName.empty()) sourceserv = this->InboundServerName; if (params.size() >= 2) { @@ -1420,10 +1420,8 @@ bool TreeSocket::ProcessLine(std::string &line) Instance->XLines->apply_lines(Utils->lines_to_apply); Utils->lines_to_apply = 0; std::string sourceserv = this->myhost; - if (this->InboundServerName != "") - { + if (!this->InboundServerName.empty()) sourceserv = this->InboundServerName; - } this->Instance->SNO->WriteToSnoMask('l',"Received end of netburst from \2%s\2",sourceserv.c_str()); Event rmode((char*)sourceserv.c_str(), (Module*)Utils->Creator, "new_server"); @@ -1438,7 +1436,7 @@ bool TreeSocket::ProcessLine(std::string &line) // this saves us having a huge ugly parser. userrec* who = this->Instance->FindNick(prefix); std::string sourceserv = this->myhost; - if (this->InboundServerName != "") + if (!this->InboundServerName.empty()) { sourceserv = this->InboundServerName; } @@ -1527,7 +1525,7 @@ bool TreeSocket::ProcessLine(std::string &line) std::string TreeSocket::GetName() { std::string sourceserv = this->myhost; - if (this->InboundServerName != "") + if (!this->InboundServerName.empty()) { sourceserv = this->InboundServerName; } @@ -1551,7 +1549,7 @@ void TreeSocket::OnClose() // If the connection is fully up (state CONNECTED) // then propogate a netsplit to all peers. std::string quitserver = this->myhost; - if (this->InboundServerName != "") + if (!this->InboundServerName.empty()) { quitserver = this->InboundServerName; } @@ -1561,7 +1559,7 @@ void TreeSocket::OnClose() Squit(s,"Remote host closed the connection"); } - if (quitserver != "") + if (!quitserver.empty()) { this->Instance->SNO->WriteToSnoMask('l',"Connection to '\2%s\2' failed.",quitserver.c_str()); time_t server_uptime = Instance->Time() - this->age; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 6c4001503..8b191fa03 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -409,7 +409,7 @@ void SpanningTreeUtilities::RefreshIPCache() ValidIPs.clear(); for (std::vector<Link>::iterator L = LinkBlocks.begin(); L != LinkBlocks.end(); L++) { - if ((L->IPAddr != "") && (L->RecvPass != "") && (L->SendPass != "") && (L->Name != "") && (L->Port)) + if ((!L->IPAddr.empty()) && (!L->RecvPass.empty()) && (!L->SendPass.empty()) && (!L->Name.empty()) && (L->Port)) { ValidIPs.push_back(L->IPAddr); @@ -468,7 +468,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) while ((portno = portrange.GetToken())) { if (IP == "*") - IP = ""; + IP.clear(); if ((!transport.empty()) && (hooks.find(transport.c_str()) == hooks.end())) { @@ -536,7 +536,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) /* Bugfix by brain, do not allow people to enter bad configurations */ if (L.Name != ServerInstance->Config->ServerName) { - if ((L.IPAddr != "") && (L.RecvPass != "") && (L.SendPass != "") && (L.Name != "") && (L.Port)) + if ((!L.IPAddr.empty()) && (!L.RecvPass.empty()) && (!L.SendPass.empty()) && (!L.Name.empty()) && (L.Port)) { ValidIPs.push_back(L.IPAddr); @@ -583,19 +583,19 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) } else { - if (L.IPAddr == "") + if (L.IPAddr.empty()) { ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', IP address not defined!",L.Name.c_str()); } - else if (L.RecvPass == "") + else if (L.RecvPass.empty()) { ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', recvpass not defined!",L.Name.c_str()); } - else if (L.SendPass == "") + else if (L.SendPass.empty()) { ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', sendpass not defined!",L.Name.c_str()); } - else if (L.Name == "") + else if (L.Name.empty()) { ServerInstance->Log(DEFAULT,"Invalid configuration, link tag without a name!"); } diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 17998b964..d8843094f 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -77,7 +77,7 @@ class cmd_spylist : public command_t cmd_spylist (InspIRCd* Instance) : command_t(Instance,"SPYLIST", 'o', 0) { this->source = "m_spy.so"; - syntax = ""; + syntax.clear(); } CmdResult Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 1b32cba3b..822867488 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -40,7 +40,7 @@ class cmd_vhost : public command_t std::string pass = Conf->ReadValue("vhost","pass",index); if ((!strcmp(parameters[0],username.c_str())) && (!strcmp(parameters[1],pass.c_str()))) { - if (mask != "") + if (!mask.empty()) { user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask); user->ChangeDisplayedHost(mask.c_str()); diff --git a/src/modules/m_xmlsocket.cpp b/src/modules/m_xmlsocket.cpp index face79635..27c767118 100644 --- a/src/modules/m_xmlsocket.cpp +++ b/src/modules/m_xmlsocket.cpp @@ -47,7 +47,8 @@ class ModuleXMLSocket : public Module for (int i = 0; i < Conf->Enumerate("bind"); i++) { // For each <bind> tag - if (((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadFlag("bind", "xmlsocket", i))) + std::string x = Conf->ReadValue("bind", "type", i); + if (((x.empty()) || (x == "clients")) && (Conf->ReadFlag("bind", "xmlsocket", i))) { // Get the port we're meant to be listening on with SSL std::string port = Conf->ReadValue("bind", "port", i); |