All pastes #564567 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-06-13 17:22 UTC
rendered paste body
#define SUCCESS 1
#define FAILURE 0
#define EXCEPT  -1

int AnopeInit(int argc, char **argv) {
	
	/* Gather the config values from the config file, or use defaults */
	for (i=0; i < 9; i++) {
		moduleGetConfigDirective(_botkiller_confvals[i]);
	}
	
	/* check and set the configurable options */
	_botkillerdb = _botkillerdb ? _botkillerdb : BOTKILLERDB;
	_botkillernick = _botkillernick ? _botkillernick : BOTKILLERNICK;
	_botkillerident = _botkillerident ? _botkillerident : BOTKILLERNICK;
	_botkillerhost = _botkillerhost ? _botkillerhost : BOTKILLERHOST;
	_botkillerrealname = _botkillerrealname ? _botkillerrealname : BOTKILLERREALNAME;
	_botkillermodes = _botkillermodes ? _botkillermodes : BOTKILLERMODES ? BOTKILLERMODES : ircd->nickservmode;
	_botkillerakilllimit = _botkillerakilllimit ? _botkillerakilllimit : BOTKILLERAKILLLIMIT;
	_botkillerakillone = _botkillerakillone ? _botkillerakillone : BOTKILLERAKILLONE;
	_botkillerakilltwo = _botkillerakilltwo ? _botkillerakilltwo : BOTKILLERAKILLTWO;
	alog("\n[begin cs_trap]\n DB: %s\n Nick: %s\n Ident: %s\n Host: %s\n Real Name: %s\n Modes: %s\n Akill Limit: %s\n Akill Time 1st: %s\n Akill Time 2nd+: %s\n[end cs_trap]\n", _botkillerdb, _botkillernick, _botkillerident, _botkillerhost, _botkillerrealname, _botkillermodes, _botkillerakilllimit, _botkillerakillone, _botkillerakilltwo);
	
	anope_cmd_bot_nick(_botkillernick, _botkillerident, _botkillerhost, _botkillerrealname, _botkillermodes);
	
	moduleAddAuthor(AUTHOR);
	moduleAddVersion(VERSION);
	
	alog("\n[cs_trap] open_db: %d\n", open_db(_botkillerdb, db_fp));
	
	return MOD_CONT;
}

int open_db(char *name, FILE *fp) {
	
	fp = fopen(name, "rw");
	
	if (!fp) {
		alog("\n[cs_trap] ERROR: Unable to open %s for use.\n", name);
		return FAILURE;
	}
	else {
		alog("\n[cs_trap] Loaded %s for use.\n", name);
		return SUCCESS;
	}
	return EXCEPT;
}