diff options
author | Timo Sirainen <cras@irssi.org> | 2000-12-09 19:12:49 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-12-09 19:12:49 +0000 |
commit | 8d98e80a6b914c6e1708b2ccc5cfd49e0ed43584 (patch) | |
tree | 8bc54aaef51243ef6669de37f4a2641a3f759cbc /src | |
parent | e6cc73bd4b8f34350c93eb45aa613de535a7b5ae (diff) | |
download | irssi-8d98e80a6b914c6e1708b2ccc5cfd49e0ed43584.zip |
-querychans option for servers and ircnets which specifies how many
channels to query in one line with MODE/WHO commands after joined to a
number of channels. Default is 10 which works usually, with some very
stupid servers (just found one) this has to be set to 1 however.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@981 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/fe-server.c | 2 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-server.c | 6 | ||||
-rw-r--r-- | src/fe-common/irc/fe-ircnet.c | 11 | ||||
-rw-r--r-- | src/irc/core/channels-query.c | 8 | ||||
-rw-r--r-- | src/irc/core/irc-chatnets.c | 3 | ||||
-rw-r--r-- | src/irc/core/irc-chatnets.h | 2 | ||||
-rw-r--r-- | src/irc/core/irc-servers-setup.c | 7 | ||||
-rw-r--r-- | src/irc/core/irc-servers-setup.h | 7 | ||||
-rw-r--r-- | src/irc/core/irc-servers.c | 3 | ||||
-rw-r--r-- | src/irc/core/irc-servers.h | 4 |
10 files changed, 41 insertions, 12 deletions
diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 72ac7b50..dff46c55 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -289,7 +289,7 @@ void fe_server_init(void) command_bind("server", NULL, (SIGNAL_FUNC) cmd_server); command_bind("server add", NULL, (SIGNAL_FUNC) cmd_server_add); command_bind("server remove", NULL, (SIGNAL_FUNC) cmd_server_remove); - command_set_options("server add", "auto noauto -host -cmdspeed -cmdmax -port"); + command_set_options("server add", "auto noauto -host -port"); signal_add("server looking", (SIGNAL_FUNC) sig_server_looking); signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting); diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index cef890ff..36452183 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -63,6 +63,8 @@ static void sig_server_add_fill(IRC_SERVER_SETUP_REC *rec, if (value != NULL && *value != '\0') rec->cmd_queue_speed = atoi(value); value = g_hash_table_lookup(optlist, "cmdmax"); if (value != NULL && *value != '\0') rec->max_cmds_at_once = atoi(value); + value = g_hash_table_lookup(optlist, "querychans"); + if (value != NULL && *value != '\0') rec->max_query_chans = atoi(value); } /* SYNTAX: SERVER LIST */ @@ -88,6 +90,8 @@ static void cmd_server_list(const char *data) g_string_sprintfa(str, "cmdmax: %d, ", rec->max_cmds_at_once); if (rec->cmd_queue_speed > 0) g_string_sprintfa(str, "cmdspeed: %d, ", rec->cmd_queue_speed); + if (rec->max_query_chans > 0) + g_string_sprintfa(str, "querychans: %d, ", rec->max_query_chans); if (rec->own_host != NULL) g_string_sprintfa(str, "host: %s, ", rec->own_host); @@ -107,7 +111,7 @@ void fe_irc_server_init(void) signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill); command_bind("server list", NULL, (SIGNAL_FUNC) cmd_server_list); - command_set_options("server add", "-ircnet"); + command_set_options("server add", "-ircnet -cmdspeed -cmdmax -querychans"); } void fe_irc_server_deinit(void) diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index 99dd7a69..cd7e5480 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -59,6 +59,8 @@ static void cmd_ircnet_list(void) g_string_sprintfa(str, "cmdspeed: %d, ", rec->cmd_queue_speed); if (rec->max_cmds_at_once > 0) g_string_sprintfa(str, "cmdmax: %d, ", rec->max_cmds_at_once); + if (rec->max_query_chans > 0) + g_string_sprintfa(str, "querychans: %d, ", rec->max_query_chans); if (rec->max_kicks > 0) g_string_sprintfa(str, "max_kicks: %d, ", rec->max_kicks); @@ -79,8 +81,9 @@ static void cmd_ircnet_list(void) /* SYNTAX: IRCNET ADD [-kicks <count>] [-msgs <count>] [-modes <count>] [-whois <count>] [-cmdspeed <ms>] [-cmdmax <count>] - [-nick <nick>] [-user <user>] [-realname <name>] - [-host <host>] [-autosendcmd <cmd>] <name> */ + [-querychans <count>] [-nick <nick>] [-user <user>] + [-realname <name>] [-host <host>] [-autosendcmd <cmd>] + <name> */ static void cmd_ircnet_add(const char *data) { GHashTable *optlist; @@ -121,6 +124,8 @@ static void cmd_ircnet_add(const char *data) if (value != NULL) rec->cmd_queue_speed = atoi(value); value = g_hash_table_lookup(optlist, "cmdmax"); if (value != NULL) rec->max_cmds_at_once = atoi(value); + value = g_hash_table_lookup(optlist, "querychans"); + if (value != NULL) rec->max_query_chans = atoi(value); value = g_hash_table_lookup(optlist, "nick"); if (value != NULL && *value != '\0') rec->nick = g_strdup(value); @@ -174,7 +179,7 @@ void fe_ircnet_init(void) command_bind("ircnet add", NULL, (SIGNAL_FUNC) cmd_ircnet_add); command_bind("ircnet remove", NULL, (SIGNAL_FUNC) cmd_ircnet_remove); - command_set_options("ircnet add", "-kicks -msgs -modes -whois -cmdspeed -cmdmax -nick -user -realname -host -autosendcmd"); + command_set_options("ircnet add", "-kicks -msgs -modes -whois -cmdspeed -cmdmax -nick -user -realname -host -autosendcmd -querychans"); } void fe_ircnet_deinit(void) diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index b338a0eb..10ab90f9 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -50,8 +50,6 @@ loop: #include "irc-servers.h" #include "servers-redirect.h" -#define MAX_QUERIES_IN_LINE 10 - enum { CHANNEL_QUERY_MODE, CHANNEL_QUERY_WHO, @@ -187,10 +185,10 @@ static void channel_send_query(IRC_SERVER_REC *server, int query) chans = rec->queries[query]; - if (g_slist_length(rec->queries[query]) > MAX_QUERIES_IN_LINE) { + if (g_slist_length(rec->queries[query]) > server->max_query_chans) { GSList *lastchan; - lastchan = g_slist_nth(rec->queries[query], MAX_QUERIES_IN_LINE-1); + lastchan = g_slist_nth(rec->queries[query], server->max_query_chans-1); newchans = lastchan->next; lastchan->next = NULL; } @@ -291,7 +289,7 @@ static void channel_send_query(IRC_SERVER_REC *server, int query) if (!onlyone) { /* all channels queried, set to newchans which contains the rest of the channels for the same query (usually NULL - unless query count exceeded MAX_QUERIES_IN_LINE) */ + unless query count exceeded max_query_chans) */ g_slist_free(rec->queries[query]); rec->queries[query] = newchans; } else { diff --git a/src/irc/core/irc-chatnets.c b/src/irc/core/irc-chatnets.c index f5bcaf0f..40c4cae1 100644 --- a/src/irc/core/irc-chatnets.c +++ b/src/irc/core/irc-chatnets.c @@ -40,6 +40,7 @@ static void ircnet_read(CONFIG_NODE *node) rec->max_cmds_at_once = config_node_get_int(node, "cmdmax", 0); rec->cmd_queue_speed = config_node_get_int(node, "cmdspeed", 0); + rec->max_query_chans = config_node_get_int(node, "max_query_chans", 0); rec->max_kicks = config_node_get_int(node, "max_kicks", 0); rec->max_msgs = config_node_get_int(node, "max_msgs", 0); @@ -62,6 +63,8 @@ static void ircnet_save(IRC_CHATNET_REC *rec) iconfig_node_set_int(node, "cmdmax", rec->max_cmds_at_once); if (rec->cmd_queue_speed > 0) iconfig_node_set_int(node, "cmdspeed", rec->cmd_queue_speed); + if (rec->max_query_chans > 0) + iconfig_node_set_int(node, "max_query_chans", rec->max_query_chans); if (rec->max_kicks > 0) iconfig_node_set_int(node, "max_kicks", rec->max_kicks); diff --git a/src/irc/core/irc-chatnets.h b/src/irc/core/irc-chatnets.h index 2890b33e..5404c0d2 100644 --- a/src/irc/core/irc-chatnets.h +++ b/src/irc/core/irc-chatnets.h @@ -18,6 +18,8 @@ typedef struct { #include "chatnet-rec.h" int max_cmds_at_once; int cmd_queue_speed; + int max_query_chans; /* when syncing, max. number of channels to + put in one MODE/WHO command */ /* max. number of kicks/msgs/mode/whois per command */ int max_kicks, max_msgs, max_modes, max_whois; diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index 3bd98d5c..4049eeda 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -41,6 +41,8 @@ static void sig_server_setup_fill_reconn(IRC_SERVER_CONNECT_REC *conn, conn->cmd_queue_speed = sserver->cmd_queue_speed; if (sserver->max_cmds_at_once > 0) conn->max_cmds_at_once = sserver->max_cmds_at_once; + if (sserver->max_query_chans > 0) + conn->max_query_chans = sserver->max_query_chans; } /* Create server connection record. `address' is required, rest can be NULL */ @@ -80,6 +82,8 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn, conn->max_cmds_at_once = ircnet->max_cmds_at_once; if (ircnet->cmd_queue_speed > 0) conn->cmd_queue_speed = ircnet->cmd_queue_speed; + if (ircnet->max_query_chans > 0) + conn->max_query_chans = ircnet->max_query_chans; } static void init_userinfo(void) @@ -154,6 +158,7 @@ static void sig_server_setup_read(SERVER_SETUP_REC **setuprec, rec->max_cmds_at_once = config_node_get_int(node, "cmds_max_at_once", 0); rec->cmd_queue_speed = config_node_get_int(node, "cmd_queue_speed", 0); + rec->max_query_chans = config_node_get_int(node, "max_query_chans", 0); *setuprec = (SERVER_SETUP_REC *) rec; signal_stop(); @@ -169,6 +174,8 @@ static void sig_server_setup_saved(IRC_SERVER_SETUP_REC *rec, iconfig_node_set_int(node, "cmds_max_at_once", rec->max_cmds_at_once); if (rec->cmd_queue_speed > 0) iconfig_node_set_int(node, "cmd_queue_speed", rec->cmd_queue_speed); + if (rec->max_query_chans > 0) + iconfig_node_set_int(node, "max_query_chans", rec->max_query_chans); } void irc_servers_setup_init(void) diff --git a/src/irc/core/irc-servers-setup.h b/src/irc/core/irc-servers-setup.h index 65739f79..92629c2b 100644 --- a/src/irc/core/irc-servers-setup.h +++ b/src/irc/core/irc-servers-setup.h @@ -13,8 +13,11 @@ typedef struct { #include "server-setup-rec.h" - int max_cmds_at_once; /* override the default if > 0 */ - int cmd_queue_speed; /* override the default if > 0 */ + + /* override the default if > 0 */ + int max_cmds_at_once; + int cmd_queue_speed; + int max_query_chans; } IRC_SERVER_SETUP_REC; void irc_servers_setup_init(void); diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index ef3b328a..126d2b42 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -48,6 +48,7 @@ #define DEFAULT_USER_MODE "+i" #define DEFAULT_CMD_QUEUE_SPEED 2200 #define DEFAULT_CMDS_MAX_AT_ONCE 5 +#define DEFAULT_MAX_QUERY_CHANS 10 void irc_servers_reconnect_init(void); void irc_servers_reconnect_deinit(void); @@ -155,6 +156,8 @@ IRC_SERVER_REC *irc_server_connect(IRC_SERVER_CONNECT_REC *conn) conn->cmd_queue_speed : settings_get_int("cmd_queue_speed"); server->max_cmds_at_once = conn->max_cmds_at_once > 0 ? conn->max_cmds_at_once : settings_get_int("cmds_max_at_once"); + server->max_query_chans = conn->max_query_chans > 0 ? + conn->max_query_chans : DEFAULT_MAX_QUERY_CHANS; server->max_kicks_in_cmd = conn->max_kicks > 0 ? conn->max_kicks : DEFAULT_MAX_KICKS; diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 598f5a6b..2bf620a6 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -27,6 +27,8 @@ typedef struct { int max_cmds_at_once; int cmd_queue_speed; + int max_query_chans; + int max_kicks, max_msgs, max_modes, max_whois; } IRC_SERVER_CONNECT_REC; @@ -66,6 +68,8 @@ typedef struct { int max_cmds_at_once; /* How many messages can be sent immediately before timeouting starts */ int cmd_queue_speed; /* Timeout between sending commands */ + int max_query_chans; /* when syncing, max. number of channels to + put in one MODE/WHO command */ GSList *idles; /* Idle queue - send these commands to server if there's nothing else to do */ |