diff options
author | epoch <epoch@hack.thebackupbox.net> | 2019-05-19 09:23:09 +0000 |
---|---|---|
committer | epoch <epoch@hack.thebackupbox.net> | 2019-05-19 09:23:09 +0000 |
commit | e02e4b69e237d16f19530b071fbb081a811e8ebe (patch) | |
tree | f3b52639891d378c1bd4bc08c4e0b27dc7483ddd /ircify.c | |
parent | 5ed56236f1ee57e71c91d356c7160aedc6e515f0 (diff) | |
download | libidc-e02e4b69e237d16f19530b071fbb081a811e8ebe.tar.gz libidc-e02e4b69e237d16f19530b071fbb081a811e8ebe.zip |
renamed everything to idc from line.
Diffstat (limited to 'ircify.c')
-rw-r--r-- | ircify.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -8,14 +8,20 @@ extern struct global libline; int pin[2]; int pout[2]; +char channel[256]; + void line_handler(struct shit *me,char *line) { char tmp[1024]; if(!strncmp(line,"PING ",5)) { - line[1]='O'; - printf("%s\r\n",line); + printf("PONG :%s\r\n",line+5); + fflush(stdout); } if(*line == ':') { if(strchr(line,' ')) { + if(!strncmp(strchr(line,' ')," 376 ",5)) { + printf("JOIN %s\r\n",channel); + fflush(stdout); + } if(!strncmp(strchr(line,' ')," PRIVMSG ",9)) { if(strchr(line+1,':')) { snprintf(tmp,sizeof(tmp),"%s\n",strchr(line+1,':')+1); @@ -24,17 +30,18 @@ void line_handler(struct shit *me,char *line) { } } } - fprintf(stderr,"READ SHIT: %s\n",line); + fprintf(stderr,"%s\n",line); } -char channel[256]; - void line_handler2(struct shit *me,char *line) { printf("PRIVMSG %s :%s\r\n",channel,line); - fflush(stdout); } int main(int argc,char *argv[]) { + setlinebuf(stdout); + printf("NICK revbot\r\n"); + printf("USER asdf asdf asdf :asdf\r\n"); + fflush(stdout); strcpy(channel,argv[1]); argv+=2; int i=0; |