summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-06-20 14:04:17 -0400
committerAdam <Adam@anope.org>2010-06-20 14:04:17 -0400
commite8a1570ed9f7b839a361169c141956978348acf8 (patch)
tree1387ff92e67c5bbad4bc7d43b760113437463c60
parent968e4d0bdd3d2524be43b2339e7287d48f6fb174 (diff)
Added m_helpchan to replace the cores helpchannel functionality
-rw-r--r--data/example.conf16
-rw-r--r--docs/Changes.conf1
-rw-r--r--include/config.h2
-rw-r--r--src/config.cpp1
-rw-r--r--src/modules/m_helpchan.cpp48
5 files changed, 59 insertions, 9 deletions
diff --git a/data/example.conf b/data/example.conf
index 89c352417..2258b4924 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -202,12 +202,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 &param)
+ {
+ 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)