diff --git a/Changelog b/Changelog index 62ffea0..f4a407d 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,9 @@ [Changes 1.2c01] +* Don't set the mode on new channels until synched - this speeds up joining + lots of channels at connect time if one of them is new, and reduces the + chance of being flooded off the server. (caf) + * Correctly handle channel sync across multi-server. (caf) * Fixes and improvements for channel logging. (caf) diff --git a/include/names.h b/include/names.h index 61196f1..7307478 100644 --- a/include/names.h +++ b/include/names.h @@ -20,11 +20,13 @@ #define CHAN_NOUNLINK 1 #define CHAN_UNLINK 2 +/* for got_mode */ #define GOTNAMES 0x01 #define GOTMODE 0x02 #define GOTBANS 0x04 #define GOTWHO 0x08 #define GOTEXEMPT 0x10 +#define GOTNEW 0x20 /* Indicates newly-created channel */ /* Channel mode flags */ #define MODE_ANONYMOUS (1U << 0) /* av2.9 */ diff --git a/source/funny.c b/source/funny.c index 0ced795..4d6648e 100644 --- a/source/funny.c +++ b/source/funny.c @@ -320,13 +320,9 @@ int user_count = 0; print_funny_names(line); } if ((user_count == 1) && (*line == '@')) - { - ChannelList *chan; - if ((chan = lookup_channel(channel, from_server, CHAN_NOUNLINK))) - if ((ptr = get_cset_str_var(chan->csets, CHANMODE_CSET))) - my_send_to_server(from_server, "MODE %s %s", channel, ptr); - } - got_info(channel, from_server, GOTNAMES); + got_info(channel, from_server, GOTNAMES | GOTNEW); + else + got_info(channel, from_server, GOTNAMES); reset_display_target(); return; } diff --git a/source/names.c b/source/names.c index f3f3bc2..6b7309f 100644 --- a/source/names.c +++ b/source/names.c @@ -1845,21 +1845,33 @@ int in_join_list(char *chan, int server) return 0; } -void channel_sync(struct joinlist *tmp, char *chan) +void channel_sync(struct joinlist *tmp, char *channel) { -struct timeval tv; + struct timeval tv; + + if (tmp->gotinfo & GOTNEW) + { + /* A channel that we just created. */ + ChannelList *chan; + char *chanmode; + + if ((chan = lookup_channel(channel, tmp->server, CHAN_NOUNLINK))) + if ((chanmode = get_cset_str_var(chan->csets, CHANMODE_CSET))) + my_send_to_server(tmp->server, "MODE %s :%s", channel, chanmode); + } + get_time(&tv); - set_display_target(chan, LOG_CRAP); - if (do_hook(CHANNEL_SYNCH_LIST, "%s %1.3f", chan, BX_time_diff(tmp->tv,tv))) - bitchsay("Join to %s was synched in %1.3f secs!!", chan, BX_time_diff(tmp->tv,tv)); + set_display_target(channel, LOG_CRAP); + if (do_hook(CHANNEL_SYNCH_LIST, "%s %1.3f", channel, BX_time_diff(tmp->tv,tv))) + bitchsay("Join to %s was synched in %1.3f secs!!", channel, BX_time_diff(tmp->tv,tv)); #ifdef WANT_USERLIST - delay_check_auto(chan); + delay_check_auto(channel); #endif update_all_status(current_window, NULL, 0); reset_display_target(); xterm_settitle(); #ifdef GUI - gui_update_nicklist(chan); + gui_update_nicklist(channel); #endif } @@ -1872,14 +1884,15 @@ int got_info(char *chan, int server, int type) for (tmp = join_list; tmp; tmp = tmp->next) if (!my_stricmp(tmp->chan, chan) && tmp->server == server) { - int what_info = (GOTNAMES | GOTMODE | GOTBANS | GOTWHO); - int ver; + int required = (GOTNAMES | GOTMODE | GOTBANS | GOTWHO); + int ver = get_server_version(server); - ver = get_server_version(server); if ((ver == Server2_8ts4) || (ver == Server2_10)) - what_info |= GOTEXEMPT; + required |= GOTEXEMPT; - if ((tmp->gotinfo |= type) == what_info) + tmp->gotinfo |= type; + + if ((tmp->gotinfo & required) == required) { channel_sync(tmp, chan); remove_from_join_list(chan, tmp->server);