From 94afbd330fc6c35f12326216ee21c5e87830eb8d Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Wed, 29 May 2019 21:19:59 +0100 Subject: Warn the relevant client if the replay log can't be read. --- blabouncer.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/blabouncer.c b/blabouncer.c index b6dc015..851df7a 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -895,8 +895,11 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli // Finally do a replay for all clients and tell them we're reconnected for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i].fd) { - doreplay(clients[i].fd, settings->replayseconds, clients, settings, ircdstrings, channels); char alertmsg[MAXDATASIZE]; + if (!doreplay(clients[i].fd, settings->replayseconds, clients, settings, ircdstrings, channels)) { + snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file!", ircdstrings->ircnick); + sendtoclient(sourcefd, alertmsg, clients, settings, 0); + } snprintf(alertmsg, MAXDATASIZE, "NOTICE %s :Reconnection complete.", ircdstrings->ircnick); sendtoclient(clients[i].fd, alertmsg, clients, settings, 0); } @@ -1687,7 +1690,10 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli clients[arrindex(clients, sourcefd)].registered = 1; // Catch the client up with the default number of seconds of replay - doreplay(sourcefd, settings->replayseconds, clients, settings, ircdstrings, channels); + if (!doreplay(sourcefd, settings->replayseconds, clients, settings, ircdstrings, channels)) { + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file!", ircdstrings->ircnick); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); + } free(strcopyPtr); return 1; @@ -1964,7 +1970,10 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli debugprint("Replaying '%s' which is '%d' seconds.\n", tokens[2], replayseconds); - doreplay(sourcefd, replayseconds, clients, settings, ircdstrings, channels); + if (!doreplay(sourcefd, replayseconds, clients, settings, ircdstrings, channels)) { + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Unable to read replay log file!", ircdstrings->ircnick); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); + } free(timestrcopyPtr); free(strcopyPtr); return 1; -- cgit v1.2.3