summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-07-12 21:10:15 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-07-12 21:10:15 +0000
commit432bfa9dfab698d35c618e648340567bdd17610c (patch)
tree0fbe87ed5e5360dae2a15519700a5fea5c423648 /src/modules
parent8ed5d452db32932d2b1148332dd9012cb3aed625 (diff)
Add m_gecosban, implements extban +b r: - hostname bans.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9989 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_gecosban.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp
new file mode 100644
index 000000000..49ca17fe0
--- /dev/null
+++ b/src/modules/m_gecosban.cpp
@@ -0,0 +1,66 @@
+/* +------------------------------------+
+ * | Inspire Internet Relay Chat Daemon |
+ * +------------------------------------+
+ *
+ * InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
+ * This program is free but copyrighted software; see
+ * the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#include "inspircd.h"
+
+/* $ModDesc: Implements extban +b r: - realname (gecos) bans */
+
+class ModuleNickBan : public Module
+{
+ private:
+ public:
+ ModuleNickBan(InspIRCd* Me) : Module(Me)
+ {
+ Implementation eventlist[] = { I_OnUserPreJoin, I_On005Numeric };
+ ServerInstance->Modules->Attach(eventlist, this, 2);
+ }
+
+ virtual ~ModuleNickBan()
+ {
+ }
+
+ virtual Version GetVersion()
+ {
+ return Version(1,2,0,0,VF_VENDOR,API_VERSION);
+ }
+
+ virtual int OnUserPreJoin(User *user, Channel *c, const char *cname, std::string &privs, const std::string &key)
+ {
+ if (!IS_LOCAL(user))
+ return 0;
+
+ if (!c)
+ return 0;
+
+ if (c->IsExtBanned(user->fullname, 'r'))
+ {
+ // XXX: send a numeric here
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot join " + c->name + ", as you match a ban");
+ return 1;
+ }
+
+ return 0;
+ }
+
+ virtual void On005Numeric(std::string &output)
+ {
+ if (output.find(" EXTBAN=:") == std::string::npos)
+ output.append(" EXTBAN=:r");
+ else
+ output.insert(output.find(" EXTBAN=:") + 9, "r");
+ }
+};
+
+
+MODULE_INIT(ModuleNickBan)
+