Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / m_defaults.c
1 /*
2  * IRC - Internet Relay Chat, ircd/m_proto.c
3  * Copyright (C) 1990 Jarkko Oikarinen and
4  *                    University of Oulu, Computing Center
5  *
6  * See file AUTHORS in IRC package for additional names of
7  * the programmers.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 1, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  * $Id$
24  */
25 #include "config.h"
26
27 #if 0
28 /*
29  * No need to include handlers.h here the signatures must match
30  * and we don't need to force a rebuild of all the handlers everytime
31  * we add a new one to the list. --Bleep
32  */
33 #include "handlers.h"
34 #endif /* 0 */
35 #include "client.h"
36 #include "ircd.h"
37 #include "ircd_reply.h"
38 #include "numeric.h"
39 #include "numnicks.h"
40 #include "send.h"
41 #include "supported.h"
42 #include "version.h"
43
44 #include <assert.h>
45
46 /*
47  * m_functions execute protocol messages on this server:
48  *
49  *    cptr    is always NON-NULL, pointing to a *LOCAL* client
50  *            structure (with an open socket connected!). This
51  *            identifies the physical socket where the message
52  *            originated (or which caused the m_function to be
53  *            executed--some m_functions may call others...).
54  *
55  *    sptr    is the source of the message, defined by the
56  *            prefix part of the message if present. If not
57  *            or prefix not found, then sptr==cptr.
58  *
59  *            (!IsServer(cptr)) => (cptr == sptr), because
60  *            prefixes are taken *only* from servers...
61  *
62  *            (IsServer(cptr))
63  *                    (sptr == cptr) => the message didn't
64  *                    have the prefix.
65  *
66  *                    (sptr != cptr && IsServer(sptr) means
67  *                    the prefix specified servername. (?)
68  *
69  *                    (sptr != cptr && !IsServer(sptr) means
70  *                    that message originated from a remote
71  *                    user (not local).
72  *
73  *            combining
74  *
75  *            (!IsServer(sptr)) means that, sptr can safely
76  *            taken as defining the target structure of the
77  *            message in this server.
78  *
79  *    *Always* true (if 'parse' and others are working correct):
80  *
81  *    1)      sptr->from == cptr  (note: cptr->from == cptr)
82  *
83  *    2)      MyConnect(sptr) <=> sptr == cptr (e.g. sptr
84  *            *cannot* be a local connection, unless it's
85  *            actually cptr!). [MyConnect(x) should probably
86  *            be defined as (x == x->from) --msa ]
87  *
88  *    parc    number of variable parameter strings (if zero,
89  *            parv is allowed to be NULL)
90  *
91  *    parv    a NULL terminated list of parameter pointers,
92  *
93  *                    parv[0], sender (prefix string), if not present
94  *                            this points to an empty string.
95  *                    parv[1]...parv[parc-1]
96  *                            pointers to additional parameters
97  *                    parv[parc] == NULL, *always*
98  *
99  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
100  *                    non-NULL pointers.
101  */
102
103 int m_not_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
104 {
105   return send_reply(cptr, ERR_NOPRIVILEGES);
106 }
107
108 int m_unregistered(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
109 {
110   send_reply(cptr, SND_EXPLICIT | ERR_NOTREGISTERED, "%s :Register first.",
111              parv[0]);
112   return 0;
113 }
114
115 int m_registered(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
116 {
117   return send_reply(sptr, ERR_ALREADYREGISTRED);
118 }
119
120 int m_ignore(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
121 {
122   return 0;
123 }
124
125 int m_unsupported(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
126 {
127 #if 0
128   send_reply(cptr, SND_EXPLICIT | ERR_UNSUPPORTED, "%s :Unsupported command",
129              parv[0]);
130 #endif
131   return 0;
132 }