- Srv = Me;
-
- Srv->AddExtendedMode('J', MT_CHANNEL, false, 1, 0);
- }
-
- virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
- {
- if ((modechar == 'J') && (type == MT_CHANNEL))
- {
- if (!mode_on)
- {
- // Taking the mode off, we need to clean up.
- chanrec* c = (chanrec*)target;
-
- delaylist* dl = (delaylist*)c->GetExt("norejoinusers");
-
- if (dl)
- {
- DELETE(dl);
- c->Shrink("norejoinusers");
- }
- }
- /* Don't allow negative or 0 +J value */
- return ((!mode_on) || (atoi(params[0].c_str()) > 0));
- }
- return 0;
+ if (!ServerInstance->Modes->AddMode(&kr))
+ throw ModuleException("Could not add new modes!");
+ ServerInstance->Extensions.Register(&kr.ext);
+ Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick };
+ ServerInstance->Modules->Attach(eventlist, this, 2);