/* * jul.c * (C) Peter Salanki 2002 * This program is copyright, and covered by the Gnu Public License. * The Natasha bot. * sorcer@linux.se */ #include #include #include #include #include #include #include #include "../../settings.h" #include "../../globals.h" #include "../../bottypes.h" #include "settings.h" #define NAME "Jul" #define VERSION 1.00 int juljoin(struct channel *c, struct activeuser *u); struct channel *notjoin; struct channel *notbein; MODULE_INIT _module_init(MODULE m); MODULE_DESTROY _module_destroy(MODULE m); MODULE_INIT _module_init(MODULE m) { strncpy(m->name, NAME, 20); strncpy(m->compiledate, __DATE__ " " __TIME__, 30); m->version = VERSION; notjoin = findchannel("#julen2002"); notbein = findchannel("#jul.swe"); } MODULE_DESTROY _module_destroy(MODULE m) { } int juljoin(struct channel *c, struct activeuser *u) { char hostmask[HOSTLEN+5+USERLEN] = ""; char tmp[512] = ""; if(c == notjoin) { if(findachanuser(u->nick, notbein->name) != NULL) { sprintf(hostmask, "%s@%s", u->username, u->hostname); sprintf(tmp, "In #jul.swe."); addban(c->name, hostmask, tmp, 0, time(NULL)+60); sprintf(tmp, "Being in #jul.swe is not acceptable"); kick(c->name, u->nick, tmp); return 1; } } else if(c == notbein) { if(findachanuser(u->nick, notjoin->name) != NULL) { sprintf(hostmask, "%s@%s", u->username, u->hostname); sprintf(tmp, "In #jul.swe."); addban(notjoin->name, hostmask, tmp, 0, time(NULL)+60); sprintf(tmp, "Being in #jul.swe is not acceptable"); kick(notjoin->name, u->nick, tmp); return 1; } } return 0; }