diff options
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/blabouncer.c b/blabouncer.c index c4e92ed..9604ba3 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -596,6 +596,19 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { // We succeeded // Set reconnection marker for other functions to know we're reconnecting ircdstate.reconnecting = 1; + // Clear gotnames from each channel since we'll need to (re-)send RPL_NAMREPLYs to all clients after reconnecting + int channelcount = getchannelcount(channels, ircdstate.maxchannelcount); + for (int i = 0; i < ircdstate.maxchannelcount; i++) { + debugprint(DEBUG_FULL, "dochat(): timeout reconnecting: checking channel[%d] out of %d.\n", i, channelcount); + // Skip this one if it's a blank channel + if (!channels[i].name[0]) { + debugprint(DEBUG_FULL, "dochat(): timeout reconnecting: skipping blank channel channel[%d].\n", i); + continue; + } + + debugprint(DEBUG_FULL, "dochat(): timeout reconnecting: clearing gotnames in channel '%s'.\n", channels[i].name); + channels[i].gotnames = 0; + } // Set oldnick in case we change nick when reconnecting so we can inform existing clients strcpy(ircdstate.oldnick, ircdstate.ircnick); if (!connecttoircserver(&serverctx, &server_ssl, serversockfd, &ircdstate, settings, clients)) { @@ -659,6 +672,19 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { // We succeeded // Set reconnection marker for other functions to know we're reconnecting ircdstate.reconnecting = 1; + // Clear gotnames from each channel since we'll need to (re-)send RPL_NAMREPLYs to all clients after reconnecting + int channelcount = getchannelcount(channels, ircdstate.maxchannelcount); + for (int i = 0; i < ircdstate.maxchannelcount; i++) { + debugprint(DEBUG_FULL, "dochat(): socket error reconnecting: checking channel[%d] out of %d.\n", i, channelcount); + // Skip this one if it's a blank channel + if (!channels[i].name[0]) { + debugprint(DEBUG_FULL, "dochat(): socket error reconnecting: skipping blank channel channel[%d].\n", i); + continue; + } + + debugprint(DEBUG_FULL, "dochat(): socket error reconnecting: clearing gotnames in channel '%s'.\n", channels[i].name); + channels[i].gotnames = 0; + } // Set oldnick in case we change nick when reconnecting so we can inform existing clients strcpy(ircdstate.oldnick, ircdstate.ircnick); if (!connecttoircserver(&serverctx, &server_ssl, serversockfd, &ircdstate, settings, clients)) { |