*/
class Channel_r : public ModeHandler
{
-
+
public:
Channel_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_CHANNEL, false) { }
// only a u-lined server may add or remove the +r mode.
if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server || (source->nick.find('.') != std::string::npos)))
{
- channel->SetMode('r',adding);
- return MODEACTION_ALLOW;
+ // Only change the mode if it's not redundant
+ if ((adding && !channel->IsModeSet('r')) || (!adding && channel->IsModeSet('r')))
+ {
+ channel->SetMode('r',adding);
+ return MODEACTION_ALLOW;
+ }
+
+ return MODEACTION_DENY;
}
else
{
*/
class User_r : public ModeHandler
{
-
+
public:
User_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_USER, false) { }
*/
class ModuleServices : public Module
{
-
+
Channel_r* m1;
Channel_R* m2;
Channel_M* m3;
ModuleServices(InspIRCd* Me)
: Module(Me)
{
-
+
m1 = new Channel_r(ServerInstance);
m2 = new Channel_R(ServerInstance);
m3 = new Channel_M(ServerInstance);
{
throw ModuleException("Could not add user and channel modes!");
}
-
+
kludgeme = false;
Implementation eventlist[] = { I_OnWhois, I_OnUserPostNick, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 5);
kludgeme = false;
}
}
-
+
virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user))
return 0;
}
// user messaging a +M channel and is not registered
- user->WriteNumeric(477, "%s %s :You need a registered nickname to speak on this channel", user->nick.c_str(), c->name);
+ user->WriteNumeric(477, "%s %s :You need a registered nickname to speak on this channel", user->nick.c_str(), c->name.c_str());
return 1;
}
}
}
return 0;
}
-
+
virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status, exempt_list);
}
-
+
virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (chan)
return 0;
}
// joining a +R channel and not identified
- user->WriteNumeric(477, "%s %s :You need a registered nickname to join this channel", user->nick.c_str(), chan->name);
+ user->WriteNumeric(477, "%s %s :You need a registered nickname to join this channel", user->nick.c_str(), chan->name.c_str());
return 1;
}
}
delete m4;
delete m5;
}
-
+
virtual Version GetVersion()
{
return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);