summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c1
-rw-r--r--src/modules/m_helpchan.cpp48
2 files changed, 48 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index 1846edfe5..33873bc20 100644
--- a/src/config.c
+++ b/src/config.c
@@ -608,7 +608,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)