summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-04 12:55:51 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-04 12:55:51 +0000
commite728d9abdfd0ea41ac249273842924fe6bce6d4d (patch)
treec24c933e77c9dd6ad7614a4f8d1395a0bd2072fc
parentb07868e77c0527642ed72bce84bf5895bf921e87 (diff)
Match on nick change option for RLine, document m_rline & this option.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9300 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--docs/inspircd.conf.example10
-rw-r--r--src/modules/extra/m_rline.cpp35
2 files changed, 42 insertions, 3 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index a4f1ad5bd..e3d8e8b33 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -2008,6 +2008,16 @@
#<module name="m_restrictmsg.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
+# Ban users through regular expression patterns
+#<module name="m_rline.so">
+#
+#-#-#-#-#-#-#-#-#-#-#-#- RLINE CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#-#
+# If you wish to re-check a user when they change nickname (can be
+# useful under some situations, but *can* also use CPU with more users
+# on a server) then set the following configuration value:
+#<rline matchonnickchange="yes">
+
+#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Provide /LIST throttling (to prevent flooding) and /LIST safety to
# prevent excess flood when the list is large.
#<module name="m_safelist.so">
diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp
index 88e40811b..15bd60bc0 100644
--- a/src/modules/extra/m_rline.cpp
+++ b/src/modules/extra/m_rline.cpp
@@ -6,7 +6,7 @@
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
@@ -196,9 +196,13 @@ class ModuleRLine : public Module
private:
CommandRLine *r;
RLineFactory *f;
+ bool MatchOnNickChange;
+
public:
ModuleRLine(InspIRCd* Me) : Module(Me)
{
+ OnRehash(NULL, "");
+
// Create a new command
r = new CommandRLine(ServerInstance);
ServerInstance->AddCommand(r);
@@ -206,8 +210,8 @@ class ModuleRLine : public Module
f = new RLineFactory(ServerInstance);
ServerInstance->XLines->RegisterFactory(f);
- Implementation eventlist[] = { I_OnUserConnect };
- ServerInstance->Modules->Attach(eventlist, this, 1);
+ Implementation eventlist[] = { I_OnUserConnect, I_OnRehash, I_OnUserPostNick };
+ ServerInstance->Modules->Attach(eventlist, this, 3);
}
@@ -232,6 +236,31 @@ class ModuleRLine : public Module
rl->Apply(user);
}
}
+
+ virtual void OnRehash(User *user, const std::string &parameter)
+ {
+ ConfigReader Conf(ServerInstance);
+
+ MatchOnNickChange = Conf.ReadFlag("rline", "matchonnickchange", 1);
+ }
+
+ virtual int OnUserPostNick(User *user, const std::string &oldnick)
+ {
+ if (!IS_LOCAL(user))
+ return 0;
+
+ if (!MatchOnNickChange)
+ return 0;
+
+ XLine *r = ServerInstance->XLines->MatchesLine("R", user);
+
+ if (r)
+ {
+ // Bang! :D
+ r->Apply(user);
+ }
+ }
+
};
MODULE_INIT(ModuleRLine)