File: msg.h

package info (click to toggle)
dancer-ircd 1.0.36-8
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 3,204 kB
  • ctags: 2,703
  • sloc: ansic: 36,121; sh: 3,534; perl: 612; makefile: 307
file content (331 lines) | stat: -rw-r--r-- 13,661 bytes parent folder | download | duplicates (4)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
/************************************************************************
 *   IRC - Internet Relay Chat, include/msg.h
 *   Copyright (C) 1990 Jarkko Oikarinen and
 *                      University of Oulu, Computing Center
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 1, or (at your option)
 *   any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * 
 */
#ifndef INCLUDED_msg_h
#define INCLUDED_msg_h
#ifndef INCLUDED_config_h
#include "config.h"
#endif

struct Client;

/* 
 * Message table structure 
 */
struct  Message
{
  const char  *cmd;
  int (*func)(struct Client *,struct Client *,int,char **);
  unsigned int  count;                  /* number of times command used */
  int   parameters;
  char  flags;
  /* bit 0 set means that this command is allowed to be used
   * only on the average of once per 2 seconds -SRB */

  /* I could have defined other bit maps to above instead of the next two
     flags that I added. so sue me. -Dianora */

  char    allow_unregistered_use;       /* flag if this command can be
                                           used if unregistered */

  char    reset_idle;                   /* flag if this command causes
                                           idle time to be reset */
  char    allow_honeypot;               /* true if this command can be used in the honeypot */

  unsigned long bytes;
};

struct MessageTree
{
  const char *final;
  struct Message *msg;
  struct MessageTree *pointers[26];
}; 

typedef struct MessageTree MESSAGE_TREE;

#ifdef TSDELTA
#define MSG_TSDELTA  "TSDELTA"
#define MSG_UTIME    "UTIME"
#endif

#define MSG_BURST    "BURST"
#define MSG_SNICK    "SNICK"
#define MSG_IDLE     "IDLE"
#define MSG_COLLIDE  "COLLIDE"

#ifdef CHALLENGERESPONSE
#define MSG_CHALL    "CHALL"    /* CHALL */
#define MSG_RESP     "RESP"     /* RESP */
#endif

