From 32007f81cf0bb475f3621d7637666b06ffa482b9 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 10 Jan 2015 15:17:16 -0500 Subject: Add networkinfo:nick_chars option to allow configuring additional characters allowed in nicknames --- src/config.cpp | 1 + src/protocol.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/config.cpp b/src/config.cpp index 3ce4251e7..18a6c5d39 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -191,6 +191,7 @@ Conf::Conf() : Block("") } this->DefLanguage = options->Get("defaultlanguage"); this->TimeoutCheck = options->Get("timeoutcheck"); + this->NickChars = networkinfo->Get("nick_chars"); for (int i = 0; i < this->CountBlock("uplink"); ++i) { diff --git a/src/protocol.cpp b/src/protocol.cpp index 05bcb54fe..0d09fee24 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -365,8 +365,10 @@ bool IRCDProto::IsNickValid(const Anope::string &nick) Anope::string special = "[]\\`_^{|}"; for (unsigned i = 0; i < nick.length(); ++i) - if (!(nick[i] >= 'A' && nick[i] <= 'Z') && !(nick[i] >= 'a' && nick[i] <= 'z') && special.find(nick[i]) == Anope::string::npos - && (!i || (!(nick[i] >= '0' && nick[i] <= '9') && nick[i] != '-'))) + if (!(nick[i] >= 'A' && nick[i] <= 'Z') && !(nick[i] >= 'a' && nick[i] <= 'z') + && special.find(nick[i]) == Anope::string::npos + && (Config && Config->NickChars.find(nick[i]) == Anope::string::npos) + && (!i || (!(nick[i] >= '0' && nick[i] <= '9') && nick[i] != '-'))) return false; return true; -- cgit From 1f02278a1c307975548499fe2a6d6d79f8397d0c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 10 Jan 2015 15:23:24 -0500 Subject: Log user away messages --- src/messages.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/messages.cpp b/src/messages.cpp index 7036acfc7..a771b2f1f 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -25,7 +25,13 @@ using namespace Message; void Away::Run(MessageSource &source, const std::vector ¶ms) { - FOREACH_MOD(OnUserAway, (source.GetUser(), params.empty() ? "" : params[0])); + const Anope::string &msg = !params.empty() ? params[0] : ""; + + FOREACH_MOD(OnUserAway, (source.GetUser(), msg)); + if (!msg.empty()) + Log(source.GetUser(), "away") << "is now away: " << msg; + else + Log(source.GetUser(), "away") << "is no longer away"; } void Capab::Run(MessageSource &source, const std::vector ¶ms) -- cgit From 969cd5dd6cac1bc702d5d1379f7bf54c1aadc6c4 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 10 Jan 2015 15:29:19 -0500 Subject: Always use source name when logging server kicks --- src/channels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 0ef8cf532..b1038f69e 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -746,7 +746,7 @@ void Channel::KickInternal(const MessageSource &source, const Anope::string &nic if (sender) Log(sender, this, "kick") << "kicked " << target->nick << " (" << reason << ")"; else - Log(target, this, "kick") << "was kicked by " << source.GetSource() << " (" << reason << ")"; + Log(target, this, "kick") << "was kicked by " << source.GetName() << " (" << reason << ")"; Anope::string chname = this->name; -- cgit From 2264a206d262f07f6c6d91df867383d6413e0c3f Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 26 Jan 2015 15:10:18 -0500 Subject: Check virtual mode bases better --- src/modes.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modes.cpp b/src/modes.cpp index dafe2ddca..38266f95f 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -213,7 +213,7 @@ ChannelModeVirtual::~ChannelModeVirtual() } template -ChannelMode *ChannelModeVirtual::Wrap(Anope::string ¶m) +void ChannelModeVirtual::Check() { if (basech == NULL) { @@ -221,7 +221,11 @@ ChannelMode *ChannelModeVirtual::Wrap(Anope::string ¶m) if (basech) basech->listeners.push_back(this); } +} +template +ChannelMode *ChannelModeVirtual::Wrap(Anope::string ¶m) +{ return basech; } @@ -453,6 +457,9 @@ bool ModeManager::AddChannelMode(ChannelMode *cm) FOREACH_MOD(OnChannelModeAdd, (cm)); + for (unsigned int i = 0; i < ChannelModes.size(); ++i) + ChannelModes[i]->Check(); + return true; } -- cgit From 845ca576b4c5a94f0a3ec12a4dd524a7d017155e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 28 Jan 2015 22:57:15 -0500 Subject: More properly track topic change sources and allow users with access to change topics through topiclock --- src/channels.cpp | 14 +++++--------- src/messages.cpp | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index b1038f69e..7e7702d7e 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -789,26 +789,22 @@ bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...) return true; } -void Channel::ChangeTopicInternal(const Anope::string &user, const Anope::string &newtopic, time_t ts) +void Channel::ChangeTopicInternal(User *u, const Anope::string &user, const Anope::string &newtopic, time_t ts) { - User *u = User::Find(user); - this->topic = newtopic; this->topic_setter = u ? u->nick : user; this->topic_ts = ts; this->topic_time = Anope::CurTime; - Log(LOG_DEBUG) << "Topic of " << this->name << " changed by " << (u ? u->nick : user) << " to " << newtopic; + Log(LOG_DEBUG) << "Topic of " << this->name << " changed by " << this->topic_setter << " to " << newtopic; - FOREACH_MOD(OnTopicUpdated, (this, user, this->topic)); + FOREACH_MOD(OnTopicUpdated, (u, this, user, this->topic)); } void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtopic, time_t ts) { - User *u = User::Find(user); - this->topic = newtopic; - this->topic_setter = u ? u->nick : user; + this->topic_setter = user; this->topic_ts = ts; IRCD->SendTopic(this->ci->WhoSends(), this); @@ -816,7 +812,7 @@ void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtop /* Now that the topic is set update the time set. This is *after* we set it so the protocol modules are able to tell the old last set time */ this->topic_time = Anope::CurTime; - FOREACH_MOD(OnTopicUpdated, (this, user, this->topic)); + FOREACH_MOD(OnTopicUpdated, (NULL, this, user, this->topic)); } void Channel::SetCorrectModes(User *user, bool give_modes) diff --git a/src/messages.cpp b/src/messages.cpp index a771b2f1f..4e1bcd0db 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -472,7 +472,7 @@ void Topic::Run(MessageSource &source, const std::vector ¶ms) { Channel *c = Channel::Find(params[0]); if (c) - c->ChangeTopicInternal(source.GetSource(), params[1], Anope::CurTime); + c->ChangeTopicInternal(source.GetUser(), source.GetSource(), params[1], Anope::CurTime); return; } -- cgit From 64ca357b136bc190e5fec32269b34b85bf9cf610 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 3 Feb 2015 19:38:23 -0500 Subject: Make module version system work --- src/misc.cpp | 7 +---- src/modulemanager.cpp | 86 ++++++++++++++++++++++++++++++++++----------------- src/version.sh | 6 ++-- 3 files changed, 62 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/misc.cpp b/src/misc.cpp index 57314c53b..a6addbc3f 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -11,7 +11,7 @@ */ #include "services.h" -#include "version.h" +#include "build.h" #include "modules.h" #include "lists.h" #include "config.h" @@ -617,11 +617,6 @@ const Anope::string Anope::LastError() #endif } -ModuleVersion Module::GetVersion() const -{ - return ModuleVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); -} - Anope::string Anope::Version() { #ifdef VERSION_GIT diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 2e7c624cd..98342b08e 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -166,6 +166,46 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) return MOD_ERR_NOLOAD; } + try + { + ModuleVersion v = GetVersion(handle); + + if (v.GetMajor() < Anope::VersionMajor() || (v.GetMajor() == Anope::VersionMajor() && v.GetMinor() < Anope::VersionMinor())) + { + Log() << "Module " << modname << " is compiled against an older version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionShort(); + dlclose(handle); + return MOD_ERR_VERSION; + } + else if (v.GetMajor() > Anope::VersionMajor() || (v.GetMajor() == Anope::VersionMajor() && v.GetMinor() > Anope::VersionMinor())) + { + Log() << "Module " << modname << " is compiled against a newer version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionShort(); + dlclose(handle); + return MOD_ERR_VERSION; + } + else if (v.GetPatch() < Anope::VersionPatch()) + { + Log() << "Module " << modname << " is compiled against an older version of Anope, " << v.GetMajor() << "." << v.GetMinor() << "." << v.GetPatch() << ", this is " << Anope::VersionShort(); + dlclose(handle); + return MOD_ERR_VERSION; + } + else if (v.GetPatch() > Anope::VersionPatch()) + { + Log() << "Module " << modname << " is compiled against a newer version of Anope, " << v.GetMajor() << "." << v.GetMinor() << "." << v.GetPatch() << ", this is " << Anope::VersionShort(); + dlclose(handle); + return MOD_ERR_VERSION; + } + else + { + Log(LOG_DEBUG_2) << "Module " << modname << " is compiled against current version of Anope " << Anope::VersionShort(); + } + } + catch (const ModuleException &ex) + { + /* this error has already been logged */ + dlclose(handle); + return MOD_ERR_NOLOAD; + } + dlerror(); Module *(*func)(const Anope::string &, const Anope::string &) = function_cast(dlsym(handle, "AnopeInit")); err = dlerror(); @@ -206,34 +246,6 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) m->filename = pbuf; m->handle = handle; - ModuleVersion v = m->GetVersion(); - if (v.GetMajor() < Anope::VersionMajor() || (v.GetMajor() == Anope::VersionMajor() && v.GetMinor() < Anope::VersionMinor())) - { - Log() << "Module " << modname << " is compiled against an older version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionShort(); - DeleteModule(m); - return MOD_ERR_VERSION; - } - else if (v.GetMajor() > Anope::VersionMajor() || (v.GetMajor() == Anope::VersionMajor() && v.GetMinor() > Anope::VersionMinor())) - { - Log() << "Module " << modname << " is compiled against a newer version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionShort(); - DeleteModule(m); - return MOD_ERR_VERSION; - } - else if (v.GetPatch() < Anope::VersionPatch()) - { - Log() << "Module " << modname << " is compiled against an older version of Anope, " << v.GetMajor() << "." << v.GetMinor() << "." << v.GetPatch() << ", this is " << Anope::VersionShort(); - DeleteModule(m); - return MOD_ERR_VERSION; - } - else if (v.GetPatch() > Anope::VersionPatch()) - { - Log() << "Module " << modname << " is compiled against a newer version of Anope, " << v.GetMajor() << "." << v.GetMinor() << "." << v.GetPatch() << ", this is " << Anope::VersionShort(); - DeleteModule(m); - return MOD_ERR_VERSION; - } - else - Log(LOG_DEBUG_2) << "Module " << modname << " is compiled against current version of Anope " << Anope::VersionShort(); - /* Initialize config */ try { @@ -272,6 +284,24 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) return MOD_ERR_OK; } +ModuleVersion ModuleManager::GetVersion(void *handle) +{ + dlerror(); + ModuleVersion (*func)() = function_cast(dlsym(handle, "AnopeVersion"));; + if (!func) + { + Log() << "No version function found, not an Anope module"; + + const char *err = dlerror(); + if (err && *err) + Log(LOG_DEBUG) << err; + + throw ModuleException("No version"); + } + + return func(); +} + ModuleReturn ModuleManager::UnloadModule(Module *m, User *u) { if (!m) diff --git a/src/version.sh b/src/version.sh index a7046fa72..198556b24 100644 --- a/src/version.sh +++ b/src/version.sh @@ -1,7 +1,7 @@ #!/bin/sh -VERSION_MAJOR="2" -VERSION_MINOR="0" -VERSION_PATCH="2" +VERSION_MAJOR=2 +VERSION_MINOR=0 +VERSION_PATCH=2 VERSION_EXTRA="-git" -- cgit From 78bff86dab32dc484164e5da8a535b3ec24c5c03 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 11 Mar 2015 14:19:38 -0400 Subject: Make cs_clone behave closer to how the help describes it --- src/regchannel.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'src') diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 37fca0528..4bb38afef 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -137,30 +137,6 @@ ChannelInfo::ChannelInfo(const ChannelInfo &ci) : Serializable("ChannelInfo"), this->access->clear(); this->akick->clear(); - for (unsigned i = 0; i < ci.GetAccessCount(); ++i) - { - const ChanAccess *taccess = ci.GetAccess(i); - AccessProvider *provider = taccess->provider; - - ChanAccess *newaccess = provider->Create(); - newaccess->SetMask(taccess->Mask(), this); - newaccess->creator = taccess->creator; - newaccess->last_seen = taccess->last_seen; - newaccess->created = taccess->created; - newaccess->AccessUnserialize(taccess->AccessSerialize()); - - this->AddAccess(newaccess); - } - - for (unsigned i = 0; i < ci.GetAkickCount(); ++i) - { - const AutoKick *takick = ci.GetAkick(i); - if (takick->nc) - this->AddAkick(takick->creator, takick->nc, takick->reason, takick->addtime, takick->last_used); - else - this->AddAkick(takick->creator, takick->mask, takick->reason, takick->addtime, takick->last_used); - } - FOREACH_MOD(OnCreateChan, (this)); } -- cgit From 310e95a92e64a9546247fe57d4643328fa4ebe9b Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 11 Mar 2015 14:36:56 -0400 Subject: Allow cs clone to clone levels too --- src/regchannel.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 4bb38afef..397a6f28b 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -551,6 +551,11 @@ void ChannelInfo::ClearAkick() delete this->akick->back(); } +const Anope::map &ChannelInfo::GetLevelEntries() +{ + return this->levels; +} + int16_t ChannelInfo::GetLevel(const Anope::string &priv) const { if (PrivilegeManager::FindPrivilege(priv) == NULL) -- cgit From 4266d17e8c0bbcc5cb8422c2af142c4c8af9d768 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 12 Mar 2015 11:14:59 -0400 Subject: Update cmake version parsing code to deal with recent build version changes Update Config.cs to no longer hardcode VS generators, it seems no longer necessary. Fix new version system, cannot return C++ types from extern C functions --- src/module.cpp | 5 +++- src/modulemanager.cpp | 2 +- src/win32/Config.cs | 67 ++++++++++++++------------------------------------- 3 files changed, 23 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/module.cpp b/src/module.cpp index 96fa24f6f..3266c955f 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -105,8 +105,11 @@ void Module::Prioritize() { } -ModuleVersion::ModuleVersion(int maj, int min, int pa) : version_major(maj), version_minor(min), version_patch(pa) +ModuleVersion::ModuleVersion(const ModuleVersionC &ver) { + version_major = ver.version_major; + version_minor = ver.version_minor; + version_patch = ver.version_patch; } int ModuleVersion::GetMajor() const diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 98342b08e..b6df3578a 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -287,7 +287,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) ModuleVersion ModuleManager::GetVersion(void *handle) { dlerror(); - ModuleVersion (*func)() = function_cast(dlsym(handle, "AnopeVersion"));; + ModuleVersionC (*func)() = function_cast(dlsym(handle, "AnopeVersion"));; if (!func) { Log() << "No version function found, not an Anope module"; diff --git a/src/win32/Config.cs b/src/win32/Config.cs index 03308fde1..4f611a129 100644 --- a/src/win32/Config.cs +++ b/src/win32/Config.cs @@ -27,7 +27,7 @@ namespace Config { class Config { - static string ExecutablePath, InstallDirectory, VSVersion, VSShortVer, ExtraIncludeDirs, ExtraLibDirs, ExtraArguments; + static string ExecutablePath, InstallDirectory, ExtraIncludeDirs, ExtraLibDirs, ExtraArguments; static bool UseNMake = true, BuildDebug = false; static bool CheckResponse(string InstallerResponse) @@ -62,10 +62,6 @@ namespace Config ExtraLibDirs = value; else if (name == "EXTRAARGS") ExtraArguments = value; - else if (name == "VSVERSION") - VSVersion = value; - else if (name == "VSSHORTVER") - VSShortVer = value; } return true; @@ -87,8 +83,6 @@ namespace Config tw.WriteLine("EXTRAINCLUDE={0}", ExtraIncludeDirs); tw.WriteLine("EXTRALIBS={0}", ExtraLibDirs); tw.WriteLine("EXTRAARGS={0}", ExtraArguments); - tw.WriteLine("VSVERSION={0}", VSVersion); - tw.WriteLine("VSSHORTVER={0}", VSShortVer); } } @@ -103,18 +97,15 @@ namespace Config Console.Write("[{0}] ", UseNMake ? "yes" : "no"); return UseNMake ? "yes" : "no"; case 2: - Console.Write("[{0}] ", VSShortVer); - return VSShortVer; - case 3: Console.Write("[{0}] ", BuildDebug ? "yes" : "no"); return BuildDebug ? "yes" : "no"; - case 4: + case 3: Console.Write("[{0}] ", ExtraIncludeDirs); return ExtraIncludeDirs; - case 5: + case 4: Console.Write("[{0}] ", ExtraLibDirs); return ExtraLibDirs; - case 6: + case 5: Console.Write("[{0}] ", ExtraArguments); return ExtraArguments; default: @@ -247,15 +238,14 @@ namespace Config if (!DoQuick) { List InstallerQuestions = new List() - { - "Where do you want Anope to be installed?", - "Would you like to build using NMake instead of using Visual Studio?\r\nNOTE: If you decide to use NMake, you must be in an environment where\r\nNMake can function, such as the Visual Studio command line. If you say\r\nyes to this while not in an environment that can run NMake, it can\r\ncause the CMake configuration to enter an endless loop. [y/n]", - "Are you using Visual Studio 2008, 2010, or 2012? You can leave this blank\nand have CMake try and auto detect it, but this usually doesn't\nwork correctly. [2008/2010/2012]", - "Would you like to build a debug version of Anope? [y/n]", - "Are there any extra include directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra include directories, enter NONE in all caps.", - "Are there any extra library directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra library directories, enter NONE in all caps.", - "Are there any extra arguments you wish to pass to CMake?\nIf you need no extra arguments to CMake, enter NONE in all caps." - }; + { + "Where do you want Anope to be installed?", + "Would you like to build using NMake instead of using Visual Studio?\r\nNOTE: If you decide to use NMake, you must be in an environment where\r\nNMake can function, such as the Visual Studio command line. If you say\r\nyes to this while not in an environment that can run NMake, it can\r\ncause the CMake configuration to enter an endless loop. [y/n]", + "Would you like to build a debug version of Anope? [y/n]", + "Are there any extra include directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra include directories, enter NONE in all caps.", + "Are there any extra library directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra library directories, enter NONE in all caps.", + "Are there any extra arguments you wish to pass to CMake?\nIf you need no extra arguments to CMake, enter NONE in all caps." + }; for (int i = 0; i < InstallerQuestions.Count; ++i) { @@ -269,8 +259,8 @@ namespace Config if (!string.IsNullOrWhiteSpace(CacheResponse) && string.IsNullOrWhiteSpace(InstallerResponse)) InstallerResponse = CacheResponse; - // Question 5-7 are optional - if (i < 4 && string.IsNullOrWhiteSpace(InstallerResponse)) + // Question 4+ are optional + if (i < 3 && string.IsNullOrWhiteSpace(InstallerResponse)) { Console.WriteLine("Invalid option"); --i; @@ -309,38 +299,21 @@ namespace Config ++i; break; case 2: - if (InstallerResponse == "2012") - { - VSVersion = "-G\"Visual Studio 11\" "; - VSShortVer = "2012"; - } - else if (InstallerResponse == "2010") - { - VSVersion = "-G\"Visual Studio 10\" "; - VSShortVer = "2010"; - } - else if (InstallerResponse == "2008") - { - VSVersion = "-G\"Visual Studio 9 2008\" "; - VSShortVer = "2008"; - } - break; - case 3: BuildDebug = CheckResponse(InstallerResponse); break; - case 4: + case 3: if (InstallerResponse == "NONE") ExtraIncludeDirs = null; else ExtraIncludeDirs = InstallerResponse; break; - case 5: + case 4: if (InstallerResponse == "NONE") ExtraLibDirs = null; else ExtraLibDirs = InstallerResponse; break; - case 6: + case 5: if (InstallerResponse == "NONE") ExtraArguments = null; else @@ -355,10 +328,6 @@ namespace Config Console.WriteLine("Anope will be compiled with the following options:"); Console.WriteLine("Install directory: {0}", InstallDirectory); Console.WriteLine("Use NMake: {0}", UseNMake ? "Yes" : "No"); - if (!string.IsNullOrWhiteSpace(VSShortVer)) - Console.WriteLine("Using Visual Studio: {0}", VSShortVer); - else - Console.WriteLine("Using Visual Studio: No"); Console.WriteLine("Build debug: {0}", BuildDebug ? "Yes" : "No"); Console.WriteLine("Anope Version: {0}", AnopeVersion); Console.WriteLine("Extra Include Directories: {0}", ExtraIncludeDirs); @@ -385,7 +354,7 @@ namespace Config InstallDirectory = "-DINSTDIR:STRING=\"" + InstallDirectory.Replace('\\', '/') + "\" "; string NMake = UseNMake ? "-G\"NMake Makefiles\" " : ""; string Debug = BuildDebug ? "-DCMAKE_BUILD_TYPE:STRING=DEBUG " : "-DCMAKE_BUILD_TYPE:STRING=RELEASE "; - string cMake = InstallDirectory + NMake + Debug + VSVersion + ExtraIncludeDirs + ExtraLibDirs + ExtraArguments + "\"" + ExecutablePath.Replace('\\', '/') + "\""; + string cMake = InstallDirectory + NMake + Debug + ExtraIncludeDirs + ExtraLibDirs + ExtraArguments + "\"" + ExecutablePath.Replace('\\', '/') + "\""; RunCMake(cMake); return 0; -- cgit From a76239144632765d01fc360d08c240c9ca53255c Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Mar 2015 13:57:27 -0400 Subject: Anope 2.0.2 Release --- src/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/version.sh b/src/version.sh index 198556b24..4ed4e2e74 100644 --- a/src/version.sh +++ b/src/version.sh @@ -3,5 +3,5 @@ VERSION_MAJOR=2 VERSION_MINOR=0 VERSION_PATCH=2 -VERSION_EXTRA="-git" +VERSION_EXTRA="" -- cgit From 3d1255dbe984ceb306a6eceebdf682e07f258b98 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Mar 2015 21:22:49 -0400 Subject: Anope 2.0.3-git --- src/version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/version.sh b/src/version.sh index 4ed4e2e74..fff3126e2 100644 --- a/src/version.sh +++ b/src/version.sh @@ -2,6 +2,6 @@ VERSION_MAJOR=2 VERSION_MINOR=0 -VERSION_PATCH=2 -VERSION_EXTRA="" +VERSION_PATCH=3 +VERSION_EXTRA="-git" -- cgit From 4cbdf9a73bae33ecf7fbf04cbeb65e6d4ba2aa3f Mon Sep 17 00:00:00 2001 From: Dominic Hargreaves Date: Wed, 1 Jul 2015 20:08:51 -0400 Subject: Support DESTDIR If DESTDIR is set it should be prepended to CMAKE_INSTALL_PREFIX. See --- src/tools/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 200aa2bf3..e547a2e9a 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -48,5 +48,5 @@ endif(NOT WIN32) # On non-Windows platforms, if RUNGROUP is set, change the permissions of the tools directory if(NOT WIN32 AND RUNGROUP) - install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\${CMAKE_INSTALL_PREFIX}/bin\")") + install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/bin\")") endif(NOT WIN32 AND RUNGROUP) -- cgit From 0f01c04b0218dccac2d763f6b483ab0e15a232b3 Mon Sep 17 00:00:00 2001 From: Dominic Hargreaves Date: Wed, 1 Jul 2015 20:09:46 -0400 Subject: Allow disabling installation of extra tools (with DISABLE_TOOLS) --- src/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6825ad6d2..b390d164b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,7 +106,9 @@ add_to_cpack_ignored_files("${SERVICES_BINARY}$" TRUE) configure_file(${Anope_SOURCE_DIR}/include/sysconf.h.cmake ${Anope_BINARY_DIR}/include/sysconf.h) # Go into the following directories and run their CMakeLists.txt as well -add_subdirectory(tools) +if(NOT DISABLE_TOOLS) + add_subdirectory(tools) +endif(NOT DISABLE_TOOLS) # Set Anope to be installed to the bin directory install(TARGETS ${PROGRAM_NAME} -- cgit From 1666b1a8d8d629fd4ea89b083863dc217154eee9 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 8 Jul 2015 10:55:44 +0100 Subject: Fix a ton of typos. --- src/channels.cpp | 14 +++++++------- src/extensible.cpp | 2 +- src/init.cpp | 2 +- src/language.cpp | 2 +- src/modes.cpp | 4 ++-- src/modulemanager.cpp | 4 ++-- src/tools/geoipupdate.sh | 2 +- src/win32/socket.cpp | 2 +- src/win32/windows.cpp | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 7e7702d7e..e61e0de5f 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -121,7 +121,7 @@ void Channel::CheckModes() bool Channel::CheckDelete() { - /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly + /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediately * We also don't part the bot here either, if necessary we will part it after the sync */ if (this->syncing) @@ -160,10 +160,10 @@ void Channel::DeleteUser(User *user) ChanUserContainer *cu = user->FindChannel(this); if (!this->users.erase(user)) - Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete nonexistant user " << user->nick << " from channel " << this->name; + Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete non-existent user " << user->nick << " from channel " << this->name; if (!user->chans.erase(this)) - Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete nonexistant channel " << this->name << " from " << user->nick << "'s channel list"; + Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete non-existent channel " << this->name << " from " << user->nick << "'s channel list"; delete cu; if (this->CheckDelete()) @@ -279,7 +279,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *ocm, const Ano if (!u) { - Log() << "MODE " << this->name << " +" << cm->mchar << " for nonexistant user " << param; + Log() << "MODE " << this->name << " +" << cm->mchar << " for non-existent user " << param; return; } @@ -350,7 +350,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const if (!u) { - Log() << "Channel::RemoveModeInternal() MODE " << this->name << "-" << cm->mchar << " for nonexistant user " << param; + Log() << "Channel::RemoveModeInternal() MODE " << this->name << "-" << cm->mchar << " for non-existent user " << param; return; } @@ -656,7 +656,7 @@ void Channel::SetModesInternal(MessageSource &source, const Anope::string &mode, if (cm->type == MODE_REGULAR) { - /* something changed if we are adding a mode we dont have, or removing one we have */ + /* something changed if we are adding a mode we don't have, or removing one we have */ changed |= !!add != this->HasMode(cm->name); if (add) this->SetModeInternal(source, cm, "", false); @@ -691,7 +691,7 @@ void Channel::SetModesInternal(MessageSource &source, const Anope::string &mode, this->RemoveModeInternal(source, cm, token, enforce_mlock); } else - Log() << "warning: Channel::SetModesInternal() recieved more modes requiring params than params, modes: " << mode; + Log() << "warning: Channel::SetModesInternal() received more modes requiring params than params, modes: " << mode; } if (!this_reference) diff --git a/src/extensible.cpp b/src/extensible.cpp index 37206f7c1..39f386d6c 100644 --- a/src/extensible.cpp +++ b/src/extensible.cpp @@ -63,7 +63,7 @@ bool* Extensible::Extend(const Anope::string &name, const bool &what) if (ref) return ref->Set(this); - Log(LOG_DEBUG) << "Extend for nonexistant type " << name << " on " << static_cast(this); + Log(LOG_DEBUG) << "Extend for non-existent type " << name << " on " << static_cast(this); return NULL; } diff --git a/src/init.cpp b/src/init.cpp index e6bc8e150..6d903ac8f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,4 +1,4 @@ -/* Initalization and related routines. +/* Initialization and related routines. * * (C) 2003-2014 Anope Team * Contact us at team@anope.org diff --git a/src/language.cpp b/src/language.cpp index 5ff344281..c2643f438 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -88,7 +88,7 @@ const char *Language::Translate(const char *lang, const char *string) SetThreadLocale(MAKELCID(MAKELANGID(WindowsGetLanguage(lang), SUBLANG_DEFAULT), SORT_DEFAULT)); #else /* First, set LANG and LANGUAGE env variables. - * Some systems (Debian) don't care about this, so we must setlocale LC_ALL aswell. + * Some systems (Debian) don't care about this, so we must setlocale LC_ALL as well. * BUT if this call fails because the LANGUAGE env variable is set, setlocale resets * the locale to "C", which short circuits gettext and causes it to fail on systems that * use the LANGUAGE env variable. We must reset the locale to en_US (or, anything not diff --git a/src/modes.cpp b/src/modes.cpp index 38266f95f..51b31bb7b 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -290,7 +290,7 @@ void StackerInfo::AddMode(Mode *mode, bool set, const Anope::string ¶m) break; } } - /* If the mode is on the other list, remove it from there (eg, we dont want +o-o Adam Adam) */ + /* If the mode is on the other list, remove it from there (eg, we don't want +o-o Adam Adam) */ for (it = otherlist->begin(), it_end = otherlist->end(); it != it_end; ++it) { /* The param must match too (can have multiple status or list modes), but @@ -320,7 +320,7 @@ static class ModePipe : public Pipe } } *modePipe; -/** Get the stacker info for an item, if one doesnt exist it is created +/** Get the stacker info for an item, if one doesn't exist it is created * @param Item The user/channel etc * @return The stacker info */ diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index b6df3578a..06a3c2181 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -435,8 +435,8 @@ bool ModuleManager::SetPriority(Module *mod, Implementation i, Priority s, Modul break; } - /* Eh? this module doesnt exist, probably trying to set priority on an event - * theyre not attached to. + /* Eh? this module doesn't exist, probably trying to set priority on an event + * they're not attached to. */ if (!found) return false; diff --git a/src/tools/geoipupdate.sh b/src/tools/geoipupdate.sh index 0b02dae36..641ac3259 100644 --- a/src/tools/geoipupdate.sh +++ b/src/tools/geoipupdate.sh @@ -5,7 +5,7 @@ # them into existing mysql tables. The tables are created # by the irc2sql module on the first load. -# Dont forget to rename this file or your changes +# Don't forget to rename this file or your changes # will be overwritte on the next 'make install' ############################ diff --git a/src/win32/socket.cpp b/src/win32/socket.cpp index d481515d3..211999f9a 100644 --- a/src/win32/socket.cpp +++ b/src/win32/socket.cpp @@ -51,7 +51,7 @@ int windows_accept(int fd, struct sockaddr *addr, int *addrlen) * @param af The protocol type, AF_INET or AF_INET6 * @param src The address * @param dst Struct to put results in - * @return 1 on sucess, -1 on error + * @return 1 on success, -1 on error */ int windows_inet_pton(int af, const char *src, void *dst) { diff --git a/src/win32/windows.cpp b/src/win32/windows.cpp index 3ef1bcfa9..997260581 100644 --- a/src/win32/windows.cpp +++ b/src/win32/windows.cpp @@ -194,7 +194,7 @@ Anope::string GetWindowsVersion() buf = "Microsoft Windows 98" + extra; } if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) - buf = "Microsoft Windows Millenium Edition"; + buf = "Microsoft Windows Millennium Edition"; } return buf; } -- cgit From ceddb8370c85f5c5319b497a9c4efb578338beed Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 13 Jul 2015 17:59:14 -0400 Subject: Unset extensibles on larger objects when they destruct Some complex extensibles require the full object to still be alive in their destructors to keep proper bookkeeping --- src/channels.cpp | 2 ++ src/extensible.cpp | 5 +++++ src/module.cpp | 2 ++ src/nickalias.cpp | 2 ++ src/nickcore.cpp | 2 ++ src/regchannel.cpp | 2 ++ src/users.cpp | 2 ++ 7 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 7e7702d7e..5a578b300 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -52,6 +52,8 @@ Channel::Channel(const Anope::string &nname, time_t ts) Channel::~Channel() { + UnsetExtensibles(); + FOREACH_MOD(OnChannelDelete, (this)); ModeManager::StackerDel(this); diff --git a/src/extensible.cpp b/src/extensible.cpp index 37206f7c1..50a23101a 100644 --- a/src/extensible.cpp +++ b/src/extensible.cpp @@ -23,6 +23,11 @@ ExtensibleBase::~ExtensibleBase() } Extensible::~Extensible() +{ + UnsetExtensibles(); +} + +void Extensible::UnsetExtensibles() { while (!extension_items.empty()) (*extension_items.begin())->Unset(this); diff --git a/src/module.cpp b/src/module.cpp index 3266c955f..5c02e4e49 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -64,6 +64,8 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt Module::~Module() { + UnsetExtensibles(); + /* Detach all event hooks for this module */ ModuleManager::DetachAll(this); IdentifyRequest::ModuleUnload(this); diff --git a/src/nickalias.cpp b/src/nickalias.cpp index 9f3651c12..fbf3411fc 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -51,6 +51,8 @@ NickAlias::NickAlias(const Anope::string &nickname, NickCore* nickcore) : Serial NickAlias::~NickAlias() { + UnsetExtensibles(); + FOREACH_MOD(OnDelNick, (this)); /* Accept nicks that have no core, because of database load functions */ diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 9c0e25f32..f669a9181 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -38,6 +38,8 @@ NickCore::NickCore(const Anope::string &coredisplay) : Serializable("NickCore"), NickCore::~NickCore() { + UnsetExtensibles(); + FOREACH_MOD(OnDelCore, (this)); if (!this->chanaccess->empty()) diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 397a6f28b..2b17c72ca 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -142,6 +142,8 @@ ChannelInfo::ChannelInfo(const ChannelInfo &ci) : Serializable("ChannelInfo"), ChannelInfo::~ChannelInfo() { + UnsetExtensibles(); + FOREACH_MOD(OnDelChan, (this)); Log(LOG_DEBUG) << "Deleting channel " << this->name; diff --git a/src/users.cpp b/src/users.cpp index 8ec13d8c0..73d1d4368 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -292,6 +292,8 @@ void User::SetRealname(const Anope::string &srealname) User::~User() { + UnsetExtensibles(); + if (this->server != NULL) { if (this->server->IsSynced()) -- cgit From 7fe0543bc67b772c6d3ac9a8d9aa6ae2725ed72e Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 14 Jul 2015 18:52:23 -0400 Subject: Also UnsetExtensibles on botinfo --- src/bots.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/bots.cpp b/src/bots.cpp index 85e605f21..c6a726855 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -49,6 +49,8 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A BotInfo::~BotInfo() { + UnsetExtensibles(); + FOREACH_MOD(OnDelBot, (this)); // If we're synchronised with the uplink already, send the bot. -- cgit From cd9a2af65ddd081f616754bd733f75af1fefd78b Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 15 Jul 2015 00:28:59 +0100 Subject: Fix support for passing relative install paths to CMake. --- src/tools/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index e547a2e9a..ef2f3b15b 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -48,5 +48,5 @@ endif(NOT WIN32) # On non-Windows platforms, if RUNGROUP is set, change the permissions of the tools directory if(NOT WIN32 AND RUNGROUP) - install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/bin\")") + install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin\")") endif(NOT WIN32 AND RUNGROUP) -- cgit From e65a22ae9d15264453ea75db5d8246569b0d79d3 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 31 Jul 2015 17:07:30 -0400 Subject: Fix use after free from unloading modules which are the last one holding onto an IdentifyRequest --- src/account.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/account.cpp b/src/account.cpp index e58ee1646..89c9c7909 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -73,8 +73,20 @@ void IdentifyRequest::ModuleUnload(Module *m) IdentifyRequest *ir = *it; ++it; - ir->Release(m); + ir->holds.erase(m); + if (ir->holds.empty() && ir->dispatched) + { + if (!ir->success) + ir->OnFail(); + delete ir; + continue; + } + if (ir->owner == m) + { + if (!ir->success) + ir->OnFail(); delete ir; + } } } -- cgit From c007b829f7767b5b836ea32ffe7d6bf8afe5d704 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 6 Sep 2015 16:00:32 -0400 Subject: Don't unset modes which have no privilege associated with them --- src/channels.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 5a578b300..18a85ab49 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -858,7 +858,8 @@ void Channel::SetCorrectModes(User *user, bool give_modes) given = true; } } - else if (take_modes && !has_priv && !u_access.HasPriv(cm->name + "ME")) + /* modes that have no privileges assigned shouldn't be removed (like operprefix, ojoin) */ + else if (take_modes && !has_priv && ci->GetLevel(cm->name + "ME") != ACCESS_INVALID && !u_access.HasPriv(cm->name + "ME")) { /* Only remove modes if they are > voice */ if (cm->name == "VOICE") -- cgit From 2f5e880e57be3d4881c47da991334c516e76ffaf Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 14 Sep 2015 12:24:13 -0400 Subject: Don't update channel last used time from ns alist access check --- src/regchannel.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 2b17c72ca..ebc542547 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -385,7 +385,7 @@ ChanAccess *ChannelInfo::GetAccess(unsigned index) const return acc; } -AccessGroup ChannelInfo::AccessFor(const User *u) +AccessGroup ChannelInfo::AccessFor(const User *u, bool updateLastUsed) { AccessGroup group; @@ -414,7 +414,8 @@ AccessGroup ChannelInfo::AccessFor(const User *u) if (group.founder || !group.empty()) { - this->last_used = Anope::CurTime; + if (updateLastUsed) + this->last_used = Anope::CurTime; for (unsigned i = 0; i < group.size(); ++i) group[i]->last_seen = Anope::CurTime; @@ -423,7 +424,7 @@ AccessGroup ChannelInfo::AccessFor(const User *u) return group; } -AccessGroup ChannelInfo::AccessFor(const NickCore *nc) +AccessGroup ChannelInfo::AccessFor(const NickCore *nc, bool updateLastUsed) { AccessGroup group; @@ -439,9 +440,10 @@ AccessGroup ChannelInfo::AccessFor(const NickCore *nc) } if (group.founder || !group.empty()) - this->last_used = Anope::CurTime; + if (updateLastUsed) + this->last_used = Anope::CurTime; - /* don't update access last seen here, this isn't the user requesting access */ + /* don't update access last seen here, this isn't the user requesting access */ return group; } -- cgit From 1ac4a1d9a56141d18b3e8a32fe165535031a4c67 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 17 Sep 2015 10:07:30 -0400 Subject: Defer channel deletion until after i/o. There are some edge cases with events kicking users mid-event that can delete them. --- src/bots.cpp | 5 +---- src/channels.cpp | 22 +++++++++++++++++----- src/messages.cpp | 8 +++----- src/uplink.cpp | 1 + 4 files changed, 22 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/bots.cpp b/src/bots.cpp index c6a726855..bc8b75594 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -219,12 +219,9 @@ void BotInfo::Part(Channel *c, const Anope::string &reason) IRCD->SendPart(this, c, "%s", !reason.empty() ? reason.c_str() : ""); - Anope::string cname = c->name; - Reference cref = c; - c->DeleteUser(this); - FOREACH_MOD(OnPartChannel, (this, cref, cname, reason)); + FOREACH_MOD(OnPartChannel, (this, c, c->name, reason)); } void BotInfo::OnMessage(User *u, const Anope::string &message) diff --git a/src/channels.cpp b/src/channels.cpp index a794f5126..8e9b3be94 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -27,6 +27,7 @@ #include "uplink.h" channel_map ChannelList; +std::vector Channel::deleting; Channel::Channel(const Anope::string &nname, time_t ts) { @@ -168,8 +169,8 @@ void Channel::DeleteUser(User *user) Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete non-existent channel " << this->name << " from " << user->nick << "'s channel list"; delete cu; - if (this->CheckDelete()) - delete this; + if (std::find(deleting.begin(), deleting.end(), this) == deleting.end()) + deleting.push_back(this); } ChanUserContainer *Channel::FindUser(User *u) const @@ -759,12 +760,11 @@ void Channel::KickInternal(const MessageSource &source, const Anope::string &nic return; } - Anope::string this_name = this->name; ChannelStatus status = cu->status; FOREACH_MOD(OnPreUserKicked, (source, cu, reason)); - this->DeleteUser(target); /* This can delete this; */ - FOREACH_MOD(OnUserKicked, (source, target, this_name, status, reason)); + this->DeleteUser(target); + FOREACH_MOD(OnUserKicked, (source, target, this->name, status, reason)); } bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...) @@ -939,3 +939,15 @@ Channel *Channel::FindOrCreate(const Anope::string &name, bool &created, time_t return chan; } +void Channel::DeleteChannels() +{ + for (unsigned int i = 0; i < deleting.size(); ++i) + { + Channel *c = deleting[i]; + + if (c->CheckDelete()) + delete c; + } + deleting.clear(); +} + diff --git a/src/messages.cpp b/src/messages.cpp index 4e1bcd0db..1c035238f 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -84,10 +84,9 @@ void Join::Run(MessageSource &source, const std::vector ¶ms) ChanUserContainer *cc = it->second; ++it; - Anope::string channame = cc->chan->name; FOREACH_MOD(OnPrePartChannel, (user, cc->chan)); cc->chan->DeleteUser(user); - FOREACH_MOD(OnPartChannel, (user, Channel::Find(channame), channame, "")); + FOREACH_MOD(OnPartChannel, (user, cc->chan, cc->chan->name, "")); } continue; } @@ -284,16 +283,15 @@ void Part::Run(MessageSource &source, const std::vector ¶ms) while (sep.GetToken(channel)) { - Reference c = Channel::Find(channel); + Channel *c = Channel::Find(channel); if (!c || !u->FindChannel(c)) continue; Log(u, c, "part") << "Reason: " << (!reason.empty() ? reason : "No reason"); FOREACH_MOD(OnPrePartChannel, (u, c)); - Anope::string ChannelName = c->name; c->DeleteUser(u); - FOREACH_MOD(OnPartChannel, (u, c, ChannelName, !reason.empty() ? reason : "")); + FOREACH_MOD(OnPartChannel, (u, c, c->name, !reason.empty() ? reason : "")); } } diff --git a/src/uplink.cpp b/src/uplink.cpp index 86851fc50..6171e2353 100644 --- a/src/uplink.cpp +++ b/src/uplink.cpp @@ -136,6 +136,7 @@ bool UplinkSocket::ProcessRead() { Anope::Process(buf); User::QuitUsers(); + Channel::DeleteChannels(); } return b; } -- cgit From 2e65bd40123750002e1fbdb85802351152257df3 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 17 Sep 2015 12:31:02 -0400 Subject: Channel::DeleteUser delets the container --- src/messages.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/messages.cpp b/src/messages.cpp index 1c035238f..8911d45cc 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -82,11 +82,12 @@ void Join::Run(MessageSource &source, const std::vector ¶ms) for (User::ChanUserList::iterator it = user->chans.begin(), it_end = user->chans.end(); it != it_end; ) { ChanUserContainer *cc = it->second; + Channel *c = cc->chan; ++it; - FOREACH_MOD(OnPrePartChannel, (user, cc->chan)); + FOREACH_MOD(OnPrePartChannel, (user, c)); cc->chan->DeleteUser(user); - FOREACH_MOD(OnPartChannel, (user, cc->chan, cc->chan->name, "")); + FOREACH_MOD(OnPartChannel, (user, c, c->name, "")); } continue; } -- cgit From 830361e97d03c74e54cb1cf1bbf329dffdeb66f7 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Sep 2015 17:22:44 -0400 Subject: Check privilege name is valid in SetLevel --- src/regchannel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/regchannel.cpp b/src/regchannel.cpp index ebc542547..b7c353554 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -576,6 +576,12 @@ int16_t ChannelInfo::GetLevel(const Anope::string &priv) const void ChannelInfo::SetLevel(const Anope::string &priv, int16_t level) { + if (PrivilegeManager::FindPrivilege(priv) == NULL) + { + Log(LOG_DEBUG) << "Unknown privilege " + priv; + return; + } + this->levels[priv] = level; } -- cgit