Page 1 of 1

Module help

Posted: Thu Jun 11, 2009 4:32 am
by ShawnPrend

Code: Select all

#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 STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif

DLLFUNC CMD_FUNC(m_calloper);

#define MSG_CALLOPER 	"calloper"
#define TOK_CALLOPER 	"CAO"	

static Command *calloper;

ModuleHeader MOD_HEADER(m_calloper)
  = {
	"m_calloper",
	"$Id: m_calloper.c,v 1.1 June 10 2008 15:15:22 Shawn Exp $",
	"command /calloper", 
	"3.2-b8-1",
	NULL 
    };

DLLFUNC int MOD_INIT(m_calloper)(ModuleInfo *modinfo)
{
	calloper = CommandAdd(modinfo->handle, MSG_CALLOPER, TOK_CALLOPER, m_calloper, MAXPARA, M_USER|M_SERVER);
	return MOD_SUCCESS;
}

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

DLLFUNC int MOD_UNLOAD(m_calloper)(int module_unload)
{
	CommandDel(calloper);
	return MOD_SUCCESS;
}



DLLFUNC CMD_FUNC(m_calloper)
{
	aClient *acptr;
	char *message;
	char *reason;
	
	message = parc > 2 ? parv[1] : NULL;
	reason = parv[2];
	
	if (BadPtr(message))
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, sptr->name, 
			"CALLOPER");
		return 0;
	}

	sendto_realops("[\2HELP\2] [By: %s] [Channel: %s] [Reason: %s]",
		sptr->name, message, reason);
}
I'm bad I know

Re: Module help

Posted: Fri Jun 12, 2009 3:46 pm
by Jobe
Forgive me for seeming dumb, but what's wrong with /helpop <message>?

Re: Module help

Posted: Fri Jun 12, 2009 6:33 pm
by katsklaw
Jobe1986 wrote:Forgive me for seeming dumb, but what's wrong with /helpop <message>?
Nothing is wrong with /helpop, unless it doesn't fill your needs.

This module:
1> it's a different solution.
2> seeing /helpop requires umode +h, being in a +si channel doesn't
3> this module can be duplicated to allow for multiple "helper" types (channel services, admin services, kline support, mass spam .. etc) without mixing all of them together in /helpop
4> because they can :wink:

One could also relativity easily add more modes to memory space, assign flags to said modes and duplicate the helpop system for each new mode/flag.