Requesting module: +X Adults only

These are old archives. They are kept for historic purposes only.
MightyWings
Posts: 20
Joined: Fri Feb 26, 2010 12:06 pm
Location: Portadown, Northern Ireland
Contact:

Re: Requesting module: +X Adults only

Post by MightyWings »

It sounds like you would benefit better from the paid module https://www.vulnscan.org/product/SQLMod-II by Syzop as it forces users to sign up to a website, use /pass PASSWORD to connect and it can pull their age from the MySQL table and check it against the channel mode on join, if their age is incorrect for the channel, it denies then from joining
MightyWings
toXic
Posts: 9
Joined: Sun Feb 28, 2010 10:55 am
Location: Turkey/Samsun

Re: Requesting module: +X Adults only

Post by toXic »

thank you but ı use this module and cant join off the channel..

All off channel ( ı dont give +X to channel, but the channels want to me +X mode )
Capitaine
Posts: 27
Joined: Mon Apr 26, 2004 6:09 pm

Re: Requesting module: +X Adults only

Post by Capitaine »

I've just been reported conflicts with others modules.
Althought I wasn't able to reproduce it, I made that update :

Code: Select all

/*
* ==================================================================================
* Filename:  m_adult.c
* Description:	Add user and channel mode +X for adults, and join restriction
* Author:Capitaine
* History:
* - v1.0 (20070220) New modes added
* - v1.1 (20080424) Join check added
* - v1.11(20080531) Using now a hook instead of command override => segfault bug fix
* - v1.2 (20120810) Maintenance release
* ==================================================================================
*/

#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "proto.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#ifdef _WIN32
#include "version.h"
#endif


#define UMODE_ADULT_CHAR  'X'
#define CMODE_ADULT_CHAR  'X'

static long UMODE_ADULT     = 0L;
static Cmode_t CMODE_ADULT  = 0L;
static Cmode *CmodeAdult    = NULL;
static Umode *UmodeAdult    = NULL;
static Hook *CheckMsg       = NULL;
static ModuleInfo m_adult_mod_info;

DLLFUNC int join_check(aClient *sptr, aChannel *chptr, char *parv[]);


ModuleHeader MOD_HEADER(m_adult)
  = {
	"m_adult",
	"v1.2",
	"User and channel modes +X",
	"3.2-b8-1",
	NULL 
    };


DLLFUNC int MOD_INIT(m_adult)(ModuleInfo *modinfo)
{
	CmodeInfo req;
	memset(&req, 0, sizeof(req));
		    
	/* Set the module info */
	bcopy(modinfo, &m_adult_mod_info, modinfo->size);

	/* Add a new usermode */
	UmodeAdult = UmodeAdd(modinfo->handle, UMODE_ADULT_CHAR, UMODE_GLOBAL, NULL, &UMODE_ADULT);
	
	/* Add a new chanmode */
	req.paracount = 0;
	req.is_ok = extcmode_default_requirehalfop;
	req.flag = CMODE_ADULT_CHAR;
	CmodeAdult = CmodeAdd(modinfo->handle, req, &CMODE_ADULT);

	CheckMsg = HookAddEx(m_adult_mod_info.handle, HOOKTYPE_PRE_LOCAL_JOIN, join_check);

	if (UmodeAdult && CmodeAdult && CheckMsg)
	{
		return MOD_SUCCESS;
	}
	else
	{
		config_error("m_adult: Error while initializing : %s", ModuleGetErrorStr(modinfo->handle));
		return MOD_FAILED;
	}
}

DLLFUNC int MOD_LOAD(m_adult)(int module_load)
{
	return MOD_SUCCESS;
}

DLLFUNC int MOD_UNLOAD(m_adult)(int module_unload)
{
	HookDel(CheckMsg);
	CmodeDel(CmodeAdult);
	UmodeDel(UmodeAdult);
	return MOD_SUCCESS;
}

DLLFUNC int join_check(aClient *sptr, aChannel *chptr, char *parv[])
{
	if (chptr && !IsMember(sptr, chptr))
	{
		/* Is this channel rated for adults ? */  
		if ((chptr->mode.extmode & CMODE_ADULT) && !(sptr->umodes & UMODE_ADULT))
		{
			/* User has not +X mode, so we deny joining */
			sendnotice(sptr, "%s is an adult only channel. To join you must be of legal age and type this command : /MODE %s +X", chptr->chname, sptr->name);
			return HOOK_DENY;
		}
	}

	return HOOK_CONTINUE;
}
Post Reply