+ if (target_type == TYPE_CHANNEL)
+ {
+ chanrec* c = (chanrec*)dest;
+ if ((c->IsModeSet('M')) && (!user->IsModeSet('r')))
+ {
+ if ((ServerInstance->ULine(user->nick)) || (ServerInstance->ULine(user->server)) || (!strcmp(user->server,"")))
+ {
+ // user is ulined, can speak regardless
+ return 0;
+ }
+ // user messaging a +M channel and is not registered
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need a registered nickname to speak on this channel");
+ return 1;
+ }
+ }
+ if (target_type == TYPE_USER)
+ {
+ userrec* u = (userrec*)dest;
+ if ((u->IsModeSet('R')) && (user->IsModeSet('r')))
+ {
+ if ((ServerInstance->ULine(user->nick)) || (ServerInstance->ULine(user->server)))
+ {
+ // user is ulined, can speak regardless
+ return 0;
+ }
+ // user messaging a +R user and is not registered
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need a registered nickname to message this user");
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status)
+ {
+ return OnUserPreMessage(user,dest,target_type,text,status);
+ }
+
+ virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
+ {
+ if (chan)
+ {
+ if (chan->IsModeSet('R'))
+ {
+ if (user->IsModeSet('r'))
+ {
+ if ((ServerInstance->ULine(user->nick)) || (ServerInstance->ULine(user->server)))
+ {
+ // user is ulined, won't be stopped from joining
+ return 0;
+ }
+ // joining a +R channel and not identified
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need a registered nickname to join this channel");
+ return 1;
+ }
+ }
+ }
+ return 0;