aboutsummaryrefslogtreecommitdiff
path: root/irc.h
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-10-28 00:48:14 +0100
committerubq323 <ubq323@ubq323.website>2022-10-28 00:49:31 +0100
commit7a17c3a4ea869a04041ff2568fd02ec676ab8dff (patch)
treea2ff40bfcae165d294344adcb941d03b535b7f90 /irc.h
parent705db03ebffa24b993f72ca2694ba0982fa80bde (diff)
large refactor continues
Diffstat (limited to 'irc.h')
-rw-r--r--irc.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/irc.h b/irc.h
new file mode 100644
index 0000000..a56379d
--- /dev/null
+++ b/irc.h
@@ -0,0 +1,29 @@
+#ifndef irc_h_INCLUDED
+#define irc_h_INCLUDED
+
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netdb.h>
+
+#define IRC_RECVBUF_SIZE 1024
+
+extern int g_ircsock;
+
+// connects to the irc server, as defined in config.h
+// returns -1 on failure.
+int irc_connect();
+
+int irc_handshake();
+
+// reads from irc socket into its buffer.
+// if a full message / many full messages are available, handles them all.
+int irc_recv();
+
+// sends a string to the irc socket. returns -1 on failure.
+int irc_sendall(char msg[], size_t len);
+
+#endif // irc_h_INCLUDED
+