2024-02-13 07:22:10 +00:00
|
|
|
#define MY_DLL_EXPORTS 1
|
|
|
|
|
2015-03-27 15:44:40 +00:00
|
|
|
#include "irc.h"
|
|
|
|
#include "events.h"
|
2015-04-07 06:56:50 +00:00
|
|
|
#include "module.h"
|
2015-03-27 15:44:40 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2024-02-13 07:22:10 +00:00
|
|
|
#include <string.h>
|
2015-03-27 15:44:40 +00:00
|
|
|
|
2024-02-16 21:28:11 +00:00
|
|
|
MY_API void hello(struct irc_conn *bot, char *user, char *host, char *chan, const char *text)
|
2015-03-27 15:44:40 +00:00
|
|
|
{
|
|
|
|
char *buf = (char *)malloc(sizeof(char *) * 500);
|
|
|
|
sprintf(buf, "hi %s", bot->nick);
|
|
|
|
|
|
|
|
if (!strcmp(text, buf))
|
|
|
|
{
|
2015-04-18 15:51:15 +00:00
|
|
|
irc_privmsg(bot, chan, "hi %s", user);
|
2024-02-13 07:22:10 +00:00
|
|
|
|
|
|
|
printf("%s said hi to me\n", user);
|
2015-03-27 15:44:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
|
2024-02-17 06:03:20 +00:00
|
|
|
MY_API void hello_join(struct irc_conn *bot, char *user, char *host, char *chan)
|
|
|
|
{
|
|
|
|
printf("%s!%s joined %s\n", user, host, chan);
|
|
|
|
|
|
|
|
irc_privmsg(bot, chan, "Hi %s! Welcome to %s", user, chan);
|
|
|
|
}
|
|
|
|
|
2024-02-13 07:22:10 +00:00
|
|
|
MY_API void mod_init()
|
2015-03-27 15:44:40 +00:00
|
|
|
{
|
2024-02-17 08:21:22 +00:00
|
|
|
register_module("hello", "Aaron Blakely", "v0.05", "Test module");
|
2024-02-17 06:03:20 +00:00
|
|
|
add_handler(PRIVMSG_CHAN, hello);
|
|
|
|
add_handler(JOIN, hello_join);
|
2024-02-13 07:22:10 +00:00
|
|
|
}
|
2024-02-13 23:47:20 +00:00
|
|
|
|
|
|
|
MY_API void mod_unload()
|
|
|
|
{
|
2024-02-17 08:21:22 +00:00
|
|
|
unregister_module("hello");
|
2024-02-13 23:47:20 +00:00
|
|
|
del_handler(PRIVMSG_CHAN, hello);
|
2024-02-17 06:03:20 +00:00
|
|
|
del_handler(JOIN, hello_join);
|
2024-02-13 23:47:20 +00:00
|
|
|
}
|