#include "module.h" #define AUTHOR "Vorex" #define VERSION "0.1" int my_privmsg(char *source, int ac, char **av); CommandHash *loveserv_cmdTable[MAX_CMD_HASH]; void addClient(char *nick, char *realname); void addMessageList(void); void delClient(void); char *s_loveserv = "loveserv"; void loveserv(User * u, char *buf); /* Commands */ int do_help(User *u); int do_kiss(User *u); int do_rose(User *u); int do_about(User *u); int do_version(User *u); int do_apology(User *u); int do_lovenote(User *u); int do_thankyou(User *u); int do_tonsil(User *u); int do_chocolate(User *u); int do_candy(User *u); int do_hug(User *u); int do_admirer(User *u); int AnopeInit(int argc, char **argv) { Message *msg = NULL; int status; #ifdef IRC_UNREAL32 msg = createMessage("PRIVMSG", my_privmsg); if (UseTokens) { msg = createMessage("!", my_privmsg); } #else msg = createMessage("PRIVMSG", my_privmsg); #endif status = moduleAddMessage(msg, MOD_HEAD); if (status == MOD_ERR_OK) { addClient(s_loveserv, "meow!"); addMessageList(); } moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); alog("ircd_loveserv.so: loaded, message status [%d]", status); return MOD_CONT; } void AnopeFini(void) { delClient(); } int my_privmsg(char *source, int ac, char **av) { User *u; char *s; /* First, some basic checks */ if (ac != 2) return MOD_CONT; /* bleh */ if (!(u = finduser(source))) { return MOD_CONT; } /* non-user source */ if (*av[0] == '#') { return MOD_CONT; } /* Channel message */ /* we should prolly honour the ignore list here, but i cba for this... */ s = strchr(av[0], '@'); if (s) { *s++ = 0; if (stricmp(s, ServerName) != 0) return MOD_CONT; } if ((stricmp(av[0], s_loveserv)) == 0) { /* its for US! */ loveserv(u, av[1]); return MOD_STOP; } else { /* ok it isnt us, let the old code have it */ return MOD_CONT; } } void addClient(char *nick, char *realname) { anope_cmd_bot_nick(nick, "LoveServ", ServiceHost, "Network Love Service", "+"); } void delClient(void) { anope_cmd_quit(s_loveserv, "QUIT :Powering Off"); } void addMessageList(void) { Command *c; c = createCommand("about", do_about, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("rose", do_rose, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("kiss", do_kiss, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("tonsil", do_tonsil, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("hug", do_hug, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("admirer", do_admirer, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("chocolate", do_chocolate, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("candy", do_candy, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("lovenote", do_lovenote, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("apology", do_apology, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("thankyou", do_thankyou, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("version", do_version, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); c = createCommand("help", do_help, NULL, -1, -1, -1, -1, -1); moduleAddCommand(loveserv_cmdTable, c, MOD_UNIQUE); } /*****************************************************************************/ /* Main loveserv routine. */ void loveserv(User * u, char *buf) { char *cmd, *s; cmd = strtok(buf, " "); if (!cmd) { return; } else if (stricmp(cmd, "\1PING") == 0) { if (!(s = strtok(NULL, ""))) s = "\1"; notice(s_loveserv, u->nick, "\1PING %s", s); } else if (skeleton) { notice_lang(s_loveserv, u, SERVICE_OFFLINE, s_loveserv); } else { mod_run_cmd(s_loveserv, u, loveserv_cmdTable, cmd); } } // about int do_about(User * u) { notice(s_loveserv, u->nick, "\2LoveServ\2 is a fun module to send presents and messages to loved ones on IRC."); return MOD_CONT; } //rose int do_rose(User * u) { char *target = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "Your rose has been sent to %s!", target); notice(s_loveserv, target, "%s has sent you this beautiful rose! 3--<--<--<{4@", u->nick); return MOD_CONT; } //kiss int do_kiss(User * u) { char *target = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "You have virtually kissed %s!", target); notice(s_loveserv, target, "%s has virtually kissed you!", u->nick); return MOD_CONT; } //tonsil int do_tonsil(User * u) { char *target = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "You have virtually tonsilly kissed %s!", target); notice(s_loveserv, target, "%s would like to send a SLoW..LoNG..DeeP..PeNeTRaTiNG..ToNSiL-TiCKLiNG.. HaiR STRaiGHTeNiNG..Toe-CuRLiNG..NeRVe-JaNGLiNG..LiFe-aLTeRiNG.. FaNTaSY-CauSiNG..i JuST SaW GoD!..GoSH, DiD MY CLoTHeS FaLL oFF?.. YeS, i'M GLaD i CaMe oN iRC..KiSS oN Da LiPS!!!", u->nick); return MOD_CONT; } //hug int do_hug(User * u) { char *target = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "%s has received your hug! :)", target); notice(s_loveserv, target, "%s has sent you a *BIG WARM HUG*!", u->nick); return MOD_CONT; } //admirer int do_admirer(User * u) { char *target = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "Secret admirer sent to %s :)", target); notice(s_loveserv, target, "You have a secret admirer! ;)"); return MOD_CONT; } //chocolate int do_chocolate(User * u) { char *target = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "A box of cholocates has been sent to %s :)", target); notice(s_loveserv, target, "%s would like you to have this YUMMY box of chocolates!", u->nick); return MOD_CONT; } //candy int do_candy(User * u) { char *target = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "A bag of yummy heart shaped candies has been sent to %s :)", target); notice(s_loveserv, target, "%s would like you to have this big YUMMY bag of heart shaped candies!", u->nick); return MOD_CONT; } //lovenote int do_lovenote(User * u) { char *target = strtok(NULL, " "); char *message = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "Your lovenote to %s has been sent! :)", target); notice(s_loveserv, target, "%s has sent you a LoveNote which reads: \2%s\2", u->nick, message); return MOD_CONT; } //apology int do_apology(User * u) { char *target = strtok(NULL, " "); char *message = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "Your apology has been sent to %s", target); notice(s_loveserv, target, "%s is sorry, and would like to apologise for \2%s\2", u->nick, message); return MOD_CONT; } //thankyou int do_thankyou(User * u) { char *target = strtok(NULL, " "); char *message = strtok(NULL, ""); if (!target) return; if (!finduser(target)) { notice(s_loveserv, u->nick, "No target nick provided. See /msg LoveServ HELP"); return MOD_CONT; } notice(s_loveserv, u->nick, "Your Thank You has been sent to %s", target); notice(s_loveserv, target, "%s wishes to thank you for \2%s\2", u->nick, message); return MOD_CONT; } //version int do_version(User * u) { notice(s_loveserv, u->nick, "\2LoveServ's Version Information\2"); notice(s_loveserv, u->nick, "LoveServ's Version: %s", VERSION); notice(s_loveserv, u->nick, "LoveServ's Origional Author: Shmad "); notice(s_loveserv, u->nick, "LoveServ was ported by: Vorex "); notice(s_loveserv, u->nick, "http://abducted.us"); return MOD_CONT; } //help int do_help(User *u){ char *cmd = strtok(NULL, " "); if (cmd){ if (!stricmp(cmd, "about")){ notice(s_loveserv, u->nick, "\2LoveServ\2 is a fun module to send presents and "); notice(s_loveserv, u->nick,"messages to loved ones on IRC."); return MOD_CONT; } if (!stricmp(cmd, "rose")){ notice(s_loveserv, u->nick, "Syntax: \2ROSE \2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send a rose to a loved one on IRC."); return MOD_CONT; } if (!stricmp(cmd, "kiss")){ notice(s_loveserv, u->nick, "Syntax: \2KISS \2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send a kiss to that special someone on IRC."); return MOD_CONT; } if (!stricmp(cmd, "tonsil")){ notice(s_loveserv, u->nick, "Syntax: \2TONSIL \2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send a deep tonsil penitrating kiss to someone on IRC."); return MOD_CONT; } if (!stricmp(cmd, "hug")){ notice(s_loveserv, u->nick, "Syntax: \2HUG \2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send a hug to someone on IRC."); return MOD_CONT; } if (!stricmp(cmd, "admirer")){ notice(s_loveserv, u->nick, "Syntax: \2ADMIRER \2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick,"Tell someone on IRC they have a SECRET Admirer!"); return MOD_CONT; } if (!stricmp(cmd, "chocolate")){ notice(s_loveserv, u->nick, "Syntax: \2CHOCOLATE \2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send a big yummy box of candy to someone on IRC."); return MOD_CONT; } if (!stricmp(cmd, "candy")){ notice(s_loveserv, u->nick, "Syntax: \2CANDY \2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send someone a box of yummy heart shaped candies"); return MOD_CONT; } if (!stricmp(cmd, "lovenote")){ notice(s_loveserv, u->nick, "Syntax: \2LOVENOTE I love you dearly.\2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send that special someone a love note."); return MOD_CONT; } if (!stricmp(cmd, "apology")){ notice(s_loveserv, u->nick, "Syntax: \2APOLOGY deleting all those songs\2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick, "Send an Apology to someone"); return MOD_CONT; } if (!stricmp(cmd, "thankyou")){ notice(s_loveserv, u->nick, "Syntax: \2THANKYOU uploading those songs\2"); notice(s_loveserv, u->nick,""); notice(s_loveserv, u->nick, "Send a THANKYOU message to someone"); return MOD_CONT; } if (!stricmp(cmd, "version")){ notice(s_loveserv, u->nick, "Syntax: \2VERSION\2"); notice(s_loveserv, u->nick, ""); notice(s_loveserv, u->nick,"Show LoveServ's current version"); return MOD_CONT; } } notice(s_loveserv, u->nick, "LoveServ is a fun module to send presents and messages to loved ones on IRC."); notice(s_loveserv, u->nick, "ABOUT About LoveServ"); notice(s_loveserv, u->nick, "ROSE Give someone a rose"); notice(s_loveserv, u->nick, "KISS Give someone a kiss"); notice(s_loveserv, u->nick, "TONSIL Give someone a tonsil kiss"); notice(s_loveserv, u->nick, "HUG Give someone a hug"); notice(s_loveserv, u->nick, "ADMIRER Tell someone they have a secret admirer"); notice(s_loveserv, u->nick, "CHOCOLATE Give someone chocolate"); notice(s_loveserv, u->nick, "CANDY Give someone candy"); notice(s_loveserv, u->nick, "LOVENOTE Give someone a lovenote"); notice(s_loveserv, u->nick, "APOLOGY Give someone an apology"); notice(s_loveserv, u->nick, "THANKYOU Give someone a thank you"); notice(s_loveserv, u->nick, "VERSION Display version info"); return MOD_CONT; }