#define MSG_PRIVATE  "PRIVMSG"  /* PRIV */
#define MSG_WHO      "WHO"      /* WHO  -> WHOC */
#define MSG_WHOIS    "WHOIS"    /* WHOI */
#define MSG_WHOWAS   "WHOWAS"   /* WHOW */
#define MSG_USER     "USER"     /* USER */
#define MSG_NICK     "NICK"     /* NICK */
#define MSG_SERVER   "SERVER"   /* SERV */
#define MSG_LIST     "LIST"     /* LIST */
#define MSG_TOPIC    "TOPIC"    /* TOPI */
#define MSG_INVITE   "INVITE"   /* INVI */
#define MSG_VERSION  "VERSION"  /* VERS */
#define MSG_QUIT     "QUIT"     /* QUIT */
#define MSG_SQUIT    "SQUIT"    /* SQUI */
#define MSG_KILL     "KILL"     /* KILL */
#define MSG_INFO     "INFO"     /* INFO */
#define MSG_LINKS    "LINKS"    /* LINK */
#define MSG_MAP      "MAP"      /* MAP */
#define MSG_STATS    "STATS"    /* STAT */
#define MSG_USERS    "USERS"    /* USER -> USRS */
#define MSG_HELP     "HELP"     /* HELP */
#define MSG_ERROR    "ERROR"    /* ERRO */
#define MSG_AWAY     "AWAY"     /* AWAY */
#define MSG_CONNECT  "CONNECT"  /* CONN */
#define MSG_PING     "PING"     /* PING */
#define MSG_PONG     "PONG"     /* PONG */
#define MSG_OPER     "OPER"     /* OPER */
#define MSG_PASS     "PASS"     /* PASS */
#define MSG_WALLOPS  "WALLOPS"  /* WALL */
#define MSG_TIME     "TIME"     /* TIME */
#define MSG_NAMES    "NAMES"    /* NAME */
#define MSG_ADMIN    "ADMIN"    /* ADMI */
#define MSG_TRACE    "TRACE"    /* TRAC */
#define MSG_LTRACE   "LTRACE"   /* LTRA */
#define MSG_NOTICE   "NOTICE"   /* NOTI */
#define MSG_JOIN     "JOIN"     /* JOIN */
#define MSG_LJOIN    "LJOIN"
#define MSG_LPART    "LPART"
#define MSG_PART     "PART"     /* PART */
#define MSG_LUSERS   "LUSERS"   /* LUSE */
#define MSG_MOTD     "MOTD"     /* MOTD */
#define MSG_MODE     "MODE"     /* MODE */
#define MSG_KICK     "KICK"     /* KICK */
#define MSG_REMOVE   "REMOVE"
#define MSG_USERHOST "USERHOST" /* USER -> USRH */
#define MSG_ISON     "ISON"     /* ISON */
#define MSG_REHASH   "REHASH"   /* REHA */
#define MSG_RESTART  "RESTART"  /* REST */
#define MSG_CLOSE    "CLOSE"    /* CLOS */
#define MSG_SVINFO   "SVINFO"   /* SVINFO */
#define MSG_SJOIN    "SJOIN"    /* SJOIN */
#define MSG_CAPAB    "CAPAB"    /* CAPAB */
#define MSG_DIE      "DIE"      /* DIE */
#define MSG_HASH     "HASH"     /* HASH */
#define MSG_DNS      "DNS"      /* DNS  -> DNSS */
#define MSG_OPERWALL "OPERWALL" /* OPERWALL */
#define MSG_KLINE    "KLINE"    /* KLINE */
#define MSG_UNKLINE  "UNKLINE"  /* UNKLINE */
#define MSG_DLINE    "DLINE"    /* DLINE */
#define MSG_HTM      "HTM"      /* HTM */
#define MSG_SET      "SET"      /* SET */
#define MSG_SILENCE  "SILENCE"  /* SILENCE */

#define MSG_SETHOST  "SETHOST"  /* SETHOST */
#define MSG_SETIDENT "SETIDENT" /* SETIDENT */
#define MSG_SETNAME  "SETNAME"  /* SETNAME */
#define MSG_MAKEPASS "MAKEPASS" /* MAKEPASS */
#define MSG_STOPIC   "STOPIC"   /* STOPIC */

#define MSG_KNOCK          "KNOCK"  /* KNOCK */

#ifdef USE_SERVICES
#define MSG_CHANSERV    "CHANSERV"      /* CHANSERV */
#define MSG_CS                  "CS"                    /* CS */
#define MSG_NICKSERV    "NICKSERV"      /* NICKSERV */
#define MSG_NS                  "NS"                    /* NS */
#define MSG_MEMOSERV    "MEMOSERV"      /* MEMOSERV */
#define MSG_MS                  "MS"                    /* MS */
#define MSG_OPERSERV    "OPERSERV"      /* OPERSERV */
#define MSG_OS                  "OS"                    /* OS */
#define MSG_SEENSERV    "SEENSERV"      /* SEENSERV */
#define MSG_LS                  "LS"                    /* LS */
#define MSG_HELPSERV    "HELPSERV"      /* HELPSERV */
#define MSG_HS                  "HS"                    /* HS */
#define MSG_STATSERV    "STATSERV"      /* STATSERV */
#define MSG_SS                  "SS"                    /* SS */
#define MSG_GLOBAL      "GLOBALNOTICE"  /* GLOBALNOTICE */
#define MSG_GN                  "GN"                    /* GN */
#endif

#define MSG_SPINGTIME   "SPINGTIME"
#define MSG_SCAN        "SCAN"
#define MSG_DUMP        "DUMP"
#define MSG_LANG        "LANG"

#define MAXPARA    15 

#define MSG_TESTLINE "TESTLINE"

#ifdef MSGTAB
#ifndef INCLUDED_m_commands_h
#include "m_commands.h"       /* m_xxx */
#endif
struct Message msgtab[] = {
#ifdef IDLE_FROM_MSG    /* reset idle time only if privmsg used */
  { MSG_PRIVATE, m_private,  0, MAXPARA, 1, 0, 1, 0, 0L },

