]> Git repositories of Nishi - okuu.git/commitdiff
fix
authorNishi <nishi@nishi.boats>
Tue, 10 Sep 2024 19:26:12 +0000 (19:26 +0000)
committerNishi <nishi@nishi.boats>
Tue, 10 Sep 2024 19:26:12 +0000 (19:26 +0000)
git-svn-id: file:///raid/svn-personal/okuu/trunk@4 7d206d2a-66c2-044b-96de-ba755a9b3ba8

Bot/bot.c
launch.sh [deleted file]

index 6fa9df30ec7200ff689c6516c18f4e16a37c2c45..98fb4ad63ad1dc038c87137312732d4243b8ca89 100644 (file)
--- 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 (executable)
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