1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

Don't ever send more than 10 channels/line in mode/who requests. Though

usually the max. channels/server limit is 10 :)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@895 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-11-28 17:43:39 +00:00 committed by cras
parent fe7621875d
commit c67e6a1b8c

View File

@ -50,6 +50,8 @@ loop:
#include "irc-servers.h"
#include "servers-redirect.h"
#define MAX_QUERIES_IN_LINE 10
enum {
CHANNEL_QUERY_MODE,
CHANNEL_QUERY_WHO,
@ -164,7 +166,7 @@ static void channel_send_query(IRC_SERVER_REC *server, int query)
{
SERVER_QUERY_REC *rec;
IRC_CHANNEL_REC *chanrec;
GSList *tmp, *chans;
GSList *tmp, *chans, *newchans;
char *cmd, *chanstr_commas, *chanstr;
int onlyone;
@ -174,6 +176,7 @@ static void channel_send_query(IRC_SERVER_REC *server, int query)
onlyone = (server->no_multi_who && query == CHANNEL_QUERY_WHO) ||
(server->no_multi_mode && CHANNEL_IS_MODE_QUERY(query));
newchans = NULL;
if (onlyone) {
chanrec = rec->queries[query]->data;
chans = g_slist_append(NULL, chanrec);
@ -184,6 +187,14 @@ 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) {
GSList *lastchan;
lastchan = g_slist_nth(rec->queries[query], MAX_QUERIES_IN_LINE-1);
newchans = lastchan->next;
lastchan->next = NULL;
}
chanstr_commas = gslistptr_to_string(rec->queries[query], G_STRUCT_OFFSET(IRC_CHANNEL_REC, name), ",");
chanstr_spaces = gslistptr_to_string(rec->queries[query], G_STRUCT_OFFSET(IRC_CHANNEL_REC, name), " ");
@ -278,9 +289,11 @@ static void channel_send_query(IRC_SERVER_REC *server, int query)
rec->last_query = query;
if (!onlyone) {
/* all channels queried, set to NULL */
/* 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) */
g_slist_free(rec->queries[query]);
rec->queries[query] = NULL;
rec->queries[query] = newchans;
} else {
/* remove the first channel from list */
rec->queries[query] = g_slist_remove(rec->queries[query], chans->data);