summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc')
-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
7 files changed, 27 insertions, 7 deletions
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 */