2 * IRC - Internet Relay Chat, ircd/m_proto.c
3 * Copyright (C) 1990 Jarkko Oikarinen and
4 * University of Oulu, Computing Center
6 * See file AUTHORS in IRC package for additional names of
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)
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.
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.
27 * No need to include handlers.h here the signatures must match
28 * and we don't need to force a rebuild of all the handlers everytime
29 * we add a new one to the list. --Bleep
35 #include "ircd_reply.h"
39 #include "supported.h"
45 * m_functions execute protocol messages on this server:
47 * cptr is always NON-NULL, pointing to a *LOCAL* client
48 * structure (with an open socket connected!). This
49 * identifies the physical socket where the message
50 * originated (or which caused the m_function to be
51 * executed--some m_functions may call others...).
53 * sptr is the source of the message, defined by the
54 * prefix part of the message if present. If not
55 * or prefix not found, then sptr==cptr.
57 * (!IsServer(cptr)) => (cptr == sptr), because
58 * prefixes are taken *only* from servers...
61 * (sptr == cptr) => the message didn't
64 * (sptr != cptr && IsServer(sptr) means
65 * the prefix specified servername. (?)
67 * (sptr != cptr && !IsServer(sptr) means
68 * that message originated from a remote
73 * (!IsServer(sptr)) means that, sptr can safely
74 * taken as defining the target structure of the
75 * message in this server.
77 * *Always* true (if 'parse' and others are working correct):
79 * 1) sptr->from == cptr (note: cptr->from == cptr)
81 * 2) MyConnect(sptr) <=> sptr == cptr (e.g. sptr
82 * *cannot* be a local connection, unless it's
83 * actually cptr!). [MyConnect(x) should probably
84 * be defined as (x == x->from) --msa ]
86 * parc number of variable parameter strings (if zero,
87 * parv is allowed to be NULL)
89 * parv a NULL terminated list of parameter pointers,
91 * parv[0], sender (prefix string), if not present
92 * this points to an empty string.
93 * parv[1]...parv[parc-1]
94 * pointers to additional parameters
95 * parv[parc] == NULL, *always*
97 * note: it is guaranteed that parv[0]..parv[parc-1] are all
101 int m_not_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
103 return send_reply(cptr, ERR_NOPRIVILEGES);
106 int m_unregistered(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
108 send_reply(cptr, SND_EXPLICIT | ERR_NOTREGISTERED, "%s :Register first.",
113 int m_registered(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
115 return send_reply(sptr, ERR_ALREADYREGISTRED);
118 int m_ignore(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
123 int m_unsupported(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
126 send_reply(cptr, SND_EXPLICIT | ERR_UNSUPPORTED, "%s :Unsupported command",