+/** Channel mode +R - registered users only
+ */
+class Channel_R : public SimpleChannelModeHandler
+{
+ public:
+ Channel_R(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'R') { }
+};
+
+/** User mode +R - only allow PRIVMSG and NOTICE from registered users
+ */
+class User_R : public SimpleUserModeHandler
+{
+ public:
+ User_R(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'R') { }
+};
+
+/** Channel mode +M - only allow privmsg and notice to channel from registered users
+ */
+class Channel_M : public SimpleChannelModeHandler
+{
+ public:
+ Channel_M(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'M') { }
+};
+
+/** Dreamnforge-like services support
+ */
+class ModuleServices : public Module
+{
+
+ Channel_r* m1;
+ Channel_R* m2;
+ Channel_M* m3;
+ User_r* m4;
+ User_R* m5;
+ public:
+ ModuleServices(InspIRCd* Me)
+ : Module(Me)
+ {
+
+ m1 = new Channel_r(ServerInstance);
+ m2 = new Channel_R(ServerInstance);
+ m3 = new Channel_M(ServerInstance);
+ m4 = new User_r(ServerInstance);
+ m5 = new User_R(ServerInstance);
+
+ if (!ServerInstance->Modes->AddMode(m1) || !ServerInstance->Modes->AddMode(m2) || !ServerInstance->Modes->AddMode(m3)
+ || !ServerInstance->Modes->AddMode(m4) || !ServerInstance->Modes->AddMode(m5))
+ {
+ 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);