diff options
| author | Luke Bratch <luke@bratch.co.uk> | 2019-05-18 19:17:52 +0100 | 
|---|---|---|
| committer | Luke Bratch <luke@bratch.co.uk> | 2019-05-18 19:17:52 +0100 | 
| commit | c47b5a1531fe0e2a3b00c4a5ec80a4dc4cbe2428 (patch) | |
| tree | 5cd2b408abf6eb1a9275ae83ec7854e861c9969c | |
| parent | bff1674c746edc0b71b022a8d48f739d76b89641 (diff) | |
Tell clients to go away if we're not registered with the real server yet.
| -rw-r--r-- | blabouncer.c | 12 | 
1 files changed, 7 insertions, 5 deletions
diff --git a/blabouncer.c b/blabouncer.c index 287176b..0eb2519 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -1,6 +1,4 @@  // TODO: -// - FIGURE OUT WHEN WE'RE REGISTERED (NICK and USER from user are replied to with commands 001, 002, 003, and 004 from the ircd when registration successful) -// - int registered = 0; already created to track when this has happened (assuming still want to do it this way)  // - handle nick in use  // - Might need to change channel struct nicks to be channel struct user struct with its own nick/modes/etc.  // - Do we actually need to store the modes in the channel struct? @@ -996,6 +994,13 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli          // Somewhere to store the several strings we will need to build and send          char outgoingmsg[MAXDATASIZE]; // String to send to client +        // Tell the client to go away if we aren't registered with the real server yet as defined by the last greeting not being set yet +        if (!strlen(ircdstrings->greeting004)) { +          sendtoclient(sourcefd, "Sorry, we aren't registered with a real IRC server yet.", clients, settings); +          disconnectclient(sourcefd, clients, ircdstrings, settings); +          return 1; +        } +          // Send IRC greeting strings (001/RPL_WELCOME, 002/RPL_YOURHOST, 003/RPL_CREATED, 004/RPL_MYINFO) to client          snprintf(outgoingmsg, MAXDATASIZE, "%s", ircdstrings->greeting001);          sendtoclient(sourcefd, outgoingmsg, clients, settings); @@ -1474,9 +1479,6 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) {    // <=============================================    // Initialise IRC connecting/registration state -  // Registered with the IRCd yet? -//////////////  int registered = 0; -    // Struct of various strings from and for the real IRCd (such as the greeting strings, the real IRCd's name,    // our nick!user@host string, our nick, username, real name, etc.)    struct ircdstrings ircdstrings;  | 
