X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_restrictmsg.cpp;h=2a9f1dc9328646a228ac846c0be8d76d3e6cc9c3;hb=ccd4c11ea1a43d079eaae9708482ef4a9148796c;hp=ef9181a2469857c245f4138926e25b41633edcad;hpb=fcacc8e0306382bc3f938073092c3729d77e2b41;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index ef9181a24..2a9f1dc93 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -26,16 +26,22 @@ class ModuleRestrictMsg : public Module { + private: + bool uline; public: - ModuleRestrictMsg() - { - - Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice }; - ServerInstance->Modules->Attach(eventlist, this, 2); + void init() + { + 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) { @@ -46,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; }