Skip to content
This repository
Newer
Older
100644 99 lines (81 sloc) 2.687 kb
29252b6b »
2010-08-15 More refactoring; chopping up quirc.c. '#pragma once'-ing headers
1 #pragma once
2
9f0cff13 »
2010-07-26 Initial commit.
3 /*
3fcb0808 »
2011-01-06 Enable many warnings & fix them
4 quIRC - simple terminal-based IRC client
3c980094 »
2011-04-06 Nudge the (C)opyright message to '2010-11'
5 Copyright (C) 2010-11 Edward Cree
3fcb0808 »
2011-01-06 Enable many warnings & fix them
6
9f0cff13 »
2010-07-26 Initial commit.
7 See quirc.c for license information
8 irc: networking functions
9 */
10
b7319a8d »
2012-01-11 Asynch name lookups
11 #define _GNU_SOURCE // feature test macro
12
9f0cff13 »
2010-07-26 Initial commit.
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <stdbool.h>
16 #include <string.h>
17 #include <unistd.h>
8844d523 »
2010-09-01 Fix various compile errors in prev. commit
18 #include <fcntl.h>
556a5210 »
2010-09-03 Functions for irc-style casemapping
19 #include <ctype.h>
9f0cff13 »
2010-07-26 Initial commit.
20 #include <sys/socket.h>
21 #include <sys/utsname.h>
22 #include <netdb.h>
23 #include <arpa/inet.h>
24 #include <netinet/in.h>
5bd9397a »
2010-09-01 Asynchronous connect(), fixes, and liveness (unfinished)
25 #include <errno.h>
417d27e3 »
2010-09-17 Handle SIGPIPE
26 #include <signal.h>
29252b6b »
2010-08-15 More refactoring; chopping up quirc.c. '#pragma once'-ing headers
27
bdca1e0e »
2010-09-03 More correct casemapping handling (doesn't yet detect from RPL_ISUPPORT)
28 typedef enum
29 {
30 RFC1459,
31 STRICT_RFC1459,
32 ASCII
33 }
34 cmap;
35
61b26588 »
2010-09-15 irc_breakdown() function, parses :prefix cmd args...
36 typedef struct
37 {
38 char *prefix;
39 char *cmd;
40 int nargs;
41 char *args[15]; // RFC specifies maximum of 15 args
42 }
43 message;
44
a9c16e9e »
2010-07-27 Things generally are now buffer-aware
45 #include "bits.h"
29252b6b »
2010-08-15 More refactoring; chopping up quirc.c. '#pragma once'-ing headers
46 #include "buffer.h"
47 #include "colour.h"
48 #include "config.h"
83af8c16 »
2010-08-15 Move handling of numeric responses out to irc.c
49 #include "numeric.h"
bdca1e0e »
2010-09-03 More correct casemapping handling (doesn't yet detect from RPL_ISUPPORT)
50 #include "names.h"
b7319a8d »
2012-01-11 Asynch name lookups
51 #include "osconf.h"
9f0cff13 »
2010-07-26 Initial commit.
52
bfdcd847 »
2010-08-21 Handle Low-Level Quoting
53 #define MQUOTE '\020'
54
b7319a8d »
2012-01-11 Asynch name lookups
55 volatile sig_atomic_t sigpipe, sigwinch, sigusr1;
417d27e3 »
2010-09-17 Handle SIGPIPE
56
b7319a8d »
2012-01-11 Asynch name lookups
57 void handle_signals(int); // handles sigpipe, sigwinch and sigusr1
417d27e3 »
2010-09-17 Handle SIGPIPE
58
5bd9397a »
2010-09-01 Asynchronous connect(), fixes, and liveness (unfinished)
59 int irc_connect(char *server, char *portno, fd_set *master, int *fdmax); // non-blocking
b7319a8d »
2012-01-11 Asynch name lookups
60 #if ASYNCH_NL
61 struct gaicb *nl_details;
62 int irc_conn_found(fd_set *master, int *fdmax); // non-blocking; call this when the getaddrinfo_a() has finished
63 #endif
b5829d68 »
2011-10-23 PASS (--pass) and related stuff, also call termsize() at startup
64 int irc_conn_rest(int b, char *nick, char *username, char *passwd, char *fullname); // call this when the non-blocking connect() has finished
e5159896 »
2010-09-03 Allow multiple automatic connects and joins in .quirc
65 int autoconnect(fd_set *master, int *fdmax, servlist *serv);
9f0cff13 »
2010-07-26 Initial commit.
66 int irc_tx(int fd, char * packet);
67 int irc_rx(int fd, char ** data);
61b26588 »
2010-09-15 irc_breakdown() function, parses :prefix cmd args...
68
69 message irc_breakdown(char *packet);
7c3fe55a »
2010-09-15 More work on parsing and protocol correctness etc.
70 void message_free(message pkt);
9add4567 »
2010-09-15 Improve PREFIX handling (RPL_ISUPPORT) and :prefix handling
71 void prefix_split(char * prefix, char **src, char **user, char **host);
72
bfdcd847 »
2010-08-21 Handle Low-Level Quoting
73 void low_quote(char *from, char to[512]);
74 char * low_dequote(char *buf);
e928ecfe »
2010-08-16 Refactor PING, MODE and KILL handling
75
bdca1e0e »
2010-09-03 More correct casemapping handling (doesn't yet detect from RPL_ISUPPORT)
76 char irc_to_upper(char c, cmap casemapping);
77 char irc_to_lower(char c, cmap casemapping);
f0484966 »
2011-07-05 Some const-correctness
78 int irc_strcasecmp(const char *c1, const char *c2, cmap casemapping);
79 int irc_strncasecmp(const char *c1, const char *c2, int n, cmap casemapping);
556a5210 »
2010-09-03 Functions for irc-style casemapping
80
d88f2427 »
2011-07-05 //text sends message /text (then /// sends //, etc.)
81 // Send an IRC PRIVMSG (ie. ordinary talking)
82 int talk(char *iinput);
83
6fee7244 »
2010-09-15 Some work on the new RX parsing
84 // Received-IRC message handlers
85 int irc_numeric(message pkt, int b);
8acd80f9 »
2010-09-15 More work on the new parsing code
86 int rx_ping(message pkt, int b);
cdd4d11c »
2011-12-24 Implemented MODEs, except that nick-prefixes are never displayed
87 int rx_mode(message pkt, int b); // the first MODE triggers auto-join
8acd80f9 »
2010-09-15 More work on the new parsing code
88 int rx_kill(message pkt, int b, fd_set *master);
89 int rx_kick(message pkt, int b);
90 int rx_error(message pkt, int b, fd_set *master);
bf8886ff »
2010-09-15 Much more parsing work
91 int rx_privmsg(message pkt, int b, bool notice);
8acd80f9 »
2010-09-15 More work on the new parsing code
92 int rx_topic(message pkt, int b);
93 int rx_join(message pkt, int b);
94 int rx_part(message pkt, int b);
95 int rx_quit(message pkt, int b);
96 int rx_nick(message pkt, int b);
097f13bb »
2010-08-20 Refactoring (CTCP handling from rx_privmsg() to ctcp())
97
834778ff »
2010-09-25 Better handling of NOTICE CTCP
98 int ctcp(char *msg, char *from, char *src, int b2, bool ha, bool notice, bool priv); // Handle CTCP (Client-To-Client Protocol) messages (from is crushed-src)
Something went wrong with that request. Please try again.