From 68b54f3fb540ab16294fbc5ed49705a44743f829 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 19 Jun 2010 13:39:12 -0400 Subject: [PATCH 1/5] Made db-converter only write mlock params if there really is one, fixes some problems with converting mlock for certain databases --- src/tools/db-convert.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c index 4e3d01034..2866079b3 100644 --- a/src/tools/db-convert.c +++ b/src/tools/db-convert.c @@ -854,16 +854,16 @@ int main(int argc, char *argv[]) process_mlock_modes(fs, ci->mlock_off, ircd); fs << std::endl; } - if (ci->mlock_limit || ci->mlock_key || ci->mlock_flood || ci->mlock_redirect) + if (ci->mlock_limit || (ci->mlock_key && *ci->mlock_key) || (ci->mlock_flood && *ci->mlock_flood) || (ci->mlock_redirect && *ci->mlock_redirect)) { fs << "MD MLP"; if (ci->mlock_limit) fs << " CMODE_LIMIT " << ci->mlock_limit; - if (ci->mlock_key) + if (ci->mlock_key && *ci->mlock_key) fs << " CMODE_KEY " << ci->mlock_key; - if (ci->mlock_flood) + if (ci->mlock_flood && *ci->mlock_flood) fs << " CMODE_FLOOD " << ci->mlock_flood; - if (ci->mlock_redirect) + if (ci->mlock_redirect && *ci->mlock_redirect) fs << " CMODE_REDIRECT " << ci->mlock_redirect; fs << std::endl; } From 448eadd74709ac46181b0c79ca65b6b1b14c9555 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 19 Jun 2010 20:53:53 -0400 Subject: [PATCH 2/5] Made db-converter add all of the core clients when converting a 1.8 database --- src/tools/db-convert.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c index 2866079b3..0b1a49c1e 100644 --- a/src/tools/db-convert.c +++ b/src/tools/db-convert.c @@ -497,6 +497,37 @@ int main(int argc, char *argv[]) } if (input == "y") broken = 1; + input = ""; + while (input != "y" && input != "n") + { + std::cout << std::endl << "Are you converting a 1.8.x database? (y/n) " << std::endl << "? "; + std::cin >> input; + } + /* 1.8 doesn't have nickserv etc in bot.db, create them */ + if (input == "y") + { + time_t now = time(NULL); + fs << "BI NickServ NickServ services.anope.org " << now << " 0 :NickServ" << std::endl; + fs << "MD FLAGS NICKSERV" << std::endl; + + fs << "BI ChanServ ChanServ services.anope.org " << now << " 0 :ChanServ" << std::endl; + fs << "MD FLAGS CHANSERV" << std::endl; + + fs << "BI BotServ BotServ services.anope.org " << now << " 0 :BotServ" << std::endl; + fs << "MD FLAGS BOTSERV" << std::endl; + + fs << "BI HostServ HostServ services.anope.org " << now << " 0 :HostServ" << std::endl; + fs << "MD FLAGS HOSTSERV" << std::endl; + + fs << "BI OperServ OperServ services.anope.org " << now << " 0 :OperServ" << std::endl; + fs << "MD FLAGS OPERSERV" << std::endl; + + fs << "BI MemoServ MemoServ services.anope.org " << now << " 0 :MemoServ" << std::endl; + fs << "MD FLAGS MEMOSERV" << std::endl; + + fs << "BI Global Global services.anope.org " << now << " 0: Global" << std::endl; + fs << "MD FLAGS GLOBAL" << std::endl; + } while ((c = getc_db(f)) == 1) { READ(read_string(&nick, f)); From 7b7e2a6150bf7b3acee29ada5a5292c11042f680 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 19 Jun 2010 21:22:48 -0400 Subject: [PATCH 3/5] Updated TODO --- docs/TODO | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/TODO b/docs/TODO index d7d461bbf..d0c8329c5 100644 --- a/docs/TODO +++ b/docs/TODO @@ -5,17 +5,17 @@ Legend: 1.9.3 ----- - [ ] Add in a subcommand system, ns_set, cs_set, etc. - [ ] Threading - [ ] Mail sending needs to be threaded - [ ] process_numlist needs to die - [ ] SList needs to die - [ ] SSL - [ ] Command handling system needs to die, strtok() needs to die more + [x] Add in a subcommand system, ns_set, cs_set, etc. + [x] Threading + [x] Mail sending needs to be threaded + [x] process_numlist needs to die + [x] SList needs to die + [x] SSL + [x] Command handling system needs to die, strtok() needs to die more [ ] Asynchronous DNS [ ] CIDR Akills, session exceptions, etc - [ ] Hashing system for storing just about everything needs to die - [ ] Add support for +k, +q, etc type umodes + [x] Hashing system for storing just about everything needs to die + [x] Add support for +k, +q, etc type umodes [ ] Language system is disgusting, it must die. [ ] Modules should also have a way to add strings programatically [ ] Should be able to add many strings by dropping a file in a set location. From 968e4d0bdd3d2524be43b2339e7287d48f6fb174 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 20 Jun 2010 13:11:31 -0400 Subject: [PATCH 4/5] Fixed the name of cs_forbid in chanserv:modules so it really loads --- data/example.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/example.conf b/data/example.conf index 90864f96a..89c352417 100644 --- a/data/example.conf +++ b/data/example.conf @@ -967,7 +967,7 @@ chanserv * The core modules to load for ChanServ. This is a space separated list that corresponds * to the base names of the modules for ChanServ. This directive is optional, but highly recommended. */ - modules = "cs_help cs_register cs_set cs_saset cs_set_bantype cs_set_description cs_set_email cs_set_entrymsg cs_set_founder cs_set_keeptopic cs_set_mlock cs_set_opnotice cs_set_peace cs_set_persist cs_set_private cs_set_restricted cs_set_secure cs_set_securefounder cs_set_secureops cs_set_signkick cs_set_successor cs_set_topiclock cs_set_url cs_set_xop cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info forbid cs_suspend cs_status cs_unban" + modules = "cs_help cs_register cs_set cs_saset cs_set_bantype cs_set_description cs_set_email cs_set_entrymsg cs_set_founder cs_set_keeptopic cs_set_mlock cs_set_opnotice cs_set_peace cs_set_persist cs_set_private cs_set_restricted cs_set_secure cs_set_securefounder cs_set_secureops cs_set_signkick cs_set_successor cs_set_topiclock cs_set_url cs_set_xop cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info cs_forbid cs_suspend cs_status cs_unban" /* * The default options for newly registered channels. Note that changing these options From e8a1570ed9f7b839a361169c141956978348acf8 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 20 Jun 2010 14:04:17 -0400 Subject: [PATCH 5/5] Added m_helpchan to replace the cores helpchannel functionality --- data/example.conf | 16 ++++++++----- docs/Changes.conf | 1 + include/config.h | 2 -- src/config.cpp | 1 - src/modules/m_helpchan.cpp | 48 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 src/modules/m_helpchan.cpp diff --git a/data/example.conf b/data/example.conf index 89c352417..2258b4924 100644 --- a/data/example.conf +++ b/data/example.conf @@ -201,12 +201,6 @@ serverinfo */ networkinfo { - /* - * For the given channel, every user that has or gets op status of the channel - * will automatically receive the +h user mode. This directive is optional. - */ - helpchannel = "#help" - /* * If set, Services will output log messages to the given channel. This * directive is optional. @@ -1565,6 +1559,16 @@ db_plain database = "anope.db" } +modules { name = "m_helpchan" } +m_helpchan +{ + /* + * For the given channel, every user that has or gets op status of the channel + * will automatically receive the +h user mode. This directive is optional. + */ + helpchannel = "#help" +} + hs_request { /* diff --git a/docs/Changes.conf b/docs/Changes.conf index e4ee68fd0..cb613c434 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -17,6 +17,7 @@ operserv:killonsgline changed to operserv:killonsnline operserv:notifications ossgline changed ossnline ** DELETED CONFIGURATION DIRECTIVES ** +serverinfo:helpchannel removed because it has been readded in m_helpchan Anope Version 1.9.2 -------------------- diff --git a/include/config.h b/include/config.h index dacf3db06..25ab0f65e 100644 --- a/include/config.h +++ b/include/config.h @@ -396,8 +396,6 @@ class ServerConfig /* The hostname if services clients */ char *ServiceHost; - /* Help channel, ops here get usermode +h **/ - char *HelpChannel; /* Log channel */ char *LogChannel; /* Name of the network were on */ diff --git a/src/config.cpp b/src/config.cpp index a1264abce..8fb4286a3 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -621,7 +621,6 @@ int ServerConfig::Read(bool bail) {"serverinfo", "hostname", "", new ValueContainerChar(&Config.ServiceHost), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"serverinfo", "pid", "services.pid", new ValueContainerChar(&Config.PIDFilename), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"serverinfo", "motd", "services.motd", new ValueContainerChar(&Config.MOTDFilename), DT_CHARPTR, ValidateNotEmpty}, - {"networkinfo", "helpchannel", "", new ValueContainerChar(&Config.HelpChannel), DT_CHARPTR, NoValidation}, {"networkinfo", "logchannel", "", new ValueContainerChar(&Config.LogChannel), DT_CHARPTR, NoValidation}, {"networkinfo", "logbot", "no", new ValueContainerBool(&Config.LogBot), DT_BOOLEAN, NoValidation}, {"networkinfo", "networkname", "", new ValueContainerChar(&Config.NetworkName), DT_CHARPTR, ValidateNotEmpty}, diff --git a/src/modules/m_helpchan.cpp b/src/modules/m_helpchan.cpp new file mode 100644 index 000000000..6255d5012 --- /dev/null +++ b/src/modules/m_helpchan.cpp @@ -0,0 +1,48 @@ +/* + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + */ + +#include "module.h" + +class HelpChannel : public Module +{ + ci::string HelpChan; + + public: + HelpChannel(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion(VERSION_STRING); + this->SetType(SUPPORTED); + + Implementation i[] = { I_OnChannelModeSet, I_OnReload }; + ModuleManager::Attach(i, this, 2); + + OnReload(true); + } + + EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const std::string ¶m) + { + if (Name == CMODE_OP && c && c->ci && c->name == this->HelpChan) + { + User *u = finduser(param); + + if (u) + u->SetMode(OperServ, UMODE_HELPOP); + } + + return EVENT_CONTINUE; + } + + void OnReload(bool) + { + ConfigReader config; + + this->HelpChan = config.ReadValue("m_helpchan", "helpchannel", "", 0).c_str(); + } +}; + +MODULE_INIT(HelpChannel)