fix
git-svn-id: file:///raid/svn-personal/okuu/trunk@8 7d206d2a-66c2-044b-96de-ba755a9b3ba8
This commit is contained in:
parent
812c58d2c1
commit
1cdc7a9100
46
Bot/bot.c
46
Bot/bot.c
|
@ -143,31 +143,33 @@ void ok_bot(void){
|
||||||
}
|
}
|
||||||
if(count <= atoi(list[i]->d_name)){
|
if(count <= atoi(list[i]->d_name)){
|
||||||
sprintf(construct, "%s/%s", nntppath, 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){
|
if(ok_news_read(construct) == 0){
|
||||||
char* tmp = ok_strcat3("PRIVMSG ", ircchan, " :\x03" "07[USENET] ~ ");
|
if(strcmp(news_entry.from, nntpfrom) != 0){
|
||||||
char* temp = ok_strcat3(tmp, news_entry.from, "\x03 ");
|
char* tmp = ok_strcat3("PRIVMSG ", ircchan, " :\x03" "07[USENET] ~ ");
|
||||||
free(tmp);
|
char* temp = ok_strcat3(tmp, news_entry.from, "\x03 ");
|
||||||
int j;
|
free(tmp);
|
||||||
int incr = 0;
|
int j;
|
||||||
for(j = 0;; j++){
|
int incr = 0;
|
||||||
if(news_entry.content[j] == 0 || news_entry.content[j] == '\n'){
|
for(j = 0;; j++){
|
||||||
char* line = malloc(j - incr + 1);
|
if(news_entry.content[j] == 0 || news_entry.content[j] == '\n'){
|
||||||
line[j - incr] = 0;
|
char* line = malloc(j - incr + 1);
|
||||||
memcpy(line, news_entry.content + incr, j - incr);
|
line[j - incr] = 0;
|
||||||
|
memcpy(line, news_entry.content + incr, j - incr);
|
||||||
if(strlen(line) > 0){
|
|
||||||
char* msg = ok_strcat(temp, line);
|
if(strlen(line) > 0){
|
||||||
ircfw_socket_send_cmd(ok_sock, NULL, msg);
|
char* msg = ok_strcat(temp, line);
|
||||||
free(msg);
|
ircfw_socket_send_cmd(ok_sock, NULL, msg);
|
||||||
usleep(1000 * 100); /* Sleep for 100ms */
|
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{
|
}else{
|
||||||
fprintf(stderr, "Could not read %s\n", construct);
|
fprintf(stderr, "Could not read %s\n", construct);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user