1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

-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
parent e6cc73bd4b
commit 8d98e80a6b
10 changed files with 41 additions and 12 deletions

View File

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

View File

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

View File

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

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