summaryrefslogtreecommitdiff
path: root/message.h
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-06-10 21:17:10 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-06-10 21:17:10 +0100
commitc84d8c493ccdc840a866a9f51f10fe6b1f2bc377 (patch)
treeb064e1f554b19378beb0909c78061001b331eb3a /message.h
parent853efa64ff8ad6ebde47d1265f8b13e954a0d2f0 (diff)
Refactoring - split giant processircmessage() switch statement into separate server and client functions in message.h/message.c.
Diffstat (limited to 'message.h')
-rw-r--r--message.h37
1 files changed, 37 insertions, 0 deletions
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 <luke@bratch.co.uk>.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+*/
+
+#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