instead of using
if (stricmp(av[2], 'my_special_channel') == 0)
i have edited it to
if (stricmp(av[2], "#testchannel") == 0)
for the time being and it stopped the crash.
now ive run into problems with the anope umode command.
when compiling, i get this error.
os_specialchan.c: In function 'handle_special_channel_join':
os_specialchan.c:56: warning: passing argument 3 of 'anope_set_umode' from incompatible pointer type
i am 99% sure thats cos of my "my_special_modes" variable but am unsure how to fix it.
also, does that anope_set_umode work for adding and removing umodes?
i have been looking at other modules to see how they go about it, but its eluding me at the moment.
just to clear things up, im trying to mark users as a bot when they join a specific channel.
#include "module.h"
#define AUTHOR "PuNkTuReD"
#define VERSION "Special Channel v 0.1"
void anope_set_umode(User * user, int argc, char **argv);
int handle_special_channel_join(int argc, char **argv);
int AnopeInit(int argc, char **argv)
{
EvtHook *hook;
int status;
hook = createEventHook(EVENT_JOIN_CHANNEL, handle_special_channel_join);
status = moduleAddEventHook(hook);
if (status != MOD_ERR_OK)
{
alog("Error binding to event EVENT_JOIN_CHANNEL [%d]", status);
return MOD_STOP;
}
moduleAddAuthor(AUTHOR);
moduleAddVersion(VERSION);
moduleSetType(THIRD);
alog("Loaded Special Channel Module.");
return MOD_CONT;
}
int handle_special_channel_join(int argc, char **av)
{
char *my_special_channel = NULL;
char *my_special_modes = NULL;
Directive confvalues1[] = {
{ "SpecialChannel", { { PARAM_STRING, PARAM_RELOAD, &my_special_channel } } }
};
Directive confvalues2[] = {
{ "SpecialModes", { { PARAM_STRING, PARAM_RELOAD, &my_special_modes } } }
};
moduleGetConfigDirective(confvalues1);
moduleGetConfigDirective(confvalues2);
User *user;
user = finduser(av[1]);
if (stricmp(av[2], "#testchannel") == 0)
{
if (stricmp(av[0], EVENT_STOP) == 0)
{
alog("\002JOIN:\002 %s joined %s", user, my_special_channel);
alog("\002UMODE:\002 %s is now marked with the mode: %s", user, my_special_modes);
anope_set_umode(user, 1, my_special_modes);
return MOD_CONT;
}
}
return MOD_CONT;
}
void AnopeFini(void)
{
alog("Unloaded Special Channel Module.");
}
/* EOF */