Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 71 lines (60 sloc) 2.105 kB
29252b6 More refactoring; chopping up quirc.c. '#pragma once'-ing headers
Sound and Fury authored
1 #pragma once
2
9f0cff1 Initial commit.
Sound and Fury authored
3 /*
4 quIRC - simple terminal-based IRC client
5 Copyright (C) 2010 Edward Cree
6
7 See quirc.c for license information
8 irc: networking functions
9 */
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <stdbool.h>
14 #include <string.h>
15 #include <unistd.h>
8844d52 Fix various compile errors in prev. commit
Sound and Fury authored
16 #include <fcntl.h>
556a521 Functions for irc-style casemapping
Sound and Fury authored
17 #include <ctype.h>
9f0cff1 Initial commit.
Sound and Fury authored
18 #include <sys/socket.h>
19 #include <sys/utsname.h>
20 #include <netdb.h>
21 #include <arpa/inet.h>
22 #include <netinet/in.h>
5bd9397 Asynchronous connect(), fixes, and liveness (unfinished)
Sound and Fury authored
23 #include <errno.h>
29252b6 More refactoring; chopping up quirc.c. '#pragma once'-ing headers
Sound and Fury authored
24
bdca1e0 More correct casemapping handling (doesn't yet detect from RPL_ISUPPORT)
Sound and Fury authored
25 typedef enum
26 {
27 RFC1459,
28 STRICT_RFC1459,
29 ASCII
30 }
31 cmap;
32
a9c16e9 Things generally are now buffer-aware
Sound and Fury authored
33 #include "bits.h"
29252b6 More refactoring; chopping up quirc.c. '#pragma once'-ing headers
Sound and Fury authored
34 #include "buffer.h"
35 #include "colour.h"
36 #include "config.h"
83af8c1 Move handling of numeric responses out to irc.c
Sound and Fury authored
37 #include "numeric.h"
bdca1e0 More correct casemapping handling (doesn't yet detect from RPL_ISUPPORT)
Sound and Fury authored
38 #include "names.h"
9f0cff1 Initial commit.
Sound and Fury authored
39
bfdcd84 Handle Low-Level Quoting
Sound and Fury authored
40 #define MQUOTE '\020'
41
5bd9397 Asynchronous connect(), fixes, and liveness (unfinished)
Sound and Fury authored
42 int irc_connect(char *server, char *portno, fd_set *master, int *fdmax); // non-blocking
43 int irc_conn_rest(int b, char *nick, char *username, char *fullname); // call this when the non-blocking connect() has finished
e515989 Allow multiple automatic connects and joins in .quirc
Sound and Fury authored
44 int autoconnect(fd_set *master, int *fdmax, servlist *serv);
9f0cff1 Initial commit.
Sound and Fury authored
45 int irc_tx(int fd, char * packet);
46 int irc_rx(int fd, char ** data);
bfdcd84 Handle Low-Level Quoting
Sound and Fury authored
47 void low_quote(char *from, char to[512]);
48 char * low_dequote(char *buf);
e928ecf Refactor PING, MODE and KILL handling
Sound and Fury authored
49
bdca1e0 More correct casemapping handling (doesn't yet detect from RPL_ISUPPORT)
Sound and Fury authored
50 char irc_to_upper(char c, cmap casemapping);
51 char irc_to_lower(char c, cmap casemapping);
52 int irc_strcasecmp(char *c1, char *c2, cmap casemapping);
53 int irc_strncasecmp(char *c1, char *c2, int n, cmap casemapping);
556a521 Functions for irc-style casemapping
Sound and Fury authored
54
e928ecf Refactor PING, MODE and KILL handling
Sound and Fury authored
55 // Received-IRC message handlers. strtok() state leaks across the boundaries of these functions, beware!
56 int irc_numeric(char *cmd, int b);
57 int rx_ping(int fd);
e515989 Allow multiple automatic connects and joins in .quirc
Sound and Fury authored
58 int rx_mode(servlist * serv, int b); // the first MODE triggers auto-join. Apart from using it as a trigger, we don't look at modes just yet
b6731b3 More refactoring; created crush() function (is still old code)
Sound and Fury authored
59 int rx_kill(int b, fd_set *master);
95baa8f Recognise KICK messages
Sound and Fury authored
60 int rx_kick(int b);
b6731b3 More refactoring; created crush() function (is still old code)
Sound and Fury authored
61 int rx_error(int b, fd_set *master);
62 int rx_privmsg(int b, char *packet, char *pdata);
8cceb3b Refactor NOTICE
Sound and Fury authored
63 int rx_notice(int b, char *packet);
606e6c3 Recognise TOPIC command
Sound and Fury authored
64 int rx_topic(int b, char *packet);
e515989 Allow multiple automatic connects and joins in .quirc
Sound and Fury authored
65 int rx_join(int b, char *packet, char *pdata);
5ba6830 Refactor JOIN, PART
Sound and Fury authored
66 int rx_part(int b, char *packet, char *pdata);
c33e200 Refactor QUIT, NICK
Sound and Fury authored
67 int rx_quit(int b, char *packet, char *pdata);
68 int rx_nick(int b, char *packet, char *pdata);
097f13b Refactoring (CTCP handling from rx_privmsg() to ctcp())
Sound and Fury authored
69
70 int ctcp(char *msg, char *from, char *src, int b2); // Handle CTCP (Client-To-Client Protocol) messages (from is crushed-src)
Something went wrong with that request. Please try again.