  /*                                           ^
                                               |__ reset idle time when 1 */
#else   /* IDLE_FROM_MSG */
  { MSG_PRIVATE, m_private,  0, MAXPARA, 1, 0, 0, 0, 0L },
  /*                                           ^
                                               |__ reset idle time when 0 */
#endif  /* IDLE_FROM_MSG */

#ifdef TSDELTA
  { MSG_TSDELTA, m_tsdelta,  0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_UTIME,   m_utime,    0, MAXPARA, 1, 0, 0, 0, 0L },
#endif

  { MSG_NICK,    m_nick,     0, MAXPARA, 1, 1, 1, 1, 0L },
  { MSG_NOTICE,  m_notice,   0, MAXPARA, 1, 1, 1, 0, 0L },
  { MSG_JOIN,    m_join,     0, MAXPARA, 1, 0, 1, 0, 0L },
/*   { MSG_LJOIN,   m_ljoin,    0, MAXPARA, 1, 0, 1, 0, 0L }, */
/*   { MSG_LPART,   m_lpart,    0, MAXPARA, 1, 0, 1, 0, 0L }, */
  { MSG_MODE,    m_mode,     0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_QUIT,    m_quit,     0, MAXPARA, 1, 1, 0, 1, 0L },
  { MSG_PART,    m_part,     0, MAXPARA, 1, 0, 1, 1, 0L },
  { MSG_KNOCK,   m_knock,    0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_TOPIC,   m_topic,    0, MAXPARA, 1, 0, 1, 1, 0L },
  { MSG_INVITE,  m_invite,   0, MAXPARA, 1, 0, 1, 1, 0L },
  { MSG_KICK,    m_kick,     0, MAXPARA, 1, 0, 1, 1, 0L },
  { MSG_REMOVE,  m_remove,   0, MAXPARA, 1, 0, 1, 1, 0L },
  { MSG_WALLOPS, m_wallops,  0, MAXPARA, 1, 0, 1, 0, 0L },

#ifdef IDLE_FROM_MSG

  /* Only m_private has reset idle flag set */
  { MSG_PONG,    m_pong,     0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_PING,    m_ping,     0, MAXPARA, 1, 0, 0, 1, 0L },

#else

  /* else for IDLE_FROM_MSG */
  /* reset idle flag sense is reversed, only reset idle time
   * when its 0, for IDLE_FROM_MSG ping/pong do not reset idle time
   */

  { MSG_PONG,    m_pong,     0, MAXPARA, 1, 0, 1, 1, 0L },
  { MSG_PING,    m_ping,     0, MAXPARA, 1, 0, 1, 1, 0L },

#endif  /* IDLE_FROM_MSG */

