From ff5b7166b8021e4562119852a9682cd09105601f Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 27 May 2019 10:29:43 +0100 Subject: Set ircdstrings.mode to null string when initialising and only send our MODE to new clients if irdstrings.mode was set. --- TODO | 4 ++++ blabouncer.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 245ddf1..54b889f 100644 --- a/TODO +++ b/TODO @@ -22,3 +22,7 @@ Test CTCP. Reconnect server if we get disconnected for some reason. Only do CAP multi-prefix negotiation with client if server approved it in the first place. + +Change default certfile and keyfile to be basedir/ instead of $HOME. + +Connecting to Miau has some sort of corruption and doesn't get channels. diff --git a/blabouncer.c b/blabouncer.c index 32ba454..8f2e975 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -1440,12 +1440,14 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli sendtoserver(server_ssl, namesreq, strlen(namesreq), 0, clients, settings); } - // Send our mode to the client - if (!snprintf(outgoingmsg, MAXDATASIZE, ":%s MODE %s %s", ircdstrings->ircnick, ircdstrings->ircnick, ircdstrings->mode)) { - fprintf(stderr, "Error while preparing USER just connected, MODE response!\n"); - exit(1); + // Send our mode to the client (if we have one) + if (strlen(ircdstrings->mode) > 0) { + if (!snprintf(outgoingmsg, MAXDATASIZE, ":%s MODE %s %s", ircdstrings->ircnick, ircdstrings->ircnick, ircdstrings->mode)) { + fprintf(stderr, "Error while preparing USER just connected, MODE response!\n"); + exit(1); + } + sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); } - sendtoclient(sourcefd, outgoingmsg, clients, settings, 0); // Set the client as registered clients[arrindex(clients, sourcefd)].registered = 1; @@ -1858,6 +1860,7 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { ircdstrings.ircnick[0] = '\0'; ircdstrings.ircusername[0] = '\0'; ircdstrings.currentmsg[0] = '\0'; + ircdstrings.mode[0] = '\0'; // Populate nick and username from our configuration file for now, real IRCd may change them later (TODO - Is this true of username?) strcpy(ircdstrings.ircnick, settings->ircnick); -- cgit v1.2.3