This commit was generated by cvs2svn to compensate for changes in r2,
[ircu2.10.12-pk.git] / include / msg.h
1 /*
2  * IRC - Internet Relay Chat, include/msg.h
3  * Copyright (C) 1990 Jarkko Oikarinen and
4  *                    University of Oulu, Computing Center
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 1, or (at your option)
9  * any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20
21 #ifndef MSG_H
22 #define MSG_H
23
24 /*=============================================================================
25  * General defines
26  */
27
28 #define MAXPARA    15
29
30 /*-----------------------------------------------------------------------------
31  * Macro's
32  */
33
34 /*
35  * Tokenization:
36  * Each command must have a TOK_COMMAND and MSG_COMMAND definition.
37  * If you don't want one or the other, make them the same.
38  * Also each command has a "msgclass" used for debugging purposes.
39  */
40
41 /* *INDENT-OFF* */
42
43 #define MSG_PRIVATE             "PRIVMSG"       /* PRIV */
44 #define TOK_PRIVATE             "P"
45 #define CLASS_PRIVATE           LEVEL_PROPAGATE
46
47 #define MSG_WHO                 "WHO"           /* WHO  -> WHOC */
48 #define TOK_WHO                 "H"
49 #define CLASS_WHO               LEVEL_QUERY
50
51 #define MSG_WHOIS               "WHOIS"         /* WHOI */
52 #define TOK_WHOIS               "W"
53 #define CLASS_WHOIS             LEVEL_QUERY
54
55 #define MSG_WHOWAS              "WHOWAS"        /* WHOW */
56 #define TOK_WHOWAS              "X"
57 #define CLASS_WHOWAS            LEVEL_QUERY
58
59 #define MSG_USER                "USER"          /* USER */
60 #define TOK_USER                "USER"
61 #define CLASS_USER              LEVEL_CLIENT
62
63 #define MSG_NICK                "NICK"          /* NICK */
64 #define TOK_NICK                "N"
65 #define CLASS_NICK              LEVEL_CLIENT
66
67 #define MSG_SERVER              "SERVER"        /* SERV */
68 #define TOK_SERVER              "S"
69 #define CLASS_SERVER            LEVEL_MAP
70
71 #define MSG_LIST                "LIST"          /* LIST */
72 #define TOK_LIST                "LIST"
73 #define CLASS_LIST              LEVEL_QUERY
74
75 #define MSG_TOPIC               "TOPIC"         /* TOPI */
76 #define TOK_TOPIC               "T"
77 #define CLASS_TOPIC             LEVEL_PROPAGATE
78
79 #define MSG_INVITE              "INVITE"        /* INVI */
80 #define TOK_INVITE              "I"
81 #define CLASS_INVITE            LEVEL_MODE
82
83 #define MSG_VERSION             "VERSION"       /* VERS */
84 #define TOK_VERSION             "V"
85 #define CLASS_VERSION           LEVEL_QUERY
86
87 #define MSG_QUIT                "QUIT"          /* QUIT */
88 #define TOK_QUIT                "Q"
89 #define CLASS_QUIT              LEVEL_CLIENT
90
91 #define MSG_SQUIT               "SQUIT"         /* SQUI */
92 #define TOK_SQUIT               "SQ"
93 #define CLASS_SQUIT             LEVEL_MAP
94
95 #define MSG_KILL                "KILL"          /* KILL */
96 #define TOK_KILL                "D"
97 #define CLASS_KILL              LEVEL_CLIENT
98
99 #define MSG_INFO                "INFO"          /* INFO */
100 #define TOK_INFO                "F"
101 #define CLASS_INFO              LEVEL_QUERY
102
103 #define MSG_LINKS               "LINKS"         /* LINK */
104 #define TOK_LINKS               "LI"
105 #define CLASS_LINKS             LEVEL_QUERY
106
107 #define MSG_STATS               "STATS"         /* STAT */
108 #define TOK_STATS               "R"
109 #define CLASS_STATS             LEVEL_QUERY
110
111 #define MSG_HELP                "HELP"          /* HELP */
112 #define TOK_HELP                "HELP"
113 #define CLASS_HELP              LEVEL_QUERY
114
115 #define MSG_ERROR               "ERROR"         /* ERRO */
116 #define TOK_ERROR               "Y"
117 #define CLASS_ERROR             LEVEL_PROPAGATE
118
119 #define MSG_AWAY                "AWAY"          /* AWAY */
120 #define TOK_AWAY                "A"
121 #define CLASS_AWAY              LEVEL_PROPAGATE
122
123 #define MSG_CONNECT             "CONNECT"       /* CONN */
124 #define TOK_CONNECT             "CO"
125 #define CLASS_CONNECT           LEVEL_PROPAGATE
126
127 #define MSG_UPING               "UPING"         /* UPIN */
128 #define TOK_UPING               "UP"
129 #define CLASS_UPING             LEVEL_PROPAGATE
130
131 #define MSG_MAP                 "MAP"           /* MAP  */
132 #define TOK_MAP                 "MAP"
133 #define CLASS_MAP               LEVEL_QUERY
134
135 #define MSG_PING                "PING"          /* PING */
136 #define TOK_PING                "G"
137 #define CLASS_PING              LEVEL_PROPAGATE
138
139 #define MSG_PONG                "PONG"          /* PONG */
140 #define TOK_PONG                "Z"
141 #define CLASS_PONG              LEVEL_CLIENT
142
143 #define MSG_OPER                "OPER"          /* OPER */
144 #define TOK_OPER                "OPER"
145 #define CLASS_OPER              LEVEL_PROPAGATE
146
147 #define MSG_PASS                "PASS"          /* PASS */
148 #define TOK_PASS                "PA"
149 #define CLASS_PASS              LEVEL_CLIENT
150
151 #define MSG_WALLOPS             "WALLOPS"       /* WALL */
152 #define TOK_WALLOPS             "WA"
153 #define CLASS_WALLOPS           LEVEL_PROPAGATE
154
155 #define MSG_DESYNCH             "DESYNCH"       /* DESY */
156 #define TOK_DESYNCH             "DS"
157 #define CLASS_DESYNCH           LEVEL_PROPAGATE
158
159 #define MSG_TIME                "TIME"          /* TIME */
160 #define TOK_TIME                "TI"
161 #define CLASS_TIME              LEVEL_QUERY
162
163 #define MSG_SETTIME             "SETTIME"       /* SETT */
164 #define TOK_SETTIME             "SE"
165 #define CLASS_SETTIME           LEVEL_PROPAGATE
166
167 #define MSG_RPING               "RPING"         /* RPIN */
168 #define TOK_RPING               "RI"
169 #define CLASS_RPING             LEVEL_PROPAGATE
170
171 #define MSG_RPONG               "RPONG"         /* RPON */
172 #define TOK_RPONG               "RO"
173 #define CLASS_RPONG             LEVEL_PROPAGATE
174
175 #define MSG_NAMES               "NAMES"         /* NAME */
176 #define TOK_NAMES               "E"
177 #define CLASS_NAMES             LEVEL_QUERY
178
179 #define MSG_ADMIN               "ADMIN"         /* ADMI */
180 #define TOK_ADMIN               "AD"
181 #define CLASS_ADMIN             LEVEL_QUERY
182
183 #define MSG_TRACE               "TRACE"         /* TRAC */
184 #define TOK_TRACE               "TR"
185 #define CLASS_TRACE             LEVEL_PROPAGATE
186
187 #define MSG_NOTICE              "NOTICE"        /* NOTI */
188 #define TOK_NOTICE              "O"
189 #define CLASS_NOTICE            LEVEL_PROPAGATE
190
191 #define MSG_WALLCHOPS           "WALLCHOPS"     /* WC */
192 #define TOK_WALLCHOPS           "WC"
193 #define CLASS_WALLCHOPS         LEVEL_PROPAGATE
194
195 #define MSG_CPRIVMSG            "CPRIVMSG"      /* CPRI */
196 #define TOK_CPRIVMSG            "CP"
197 #define CLASS_CPRIVMSG          LEVEL_CLIENT
198
199 #define MSG_CNOTICE             "CNOTICE"       /* CNOT */
200 #define TOK_CNOTICE             "CN"
201 #define CLASS_CNOTICE           LEVEL_CLIENT
202
203 #define MSG_JOIN                "JOIN"          /* JOIN */
204 #define TOK_JOIN                "J"
205 #define CLASS_JOIN              LEVEL_CHANNEL
206
207 #define MSG_PART                "PART"          /* PART */
208 #define TOK_PART                "L"
209 #define CLASS_PART              LEVEL_CHANNEL
210
211 #define MSG_LUSERS              "LUSERS"        /* LUSE */
212 #define TOK_LUSERS              "LU"
213 #define CLASS_LUSERS            LEVEL_QUERY
214
215 #define MSG_MOTD                "MOTD"          /* MOTD */
216 #define TOK_MOTD                "MO"
217 #define CLASS_MOTD              LEVEL_QUERY
218
219 #define MSG_MODE                "MODE"          /* MODE */
220 #define TOK_MODE                "M"
221 #define CLASS_MODE              LEVEL_MODE
222
223 #define MSG_KICK                "KICK"          /* KICK */
224 #define TOK_KICK                "K"
225 #define CLASS_KICK              LEVEL_CHANNEL
226
227 #define MSG_USERHOST            "USERHOST"      /* USER -> USRH */
228 #define TOK_USERHOST            "USERHOST"
229 #define CLASS_USERHOST          LEVEL_QUERY
230
231 #define MSG_USERIP              "USERIP"        /* USER -> USIP */
232 #define TOK_USERIP              "USERIP"
233 #define CLASS_USERIP            LEVEL_QUERY
234
235 #define MSG_ISON                "ISON"          /* ISON */
236 #define TOK_ISON                "ISON"
237 #define CLASS_ISON              LEVEL_QUERY
238
239 #define MSG_SQUERY              "SQUERY"        /* SQUE */
240 #define TOK_SQUERY              "SQUERY"
241 #define CLASS_SQUERY            LEVEL_QUERY
242
243 #define MSG_SERVLIST            "SERVLIST"      /* SERV -> SLIS */
244 #define TOK_SERVLIST            "SERVSET"
245 #define CLASS_SERVLIST          LEVEL_QUERY
246
247 #define MSG_SERVSET             "SERVSET"       /* SERV -> SSET */
248 #define TOK_SERVSET             "SERVSET"
249 #define CLASS_SERVSET           LEVEL_CLIENT
250
251 #define MSG_REHASH              "REHASH"        /* REHA */
252 #define TOK_REHASH              "REHASH"
253 #define CLASS_REHASH            LEVEL_MAP
254
255 #define MSG_RESTART             "RESTART"       /* REST */
256 #define TOK_RESTART             "RESTART"
257 #define CLASS_RESTART           LEVEL_MAP
258
259 #define MSG_CLOSE               "CLOSE"         /* CLOS */
260 #define TOK_CLOSE               "CLOSE"
261 #define CLASS_CLOSE             LEVEL_CLIENT
262
263 #define MSG_DIE                 "DIE"           /* DIE  */
264 #define TOK_DIE                 "DIE"
265 #define CLASS_DIE               LEVEL_MAP
266
267 #define MSG_HASH                "HASH"          /* HASH */
268 #define TOK_HASH                "HASH"
269 #define CLASS_HASH              LEVEL_QUERY
270
271 #define MSG_DNS                 "DNS"           /* DNS  -> DNSS */
272 #define TOK_DNS                 "DNS"
273 #define CLASS_DNS               LEVEL_QUERY
274
275 #define MSG_SILENCE             "SILENCE"       /* SILE */
276 #define TOK_SILENCE             "U"
277 #define CLASS_SILENCE           LEVEL_PROPAGATE
278
279 #define MSG_GLINE               "GLINE"         /* GLIN */
280 #define TOK_GLINE               "GL"
281 #define CLASS_GLINE             LEVEL_CLIENT
282
283 #define MSG_BURST               "BURST"         /* BURS */
284 #define TOK_BURST               "B"
285 #define CLASS_BURST             LEVEL_CHANNEL
286
287 #define MSG_CREATE              "CREATE"        /* CREA */
288 #define TOK_CREATE              "C"
289 #define CLASS_CREATE            LEVEL_CHANNEL
290
291 #define MSG_DESTRUCT            "DESTRUCT"      /* DEST */
292 #define TOK_DESTRUCT            "DE"
293 #define CLASS_DESTRUCT          LEVEL_CHANNEL
294
295 #define MSG_END_OF_BURST        "END_OF_BURST"  /* END_ */
296 #define TOK_END_OF_BURST        "EB"
297 #define CLASS_END_OF_BURST      LEVEL_MAP
298
299 #define MSG_END_OF_BURST_ACK    "EOB_ACK"       /* EOB_ */
300 #define TOK_END_OF_BURST_ACK    "EA"
301 #define CLASS_END_OF_BURST_ACK  LEVEL_MAP
302
303 /* *INDENT-ON* */
304
305 /*=============================================================================
306  * Constants
307  */
308 #define   MFLG_SLOW              0x01   /* Command can be executed roughly    *
309                                          * once per 2 seconds.                */
310 #define   MFLG_UNREG             0x02   /* Command available to unregistered  *
311                                          * clients.                           */
312
313 /*=============================================================================
314  * Structures
315  */
316
317 struct Message {
318   unsigned int msgclass;
319   char *cmd;
320   char *tok;
321   int (*func) (aClient *cptr, aClient *sptr, int parc, char *parv[]);
322   /* cptr = Connected client ptr
323      sptr = Source client ptr
324      parc = parameter count
325      parv = parameter variable array */
326   unsigned int count;
327   unsigned int parameters;
328   unsigned char flags;          /* bit 0 set means that this command is allowed
329                                    to be used only on the average of once per 2
330                                    seconds -SRB */
331   unsigned int bytes;
332 };
333
334 struct MessageTree {
335   char *final;
336   struct Message *msg;
337   struct MessageTree *pointers[26];
338 };
339
340 /*=============================================================================
341  * Proto types
342  */
343
344 extern struct Message msgtab[];
345
346 #endif /* MSG_H */