From c84d8c493ccdc840a866a9f51f10fe6b1f2bc377 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 10 Jun 2019 21:17:10 +0100 Subject: Refactoring - split giant processircmessage() switch statement into separate server and client functions in message.h/message.c. --- message.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 message.h (limited to 'message.h') diff --git a/message.h b/message.h new file mode 100644 index 0000000..349a764 --- /dev/null +++ b/message.h @@ -0,0 +1,37 @@ +/* + * This file is part of blabouncer (https://www.blatech.co.uk/l_bratch/blabouncer). + * Copyright (C) 2019 Luke Bratch . + * + * Blabouncer is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * Blabouncer is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with blabouncer. If not, see . +*/ + +#ifndef MESSAGE_H_INCLUDED +#define MESSAGE_H_INCLUDED + +#include "functions.h" +#include "config.h" +#include "logging.h" + +#define MAXTOKENS 100 // maximum number of (CRLF or space) separated tokens per server response we expect (TODO - check this is reasonable) (CRLF and spaces just grouped here due to laziness) + +// Process an IRC message that came from the real server. +// Return 1 if we processed it, or 0 if we didn't. +int processservermessage(SSL *server_ssl, char *str, struct client *clients, int sourcefd, struct ircdstrings *ircdstrings, + struct channel *channels, struct settings *settings, char tokens[MAXTOKENS][MAXDATASIZE], int counter); + +// Process an IRC message that came from a client. +// Return 1 if we processed it, or 0 if we didn't. +int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int sourcefd, struct ircdstrings *ircdstrings, + struct channel *channels, struct settings *settings, char tokens[MAXTOKENS][MAXDATASIZE], int counter); + +#endif -- cgit v1.2.3