[IRCServices Coding] 5.1 Suggestion: Aliases.
Andrew Church
achurch at achurch.org
Sun Jan 22 20:21:01 PST 2006
>On chatspike, i've modified a few files for 'convieniance' purposes,
>adding things like id -> handle_identify and what not, what would be
>nice, if it were possible to configure some of these in the
>configuration file, rather than having to modifying the core :)
You could just make a module with something like
extern char *s_NickServ;
int do_privmsg(const char *source, const char *target, char *buf)
{
if (irc_stricmp(target, s_NickServ) == 0
&& stricmp(buf, "ID", 2)
&& isspace(buf[2]
) {
memmove(buf+8, buf+2, strlen(buf+8));
memcpy(buf, "IDENTIFY", 8);
}
return 0;
}
int init_module()
{
// ...
add_callback_pri(NULL, "m_privmsg", do_privmsg, CBPRI_MAX); // called first
// ...
}
which is rather kludgey in that it relies on `buf' being writeable and
having room for 6 more bytes (which should always be true), but it doesn't
require modifying the core. I'll think about a more general solution,
though.
--Andrew Church
achurch at achurch.org
http://achurch.org/