]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix not being able to message ulines when m_restrictmsg is loaded.
authorPeter Powell <petpow@saberuk.com>
Tue, 28 Apr 2015 19:22:34 +0000 (20:22 +0100)
committerPeter Powell <petpow@saberuk.com>
Sun, 10 May 2015 03:50:35 +0000 (04:50 +0100)
docs/conf/modules.conf.example
src/modules/m_restrictmsg.cpp

index 71a0fb079b8b58b33c07198987d355abc4f10628..32701f0c455a672331d37e38fcc6778e65b94454 100644 (file)
 # You probably *DO NOT* want to load this module on a public network.
 #
 #<module name="m_restrictmsg.so">
+#
+# Uncomment this to allow users to message ulines (e.g. services):
+#<restrictmsg uline="yes">
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # R-Line module: Ban users through regular expression patterns.
index e814f3b161d2db6bd7570e546686f25ebb9de6d9..2a9f1dc9328646a228ac846c0be8d76d3e6cc9c3 100644 (file)
 
 class ModuleRestrictMsg : public Module
 {
+ private:
+       bool uline;
 
  public:
 
        void init()
        {
-               Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
+               OnRehash(NULL);
+               Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice };
                ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
+       void OnRehash(User*)
+       {
+               uline = ServerInstance->Config->ConfValue("restrictmsg")->getBool("uline", false);
+       }
 
        virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
@@ -45,8 +52,9 @@ class ModuleRestrictMsg : public Module
                        // message allowed if:
                        // (1) the sender is opered
                        // (2) the recipient is opered
+                       // (3) the recipient is on a ulined server
                        // anything else, blocked.
-                       if (IS_OPER(u) || IS_OPER(user))
+                       if (IS_OPER(u) || IS_OPER(user) || (uline && ServerInstance->ULine(u->server)))
                        {
                                return MOD_RES_PASSTHRU;
                        }