summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-29 21:19:59 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-29 21:19:59 +0100
commit94afbd330fc6c35f12326216ee21c5e87830eb8d (patch)
tree361df0b570d94de647066d600bb21d84c921d907
parent50f345b10e489c3099497c10f493663fee631683 (diff)
Warn the relevant client if the replay log can't be read.
-rw-r--r--blabouncer.c15
1 files 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;