Simplify show_acros() by sending each line immediately, rather than

buffering lines together.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@256 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-07-07 08:51:25 +00:00
parent 8a02a1946a
commit 5ab9f87936

View File

@@ -489,26 +489,10 @@ void show_acros(prec *players, char *chan)
{ {
prec *tmp; prec *tmp;
int i = 1; int i = 1;
char *line, buff[201];
if (!players) if (!players)
return; return;
line = (char *)new_malloc(513);
memset(buff, 0, sizeof(buff));
for (tmp = players; tmp; tmp = tmp->next) for (tmp = players; tmp; tmp = tmp->next)
{ send_to_server("PRIVMSG %s :%2d: %s", chan, i++, tmp->acro);
snprintf(buff, 198, "PRIVMSG %s :%2d: %s", chan, i++, tmp->acro);
strcat(buff, "\r\n");
if (strlen(line)+strlen(buff) >= 512)
{
send_to_server("%s", line);
memset(line, 0, 513);
}
strcat(line, buff);
memset(buff, 0, sizeof(buff));
}
if (line)
send_to_server("%s", line);
new_free(&line);
} }
void show_scores(grec *acro, srec *score, srec *gscore, char *chan) void show_scores(grec *acro, srec *score, srec *gscore, char *chan)