/*****************************************************************************************/ /* Anope Module : ns_info_notice.c : v1.0 */ /* Contac info : westor -> westor7@gmail.com -> #Scripting on @ ChatNet (irc.chatnet.gr) */ /* Thanks to: katsklaw - katsklaw@ircmojo.net */ /* */ /* Anope (c) 2013 Anope.org */ /* */ /* This program is free software; you can redistribute it and/or modify it under the */ /* terms of the GNU General Public License as published by the Free Software */ /* Foundation; either version 1, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ /* PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* */ /*****************************************************************************************/ #include #define AUTHOR "westor" #define VERSION "1.1" /*************************************************************************/ int myNickInfo(User * u); int myChanInfo(User * u); /*************************************************************************/ /** * AnopeInit is called when the module is loaded * @param argc Argument count * @param argv Argument list * @return MOD_CONT to allow the module, MOD_STOP to stop it **/ int AnopeInit(int argc, char **argv) { Command *c; moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); c = createCommand("INFO", myNickInfo, NULL, -1, -1, -1, -1, -1); moduleAddCommand(NICKSERV, c, MOD_TAIL); c = createCommand("INFO", myChanInfo, NULL, -1, -1, -1, -1, -1); moduleAddCommand(CHANSERV, c, MOD_TAIL); alog("\002ns_info_notice:\002 Module loaded."); return MOD_CONT; } void AnopeFini(void) { alog("\002ns_info_notice:\002 Module unloaded."); } /*************************************************************************/ /** * Called after a user does a /msg nickserv info [nick] * @param u The user who requested info * @return MOD_CONT to continue processing commands or MOD_STOP to stop **/ int myNickInfo(User * u) { char *text, *nick; User *u2; /* Get the last buffer anope recived */ if ((text = moduleGetLastBuffer())) { /* check if the nick is registered */ if ((nick = myStrGetToken(text, ' ', 0)) && findnick(nick)) { /* check if the nick is online and an operator and send a notice*/ if ((u2 = finduser(nick)) && is_oper(u2)) notice_user(s_NickServ, u2, "*** %s (%s@%s) did an \002/NICKSERV INFO\002 on your nickname", u->nick, u->username, u->host); /* log ALL /ns info commands */ alog("*** %s (%s@%s) did an \002/NICKSERV INFO\002 on %s", u->nick, u->username, u->host, nick); /* free the memory allocated with myStrGetToken() */ free(nick); } } return MOD_CONT; } /** * Called after a user does a /msg chanserv info chan * @param u The user who requested info * @return MOD_CONT to continue processing commands or MOD_STOP to stop **/ int myChanInfo(User * u) { char *text, *chan; ChannelInfo *ci; if ((text = moduleGetLastBuffer())) { if ((chan = myStrGetToken(text, ' ', 0)) && (ci = cs_findchan(chan))) { alog("*** %s (%s@%s) did an \002/CHANSERV INFO\002 on %s", u->nick, u->username, u->host, ci->name); free(chan); } } return MOD_CONT; } /*************************************************************************/ /* EOF */