summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2020-10-21 21:35:23 +0100
committerLuke Bratch <luke@bratch.co.uk>2020-10-21 21:35:23 +0100
commit5dd40bf9003063fd54071948654bc5a5640de282 (patch)
tree83733e58fef9cd0433bff4b1f503254790e32e87
parent82ab48d41bfef30ab51b407b48dfcda9ebc5f7e7 (diff)
Mark each channel as not having received nick names yet so existing clients get channel nicks after server reconnections.
-rw-r--r--TODO10
-rw-r--r--blabouncer.c26
2 files changed, 35 insertions, 1 deletions
diff --git a/TODO b/TODO
index 8d8d80c..02cbdf0 100644
--- a/TODO
+++ b/TODO
@@ -2,6 +2,8 @@ All the TODOs sprinkled throughout the code!
Configurable rotation of replay and debug logs.
+Configurable timestamp format in logs.
+
Add a make install/uninstall/etc., add an "INSTALL" file, include a dependency listing.
macOS compiler may need limits.h included in structures.h.
@@ -17,7 +19,7 @@ When blabouncer reconnects to a server, clients (at least XChat) get stuck with
[13:16:20]* PONG LAG1574032980263198
[13:16:50]* PONG LAG1574033010319500
[13:17:20]* PONG LAG1574033040377501
-In channels with no nicks.
+In channels with no nicks (no nicks bit may now be fixed - retest).
Sometimes replaymode = "lastspoke" will replay the last message you sent if you spoke last and sometimes it doesn't - change to always include your last message?
@@ -26,3 +28,9 @@ Can memory usage be reduced further? (e.g. better channel struct management)
Ability to load new certificate whilst running.
arrindex() shouldn't return 0 on failure as 0 is a valid index. Instead return -1 and change callers to check this.
+
+Make the "channels" configuration file entry an array.
+
+Crash when requesting 30 hour replay.
+
+Existing clients' own nicks are not updated if we decided the server timed out and reconnected before the server decided we were gone.
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)) {