~rcr/rirc

ref: 7ca2a99a605b7e0b88fa85bc43a8fadc13695ba8 rirc/src/handlers/irc_send.gperf -rw-r--r-- 1.5 KiB
7ca2a99a — Richard Robbins refactor order of includes 1 year, 7 months ago
                                                                                
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%{
#include <string.h>

#define SEND_HANDLERS \
	X(notice) \
	X(part) \
	X(privmsg) \
	X(quit) \
	X(topic)

#define SEND_CTCP_HANDLERS \
	X(action) \
	X(clientinfo) \
	X(finger) \
	X(ping) \
	X(source) \
	X(time) \
	X(userinfo) \
	X(version)

#define SEND_IRCV3_CAP_HANDLERS \
	X(ls) \
	X(list)

#define X(cmd) static int send_##cmd(struct server*, struct channel*, char*);
SEND_HANDLERS
#undef X

#define X(cmd) static int send_ctcp_##cmd(struct server*, struct channel*, char*);
SEND_CTCP_HANDLERS
#undef X

#define X(cmd) static int send_ircv3_cap_##cmd(struct server*, struct channel*, char*);
SEND_IRCV3_CAP_HANDLERS
#undef X

typedef int (*irc_send_f)(struct server*, struct channel*, char*);

struct send_handler
{
	char *key;
	irc_send_f f;
};
%}

%enum
%null-strings
%readonly-tables
%struct-type
%define slot-name key
%define word-array-name      send_handlers
%define hash-function-name   send_handler_hash
%define lookup-function-name send_handler_lookup
%define initializer-suffix ,(irc_send_f)0
struct send_handler;
%%
CAP-LS,          send_ircv3_cap_ls
CAP-LIST,        send_ircv3_cap_list
CTCP-ACTION,     send_ctcp_action
CTCP-CLIENTINFO, send_ctcp_clientinfo
CTCP-FINGER,     send_ctcp_finger
CTCP-PING,       send_ctcp_ping
CTCP-SOURCE,     send_ctcp_source
CTCP-TIME,       send_ctcp_time
CTCP-USERINFO,   send_ctcp_userinfo
CTCP-VERSION,    send_ctcp_version
NOTICE,          send_notice
PART,            send_part
PRIVMSG,         send_privmsg
QUIT,            send_quit
TOPIC,           send_topic
%%