diff --git a/Bot/bot.c b/Bot/bot.c index 6fa9df3..98fb4ad 100644 --- a/Bot/bot.c +++ b/Bot/bot.c @@ -111,6 +111,7 @@ void ok_bot(void){ ircfw_socket_send_cmd(ok_sock, NULL, construct); bool is_in = false; + bool sendable = false; struct pollfd pollfds[1]; pollfds[0].fd = ok_sock; @@ -131,6 +132,10 @@ void ok_bot(void){ if(n >= 0){ int i; for(i = 0; i < n; i++){ + if(!sendable){ + free(list[i]); + continue; + } if(count <= atoi(list[i]->d_name)){ sprintf(construct, "%s/%s", nntppath, list[i]->d_name); if(ok_news_read(construct) == 0){ @@ -192,6 +197,8 @@ void ok_bot(void){ fprintf(stderr, "Login successful\n"); sprintf(construct, "JOIN :%s", ircchan); ircfw_socket_send_cmd(ok_sock, NULL, construct); + }else if(res == 331 || res == 332){ + sendable = true; } }else{ if(strcasecmp(ircfw_message.command, "PING") == 0){ diff --git a/launch.sh b/launch.sh deleted file mode 100755 index 97f6c0e..0000000 --- a/launch.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -export NNTPSERVER=127.0.0.1 -export NNTPPATH=/var/news/spool/articles/comp/os/netbsd -export NNTPCOUNT=netbsd-count -export IRCSERVER=192.168.0.161 -export IRCCHAN=#test -export IRCUSER=okuu -export IRCNICK=Okuu -export IRCREAL="Utsuho Reiuji" -./Bot/okuu