#include #include "vars.h" #include "config.h" /* parse.c ** The socket's core of this code has been made by wildthang ** . You can modify it but not distribute it ** modified. This file is part of Mudbot and is (C) 1997 by Drow ** All rights reserved. */ extern char global_buf[]; int bot_parse(sck,fromhost,k) int sck; char *fromhost; int k; { int level,i; token[0]++; /* token[3]++;*/ /* if(k < 4) return; */ /* Here is where you process privmsg send to bot or channels */ #ifdef BITCH if (!cas_cmp(token[1],"MODE")) { do_bitch(sck); } #endif #ifdef SHARE_USERFILE if(token[1]!=NULL) { if(!cas_cmp(token[1],"PRIVMSG")) { if(token[2]!=NULL) { if(token[3]!=NULL) { if(!cas_cmp(token[3],":share-add")) do_shared(sck); } } } } #endif if(token[1]!=NULL && token[2]!=NULL && token[3]!=NULL) { if(chklevel(fromhost)>0) { if(!cas_cmp(token[1],"PRIVMSG")) { if(*(token[3]+2)=='P' && *(token[3]+3)=='I' && *(token[3]+4)=='N' && *(token[3]+5)=='G') { if(token[4]!=NULL) sprintf(buf,"NOTICE %s :\001PING %s\001\n",token[0],token[4]); else sprintf(buf,"NOTICE %s :\001PING %d\001\n",token[0],time(NULL)); writeln(sck,buf); #ifdef REPORTS sprintf(buf,"PRIVMSG %s :%s did a PING on me...\n",REPORTS,token[0]); writeln(sck,buf); #endif } if(*(token[3]+2)=='V' && *(token[3]+3)=='E' && *(token[3]+4)=='R' && *(token[3]+5)=='S' && *(token[3]+6)=='I') { sprintf(buf,"NOTICE %s :\001VERSION MudBot %d.%d\001\n",token[0],VERSION_MAJOR,VERSION_MINOR); writeln(sck,buf); #ifdef REPORTS sprintf(buf,"PRIVMSG %s :%s did a VERSION on me...\n",REPORTS,token[0]); writeln(sck,buf); #endif } } } } #ifdef USE_BINDS if(token[1] != NULL) { #ifdef BIND_JOIN if(!cas_cmp(token[1],"JOIN")) bind_join(sck); #endif #ifdef BIND_PRIVMSG if(!cas_cmp(token[1],"PRIVMSG")) bind_msg(sck); #endif #ifdef BIND_NOTICE if(!cas_cmp(token[1],"NOTICE")) bind_notice(sck); #endif #ifdef BIND_PART if(!cas_cmp(token[1],"PART")) bind_part(sck); #endif #ifdef BIND_MODE if(!cas_cmp(token[1],"MODE")) bind_mode(sck); #endif } #endif #ifdef MASSDEOP if(token[1]!=NULL) { if(token[3]!=NULL) { if(!cas_cmp(token[1],"MODE")) { if(!cas_cmp(token[3],"-oooooo")&&*token[3]=='-') { sprintf(buf,"KICK %s %s :MASS-DEOP Protection!\n",token[2],token[0]); writeln(sck,buf); } } } } #endif #ifdef VIEW if(token[1] != NULL) { if(!cas_cmp(token[1],"PRIVMSG")) client_msg(sck); else if(!cas_cmp(token[1],"NOTICE")) client_notice(sck); else if(!cas_cmp(token[1],"TOPIC")) client_topic(sck); else if(!cas_cmp(token[1],"KICK")) client_kick(sck); else if(!cas_cmp(token[1],"JOIN")) client_join(sck); else if(!cas_cmp(token[1],"PART")) client_part(sck); else if(!cas_cmp(token[1],"NICK")) client_nick(sck); else if(!cas_cmp(token[1],"WALLOPS")) client_wallops(sck); else if(!cas_cmp(token[1],"INVITE")) printf("[INVITE] %s invites you to %s\n",token[2],token[3]); } #endif if(cas_cmp(spying,"dummy") && token[1]!=NULL && token[2]!=NULL) { if(!cas_cmp(token[2],spying)) spy_report(sck); } #ifdef USE_ALIASES show_aliases(sck,fromhost,0); #endif if(k < 4) return; #ifdef LOGFILE_MSG if(!cas_cmp(token[1],"PRIVMSG") && token[2][0]!='#') writelog(fromhost,0); #endif #ifdef LOGFILE_PUB if(!cas_cmp(token[1],"PRIVMSG") && token[2][0]=='#') writelog(fromhost,1); #endif token[3]++; if(*token[3]==CMDCHAR) do_check_command(sck,fromhost,k); else { sev_stuff(sck,k); } } sev_stuff(sck,k) int sck; int k; { int i,j; FILE *fpa; char temp[512] = "Closing link "; char temp1[512] = "Closing link "; char local_buf[512]; j=chk_num(0); if (!cas_cmp(token[0],"ERROR")) { if (!cas_cmp(token[1],":Closing")) { if(token[2]!=NULL) { if(token[3]!=NULL) { if (j>3) for(i=3;i