diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 126d2b42..0bd19e4b 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -227,7 +227,7 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now) { long usecs; char *cmd; - int len, add_rawlog; + int len; if (!IS_IRC_SERVER(server)) return; @@ -235,14 +235,12 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now) if (server->cmdcount == 0 && server->cmdqueue == NULL) return; - if (!server->cmd_last_split) { - if (g_timeval_cmp(now, &server->wait_cmd) == -1) - return; + if (g_timeval_cmp(now, &server->wait_cmd) == -1) + return; - usecs = get_timeval_diff(now, &server->last_cmd); - if (usecs < server->cmd_queue_speed) - return; - } + usecs = get_timeval_diff(now, &server->last_cmd); + if (usecs < server->cmd_queue_speed) + return; server->cmdcount--; if (server->cmdqueue == NULL) return; @@ -251,28 +249,19 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now) cmd = server->cmdqueue->data; len = strlen(cmd); - add_rawlog = !server->cmd_last_split; - if (net_sendbuffer_send(server->handle, cmd, len) == -1) { /* something bad happened */ - g_warning("net_sendbuffer_send() failed: %s", g_strerror(errno)); + g_warning("net_sendbuffer_send() failed: %s", + g_strerror(errno)); return; } server->wait_cmd.tv_sec = 0; memcpy(&server->last_cmd, now, sizeof(GTimeVal)); - if (server->cmd_last_split) - server->cmd_last_split = FALSE; - if (add_rawlog) { - /* add to rawlog without CR+LF */ - int slen; - - slen = strlen(cmd); - cmd[slen-2] = '\0'; - rawlog_output(server->rawlog, cmd); - cmd[slen-2] = '\r'; - } + /* add to rawlog without CR+LF */ + cmd[len-2] = '\0'; + rawlog_output(server->rawlog, cmd); /* remove from queue */ g_free(cmd); diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 2bf620a6..7dab4972 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -60,8 +60,6 @@ typedef struct { there actually is, to make flood control remember how many messages can be sent before starting the flood control */ - int cmd_last_split; /* Last command wasn't sent entirely to server. - First item in `cmdqueue' should be re-sent. */ GSList *cmdqueue; GTimeVal wait_cmd; /* don't send anything to server before this */ GTimeVal last_cmd; /* last time command was sent to server */ diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index b1bcd0bf..24a2c757 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -89,10 +89,9 @@ void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd) if (server == NULL) return; g_get_current_time(&now); - send_now = !server->cmd_last_split && + send_now = g_timeval_cmp(&now, &server->wait_cmd) >= 0 && (server->cmdcount < server->max_cmds_at_once || - server->cmd_queue_speed <= 0) && - g_timeval_cmp(&now, &server->wait_cmd) >= 0; + server->cmd_queue_speed <= 0); cmd_send(server, cmd, send_now, FALSE); } @@ -119,7 +118,7 @@ void irc_send_cmd_now(IRC_SERVER_REC *server, const char *cmd) g_return_if_fail(cmd != NULL); if (server == NULL) return; - cmd_send(server, cmd, !server->cmd_last_split, TRUE); + cmd_send(server, cmd, TRUE, TRUE); } static char *split_nicks(const char *cmd, char **pre, char **nicks, char **post, int arg)