aboutsummaryrefslogtreecommitdiff
path: root/src/irc.h
blob: 4e28899f00c93529991896a778e555e337c6850a (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#define FNET_TRANSLATION 3
#define MAX_IRC_MSG_LEN 512

#define streq(x,y) !strcmp(x,y)
#define streq_i(x,y) !strcasecmp(x,y)

/**** main.c */
extern char url[256];
extern char usernick[32];
extern char *rx_buf;
extern unsigned short rxbuflen;
extern unsigned char err;
extern unsigned char trip;

extern unsigned int txbuflen;
extern char *tx_buf;

/* clears the transmit buffer. */
void txbuf_init(void);

/* appends a string to the transmit buffer, updates txbuflen. */
void txbuf_append_str(const char *str);

/* clears the transmit buffer, then appends a string to it. */
void txbuf_set_str(const char *str);

/* as txbuf_set_str2(), but multiple strings. */
void txbuf_set_str2(const char *s1, const char *s2);
void txbuf_set_str3(const char *s1, const char *s2, const char *s3);

/* sends whatever's in the transmit buffer, then clears it. if nothing was
   in the buffer, nothing gets sent. */
void txbuf_send(void);

/* sends a string. clears transmit buffer first, then clears it again on exit. */
void txbuf_send_str(const char *str);

void print_error(unsigned char err);

/**** irc.c */
#define MAX_MSG_ARGS 8
extern char *msg_src, *msg_cmd, *msg_dest, *msg_text;
extern char *msg_args[MAX_MSG_ARGS];
extern int msg_argcount;

/* call this once, right after TCP connection is established. */
void irc_register(void);

/* does all the work. doesn't return until we get disconnected from
   the IRC server (via /quit or error). */
void irc_loop(void);

void print_errnum(void);

/**** cmd.c */
void cmd_command(const char *cmd);
void cmd_execute(void);