diff options
author | Peter Powell <petpow@saberuk.com> | 2015-04-28 20:22:34 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2015-05-10 04:50:35 +0100 |
commit | 15b0a1853d2912ae10d218b00c2e6f175bb5ae30 (patch) | |
tree | c6fd48e61febf3b7c6fff1918c6169d19fe97acd | |
parent | 1548078e5dc304814669cd1ea052f92be9d1ac40 (diff) |
Fix not being able to message ulines when m_restrictmsg is loaded.
-rw-r--r-- | docs/conf/modules.conf.example | 3 | ||||
-rw-r--r-- | src/modules/m_restrictmsg.cpp | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 71a0fb079..32701f0c4 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1486,6 +1486,9 @@ # 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. diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index e814f3b16..2a9f1dc93 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -26,15 +26,22 @@ 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; } |