From 886629c16b9a24099f0e9cce5a5c92b3c901685b Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 23 Dec 2019 11:05:25 +0000 Subject: Add BLABOUNCER VERSION command and change version string to have -git suffix between releases. --- README | 1 + TODO | 4 ++-- functions.h | 2 +- message.c | 10 ++++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README b/README index c688dae..38fb23c 100644 --- a/README +++ b/README @@ -48,6 +48,7 @@ Once connected to blabouncer with an IRC client, you can use the following speci "BLABOUNCER REHASH" (To reload settings from the configuration file, see above for details.) "BLABOUNCER CLIENTCODE [clientcode]" (To set an identifier for the current client for auto replaying just what this client has missed.) +"BLABOUNCER VERSION" (To show the current blabouncer version.) Blabouncer commands are all prefixed with BLABOUNCER which you can usually send using "/QUOTE BLABOUNCER". diff --git a/TODO b/TODO index d302400..6c64616 100644 --- a/TODO +++ b/TODO @@ -19,8 +19,8 @@ When blabouncer reconnects to a server, clients (at least XChat) get stuck with [13:17:20]* PONG LAG1574033040377501 In channels with no nicks. -Add BLABOUNCER VERSION. - 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? Can memory usage be reduced further? (e.g. better channel struct management) + +Ability to load new certificate whilst running. diff --git a/functions.h b/functions.h index 49417e8..643328f 100644 --- a/functions.h +++ b/functions.h @@ -55,7 +55,7 @@ #define MAXTOKENS 100 // For strsep string splitting -#define VERSION "0.2" // Blabouncer version +#define VERSION "0.2-git" // Blabouncer version // Write debug string to file. // Debug level is provided by level, set to one of DEBUG_CRIT, DEBUG_SOME or DEBUG_FULL. diff --git a/message.c b/message.c index e30a247..7d50f0a 100644 --- a/message.c +++ b/message.c @@ -966,6 +966,8 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER QUIT [quit message]\" (To quit blabouncer, optionally sending [quit message] to the server.)", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER VERSION\" (To show the current blabouncer version.)", ircdstate->ircnick); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); // Get the channel count so we can iterate over all channels. int channelcount = getchannelcount(channels, ircdstate->maxchannelcount); @@ -1425,6 +1427,12 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int } } + return 1; + // VERSION received, send current blabouncer version + } else if (strncasecmp(tokens[1], "VERSION", strlen("VERSION")) == 0) { + debugprint(DEBUG_SOME, "Client BLABOUNCER VERSION found and it is: %s with length %zd!\n", tokens[1], strlen(tokens[1])); + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :This is blabouncer version %s!", ircdstate->ircnick, VERSION); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); return 1; // Unrecognised BLABOUNCER command received (or a BLABOUNCER HELP command), send some help instructions } else { @@ -1442,6 +1450,8 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER QUIT [quit message]\" (To quit blabouncer, optionally sending [quit message] to the server.)", ircdstate->ircnick); sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); + snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :\"BLABOUNCER VERSION\" (To show the current blabouncer version.)", ircdstate->ircnick); + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); return 1; } } -- cgit v1.2.3