mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05: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:
parent
fe7621875d
commit
c67e6a1b8c
@ -50,6 +50,8 @@ loop:
|
|||||||
#include "irc-servers.h"
|
#include "irc-servers.h"
|
||||||
#include "servers-redirect.h"
|
#include "servers-redirect.h"
|
||||||
|
|
||||||
|
#define MAX_QUERIES_IN_LINE 10
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CHANNEL_QUERY_MODE,
|
CHANNEL_QUERY_MODE,
|
||||||
CHANNEL_QUERY_WHO,
|
CHANNEL_QUERY_WHO,
|
||||||
@ -164,7 +166,7 @@ static void channel_send_query(IRC_SERVER_REC *server, int query)
|
|||||||
{
|
{
|
||||||
SERVER_QUERY_REC *rec;
|
SERVER_QUERY_REC *rec;
|
||||||
IRC_CHANNEL_REC *chanrec;
|
IRC_CHANNEL_REC *chanrec;
|
||||||
GSList *tmp, *chans;
|
GSList *tmp, *chans, *newchans;
|
||||||
char *cmd, *chanstr_commas, *chanstr;
|
char *cmd, *chanstr_commas, *chanstr;
|
||||||
int onlyone;
|
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) ||
|
onlyone = (server->no_multi_who && query == CHANNEL_QUERY_WHO) ||
|
||||||
(server->no_multi_mode && CHANNEL_IS_MODE_QUERY(query));
|
(server->no_multi_mode && CHANNEL_IS_MODE_QUERY(query));
|
||||||
|
|
||||||
|
newchans = NULL;
|
||||||
if (onlyone) {
|
if (onlyone) {
|
||||||
chanrec = rec->queries[query]->data;
|
chanrec = rec->queries[query]->data;
|
||||||
chans = g_slist_append(NULL, chanrec);
|
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];
|
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_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), " ");
|
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;
|
rec->last_query = query;
|
||||||
|
|
||||||
if (!onlyone) {
|
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]);
|
g_slist_free(rec->queries[query]);
|
||||||
rec->queries[query] = NULL;
|
rec->queries[query] = newchans;
|
||||||
} else {
|
} else {
|
||||||
/* remove the first channel from list */
|
/* remove the first channel from list */
|
||||||
rec->queries[query] = g_slist_remove(rec->queries[query], chans->data);
|
rec->queries[query] = g_slist_remove(rec->queries[query], chans->data);
|
||||||
|
Loading…
Reference in New Issue
Block a user