summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fe-common/core/fe-server.c2
-rw-r--r--src/fe-common/irc/fe-irc-server.c6
-rw-r--r--src/fe-common/irc/fe-ircnet.c11
-rw-r--r--src/irc/core/channels-query.c8
-rw-r--r--src/irc/core/irc-chatnets.c3
-rw-r--r--src/irc/core/irc-chatnets.h2
-rw-r--r--src/irc/core/irc-servers-setup.c7
-rw-r--r--src/irc/core/irc-servers-setup.h7
-rw-r--r--src/irc/core/irc-servers.c3
-rw-r--r--src/irc/core/irc-servers.h4
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 */