-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
This commit is contained in:
Timo Sirainen 2000-12-09 19:12:49 +00:00 committed by cras
commit 8d98e80a6b
10 changed files with 41 additions and 12 deletions

View file

@ -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 {

View file

@ -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);

View file

@ -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;

View file

@ -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)

View file

@ -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);

View file

@ -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;

View file

@ -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 */