From abb3245bd54843f83cdcbe26837e811947f57535 Mon Sep 17 00:00:00 2001 From: Nishi Date: Tue, 10 Sep 2024 19:26:12 +0000 Subject: [PATCH] fix git-svn-id: file:///raid/svn-personal/okuu/trunk@4 7d206d2a-66c2-044b-96de-ba755a9b3ba8 --- Bot/bot.c | 7 +++++++ launch.sh | 10 ---------- 2 files changed, 7 insertions(+), 10 deletions(-) delete mode 100755 launch.sh 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 -- 2.43.0