diff options
Diffstat (limited to 'src')
46 files changed, 123 insertions, 160 deletions
diff --git a/src/access.cpp b/src/access.cpp index 1c1a6f8e4..5b994e916 100644 --- a/src/access.cpp +++ b/src/access.cpp @@ -84,7 +84,7 @@ void PrivilegeManager::AddPrivilege(Privilege p) if (priv.rank > p.rank) break; } - + Privileges.insert(Privileges.begin() + i, p); } @@ -265,7 +265,7 @@ bool ChanAccess::Matches(const User *u, const NickCore *acc, ChannelInfo* &next) else if (Anope::Match(u->GetDisplayedMask(), this->mask)) return true; } - + if (acc) { for (unsigned i = 0; i < acc->aliases->size(); ++i) @@ -275,12 +275,12 @@ bool ChanAccess::Matches(const User *u, const NickCore *acc, ChannelInfo* &next) return true; } } - + if (IRCD->IsChannelValid(this->mask)) { next = ChannelInfo::Find(this->mask); } - + return false; } @@ -313,7 +313,7 @@ bool ChanAccess::operator<(const ChanAccess &other) const continue; return !this_p && other_p; - } + } return false; } @@ -473,4 +473,3 @@ bool AccessGroup::operator<=(const AccessGroup &other) const { return !(*this > other); } - diff --git a/src/base.cpp b/src/base.cpp index 27fecf69c..6dfd7ff22 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -46,4 +46,3 @@ void Base::DelReference(ReferenceBase *r) } } } - diff --git a/src/base64.cpp b/src/base64.cpp index 0f17fdada..2ca476494 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -161,4 +161,3 @@ void Anope::B64Decode(const Anope::string &src, Anope::string &target) if (!target.empty() && !target[target.length() - 1]) target.erase(target.length() - 1); } - diff --git a/src/bots.cpp b/src/bots.cpp index a9933e336..512de4c46 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -29,7 +29,7 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A (*BotListByNick)[this->nick] = this; if (!this->uid.empty()) (*BotListByUID)[this->uid] = this; - + FOREACH_MOD(OnCreateBot, (this)); // If we're synchronised with the uplink already, send the bot. @@ -160,7 +160,7 @@ void BotInfo::Assign(User *u, ChannelInfo *ci) if (ci->bi) ci->bi->UnAssign(u, ci); - + ci->bi = this; this->channels->insert(ci); @@ -275,4 +275,3 @@ BotInfo* BotInfo::Find(const Anope::string &nick, bool nick_only) return NULL; } - diff --git a/src/channels.cpp b/src/channels.cpp index 1cf2e528c..3ea8da375 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -90,7 +90,7 @@ void Channel::Reset() for (ChanUserList::const_iterator it = this->users.begin(), it_end = this->users.end(); it != it_end; ++it) this->SetCorrectModes(it->second->user, true); - + // If the channel is syncing now, do not force a sync due to Reset(), as we are probably iterating over users in Message::SJoin // A sync will come soon if (!syncing) @@ -128,7 +128,7 @@ bool Channel::CheckDelete() */ if (this->syncing) return false; - + /* Permanent channels never get deleted */ if (this->HasMode("PERM")) return false; @@ -162,10 +162,10 @@ void Channel::DeleteUser(User *user) ChanUserContainer *cu = user->FindChannel(this); if (!this->users.erase(user)) - Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete non-existent user " << user->nick << " from channel " << this->name; + Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete nonexistent user " << user->nick << " from channel " << this->name; if (!user->chans.erase(this)) - Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete non-existent channel " << this->name << " from " << user->nick << "'s channel list"; + Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete nonexistent channel " << this->name << " from " << user->nick << "'s channel list"; delete cu; QueueForDeletion(); @@ -280,7 +280,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *ocm, const Ano if (!u) { - Log(LOG_DEBUG) << "MODE " << this->name << " +" << cm->mchar << " for non-existent user " << param; + Log(LOG_DEBUG) << "MODE " << this->name << " +" << cm->mchar << " for nonexistent user " << param; return; } @@ -351,7 +351,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const if (!u) { - Log(LOG_DEBUG) << "Channel::RemoveModeInternal() MODE " << this->name << "-" << cm->mchar << " for non-existent user " << param; + Log(LOG_DEBUG) << "Channel::RemoveModeInternal() MODE " << this->name << "-" << cm->mchar << " for nonexistent user " << param; return; } @@ -381,7 +381,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const } else this->modes.erase(cm->name); - + if (cm->type == MODE_LIST) { ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm); @@ -713,7 +713,7 @@ void Channel::SetModesInternal(MessageSource &source, const Anope::string &mode, Log(setter, this, "mode") << modestring << paramstring; else Log(LOG_DEBUG) << source.GetName() << " is setting " << this->name << " to " << modestring << paramstring; - + if (enforce_mlock) this->CheckModes(); } @@ -776,7 +776,7 @@ bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...) /* Do not kick protected clients or Ulines */ if (u->IsProtected()) return false; - + if (bi == NULL) bi = this->ci->WhoSends(); @@ -819,7 +819,7 @@ void Channel::SetCorrectModes(User *user, bool give_modes) { if (user == NULL) return; - + if (!this->ci) return; @@ -905,7 +905,7 @@ bool Channel::CheckKick(User *user) FOREACH_RESULT(OnCheckKick, MOD_RESULT, (user, this, mask, reason)); if (MOD_RESULT != EVENT_STOP) return false; - + if (mask.empty()) mask = this->ci->GetIdealBan(user); if (reason.empty()) @@ -954,4 +954,3 @@ void Channel::DeleteChannels() } deleting.clear(); } - diff --git a/src/command.cpp b/src/command.cpp index f314eaf93..5cfdf2833 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -309,7 +309,6 @@ bool Command::FindCommandFromService(const Anope::string &command_service, BotIn return true; } } - + return false; } - diff --git a/src/config.cpp b/src/config.cpp index bf9938507..5d20caf82 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -35,7 +35,7 @@ int Block::CountBlock(const Anope::string &bname) { if (!this) return 0; - + return blocks.count(bname); } @@ -43,7 +43,7 @@ Block* Block::GetBlock(const Anope::string &bname, int num) { if (!this) return NULL; - + std::pair<block_map::iterator, block_map::iterator> it = blocks.equal_range(bname); for (int i = 0; it.first != it.second; ++it.first, ++i) @@ -278,7 +278,7 @@ Conf::Conf() : Block("") ValidateNotEmpty("oper", "name", nname); ValidateNotEmpty("oper", "type", type); - + OperType *ot = NULL; for (unsigned j = 0; j < this->MyOperTypes.size(); ++j) if (this->MyOperTypes[j]->GetName() == type) @@ -588,7 +588,7 @@ Block *Conf::GetModule(Module *m) { if (!m) return NULL; - + return GetModule(m->name); } @@ -599,7 +599,7 @@ Block *Conf::GetModule(const Anope::string &mname) return it->second; Block* &block = modules[mname]; - + /* Search for the block */ for (std::pair<block_map::iterator, block_map::iterator> iters = blocks.equal_range("module"); iters.first != iters.second; ++iters.first) { @@ -723,10 +723,10 @@ void Conf::LoadConf(File &file) Log(LOG_DEBUG) << "Start to read conf " << file.GetName(); // Start reading characters... while (!file.End()) - { + { Anope::string line = file.Read(); ++linenumber; - + /* If this line is completely empty and we are in a quote, just append a newline */ if (line.empty() && in_quote) wordbuffer += "\n"; @@ -925,4 +925,3 @@ void Conf::LoadConf(File &file) if (!block_stack.empty()) throw ConfigException("Unterminated block at end of file: " + file.GetName() + ". Block was opened on line " + stringify(block_stack.top()->linenum)); } - diff --git a/src/extensible.cpp b/src/extensible.cpp index 485ac7fb7..332df6673 100644 --- a/src/extensible.cpp +++ b/src/extensible.cpp @@ -66,7 +66,6 @@ bool* Extensible::Extend(const Anope::string &name, const bool &what) if (ref) return ref->Set(this); - Log(LOG_DEBUG) << "Extend for non-existent type " << name << " on " << static_cast<void *>(this); + Log(LOG_DEBUG) << "Extend for nonexistent type " << name << " on " << static_cast<void *>(this); return NULL; } - diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 507bb2929..4fb1cfa98 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -43,7 +43,7 @@ unsigned char Anope::toupper(unsigned char c) * which is a case-insensitive equivalent to std::string. * */ - + bool ci::ci_char_traits::eq(char c1st, char c2nd) { return case_map_upper[static_cast<unsigned char>(c1st)] == case_map_upper[static_cast<unsigned char>(c2nd)]; @@ -161,4 +161,3 @@ bool sepstream::StreamEnd() { return this->pos > this->tokens.length(); } - diff --git a/src/init.cpp b/src/init.cpp index 18c54d050..515f610f2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -105,7 +105,7 @@ void Anope::Fork() { #ifndef _WIN32 kill(getppid(), SIGUSR2); - + freopen("/dev/null", "r", stdin); freopen("/dev/null", "w", stdout); freopen("/dev/null", "w", stderr); @@ -558,4 +558,3 @@ void Anope::Init(int ac, char **av) Serialize::CheckTypes(); } - diff --git a/src/language.cpp b/src/language.cpp index 7fd63c756..8b7b0ee37 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -125,4 +125,3 @@ const char *Language::Translate(const char *lang, const char *string) return string != NULL ? string : ""; } #endif - diff --git a/src/logger.cpp b/src/logger.cpp index b296d1081..935b0cfae 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -82,7 +82,7 @@ Log::Log(LogType t, CommandSource &src, Command *_c, ChannelInfo *_ci) : u(src.G { if (!c) throw CoreException("Invalid pointers passed to Log::Log"); - + if (type != LOG_COMMAND && type != LOG_OVERRIDE && type != LOG_ADMIN) throw CoreException("This constructor does not support this log type"); @@ -129,7 +129,7 @@ Log::~Log() std::cout << this->BuildPrefix() << this->buf.str() << std::endl; FOREACH_MOD(OnLog, (this)); - + if (Config) for (unsigned i = 0; i < Config->LogInfos.size(); ++i) if (Config->LogInfos[i].HasType(this->type, this->category)) @@ -377,7 +377,7 @@ void LogInfo::ProcessMessage(const Log *l) } } } - + tm *tm = localtime(&Anope::CurTime); if (tm->tm_mday != this->last_day) { @@ -407,4 +407,3 @@ void LogInfo::ProcessMessage(const Log *l) lf->stream << GetTimeStamp() << " " << buffer << std::endl; } } - diff --git a/src/mail.cpp b/src/mail.cpp index 0094f9b30..80a80d6d7 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -56,7 +56,7 @@ bool Mail::Send(User *u, NickCore *nc, BotInfo *service, const Anope::string &su return false; Configuration::Block *b = Config->GetBlock("mail"); - + if (!u) { if (!b->Get<bool>("usemail") || b->Get<const Anope::string>("sendfrom").empty()) diff --git a/src/memos.cpp b/src/memos.cpp index 4c4dfc63d..b04a385ca 100644 --- a/src/memos.cpp +++ b/src/memos.cpp @@ -49,7 +49,7 @@ Serializable* Memo::Unserialize(Serializable *obj, Serialize::Data &data) Anope::string owner; data["owner"] >> owner; - + bool ischan; MemoInfo *mi = MemoInfo::GetMemoInfo(owner, ischan); if (!mi) @@ -138,4 +138,3 @@ MemoInfo *MemoInfo::GetMemoInfo(const Anope::string &target, bool &ischan) return NULL; } - diff --git a/src/messages.cpp b/src/messages.cpp index 056d5853b..93c45ea87 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -61,7 +61,7 @@ void Invite::Run(MessageSource &source, const std::vector<Anope::string> ¶ms if (!targ || targ->server != Me || !c || c->FindUser(targ)) return; - + FOREACH_MOD(OnInvite, (source.GetUser(), c, targ)); } @@ -119,14 +119,14 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co /* Their TS is newer, don't accept any modes from them */ else if (ts > c->creation_time) keep_their_modes = false; - + /* Update the modes for the channel */ if (keep_their_modes && !modes.empty()) /* If we are syncing, mlock is checked later in Channel::Sync. It is important to not check it here * so that Channel::SetCorrectModes can correctly detect the presence of channel mode +r. */ c->SetModesInternal(source, modes, ts, !c->syncing); - + for (std::list<SJoinUser>::const_iterator it = users.begin(), it_end = users.end(); it != it_end; ++it) { const ChannelStatus &status = it->first; @@ -147,7 +147,7 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co * they aren't allowed to have (secureops etc). */ c->SetCorrectModes(u, true); - + FOREACH_MOD(OnJoinChannel, (u, c)); } @@ -365,7 +365,7 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m FOREACH_RESULT(OnBotPrivmsg, MOD_RESULT, (u, bi, message)); if (MOD_RESULT == EVENT_STOP) return; - + bi->OnMessage(u, message); } } @@ -499,4 +499,3 @@ void Whois::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) else IRCD->SendNumeric(401, source.GetSource(), "%s :No such user.", params[0].c_str()); } - diff --git a/src/misc.cpp b/src/misc.cpp index 956514ceb..2c879365d 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -651,7 +651,7 @@ Anope::string Anope::VersionBuildString() if (!flags.empty()) s += ", flags " + flags; - + return s; } @@ -763,4 +763,3 @@ Anope::string Anope::Random(size_t len) buf.append(chars[rand() % sizeof(chars)]); return buf; } - diff --git a/src/modes.cpp b/src/modes.cpp index b559e7026..18d892e2f 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -397,7 +397,7 @@ bool ModeManager::AddUserMode(UserMode *um) return false; if (ModeManager::FindUserModeByName(um->name) != NULL) return false; - + if (um->name.empty()) { um->name = stringify(++GenericUserModes); @@ -470,10 +470,10 @@ void ModeManager::RemoveUserMode(UserMode *um) unsigned want = um->mchar; if (want >= UserModesIdx.size()) return; - + if (UserModesIdx[want] != um) return; - + UserModesIdx[want] = NULL; UserModesByName.erase(um->name); @@ -495,10 +495,10 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm) unsigned want = cm->mchar; if (want >= ChannelModesIdx.size()) return; - + if (ChannelModesIdx[want] != cm) return; - + ChannelModesIdx[want] = NULL; } @@ -532,7 +532,7 @@ ChannelMode *ModeManager::FindChannelModeByChar(char mode) unsigned want = mode; if (want >= ChannelModesIdx.size()) return NULL; - + return ChannelModesIdx[want]; } @@ -541,7 +541,7 @@ UserMode *ModeManager::FindUserModeByChar(char mode) unsigned want = mode; if (want >= UserModesIdx.size()) return NULL; - + return UserModesIdx[want]; } @@ -566,11 +566,11 @@ char ModeManager::GetStatusChar(char value) unsigned want = value; if (want >= ChannelModesIdx.size()) return 0; - + ChannelMode *cm = ChannelModesIdx[want]; if (cm == NULL || cm->type != MODE_STATUS || cm->mchar == value) return 0; - + return cm->mchar; } @@ -769,21 +769,21 @@ Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh else this->nick = fh; } - + at = this->host.find('#'); if (at != Anope::string::npos) { this->real = this->host.substr(at + 1); this->host = this->host.substr(0, at); } - + /* If the mask is all *'s it will match anything, so just clear it */ if (this->nick.find_first_not_of("*") == Anope::string::npos) this->nick.clear(); - + if (this->user.find_first_not_of("*") == Anope::string::npos) this->user.clear(); - + if (this->host.find_first_not_of("*") == Anope::string::npos) this->host.clear(); else @@ -888,10 +888,9 @@ bool Entry::Matches(User *u, bool full) const else if (!this->host.empty() && !Anope::Match(u->GetDisplayedHost(), this->host) && !Anope::Match(u->GetCloakedHost(), this->host) && (!full || (!Anope::Match(u->host, this->host) && !Anope::Match(u->ip.addr(), this->host)))) ret = false; - + if (!this->real.empty() && !Anope::Match(u->realname, this->real)) ret = false; - + return ret; } - diff --git a/src/module.cpp b/src/module.cpp index 460f809a0..0fcf8687f 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -33,7 +33,7 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt if (ModuleManager::FindModule(this->name)) throw CoreException("Module already exists!"); - + if (Anope::NoThird && type & THIRD) throw ModuleException("Third party modules may not be loaded"); @@ -127,4 +127,3 @@ int ModuleVersion::GetPatch() const { return this->version_patch; } - diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 432d57bf5..ce17e61ae 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -28,7 +28,7 @@ void ModuleManager::CleanupRuntimeDirectory() { Anope::string dirbuf = Anope::DataDir + "/runtime"; - Log(LOG_DEBUG) << "Cleaning out Module run time directory (" << dirbuf << ") - this may take a moment please wait"; + Log(LOG_DEBUG) << "Cleaning out Module run time directory (" << dirbuf << ") - this may take a moment, please wait"; DIR *dirp = opendir(dirbuf.c_str()); if (!dirp) @@ -36,7 +36,7 @@ void ModuleManager::CleanupRuntimeDirectory() Log(LOG_DEBUG) << "Cannot open directory (" << dirbuf << ")"; return; } - + for (dirent *dp; (dp = readdir(dirp));) { if (!dp->d_ino) @@ -62,17 +62,17 @@ void ModuleManager::CleanupRuntimeDirectory() static ModuleReturn moduleCopyFile(const Anope::string &name, Anope::string &output) { Anope::string input = Anope::ModuleDir + "/modules/" + name + ".so"; - + struct stat s; if (stat(input.c_str(), &s) == -1) return MOD_ERR_NOEXIST; else if (!S_ISREG(s.st_mode)) return MOD_ERR_NOEXIST; - + std::ifstream source(input.c_str(), std::ios_base::in | std::ios_base::binary); if (!source.is_open()) return MOD_ERR_NOEXIST; - + char *tmp_output = strdup(output.c_str()); int target_fd = mkstemp(tmp_output); if (target_fd == -1 || close(target_fd) == -1) @@ -85,7 +85,7 @@ static ModuleReturn moduleCopyFile(const Anope::string &name, Anope::string &out free(tmp_output); Log(LOG_DEBUG_2) << "Runtime module location: " << output; - + std::ofstream target(output.c_str(), std::ios_base::in | std::ios_base::binary); if (!target.is_open()) { @@ -103,7 +103,7 @@ static ModuleReturn moduleCopyFile(const Anope::string &name, Anope::string &out target.write(buffer, read_len); want -= read_len; } - + source.close(); target.close(); @@ -216,7 +216,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) dlclose(handle); return MOD_ERR_NOLOAD; } - + /* Create module. */ Anope::string nick; if (u) @@ -234,7 +234,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) Log() << "Error while loading " << modname << ": " << ex.GetReason(); moderr = MOD_ERR_EXCEPTION; } - + if (moderr != MOD_ERR_OK) { if (dlclose(handle)) @@ -263,7 +263,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) catch (const NotImplementedException &ex) { } - + if (moderr != MOD_ERR_OK) { DeleteModule(m); @@ -389,7 +389,7 @@ ModuleReturn ModuleManager::DeleteModule(Module *m) if (!filename.empty()) unlink(filename.c_str()); #endif - + return MOD_ERR_OK; } @@ -516,7 +516,7 @@ void ModuleManager::UnloadAll() if ((m->type & j) == m->type) modules.push_back(m->name); } - + for (unsigned i = 0; i < modules.size(); ++i) { Module *m = FindModule(modules[i]); @@ -524,4 +524,3 @@ void ModuleManager::UnloadAll() UnloadModule(m, NULL); } } - diff --git a/src/nickalias.cpp b/src/nickalias.cpp index fe32a2b69..653e9461b 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -214,4 +214,3 @@ Serializable* NickAlias::Unserialize(Serializable *obj, Serialize::Data &data) return na; } - diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 59296ce94..cede8b6e4 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -31,7 +31,7 @@ NickCore::NickCore(const Anope::string &coredisplay) : Serializable("NickCore"), (*NickCoreList)[this->display] = this; if (old == NickCoreList->size()) Log(LOG_DEBUG) << "Duplicate account " << coredisplay << " in nickcore table?"; - + FOREACH_MOD(OnNickCoreCreate, (this)); } @@ -267,4 +267,3 @@ NickCore* NickCore::Find(const Anope::string &nick) return NULL; } - diff --git a/src/opertype.cpp b/src/opertype.cpp index 702ab758a..d7bce5df1 100644 --- a/src/opertype.cpp +++ b/src/opertype.cpp @@ -145,4 +145,3 @@ const std::list<Anope::string> OperType::GetPrivs() const } return priv_list; } - diff --git a/src/pipeengine.cpp b/src/pipeen |