  { MSG_ERROR,   m_error,    0, MAXPARA, 1, 1, 0, 1, 0L },
  { MSG_KILL,    m_kill,     0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_COLLIDE, m_collide,  0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_USER,    m_user,     0, MAXPARA, 1, 1, 0, 1, 0L },
  { MSG_AWAY,    m_away,     0, MAXPARA, 1, 0, 1, 1, 0L },
#ifdef IDLE_FROM_MSG
  { MSG_ISON,    m_ison,     0, 1,       1, 0, 0, 0, 0L },
#else
  /* ISON should not reset idle time ever
   * remember idle flag sense is reversed when IDLE_FROM_MSG is undefined
   */
  { MSG_ISON,    m_ison,     0, 1,       1, 0, 1, 0, 0L },
#endif /* !IDLE_FROM_MSG */
  { MSG_SERVER,  m_server,   0, MAXPARA, 1, 1, 0, 0, 0L },
  { MSG_SQUIT,   m_squit,    0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_WHOIS,   m_whois,    0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_WHO,     m_who,      0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_WHOWAS,  m_whowas,   0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_LIST,    m_list,     0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_NAMES,   m_names,    0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_USERHOST,m_userhost, 0, 1,       1, 0, 0, 1, 0L },
  { MSG_TRACE,   m_trace,    0, MAXPARA, 1, 0, 0, 1, 0L },
#ifdef LTRACE
  { MSG_LTRACE,  m_ltrace,   0, MAXPARA, 1, 0, 0, 1, 0L },
#endif /* LTRACE */
#ifdef CHALLENGERESPONSE
  { MSG_CHALL,   m_chall,    0, MAXPARA, 1, 1, 0, 0, 0L },  
  { MSG_RESP,    m_resp,     0, MAXPARA, 1, 1, 0, 0, 0L },
#endif
  { MSG_PASS,    m_pass,     0, MAXPARA, 1, 1, 0, 1, 0L },
  { MSG_LUSERS,  m_lusers,   0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_TIME,    m_time,     0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_OPER,    m_oper,     0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_CONNECT, m_connect,  0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_VERSION, m_version,  0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_STATS,   m_stats,    0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_LINKS,   m_links,    0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_MAP,     m_map,      0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_ADMIN,   m_admin,    0, MAXPARA, 1, 1, 0, 1, 0L },
  { MSG_USERS,   m_users,    0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_HELP,    m_help,     0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_INFO,    m_info,     0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_MOTD,    m_motd,     0, MAXPARA, 1, 0, 0, 1, 0L },
  { MSG_SVINFO,  m_svinfo,   0, MAXPARA, 1, 1, 0, 0, 0L },
  { MSG_SJOIN,   m_sjoin,    0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_CAPAB,   m_capab,    0, MAXPARA, 1, 1, 0, 0, 0L },
  { MSG_OPERWALL, m_operwall,0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_CLOSE,   m_close,    0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_KLINE,   m_kline,    0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_UNKLINE, m_unkline,  0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_DLINE,   m_dline,    0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_HASH,    m_hash,     0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_DNS,     m_dns,      0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_REHASH,  m_rehash,   0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_RESTART, m_restart,  0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_DIE, m_die,          0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_HTM,    m_htm,       0, MAXPARA, 1, 0, 1, 0, 0L },
  { MSG_SET,    m_set,       0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_SILENCE,  m_silence, 0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_TESTLINE, m_testline,0, MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_CHANSERV, m_chanserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_CS,       m_chanserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_NICKSERV, m_nickserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_NS,       m_nickserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_MEMOSERV, m_memoserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_MS,       m_memoserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_OPERSERV, m_operserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_OS,       m_operserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_SEENSERV, m_seenserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_LS,       m_seenserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_STATSERV, m_statserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_SS,       m_statserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_HELPSERV, m_helpserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_HS,       m_helpserv,      0, 1, 1, 0, 1, 1, 0L },
  { MSG_GLOBAL,   m_global,        0, 1, 1, 0, 1, 1, 0L },
  { MSG_GN,       m_global,        0, 1, 1, 0, 1, 1, 0L },
  { MSG_SETHOST,  m_sethost,       0, 2, 1, 0, 0, 0, 0L },
  { MSG_SETIDENT, m_setident,      0, 2, 1, 0, 0, 0, 0L },
  { MSG_SETNAME,  m_setname,       0, 2, 1, 0, 0, 0, 0L },
  { MSG_MAKEPASS, m_makepass,      0, 2, 1, 0, 0, 1, 0L },
  { MSG_STOPIC,   m_stopic,   0,MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_SPINGTIME,m_spingtime,0,MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_SCAN,     m_scan,     0,MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_DUMP,     m_dump,     0,MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_BURST,    m_burst,    0,MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_SNICK,    m_snick,    0,MAXPARA, 1, 0, 0, 0, 0L },
  { MSG_IDLE,     m_idle,     0,MAXPARA, 1, 0, 1, 0, 0L },

  { (char *) 0, (int (*)(struct Client *,struct Client *,int,char **)) 0 , 0, 0,    0, 0, 0, 0, 0L }
};

struct MessageTree* msg_tree_root;

#else
extern struct Message       msgtab[];
extern struct MessageTree*  msg_tree_root;
#endif

#endif /* INCLUDED_msg_h */