- void init()
- {
- if (!ServerInstance->Modes->AddMode(&pm))
- throw ModuleException("Could not add new modes!");
- Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
- ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
+ User* targuser = target.Get<User>();
+ if (!targuser->IsModeSet(mode) || user->SharesChannelWith(targuser))
+ return MOD_RES_PASSTHRU;
+
+ if (user->HasPrivPermission("users/ignore-commonchans") || user->server->IsULine())
+ return MOD_RES_PASSTHRU;
+
+ user->WriteNumeric(ERR_CANTSENDTOUSER, targuser->nick, "You are not permitted to send private messages to this user (+c is set)");
+ return MOD_RES_DENY;