X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/f011b15a26be6b21aac31ae703347377d0c6e277..78546f2b0f59b5c8fede1ce5535972716eb17041:/qabot/qabot.c diff --git a/qabot/qabot.c b/qabot/qabot.c index 3134ebff..ac472f3b 100644 --- a/qabot/qabot.c +++ b/qabot/qabot.c @@ -11,9 +11,12 @@ #include "../lib/base64.h" #include "../lib/irc_string.h" #include "../lib/splitline.h" +#include "../lib/version.h" #include "qabot.h" +MODULE_VERSION(""); + time_t qab_startime; int qabot_nickext; int qabot_spam_nickext; @@ -66,6 +69,12 @@ void _init() { addcommandtotree(qabot_chancommands, "spam", QAC_QUESTIONCHAN|QAC_STAFFCHAN, 30, qabot_dochanspam); addcommandtotree(qabot_chancommands, "status", QAC_QUESTIONCHAN|QAC_STAFFCHAN, 0, qabot_dochanstatus); addcommandtotree(qabot_chancommands, "unblock", QAC_QUESTIONCHAN|QAC_STAFFCHAN, 2, qabot_dochanunblock); + addcommandtotree(qabot_chancommands, "record", QAC_STAFFCHAN, 1, qabot_dochanrecord); + addcommandtotree(qabot_chancommands, "play", QAC_STAFFCHAN, 1, qabot_dochanplay); + addcommandtotree(qabot_chancommands, "continue", QAC_STAFFCHAN, 0, qabot_dochancontinue); + addcommandtotree(qabot_chancommands, "stop", QAC_STAFFCHAN, 0, qabot_dochanstop); + addcommandtotree(qabot_chancommands, "delete", QAC_STAFFCHAN, 1, qabot_dochandelete); + addcommandtotree(qabot_chancommands, "list", QAC_STAFFCHAN, 0, qabot_dochanlist); if ((qabot_nickext = registernickext("QABOT")) == -1) { return; @@ -138,6 +147,12 @@ void _fini() { deletecommandfromtree(qabot_chancommands, "spam", qabot_dochanspam); deletecommandfromtree(qabot_chancommands, "status", qabot_dochanstatus); deletecommandfromtree(qabot_chancommands, "unblock", qabot_dochanunblock); + deletecommandfromtree(qabot_chancommands, "record", qabot_dochanrecord); + deletecommandfromtree(qabot_chancommands, "play", qabot_dochanplay); + deletecommandfromtree(qabot_chancommands, "continue", qabot_dochancontinue); + deletecommandfromtree(qabot_chancommands, "stop", qabot_dochanstop); + deletecommandfromtree(qabot_chancommands, "delete", qabot_dochandelete); + deletecommandfromtree(qabot_chancommands, "list", qabot_dochanlist); destroycommandtree(qabot_chancommands); } @@ -158,6 +173,17 @@ void qabot_lostnick(int hooknum, void* arg) { if (!b->lastspam) qabot_spamstored((void*)b); } + + if (b->recnumeric == np->numeric) { + b->recnumeric = 0; + + if (b->recfile) { + fclose(b->recfile); + b->recfile = NULL; + } + + sendmessagetochannel(b->np, b->staff_chan->channel, "Recorder deactivated."); + } } } @@ -179,6 +205,17 @@ void qabot_channel_part(int hooknum, void* arg) { if (!b->lastspam) qabot_spamstored((void*)b); } + + if (b->recnumeric == np->numeric) { + b->recnumeric = 0; + + if (b->recfile) { + fclose(b->recfile); + b->recfile = NULL; + } + + sendmessagetochannel(b->np, b->staff_chan->channel, "Recorder deactivated."); + } } } @@ -352,6 +389,11 @@ void qabot_child_handler(nick* me, int type, void** args) { } } } + else if ((*text != '!') && (bot->recnumeric == sender->numeric) && (cp->index == bot->staff_chan)) { + if (bot->recfile) { + fprintf(bot->recfile, "%s\n", text); + } + } break; case LU_PRIVMSG: