diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-05-27 14:09:58 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-05-27 14:09:58 +0100 |
commit | 90fcfc730331e66c2927ecc61bc36be0e51c8eff (patch) | |
tree | 7c0fec5ad1de47f23263c33dfd637b5074d279a8 /blabouncer.c | |
parent | f45ca7022725d7f68aa68555e081f55d8f02db00 (diff) |
Handle CTCP VERSION requests and responses.
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/blabouncer.c b/blabouncer.c index 886d8b8..07bee1a 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -1543,6 +1543,13 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli // Send original request straight to server sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings); + // If it seems to be a CTCP VERSION request, just send to the server (CTCP requests are delimited with \1) + if (counter == 3 && strncmp(tokens[2], ":\1VERSION\1", strlen(tokens[2])) == 0) { + printf("Client PRIVMSG looked like a CTCP VERSION request, so not sending to other clients.\n"); + free(strcopyPtr); + return 1; + } + // Rebuild to full PRIVMSG string and relay to all other clients char outgoingmsg[MAXDATASIZE]; // String to send to client @@ -1660,6 +1667,19 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli return 1; } + // Client NOTICE received + if (strncasecmp(tokens[0], "NOTICE", strlen(tokens[0])) == 0) { + // If it's a CTCP VERSION response then only send to the server (CTCP requests are delimited with \1) + if (counter >= 3 && strncmp(tokens[2], ":\1VERSION", strlen(tokens[2])) == 0) { + printf("Client NOTICE looked like a CTCP VERSION response, so just sending to the server.\n"); + sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings); + free(strcopyPtr); + return 1; + } + + // If it wasn't a CTCP VERSION response, then let this fall through to the default unhandled action by not returning here + } + // Custom BLABOUNCER command received // Case insensitive comparisons here since clients won't be recognising and uppercasing these commands if (strncasecmp(tokens[0], "BLABOUNCER", strlen(tokens[0])) == 0) { |