mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
server->cmd_last_split wasn't used anymore, removed code related to it.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1024 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
1a536c204c
commit
46a427b410
@ -227,7 +227,7 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now)
|
|||||||
{
|
{
|
||||||
long usecs;
|
long usecs;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int len, add_rawlog;
|
int len;
|
||||||
|
|
||||||
if (!IS_IRC_SERVER(server))
|
if (!IS_IRC_SERVER(server))
|
||||||
return;
|
return;
|
||||||
@ -235,14 +235,12 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now)
|
|||||||
if (server->cmdcount == 0 && server->cmdqueue == NULL)
|
if (server->cmdcount == 0 && server->cmdqueue == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!server->cmd_last_split) {
|
|
||||||
if (g_timeval_cmp(now, &server->wait_cmd) == -1)
|
if (g_timeval_cmp(now, &server->wait_cmd) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
usecs = get_timeval_diff(now, &server->last_cmd);
|
usecs = get_timeval_diff(now, &server->last_cmd);
|
||||||
if (usecs < server->cmd_queue_speed)
|
if (usecs < server->cmd_queue_speed)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
server->cmdcount--;
|
server->cmdcount--;
|
||||||
if (server->cmdqueue == NULL) return;
|
if (server->cmdqueue == NULL) return;
|
||||||
@ -251,28 +249,19 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now)
|
|||||||
cmd = server->cmdqueue->data;
|
cmd = server->cmdqueue->data;
|
||||||
len = strlen(cmd);
|
len = strlen(cmd);
|
||||||
|
|
||||||
add_rawlog = !server->cmd_last_split;
|
|
||||||
|
|
||||||
if (net_sendbuffer_send(server->handle, cmd, len) == -1) {
|
if (net_sendbuffer_send(server->handle, cmd, len) == -1) {
|
||||||
/* something bad happened */
|
/* something bad happened */
|
||||||
g_warning("net_sendbuffer_send() failed: %s", g_strerror(errno));
|
g_warning("net_sendbuffer_send() failed: %s",
|
||||||
|
g_strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
server->wait_cmd.tv_sec = 0;
|
server->wait_cmd.tv_sec = 0;
|
||||||
memcpy(&server->last_cmd, now, sizeof(GTimeVal));
|
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 */
|
/* add to rawlog without CR+LF */
|
||||||
int slen;
|
cmd[len-2] = '\0';
|
||||||
|
|
||||||
slen = strlen(cmd);
|
|
||||||
cmd[slen-2] = '\0';
|
|
||||||
rawlog_output(server->rawlog, cmd);
|
rawlog_output(server->rawlog, cmd);
|
||||||
cmd[slen-2] = '\r';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove from queue */
|
/* remove from queue */
|
||||||
g_free(cmd);
|
g_free(cmd);
|
||||||
|
@ -60,8 +60,6 @@ typedef struct {
|
|||||||
there actually is, to make flood control remember
|
there actually is, to make flood control remember
|
||||||
how many messages can be sent before starting the
|
how many messages can be sent before starting the
|
||||||
flood control */
|
flood control */
|
||||||
int cmd_last_split; /* Last command wasn't sent entirely to server.
|
|
||||||
First item in `cmdqueue' should be re-sent. */
|
|
||||||
GSList *cmdqueue;
|
GSList *cmdqueue;
|
||||||
GTimeVal wait_cmd; /* don't send anything to server before this */
|
GTimeVal wait_cmd; /* don't send anything to server before this */
|
||||||
GTimeVal last_cmd; /* last time command was sent to server */
|
GTimeVal last_cmd; /* last time command was sent to server */
|
||||||
|
@ -89,10 +89,9 @@ void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd)
|
|||||||
if (server == NULL) return;
|
if (server == NULL) return;
|
||||||
|
|
||||||
g_get_current_time(&now);
|
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->cmdcount < server->max_cmds_at_once ||
|
||||||
server->cmd_queue_speed <= 0) &&
|
server->cmd_queue_speed <= 0);
|
||||||
g_timeval_cmp(&now, &server->wait_cmd) >= 0;
|
|
||||||
|
|
||||||
cmd_send(server, cmd, send_now, FALSE);
|
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);
|
g_return_if_fail(cmd != NULL);
|
||||||
if (server == NULL) return;
|
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)
|
static char *split_nicks(const char *cmd, char **pre, char **nicks, char **post, int arg)
|
||||||
|
Loading…
Reference in New Issue
Block a user