git-svn-id: file:///raid/svn-personal/okuu/trunk@8 7d206d2a-66c2-044b-96de-ba755a9b3ba8
This commit is contained in:
Nishi 2024-09-11 00:41:52 +00:00
parent 812c58d2c1
commit 1cdc7a9100

View File

@ -143,31 +143,33 @@ void ok_bot(void){
}
if(count <= atoi(list[i]->d_name)){
sprintf(construct, "%s/%s", nntppath, list[i]->d_name);
if(ok_news_read(construct) == 0 && strcmp(news_entry.from, nntpfrom) != 0){
char* tmp = ok_strcat3("PRIVMSG ", ircchan, " :\x03" "07[USENET] ~ ");
char* temp = ok_strcat3(tmp, news_entry.from, "\x03 ");
free(tmp);
int j;
int incr = 0;
for(j = 0;; j++){
if(news_entry.content[j] == 0 || news_entry.content[j] == '\n'){
char* line = malloc(j - incr + 1);
line[j - incr] = 0;
memcpy(line, news_entry.content + incr, j - incr);
if(strlen(line) > 0){
char* msg = ok_strcat(temp, line);
ircfw_socket_send_cmd(ok_sock, NULL, msg);
free(msg);
usleep(1000 * 100); /* Sleep for 100ms */
if(ok_news_read(construct) == 0){
if(strcmp(news_entry.from, nntpfrom) != 0){
char* tmp = ok_strcat3("PRIVMSG ", ircchan, " :\x03" "07[USENET] ~ ");
char* temp = ok_strcat3(tmp, news_entry.from, "\x03 ");
free(tmp);
int j;
int incr = 0;
for(j = 0;; j++){
if(news_entry.content[j] == 0 || news_entry.content[j] == '\n'){
char* line = malloc(j - incr + 1);
line[j - incr] = 0;
memcpy(line, news_entry.content + incr, j - incr);
if(strlen(line) > 0){
char* msg = ok_strcat(temp, line);
ircfw_socket_send_cmd(ok_sock, NULL, msg);
free(msg);
usleep(1000 * 100); /* Sleep for 100ms */
}
free(line);
incr = j + 1;
if(news_entry.content[j] == 0) break;
}
free(line);
incr = j + 1;
if(news_entry.content[j] == 0) break;
}
free(temp);
}
free(temp);
}else{
fprintf(stderr, "Could not read %s\n", construct);
}