1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
19 /* $ModDesc: Forbids users from messaging each other. Users may still message opers and opers may message other opers. */
22 class ModuleRestrictMsg : public Module
27 ModuleRestrictMsg(InspIRCd* Me)
33 void Implements(char* List)
35 List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
38 virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
40 if ((target_type == TYPE_USER) && (IS_LOCAL(user)))
42 userrec* u = (userrec*)dest;
44 // message allowed if:
45 // (1) the sender is opered
46 // (2) the recipient is opered
47 // anything else, blocked.
48 if (IS_OPER(u) || IS_OPER(user))
52 user->WriteServ("531 %s %s :You are not permitted to send private messages to this user",user->nick,u->nick);
56 // however, we must allow channel messages...
60 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
62 return this->OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
65 virtual ~ModuleRestrictMsg()
69 virtual Version GetVersion()
71 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
75 MODULE_INIT(ModuleRestrictMsg)