/* send-ons.c * GloveNet Client.. GloveSend Version 2.0 * * By David Barberi * Bot shell by Peyote Coyote * *=====[ ons.c ]============================================================= This would be the only file for end users to confiure.. Has all the on_* functions that the parser recognizes. ============================================================================*/ #include #include #include #include "all-bot.h" static char buf[MAXLEN]; extern int writeln(); int send_data; char current_channel[30]; int sleepval; /*=====[ on_join ]=========================================================== "who" has joined channel "channel" - do whatever ===========================================================================*/ void send_on_join(who, channel) char *who; char *channel; { #ifdef DBUG printf("SEND On_join: who = %s, channel = %s\n", who, channel); #endif sprintf(buf, "PRIVMSG %s type START to get Glove stream\n", who); writeln(buf); #ifdef DBUG printf("SEND Exiting on_join\n"); #endif } /*=====[ on_msg ]============================================================ A message was sent from "from" to "to", the text is in "msg" ===========================================================================*/ void send_on_msg(from, to, msg) char *from; char *to; char *msg; { char *replyto; char *com; #ifdef DBUG printf("SEND On_msg: from = %s, to = %s, msg = %s\n", from, to, msg); #endif if(strcasestr(msg, "JOIN")) { strtok(msg, " "); com= strtok(NULL, " "); strcpy(current_channel,com); sprintf(buf, "JOIN %s\n", com); writeln(buf); } if(strcasestr(msg, "PART")) { strtok(msg, " "); com = strtok(NULL, " "); sprintf(buf, "PART %s\n", com); writeln(buf); } if(strcasestr(msg, "SLEEP")) { strtok(msg, " "); com = strtok(NULL, " "); sleepval = atoi(com); sprintf(buf, "PRIVMSG %s sleepval = %i\n", current_channel, sleepval); writeln(buf); } if(strcasestr(msg, "NICK")) { strtok(msg, " "); com = strtok(NULL, " "); sprintf(buf, "NICK %s\n", com); writeln(buf); } if(strcasestr(msg, "INFO")) { /* | should go to from */ sprintf(buf, "PRIVMSG %s current_channel = %s , sleepval = %i\n",current_channel, current_channel, sleepval); writeln(buf); } if(strcasestr(msg, "START")) send_data = TRUE; #ifdef DBUG printf("SEND Exiting on_msg\n"); #endif }