aboutsummaryrefslogtreecommitdiff
path: root/src/irc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc.h')
-rw-r--r--src/irc.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/irc.h b/src/irc.h
new file mode 100644
index 0000000..77510d1
--- /dev/null
+++ b/src/irc.h
@@ -0,0 +1,59 @@
+#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 channel[32];
+extern unsigned char rx_buf[MAX_IRC_MSG_LEN];
+extern unsigned short bw;
+extern unsigned char err;
+extern unsigned char trip;
+
+extern unsigned int txbuflen;
+extern char tx_buf[MAX_IRC_MSG_LEN];
+
+/* 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);
+
+/* 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);
+
+/**** ui.c */
+void ui_init(void);
+void ui_start_msg(void);
+void ui_end_msg(void);
+void ui_keystroke(void);
+void ui_print(const char *str);
+void ui_putchar(char c);
+
+/**** cmd.c */
+void cmd_command(const char *cmd);