diff options
Diffstat (limited to 'src')
55 files changed, 182 insertions, 219 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 9ed0f8ee4..b8195ee9f 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -81,7 +81,7 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset) /* 0: check status, 1: don't, -1: disallow change silently */ FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(u,this,ntopic)); - + if (MOD_RESULT == 1) return CMD_FAILURE; else if (MOD_RESULT == 0) diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 9ea7b0202..7c18c8ab1 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -262,10 +262,10 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) command_p.push_back(token); std::transform(command.begin(), command.end(), command.begin(), ::toupper); - + /* find the command, check it exists */ Commandtable::iterator cm = cmdlist.find(command); - + if (cm == cmdlist.end()) { int MOD_RESULT = 0; @@ -310,7 +310,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) { // BE CAREFUL: .end() returns past the end of the vector, hence decrement. std::vector<std::string>::iterator it = --command_p.end(); - + lparam.insert(0, " " + *(it)); command_p.erase(it); // remove last element } @@ -679,5 +679,3 @@ int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, st return translations; } - - diff --git a/src/commands.cpp b/src/commands.cpp index 18153d87b..9a388684f 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -23,13 +23,13 @@ bool InspIRCd::HostMatchesEveryone(const std::string &mask, User* user) { char itrigger[MAXBUF]; long matches = 0; - + if (!Config->ConfValue(Config->config_data, "insane","trigger", 0, itrigger, MAXBUF)) strlcpy(itrigger,"95.5",MAXBUF); - + if (Config->ConfValueBool(Config->config_data, "insane","hostmasks", 0)) return false; - + for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++) { if ((InspIRCd::Match(u->second->MakeHost(), mask, ascii_case_insensitive_map)) || @@ -55,13 +55,13 @@ bool InspIRCd::IPMatchesEveryone(const std::string &ip, User* user) { char itrigger[MAXBUF]; long matches = 0; - + if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF)) strlcpy(itrigger,"95.5",MAXBUF); - + if (Config->ConfValueBool(Config->config_data, "insane","ipmasks",0)) return false; - + for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++) { if (InspIRCd::Match(u->second->GetIPString(), ip, ascii_case_insensitive_map)) @@ -84,10 +84,10 @@ bool InspIRCd::NickMatchesEveryone(const std::string &nick, User* user) { char itrigger[MAXBUF]; long matches = 0; - + if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF)) strlcpy(itrigger,"95.5",MAXBUF); - + if (Config->ConfValueBool(Config->config_data, "insane","nickmasks",0)) return false; diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp index 7d9204fe6..9f1bf4591 100644 --- a/src/commands/cmd_die.cpp +++ b/src/commands/cmd_die.cpp @@ -31,7 +31,7 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User * ServerInstance->Logs->Log("COMMAND",SPARSE, diebuf); ServerInstance->SendError(diebuf); } - + if (ServerInstance->Config->DieDelay) sleep(ServerInstance->Config->DieDelay); diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp index 782ef8c45..0a4c32866 100644 --- a/src/commands/cmd_eline.cpp +++ b/src/commands/cmd_eline.cpp @@ -25,7 +25,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User *user) { std::string target = parameters[0]; - + if (parameters.size() >= 3) { IdentHostPair ih; diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp index 18b5fa9ef..ad60b0416 100644 --- a/src/commands/cmd_gline.cpp +++ b/src/commands/cmd_gline.cpp @@ -25,7 +25,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User *user) { std::string target = parameters[0]; - + if (parameters.size() >= 3) { IdentHostPair ih; @@ -92,4 +92,3 @@ CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User return CMD_SUCCESS; } - diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp index 827951366..691c92444 100644 --- a/src/commands/cmd_kline.cpp +++ b/src/commands/cmd_kline.cpp @@ -38,7 +38,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User } else ih = ServerInstance->XLines->IdentSplit(target.c_str()); - + if (ih.first.empty()) { user->WriteServ("NOTICE %s :*** Target not found", user->nick.c_str()); @@ -91,4 +91,3 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User return CMD_SUCCESS; } - diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp index d22bd2fce..3e249b864 100644 --- a/src/commands/cmd_notice.cpp +++ b/src/commands/cmd_notice.cpp @@ -27,7 +27,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use CUList exempt_list; user->idle_lastmsg = ServerInstance->Time(); - + if (ServerInstance->Parser->LoopCall(user, this, parameters, 0)) return CMD_SUCCESS; if (parameters[0][0] == '$') @@ -123,7 +123,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use } return CMD_SUCCESS; } - + const char* destnick = parameters[0].c_str(); if (IS_LOCAL(user)) @@ -185,4 +185,3 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use return CMD_SUCCESS; } - diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index da07d631c..270306b05 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -128,7 +128,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User // tell them they suck, and lag them up to help prevent brute-force attacks user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick.c_str()); user->IncreasePenalty(10); - + snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str(), fields.c_str()); ServerInstance->SNO->WriteToSnoMask('o',std::string(broadcast)); ServerInstance->PI->SendSNONotice("o", std::string("OPER: ") + broadcast); @@ -150,4 +150,3 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User } return CMD_SUCCESS; } - diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp index 54fd13216..d9fbfb595 100644 --- a/src/commands/cmd_part.cpp +++ b/src/commands/cmd_part.cpp @@ -44,7 +44,7 @@ CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User return CMD_SUCCESS; Channel* c = ServerInstance->FindChan(parameters[0]); - + if (c) { if (!c->PartUser(user, reason)) diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index 64adafbe8..0ff7661a3 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -26,7 +26,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us CUList except_list; user->idle_lastmsg = ServerInstance->Time(); - + if (ServerInstance->Parser->LoopCall(user, this, parameters, 0)) return CMD_SUCCESS; @@ -120,7 +120,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%s", status, chan->name.c_str(), text); } } - else + else { chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name.c_str(), text); } @@ -141,7 +141,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us if (IS_LOCAL(user)) { const char* targetserver = strchr(destnick, '@'); - + if (targetserver) { std::string nickonly; @@ -176,7 +176,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us } int MOD_RESULT = 0; - + std::string temp = parameters[1]; FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user, dest, TYPE_USER, temp, 0, except_list)); if (MOD_RESULT) { @@ -202,4 +202,3 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us } return CMD_SUCCESS; } - diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp index ba31dbd3e..6920896d8 100644 --- a/src/commands/cmd_reloadmodule.cpp +++ b/src/commands/cmd_reloadmodule.cpp @@ -31,7 +31,7 @@ CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameter return CMD_SUCCESS; } } - + ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unsuccessfully reloaded %s",user->nick.c_str(), parameters[0].c_str()); user->WriteNumeric(975, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); return CMD_FAILURE; diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index aea34511c..66274c58a 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -61,7 +61,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str results.push_back(sn + " 481 " + user->nick + " :Permission denied - STATS " + statschar + " requires the servers/auspex priv."); return; } - + int MOD_RESULT = 0; FOREACH_RESULT(I_OnStats,OnStats(statschar, user, results)); if (MOD_RESULT) @@ -93,7 +93,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str case 'n': case 'c': break; - + case 'i': { int idx = 0; @@ -105,7 +105,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str } } break; - + case 'Y': { int idx = 0; @@ -129,7 +129,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str } } break; - + case 'P': { int idx = 0; @@ -145,7 +145,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str results.push_back(sn+" 249 "+user->nick+" :"+ConvToStr(idx)+" OPER(s)"); } break; - + case 'k': ServerInstance->XLines->InvokeStats("K",216,user,results); break; @@ -239,7 +239,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str timeval tv; char percent[30]; gettimeofday(&tv, NULL); - + float n_elapsed = ((tv.tv_sec - ServerInstance->stats->LastSampled.tv_sec) * 1000000 + tv.tv_usec - ServerInstance->stats->LastSampled.tv_usec); float n_eaten = ((R.ru_utime.tv_sec - ServerInstance->stats->LastCPU.tv_sec) * 1000000 + R.ru_utime.tv_usec - ServerInstance->stats->LastCPU.tv_usec); float per = (n_eaten / n_elapsed) * 100; @@ -259,7 +259,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str #endif } break; - + case 'T': { char buffer[MAXBUF]; diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp index 8ed5f606c..40ba937c1 100644 --- a/src/commands/cmd_userhost.cpp +++ b/src/commands/cmd_userhost.cpp @@ -23,7 +23,6 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U { std::string retbuf = std::string("302 ") + user->nick + " :"; - for (unsigned int i = 0; i < parameters.size(); i++) { User *u = ServerInstance->FindNick(parameters[i]); diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 4f44fd518..9ba3c0fc9 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -286,10 +286,10 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User * if (CanView(ch,user)) { bool inside = ch->HasUser(user); - + /* who on a channel. */ CUList *cu = ch->GetUsers(); - + for (CUList::iterator i = cu->begin(); i != cu->end(); i++) { /* None of this applies if we WHO ourselves */ @@ -298,12 +298,12 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User * /* opers only, please */ if (opt_viewopersonly && !IS_OPER(i->first)) continue; - + /* If we're not inside the channel, hide +i users */ if (i->first->IsModeSet('i') && !inside && !user->HasPrivPermission("users/auspex")) continue; } - + SendWhoLine(user, initial, ch, i->first, whoresults); } } @@ -362,4 +362,3 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User * return CMD_FAILURE; } } - diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index f15b523c0..6340216f7 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -56,18 +56,18 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use time_t rawtime = u->signon; tm *timeinfo; char b[MAXBUF]; - + timeinfo = localtime(&rawtime); - + /* XXX - 'b' could be only 25 chars long and then strlcpy() would terminate it for us too? */ strlcpy(b,asctime(timeinfo),MAXBUF); b[24] = 0; user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick.c_str(),parameters[0].c_str(),u->ident,u->dhost,u->gecos); - + if (user->HasPrivPermission("users/auspex")) user->WriteNumeric(379, "%s %s :was connecting from *@%s", user->nick.c_str(), parameters[0].c_str(), u->host); - + if (*ServerInstance->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex")) user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(),parameters[0].c_str(), ServerInstance->Config->HideWhoisServer, b); else diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp index f275ac313..b0df24a95 100644 --- a/src/commands/cmd_zline.cpp +++ b/src/commands/cmd_zline.cpp @@ -35,7 +35,7 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User } User *u = ServerInstance->FindNick(target.c_str()); - + if (u) { target = u->GetIPString(); diff --git a/src/dns.cpp b/src/dns.cpp index 0801fc76c..4e2a5b5a9 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -214,7 +214,7 @@ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryTyp this->rr_class = 1; this->type = qt; - + DNS::EmptyHeader(payload,header,length); #ifdef IPV6 @@ -250,7 +250,7 @@ DNSRequest* DNS::AddQuery(DNSHeader *header, int &id, const char* original) /* Is the DNS connection down? */ if (this->GetFd() == -1) return NULL; - + /* Create an id */ id = this->PRNG() & DNS::MAX_REQUEST_ID; @@ -405,7 +405,7 @@ DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance) /* DNS::Rehash() sets this to a valid ptr */ this->cache = NULL; - + /* Again, DNS::Rehash() sets this to a * valid value */ @@ -463,7 +463,7 @@ int DNS::GetIP(const char *name) DNSHeader h; int id; int length; - + if ((length = this->MakePayload(name, DNS_QUERY_A, 1, (unsigned char*)&h.payload)) == -1) return -1; @@ -763,7 +763,6 @@ DNSResult DNS::GetResult(int resultnum) default: break; - } /* Build the reply with the id and hostname/ip in it */ @@ -847,7 +846,7 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length, int result_we_w /* XXX: We actually initialise 'rr' here including its ttl field */ if (curanswer == result_we_want) DNS::FillResourceRecord(&rr,&header.payload[i]); - + i += 10; if (rr.type != this->type) { @@ -939,7 +938,7 @@ CachedQuery* DNS::GetCache(const std::string &source) else return NULL; } - + void DNS::DelCache(const std::string &source) { cache->erase(source.c_str()); @@ -1064,7 +1063,7 @@ void DNS::HandleEvent(EventType, int) res = this->GetResult(resultnum); ServerInstance->Logs->Log("RESOLVER",DEBUG,"Result %d id %d", resultnum, res.id); - + /* Is there a usable request id? */ if (res.id != -1) { @@ -1091,7 +1090,7 @@ void DNS::HandleEvent(EventType, int) { if (ServerInstance && ServerInstance->stats) ServerInstance->stats->statsDnsGood++; - + if (!this->GetCache(res.original.c_str())) this->cache->insert(std::make_pair(res.original.c_str(), CachedQuery(res.result, res.ttl))); @@ -1100,14 +1099,14 @@ void DNS::HandleEvent(EventType, int) Classes[res.id] = NULL; } } - + if (ServerInstance && ServerInstance->stats) ServerInstance->stats->statsDns++; } resultnum++; } - + /** Add a derived Resolver to the working set */ bool DNS::AddResolverClass(Resolver* r) { @@ -1169,5 +1168,3 @@ unsigned long DNS::PRNG() val += (s->statsConnects ^ (unsigned long)s->statsSent ^ (unsigned long)s->statsRecv) - ServerInstance->Config->ports.size(); return val; } - - diff --git a/src/dynamic.cpp b/src/dynamic.cpp index fd0b60cf5..29b5c7b94 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -52,7 +52,7 @@ bool DLLManager::GetSymbol(void** v, const char* sym_name) * try extract a symbol from the library * get any error message is there is any */ - + if (h) { dlerror(); // clear value @@ -61,7 +61,7 @@ bool DLLManager::GetSymbol(void** v, const char* sym_name) if (!*v || err) return false; } - + /* succeeded :) */ return true; } diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index ab4d8368d..8f02e7668 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -290,7 +290,7 @@ std::string irc::hex(const unsigned char *raw, size_t rawsz) return ""; /* EWW! This used to be using sprintf, which is WAY inefficient. -Special */ - + const char *hex = "0123456789abcdef"; static char hexbuf[MAXBUF]; @@ -455,7 +455,7 @@ long irc::portparser::GetToken() { while (((Overlaps(in_range)) && (in_range <= range_end))) in_range++; - + if (in_range <= range_end) return in_range; } @@ -522,4 +522,3 @@ long irc::portparser::GetToken() text = replacement; return text; }*/ - diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index f38b3e6b5..c56dc39ae 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -55,7 +55,7 @@ User* InspIRCd::FindNick(const char* nick) return FindUUID(nick); user_hash::iterator iter = this->Users->clientlist->find(nick); - + if (iter == this->Users->clientlist->end()) return NULL; @@ -204,7 +204,7 @@ bool IsChannelHandler::Call(const char *chname, size_t max) c++; } - size_t len = c - chname; + size_t len = c - chname; /* too long a name - note funky pointer arithmetic here. */ if (len > max) { @@ -219,7 +219,7 @@ bool IsNickHandler::Call(const char* n, size_t max) { if (!n || !*n) return false; - + unsigned int p = 0; for (const char* i = n; *i; i++, p++) { @@ -443,7 +443,7 @@ void InspIRCd::AddExtBanChar(char c) { std::string &tok = Config->data005; std::string::size_type ebpos; - + if ((ebpos = tok.find(" EXTBAN=,")) == std::string::npos) { tok.append(" EXTBAN=,"); @@ -452,6 +452,3 @@ void InspIRCd::AddExtBanChar(char c) else tok.insert(ebpos + 9, 1, c); } - - - diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 431ed13d9..a921db193 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -319,7 +319,7 @@ void InspIRCd::WritePID(const std::string &filename) InspIRCd::InspIRCd(int argc, char** argv) : GlobalCulls(this), - /* Functor initialisation. Note that the ordering here is very important. + /* Functor initialisation. Note that the ordering here is very important. * * THIS MUST MATCH ORDER OF DECLARATION OF THE HandleWhateverFunc classes * within class InspIRCd. @@ -351,7 +351,7 @@ InspIRCd::InspIRCd(int argc, char** argv) #ifdef WIN32 // Strict, frequent checking of memory on debug builds _CrtSetDbgFlag ( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); - + // Avoid erroneous frees on early exit WindowsIPC = 0; #endif @@ -400,10 +400,10 @@ InspIRCd::InspIRCd(int argc, char** argv) this->PI = new ProtocolInterface(this); this->s_signal = 0; - + // Create base manager classes early, so nothing breaks this->Users = new UserManager(this); - + this->Users->unregistered_count = 0; this->Users->clientlist = new user_hash(); @@ -518,7 +518,7 @@ InspIRCd::InspIRCd(int argc, char** argv) /* Windows can (and defaults to) hide file extensions, so let's play a bit nice for windows users. */ std::string txtconf = this->ConfigFileName; txtconf.append(".txt"); - + if (ServerConfig::FileExists(txtconf.c_str())) { strlcat(this->ConfigFileName, ".txt", MAXBUF); @@ -625,7 +625,7 @@ InspIRCd::InspIRCd(int argc, char** argv) printf("\n"); this->Modules->LoadAll(); - + /* Just in case no modules were loaded - fix for bug #101 */ this->BuildISupport(); InitializeDisabledCommands(Config->DisabledCommands, this); @@ -643,7 +643,7 @@ InspIRCd::InspIRCd(int argc, char** argv) } printf("\nInspIRCd is now running as '%s'[%s] with %d max open sockets\n", Config->ServerName,Config->GetSID().c_str(), SE->GetMaxFds()); - + #ifndef WINDOWS if (!Config->nofork) { @@ -852,7 +852,7 @@ int InspIRCd::Run() this->stats->LastCPU = ru.ru_utime; } #else - WindowsIPC->Check(); + WindowsIPC->Check(); #endif } diff --git a/src/inspstring.cpp b/src/inspstring.cpp index 5955ae845..b4c581f94 100644 --- a/src/inspstring.cpp +++ b/src/inspstring.cpp @@ -24,9 +24,9 @@ * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * @@ -41,7 +41,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #ifndef HAS_STRLCPY CoreExport size_t strlcat(char *dst, const char *src, size_t siz) { @@ -136,4 +136,3 @@ CoreExport bool charremove(char* mp, char remove) return shift_down; } - diff --git a/src/logger.cpp b/src/logger.cpp index d40e366b4..d8c1a3b0b 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -31,7 +31,7 @@ * * How it works: * Modules create their own logstream types (core will create one for 'file logging' for example) and create instances of these logstream types - * and register interest in a certain logtype. Globbing is not here, with the exception of * - for all events.. loglevel is used to drop + * and register interest in a certain logtype. Globbing is not here, with the exception of * - for all events.. loglevel is used to drop * events that are of no interest to a logstream. * * When Log is called, the vector of logstreams for that type is iterated (along with the special vector for "*"), and all registered logstreams @@ -41,7 +41,7 @@ * NOTE: Somehow we have to let LogManager manage the non-blocking file streams and provide an interface to share them with various LogStreams, * as, for example, a user may want to let 'KILL' and 'XLINE' snotices go to /home/ircd/inspircd/logs/operactions.log, or whatever. How * can we accomplish this easily? I guess with a map of pre-loved logpaths, and a pointer of FILE *.. - * + * */ void LogManager::SetupNoFork() @@ -363,4 +363,3 @@ void FileWriter::Close() FileWriter::~FileWriter() { } - diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index db1926044..3540346b5 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -22,7 +22,7 @@ ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, 'k', } ModePair ModeChannelKey::ModeSet(User*, User*, Channel* channel, const std::string ¶meter) -{ +{ if (channel->modes[CM_KEY]) { std::string ckey = channel->GetModeParameter('k'); @@ -101,4 +101,3 @@ ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, s return MODEACTION_DENY; } } - diff --git a/src/modules.cpp b/src/modules.cpp index b9f5de63c..0f7992a38 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -400,21 +400,21 @@ bool ModuleManager::Load(const char* filename) Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } - + if (!ServerConfig::FileExists(modfile)) { LastModuleError = "Module file could not be found: " + filename_str; Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } - + if (Modules.find(filename_str) != Modules.end()) - { + { LastModuleError = "Module " + filename_str + " is already loaded, cannot load a module twice!"; Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } - + Module* newmod = NULL; ircd_module* newhandle = NULL; @@ -569,8 +569,8 @@ void ModuleManager::LoadAll() { Instance->Config->ConfValue(Instance->Config->config_data, "module", "name", count, configToken, MAXBUF); printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken); - - if (!this->Load(configToken)) + + if (!this->Load(configToken)) { Instance->Logs->Log("MODULE", DEFAULT, this->LastError()); printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str()); @@ -592,7 +592,7 @@ bool ModuleManager::PublishFeature(const std::string &FeatureName, Module* Mod) bool ModuleManager::UnpublishFeature(const std::string &FeatureName) { featurelist::iterator iter = Features.find(FeatureName); - + if (iter == Features.end()) return false; @@ -843,9 +843,9 @@ ConfigReader::ConfigReader(InspIRCd* Instance, const std::string &filename) : Se std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds) { - /* Don't need to strlcpy() tag and name anymore, ReadConf() takes const char* */ + /* Don't need to strlcpy() tag and name anymore, ReadConf() takes const char* */ std::string result; - + if (!ServerInstance->Config->ConfValue(*this->data, tag, name, default_value, index, result, allow_linefeeds)) { this->error = CONF_VALUE_NOT_FOUND; @@ -872,19 +872,19 @@ bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive) { int result; - + if(!ServerInstance->Config->ConfValueInteger(*this->data, tag, name, default_value, index, result)) { this->error = CONF_VALUE_NOT_FOUND; return 0; } - + if ((need_positive) && (result < 0)) { this->error = CONF_INT_NEGATIVE; return 0; } - + return result; } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index c7c2e0c0d..b16ebd12b 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -73,7 +73,6 @@ public: ServerInstance->Modules->Attach(eventlist, this, 3); } - bool OneOfMatches(const char* host, const char* ip, const char* hostlist) { std::stringstream hl(hostlist); diff --git a/src/modules/extra/m_sqlutils.h b/src/modules/extra/m_sqlutils.h index dab9c721a..6fb741531 100644 --- a/src/modules/extra/m_sqlutils.h +++ b/src/modules/extra/m_sqlutils.h @@ -34,12 +34,12 @@ public: /** User */ User* user; - + AssociateUser(Module* s, Module* d, unsigned long i, User* u) : Request(s, d, SQLUTILAU), id(i), user(u) { } - + AssociateUser& S() { Send(); @@ -58,12 +58,12 @@ public: /** Channel */ Channel* chan; - + AssociateChan(Module* s, Module* d, unsigned long i, Channel* u) : Request(s, d, SQLUTILAC), id(i), chan(u) { } - + AssociateChan& S() { Send(); @@ -84,7 +84,7 @@ public: : Request(s, d, SQLUTILUA), id(i) { } - + UnAssociate& S() { Send(); @@ -108,7 +108,7 @@ public: : Request(s, d, SQLUTILGU), id(i), user(NULL) { } - + GetAssocUser& S() { Send(); @@ -132,7 +132,7 @@ public: : Request(s, d, SQLUTILGC), id(i), chan(NULL) { } - + GetAssocChan& S() { Send(); diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 1a8da4da3..4d3c8fd86 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -240,7 +240,7 @@ class ModuleSSLGnuTLS : public Module keyfile = confdir + keyfile; int ret; - + if (cred_alloc) { // Deallocate the old credentials @@ -249,13 +249,13 @@ class ModuleSSLGnuTLS : public Module } else cred_alloc = true; - + if((ret = gnutls_certificate_allocate_credentials(&x509_cred)) < 0) ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials: %s", gnutls_strerror(ret)); - + if((ret = gnutls_dh_params_init(&dh_params)) < 0) ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters: %s", gnutls_strerror(ret)); - + if((ret =gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM)) < 0) ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file '%s': %s", cafile.c_str(), gnutls_strerror(ret)); diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 1d601127a..39d19b2bc 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -68,7 +68,7 @@ class ModuleAlias : public Module ConfigReader MyConf(ServerInstance); AllowBots = MyConf.ReadFlag("fantasy", "allowbots", "no", 0); - + std::string fpre = MyConf.ReadValue("fantasy","prefix",0); fprefix = fpre.empty() ? '!' : fpre[0]; @@ -231,7 +231,7 @@ class ModuleAlias : public Module if (i == Aliases.end()) return 0; - + /* Avoid iterating on to other aliases if no patterns match */ std::multimap<std::string, Alias>::iterator upperbound = Aliases.upper_bound(fcommand); @@ -255,7 +255,7 @@ class ModuleAlias : public Module i++; } - + return 0; } @@ -361,7 +361,7 @@ class ModuleAlias : public Module if (c) { /* Channel specific variables */ - SearchAndReplace(newline, std::string("$chan"), c->name); + SearchAndReplace(newline, std::string("$chan"), c->name); } irc::tokenstream ss(newline); diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 892c18bd1..85c8660a2 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -194,7 +194,7 @@ class ChanFounder : public ModeHandler, public FounderProtectBase { return FounderProtectBase::HandleChange(source, theuser, adding, channel, parameter); } - + char isoverride=0; Module *Override = ServerInstance->Modules->FindFeature("Override"); if (Override) diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index beb2b32e5..0382ea836 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -135,7 +135,7 @@ class CommandDccallow : public Command user->WriteNumeric(996, "%s %s :You cannot add yourself to your own DCCALLOW list!", user->nick.c_str(), user->nick.c_str()); return CMD_FAILURE; } - + if (!user->GetExt("dccallow_list", dl)) { dl = new dccallowlist; @@ -143,7 +143,7 @@ class CommandDccallow : public Command // add this user to the userlist ul.push_back(user); } - + for (dccallowlist::const_iterator k = dl->begin(); k != dl->end(); ++k) { if (k->nickname == target->nick) @@ -356,7 +356,7 @@ class ModuleDCCAllow : public Module return 0; } } - + user->WriteServ("NOTICE %s :The user %s is not accepting DCC SENDs from you. Your file %s was not sent.", user->nick.c_str(), u->nick.c_str(), filename.c_str()); u->WriteServ("NOTICE %s :%s (%s@%s) attempted to send you a file named %s, which was blocked.", u->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), filename.c_str()); u->WriteServ("NOTICE %s :If you trust %s and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system.", u->nick.c_str(), user->nick.c_str()); @@ -476,4 +476,3 @@ class ModuleDCCAllow : public Module }; MODULE_INIT(ModuleDCCAllow) - diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 71742d596..60ae7e891 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -281,7 +281,7 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri if (i != exemptfromfilter.end()) return 0; } if (f->action == "block") - { + { ServerInstance->SNO->WriteToSnoMask('A', std::string("FILTER: ")+user->nick+" had their message filtered, target was "+target+": "+f->reason); user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message has been filtered and opers notified: "+f->reason); } @@ -318,7 +318,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par std::string checkline; int replacepoint = 0; bool parting = false; - + if (command == "QUIT") { /* QUIT with no reason: nothing to do */ @@ -348,7 +348,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par return 0; FilterResult* f = NULL; - + if (flags) f = this->FilterMatch(user, checkline, flags); @@ -683,4 +683,3 @@ class ModuleFilter : public FilterBase }; MODULE_INIT(ModuleFilter) - diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index bb0b3ac63..27c749b3d 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -14,7 +14,7 @@ /* * Originally by Chernov-Phoenix Alexey (Phoenix@RusNet) mailto:phoenix /email address separator/ pravmail.ru */ - + /* $ModDesc: Gives opers cmode +y which provides a staff prefix. */ #include "inspircd.h" @@ -118,7 +118,7 @@ class ModuleOperPrefixMode : public Module opm = new OperPrefixMode(ServerInstance); if ((!ServerInstance->Modes->AddMode(opm))) throw ModuleException("Could not add a new mode!"); - + Implementation eventlist[] = { I_OnPostJoin, I_OnCleanup, I_OnUserQuit, I_OnUserKick, I_OnUserPart, I_OnOper }; ServerInstance->Modules->Attach(eventlist, this, 6); } @@ -239,4 +239,3 @@ class ModuleOperPrefixMode : public Module }; MODULE_INIT(ModuleOperPrefixMode) - diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index cf2723bec..3010e1e46 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -131,7 +131,7 @@ class ModuleOverride : public Module { // If the kicker's status is less than the target's, or the kicker's status is less than or equal to voice if ((chan->GetStatus(source) < chan->GetStatus(user)) || (chan->GetStatus(source) <= STATUS_VOICE)) - { + { ServerInstance->SNO->WriteToSnoMask('G',std::string(source->nick)+" used oper override to kick "+std::string(user->nick)+" on "+std::string(chan->name)+" ("+reason+")"); } /* Returning -1 explicitly allows the kick */ diff --git a/src/modules/m_regex.h b/src/modules/m_regex.h index 85f52c4d8..3880be342 100644 --- a/src/modules/m_regex.h +++ b/src/modules/m_regex.h @@ -45,7 +45,7 @@ class RegexFactoryRequest : public Request { private: std::string regex; - + public: Regex* result; diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 6c976d6ba..d71807c69 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -37,7 +37,7 @@ class CommandSATopic : public Command if(target) { std::string newTopic = parameters[1]; - + // 3rd parameter overrides access checks target->SetTopic(user, newTopic, true); ServerInstance->SNO->WriteToSnoMask('A', user->nick + " used SATOPIC on " + target->name + ", new topic: " + newTopic); diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index ebe1b1220..6789d26d8 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -229,7 +229,7 @@ class ModuleServicesAccount : public Module // user is ulined, won't be stopped from joining return 0; } - + if (chan->IsModeSet('R')) { if (!is_registered) diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 12484e195..7f0500fe5 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -24,7 +24,7 @@ class ServProtectMode : public ModeHandler ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { - /* Because this returns MODEACTION_DENY all the time, there is only ONE + /* Because this returns MODEACTION_DENY all the time, there is only ONE * way to add this mode and that is at client introduction in the UID command, * as this calls OnModeChange for each mode but disregards the return values. * The mode cannot be manually added or removed, not even by a server or by a remote diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index f4939c00e..49d345383 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -369,5 +369,3 @@ TreeServer::~TreeServer() if (iter != Utils->sidlist.end()) Utils->sidlist.erase(iter); } - - diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index 528414261..fea17b7d2 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -56,7 +56,7 @@ class TreeServer : public classbase bool Warned; /* True if we've warned opers about high latency on this server */ bool bursting; /* whether or not this server is bursting */ - + /** We don't use this constructor. Its a dummy, and won't cause any insertion * of the TreeServer into the hash_map. See below for the two we DO use. */ @@ -67,7 +67,7 @@ class TreeServer : public classbase * no socket associated with it. Its version string is our own local version. */ TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id); - + /** When we create a new server, we call this constructor to initialize it. * This constructor initializes the server's Route and Parent, and sets up * its ping counters so that it will be pinged one minute from now. @@ -121,7 +121,7 @@ class TreeServer : public classbase /** Round trip time of last ping */ unsigned long rtt; - + /** When we recieved BURST from this server, used to calculate total burst time at ENDBURST. */ unsigned long StartBurst; diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 4d87c450c..c006344ba 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -250,7 +250,7 @@ bool TreeSocket::ProcessLine(std::string &line) * "miscreant" servers, though, so let's check anyway. -- w * * We also check here for totally invalid prefixes (prefixes that are neither - * a valid SID or a valid UUID, so that invalid UUID or SID never makes it + * a valid SID or a valid UUID, so that invalid UUID or SID never makes it * to the higher level functions. -- B */ std::string direction = prefix; @@ -694,5 +694,3 @@ void TreeSocket::OnClose() this->ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); } } - - diff --git a/src/modules/rpc.h b/src/modules/rpc.h index 75a7efd62..36f1c031a 100644 --- a/src/modules/rpc.h +++ b/src/modules/rpc.h @@ -25,27 +25,27 @@ class RPCValue : public classbase protected: RPCValueType type; void *value; - + double *CastInteger() { return (double*)value; } - + std::string *CastString() { return (std::string*)value; } - + RPCObjectContainer *CastObject() { return (RPCObjectContainer*)value; } - + RPCArrayContainer *CastArray() { return (RPCArrayContainer*)value; } - + void DestroyValue() { // Some versions of GCC complain about declaration in switch statements @@ -74,10 +74,10 @@ class RPCValue : public classbase default: break; } - + value = NULL; } - + void InitValue() { switch (type) @@ -100,9 +100,9 @@ class RPCValue : public classbase break; } } - + RPCValue(const RPCValue &v) { } - + public: RPCValue *parent; @@ -111,30 +111,30 @@ class RPCValue : public classbase RPCValue(bool nvalue, RPCValue *rparent = NULL) : type(RPCBoolean), value((void*)nvalue), parent(rparent) { } RPCValue(double nvalue, RPCValue *rparent = NULL) : type(RPCInteger), parent(rparent) { value = new double(nvalue); } RPCValue(const std::string &nvalue, RPCValue *rparent = NULL) : type(RPCString), parent(rparent) { value = new std::string(nvalue); } - + virtual ~RPCValue() { DestroyValue(); } - + RPCValueType GetType() { return type; } - + void SetNull() { DestroyValue(); type = RPCNull; } - + void SetBoolean(bool nvalue) { DestroyValue(); value = (void*)nvalue; type = RPCBoolean; } - + void SetInteger(double nvalue) { if (type == RPCInteger) @@ -148,7 +148,7 @@ class RPCValue : public classbase type = RPCInteger; } } - + void SetString(const std::string &nvalue) { if (type == RPCString) @@ -162,7 +162,7 @@ class RPCValue : public classbase type = RPCString; } } - + void SetArray() { if (type == RPCArray) @@ -176,7 +176,7 @@ class RPCValue : public classbase InitValue(); } } - + void SetObject() { if (type == RPCObject) @@ -190,7 +190,7 @@ class RPCValue : public classbase InitValue(); } } - + void ArrayAdd(RPCValue *nvalue) { if (type != RPCArray) @@ -199,7 +199,7 @@ class RPCValue : public classbase a->push_back(nvalue); nvalue->parent = this; } - + void ObjectAdd(const std::string &key, RPCValue *nvalue) { if (type != RPCObject) @@ -208,7 +208,7 @@ class RPCValue : public classbase o->insert(std::make_pair(key, nvalue)); nvalue->parent = this; } - + RPCValue *GetArray(int i) { if (type != RPCArray) @@ -218,7 +218,7 @@ class RPCValue : public classbase return NULL; return a->at(i); } - + int ArraySize() { if (type != RPCArray) @@ -226,7 +226,7 @@ class RPCValue : public classbase RPCArrayContainer *a = this->CastArray(); return a->size(); } - + RPCValue *GetObject(const std::string &key) { if (type != RPCObject) @@ -237,7 +237,7 @@ class RPCValue : public classbase return NULL; return it->second; } - + std::pair<RPCObjectContainer::iterator,RPCObjectContainer::iterator> GetObjectIterator() { if (type != RPCObject) @@ -245,21 +245,21 @@ class RPCValue : public classbase RPCObjectContainer *o = this->CastObject(); return std::make_pair(o->begin(), o->end()); } - + std::string GetString() { if (type != RPCString) return std::string(); return *this->CastString(); } - + double GetInt() { if (type != RPCInteger) return 0; return *this->CastInteger(); } - + bool GetBool() { if (type != RPCBoolean) @@ -271,7 +271,7 @@ class RPCValue : public classbase class RPCRequest : public classbase { protected: - + public: std::string method; RPCValue *parameters; @@ -279,13 +279,13 @@ class RPCRequest : public classbase std::string provider; bool claimed; std::string error; - + RPCRequest(const std::string &sprovider, const std::string &smethod, RPCValue *rparameters) : method(smethod), parameters(rparameters), provider(sprovider), claimed(false) { result = new RPCValue(); } - + ~RPCRequest() { if (result) diff --git a/src/modules/transport.h b/src/modules/transport.h index 269880b75..1ca3e9470 100644 --- a/src/modules/transport.h +++ b/src/modules/transport.h @@ -50,7 +50,7 @@ class ssl_cert : public Extensible ssl_cert() : empty("") { } - + /** Get certificate distinguished name * @return Certificate DN */ @@ -228,4 +228,3 @@ class BufferedSocketNameRequest : public ISHRequest }; #endif - diff --git a/src/server.cpp b/src/server.cpp index 75e404b80..734e551b0 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -148,7 +148,7 @@ void InspIRCd::IncrementUID(int pos) for (int i = 3; i < UUID_LENGTH; i++) { current_uid[i] = 'A'; - pos = UUID_LENGTH - 1; + pos = UUID_LENGTH - 1; } } else diff --git a/src/snomasks.cpp b/src/snomasks.cpp index cde8839ca..c166bd72d 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -24,7 +24,7 @@ SnomaskManager::SnomaskManager(InspIRCd* Instance) : ServerInstance(Instance) } SnomaskManager::~SnomaskManager() -{ +{ for (std::map<char, Snomask *>::iterator i = SnoMasks.begin(); i != SnoMasks.end(); i++) { delete i->second; diff --git a/src/socket.cpp b/src/socket.cpp index fa5f0709c..649f3ee5f 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -20,7 +20,7 @@ /** This will bind a socket to a port. It works for UDP/TCP. * It can only bind to IP addresses, if you wish to bind to hostnames * you should first resolve them using class 'Resolver'. - */ + */ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) { /* We allocate 2 of these, because sockaddr_in6 is larger than sockaddr (ugh, hax) */ @@ -195,10 +195,10 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports) Config->ConfValue(Config->config_data, "bind", "port", count, configToken, MAXBUF); Config->ConfValue(Config->config_data, "bind", "address", count, Addr, MAXBUF); Config->ConfValue(Config->config_data, "bind", "type", count, Type, MAXBUF); - + if (strncmp(Addr, "::ffff:", 7) == 0) this->Logs->Log("SOCKET",DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead."); - + if ((!*Type) || (!strcmp(Type,"clients"))) { irc::portparser portrange(configToken, false); diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 43de35e1e..e9554bee3 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -149,7 +149,7 @@ std::string SocketEngine::GetName() } bool SocketEngine::BoundsCheckFd(EventHandler* eh) -{ +{ if (!eh) return false; if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS)) diff --git a/src/socketengines/socketengine_iocp.cpp b/src/socketengines/socketengine_iocp.cpp index 7dce02dbd..6425d5fca 100644 --- a/src/socketengines/socketengine_iocp.cpp +++ b/src/socketengines/socketengine_iocp.cpp @@ -166,7 +166,7 @@ bool IOCPEngine::DelFd(EventHandler* eh, bool force /* = false */) /* decrement set size */ --CurrentSetSize; - + /* success */ return true; } @@ -175,7 +175,7 @@ void IOCPEngine::WantWrite(EventHandler* eh) { if (!eh) return; - + void* m_writeEvent = NULL; int* fake_fd = NULL; @@ -351,7 +351,7 @@ int IOCPEngine::DispatchEvents() } } break; - + case SOCKET_IO_EVENT_ACCEPT: { /* this is kinda messy.. :/ */ @@ -370,7 +370,7 @@ int IOCPEngine::DispatchEvents() } break; } - + delete ov; } @@ -464,7 +464,7 @@ int IOCPEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen) Overlapped* ovl = acceptevent; accept_overlap* ov = (accept_overlap*)ovl->m_params; - + //sockaddr_in* server_address = (sockaddr_in*)&ov->buf[10]; sockaddr_in* client_address = (sockaddr_in*)&ov->buf[38]; @@ -477,7 +477,7 @@ int IOCPEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen) int IOCPEngine::GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namelen) { Overlapped* ovl = NULL; - + if (!fd->GetExt("windows_acceptevent", ovl)) return -1; @@ -524,5 +524,3 @@ int IOCPEngine::Close(EventHandler* fd) { return this->Close(fd->GetFd()); } - - diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 80d73581e..76ef3851e 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -33,7 +33,7 @@ void KQueueEngine::RecoverFromFork() /* * The only bad thing about kqueue is that its fd cant survive a fork and is not inherited. * BUM HATS. - * + * */ EngineHandle = kqueue(); if (EngineHandle == -1) diff --git a/src/timer.cpp b/src/timer.cpp index 27f2aecfd..ec0ddb645 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -26,7 +26,7 @@ void TimerManager::TickTimers(time_t TIME) { std::vector<Timer *>::iterator i = Timers.begin(); Timer *t = (*i); - + // Probable fix: move vector manipulation to *before* we modify the vector. Timers.erase(i); @@ -62,5 +62,3 @@ bool TimerManager::TimerComparison( Timer *one, Timer *two) { return (one->GetTimer()) < (two->GetTimer()); } - - diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp index 820d7ef65..bd27d6350 100644 --- a/src/user_resolver.cpp +++ b/src/user_resolver.cpp @@ -102,7 +102,7 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, this->bound_user->dns_done = true; } } - + // Save some memory by freeing this up; it's never used again in the user's lifetime. this->bound_user->stored_host.resize(0); } diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 86b324c82..f8b1f0de2 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -275,7 +275,7 @@ void UserManager::RemoveCloneCounts(User *user) local_clones.erase(x); } } - + clonemap::iterator y = global_clones.find(user->GetCIDRMask(range)); if (y != global_clones.end()) { @@ -487,6 +487,3 @@ int UserManager::ModeCount(const char mode) else return 0; } - - - diff --git a/src/users.cpp b/src/users.cpp index fd71b07ad..7ce7ea673 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -483,7 +483,7 @@ bool User::HasModePermission(unsigned char mode, ModeType type) if (mode < 'A' || mode > ('A' + 64)) return false; return ((type == MODETYPE_USER ? AllowedUserModes : AllowedChanModes))[(mode - 'A')]; - + } bool User::HasPermission(const std::string &command) @@ -918,7 +918,7 @@ void User::CheckClass() bool User::CheckLines(bool doZline) { const char* check[] = { "G" , "K", (doZline) ? "Z" : NULL, NULL }; - + if (!this->exempt) { for (int n = 0; check[n]; ++n) @@ -948,7 +948,7 @@ void User::FullConnect() * Don't remove this! -- w00t */ this->SetClass(); - + /* Check the password, if one is required by the user's connect class. * This CANNOT be in CheckClass(), because that is called prior to PASS as well! */ @@ -1158,7 +1158,7 @@ const char* User::GetCIDRMask(int range) sockaddr_in6* sin; int i, bytestozero, extrabits; char buffer[40]; - + if(range > 128) throw "CIDR mask width greater than address width (IPv6, 128 bit)"; @@ -1171,12 +1171,12 @@ const char* User::GetCIDRMask(int range) * which must be set to zero. */ bytestozero = (128 - range) / 8; - + /* Some of the least significant bits of the next most significant byte may also have to * be zeroed. The number of bits is the remainder of the above division. */ extrabits = (128 - range) % 8; - + /* Populate our working struct with the parts of the user's IP which are required in the * final CIDR mask. Set all the subsequent bytes to zero. * (16 - bytestozero) is the number of bytes which must be populated with actual IP data. @@ -1185,13 +1185,13 @@ const char* User::GetCIDRMask(int range) { v6.s6_addr[i] = sin->sin6_addr.s6_addr[i]; } - + /* And zero all the remaining bytes in the IP. */ for(; i < 16; i++) { v6.s6_addr[i] = 0; } - + /* And finally, zero the extra bits required. */ v6.s6_addr[15 - bytestozero] = (v6.s6_addr[15 - bytestozero] >> extrabits) << extrabits; @@ -1268,7 +1268,7 @@ const char* User::GetIPString() this->cachedip = temp; return temp; } - + this->cachedip = buf; return buf; } @@ -1285,7 +1285,7 @@ const char* User::GetIPString() default: break; } - + // Unreachable, probably return ""; } @@ -1866,7 +1866,7 @@ ConnectClass* User::SetClass(const std::string &explicit_name) } /* check if host matches.. */ - if (!InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) && + if (!InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) && !InspIRCd::MatchCIDR(this->host, c->GetHost(), NULL)) { ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "No host match (for %s)", c->GetHost().c_str()); @@ -2054,4 +2054,3 @@ bool VisData::VisibleTo(User* user) { return true; } - diff --git a/src/xline.cpp b/src/xline.cpp index da46c2eee..c92643bcd 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -18,7 +18,7 @@ #include "bancache.h" /* - * This is now version 3 of the XLine subsystem, let's see if we can get it as nice and + * This is now version 3 of the XLine subsystem, let's see if we can get it as nice and * efficient as we can this time so we can close this file and never ever touch it again .. * * Background: @@ -192,7 +192,7 @@ bool XLineManager::AddLine(XLine* line, User* user) lookup_lines[line->type][line->Displayable()] = line; line->OnAdd(); - FOREACH_MOD(I_OnAddLine,OnAddLine(user, line)); + FOREACH_MOD(I_OnAddLine,OnAddLine(user, line)); return true; } @@ -423,7 +423,7 @@ XLineManager::~XLineManager() i->second.clear(); } lookup_lines.clear(); - + } void XLine::Apply(User* u) @@ -498,7 +498,7 @@ bool GLine::Matches(User *u) } void GLine::Apply(User* u) -{ +{ DefaultApply(u, "G", (strcmp(this->identmask, "*") == 0) ? true : false); } @@ -531,7 +531,7 @@ bool ZLine::Matches(User *u) } void ZLine::Apply(User* u) -{ +{ DefaultApply(u, "Z", true); } @@ -545,7 +545,7 @@ bool QLine::Matches(User *u) } void QLine::Apply(User* u) -{ +{ /* Force to uuid on apply of qline, no need to disconnect any more :) */ u->ForceNickChange(u->uuid.c_str()); } @@ -681,4 +681,3 @@ XLineFactory* XLineManager::GetFactory(const std::string &type) return n->second; } - |