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 #include "client.h"
28 #include "ircd.h"
29 #include "ircd_reply.h"
30 #include "numeric.h"
31 #include "numnicks.h"
32 #include "send.h"
33 #include "supported.h"
34 #include "version.h"
35
36 #include <assert.h>
37
38 /*
39  * m_functions execute protocol messages on this server:
40  *
41  *    cptr    is always NON-NULL, pointing to a *LOCAL* client
42  *            structure (with an open socket connected!). This
43  *            identifies the physical socket where the message
44  *            originated (or which caused the m_function to be
45  *            executed--some m_functions may call others...).
46  *
47  *    sptr    is the source of the message, defined by the
48  *            prefix part of the message if present. If not
49  *            or prefix not found, then sptr==cptr.
50  *
51  *            (!IsServer(cptr)) => (cptr == sptr), because
52  *            prefixes are taken *only* from servers...
53  *
54  *            (IsServer(cptr))
55  *                    (sptr == cptr) => the message didn't
56  *                    have the prefix.
57  *
58  *                    (sptr != cptr && IsServer(sptr) means
59  *                    the prefix specified servername. (?)
60  *
61  *                    (sptr != cptr && !IsServer(sptr) means
62  *                    that message originated from a remote
63  *                    user (not local).
64  *
65  *            combining
66  *
67  *            (!IsServer(sptr)) means that, sptr can safely
68  *            taken as defining the target structure of the
69  *            message in this server.
70  *
71  *    *Always* true (if 'parse' and others are working correct):
72  *
73  *    1)      sptr->from == cptr  (note: cptr->from == cptr)
74  *
75  *    2)      MyConnect(sptr) <=> sptr == cptr (e.g. sptr
76  *            *cannot* be a local connection, unless it's
77  *            actually cptr!). [MyConnect(x) should probably
78  *            be defined as (x == x->from) --msa ]
79  *
80  *    parc    number of variable parameter strings (if zero,
81  *            parv is allowed to be NULL)
82  *
83  *    parv    a NULL terminated list of parameter pointers,
84  *
85  *                    parv[0], sender (prefix string), if not present
86  *                            this points to an empty string.
87  *                    parv[1]...parv[parc-1]
88  *                            pointers to additional parameters
89  *                    parv[parc] == NULL, *always*
90  *
91  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
92  *                    non-NULL pointers.
93  */
94
95 int m_not_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
96 {
97   return send_reply(cptr, ERR_NOPRIVILEGES);
98 }
99
100 int m_unregistered(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
101 {
102   send_reply(cptr, SND_EXPLICIT | ERR_NOTREGISTERED, "%s :Register first.",
103              parv[0]);
104   return 0;
105 }
106
107 int m_registered(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
108 {
109   return send_reply(sptr, ERR_ALREADYREGISTRED);
110 }
111
112 int m_ignore(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
113 {
114   return 0;
115 }
116
117 int m_unsupported(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
118 {
119   return 0;
120 }