aboutsummaryrefslogtreecommitdiff
path: root/irc.h
blob: 870508fe3409f42cf9de72dab6ec0c9ae008ab5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#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

// fd of the irc connection socket
extern int g_ircsock;

// list of channels to join
extern char *g_chanlist[];
// length of the above
extern const int g_nchannels;


// 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