2015-04-18 15:51:15 +00:00
|
|
|
#include "irc.h"
|
|
|
|
#include "events.h"
|
|
|
|
#include "module.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2024-02-13 07:22:10 +00:00
|
|
|
#include <string.h>
|
2015-04-18 15:51:15 +00:00
|
|
|
|
2024-02-13 12:07:59 +00:00
|
|
|
MY_API void up(struct irc_conn *bot, char *user, char *chan, const char *text)
|
2015-04-18 15:51:15 +00:00
|
|
|
{
|
|
|
|
char buf[100];
|
|
|
|
FILE* file;
|
|
|
|
|
2024-02-13 12:07:59 +00:00
|
|
|
printf("dbug up called: %s\n", text);
|
2024-02-13 07:22:10 +00:00
|
|
|
|
2015-04-18 15:51:15 +00:00
|
|
|
if (!strcmp(text, "!uptime"))
|
|
|
|
{
|
|
|
|
file = popen("uptime", "r");
|
|
|
|
fgets(buf, 100, file);
|
|
|
|
pclose(file);
|
|
|
|
|
|
|
|
irc_privmsg(bot, chan, "%s", buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-02-13 12:07:59 +00:00
|
|
|
MY_API void mod_init()
|
2015-04-18 15:51:15 +00:00
|
|
|
{
|
2024-02-13 12:07:59 +00:00
|
|
|
printf("installing up handler\n");
|
2015-04-18 15:51:15 +00:00
|
|
|
add_handler(PRIVMSG_CHAN, up);
|
2024-02-13 07:22:10 +00:00
|
|
|
}
|
2024-02-13 23:47:20 +00:00
|
|
|
|
|
|
|
MY_API void mod_unload()
|
|
|
|
{
|
|
|
|
printf("unloading up handler\n");
|
|
|
|
del_handler(PRIVMSG_CHAN, up);
|
|
|
|
}
|