2000-03-27 Kevin L. Mitchell <klmitch@emc.com>
+ * ircd/m_clearmode.c: define skeleton for m{o,s}_clearmode
+
+ * ircd/m_opmode.c: define skeleton for m{o,s}_opmode
+
+ * ircd/Makefile.in (SRC): added m_opmode() and m_clearmode() to
+ the list
+
+ * ircd/parse.c: added messages for opmode and clearmode
+
+ * include/handlers.h: added declarations for mo_opmode(),
+ ms_opmode(), mo_clearmode(), and ms_clearmode()
+
+ * include/msg.h: define MSG_OPMODE, TOK_OPMODE, MSG_CLEARMODE, and
+ TOK_CLEARMODE
+
+ * include/channel.h (MODEBUF_DEST_OPMODE): Define the
+ MODEBUF_DEST_OPMODE flag
+
+ * ircd/channel.c (modebuf_flush): added new flag,
+ MODEBUF_DEST_OPMODE; causes channel MODE/HACK(4) notice to appear
+ to originate from source's server (or source itself, if
+ IsServer(source)); also causes a server-level MODE to be sent as
+ OPMODE instead
+
* include/channel.h: defined MODEBUF_DEST_SERVER,
MODEBUF_DEST_HACK4
#
# ChangeLog for ircu2.10.11
#
-# $Id: ChangeLog,v 1.25 2000-03-27 15:36:41 kev Exp $
+# $Id: ChangeLog,v 1.26 2000-03-27 16:15:06 kev Exp $
#
# Insert new changes at beginning of the change list.
#
#define MODEBUF_DEST_CHANNEL 0x01 /* Mode is flushed to channel */
#define MODEBUF_DEST_SERVER 0x02 /* Mode is flushed to server */
+#define MODEBUF_DEST_OPMODE 0x40 /* Send server mode as OPMODE */
#define MODEBUF_DEST_HACK4 0x80 /* Send a HACK(4) notice and, on
server sends, use a TS of 0 */
extern int m_who(struct Client*, struct Client*, int, char*[]);
extern int m_whois(struct Client*, struct Client*, int, char*[]);
extern int m_whowas(struct Client*, struct Client*, int, char*[]);
+extern int mo_clearmode(struct Client*, struct Client*, int, char*[]);
extern int mo_close(struct Client*, struct Client*, int, char*[]);
extern int mo_connect(struct Client*, struct Client*, int, char*[]);
extern int mo_die(struct Client*, struct Client*, int, char*[]);
extern int mo_kill(struct Client*, struct Client*, int, char*[]);
extern int mo_notice(struct Client*, struct Client*, int, char*[]);
extern int mo_oper(struct Client*, struct Client*, int, char*[]);
+extern int mo_opmode(struct Client*, struct Client*, int, char*[]);
extern int mo_privmsg(struct Client*, struct Client*, int, char*[]);
extern int mo_rehash(struct Client*, struct Client*, int, char*[]);
extern int mo_restart(struct Client*, struct Client*, int, char*[]);
extern int ms_admin(struct Client*, struct Client*, int, char*[]);
extern int ms_away(struct Client*, struct Client*, int, char*[]);
extern int ms_burst(struct Client*, struct Client*, int, char*[]);
+extern int ms_clearmode(struct Client*, struct Client*, int, char*[]);
extern int ms_connect(struct Client*, struct Client*, int, char*[]);
extern int ms_create(struct Client*, struct Client*, int, char*[]);
extern int ms_destruct(struct Client*, struct Client*, int, char*[]);
extern int ms_nick(struct Client*, struct Client*, int, char*[]);
extern int ms_notice(struct Client*, struct Client*, int, char*[]);
extern int ms_oper(struct Client*, struct Client*, int, char*[]);
+extern int ms_opmode(struct Client*, struct Client*, int, char*[]);
extern int ms_part(struct Client*, struct Client*, int, char*[]);
extern int ms_ping(struct Client*, struct Client*, int, char*[]);
extern int ms_pong(struct Client*, struct Client*, int, char*[]);
#define MSG_JUPE "JUPE" /* JUPE */
#define TOK_JUPE "JU"
+#define MSG_OPMODE "OPMODE" /* OPMO */
+#define TOK_OPMODE "OM"
+
+#define MSG_CLEARMODE "CLEARMODE" /* CLMO */
+#define TOK_CLEARMODE "CM"
+
/*
* Constants
m_admin.c \
m_away.c \
m_burst.c \
+ m_clearmode.c \
m_close.c \
m_connect.c \
m_cprivmsg.c \
m_nick.c \
m_notice.c \
m_oper.c \
+ m_opmode.c \
m_part.c \
m_pass.c \
m_ping.c \
int i;
int *flag_p;
+ struct Client *app_source;
+
char addbuf[20] = "+";
int addbuf_i = 1;
char rembuf[20] = "-";
assert(0 != mbuf);
+ if (mbuf->mb_dest & MODEBUF_DEST_OPMODE && !IsServer(mbuf->mb_source))
+ app_source = mbuf->mb_source->from;
+ else
+ app_source = mbuf->mb_source;
+
for (flag_p = flags; flag_p[0]; flag_p += 2) {
if (*flag_p & mbuf->mb_add)
addbuf[addbuf_i++] = flag_p[1];
}
if (mbuf->mb_dest & MODEBUF_DEST_CHANNEL)
- sendto_channel_butserv(mbuf->mb_channel, mbuf->mb_source,
- ":%s MODE %s %s%s%s%s", mbuf->mb_source->name,
+ sendto_channel_butserv(mbuf->mb_channel, app_source,
+ ":%s MODE %s %s%s%s%s", app_source->name,
mbuf->mb_channel->chname, addbuf, rembuf, addstr,
remstr);
if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
sendto_op_mask(SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s [" TIME_T_FMT
- "]", mbuf->mb_source->name, mbuf->mb_channel->chname,
+ "]", app_source->name, mbuf->mb_channel->chname,
addbuf, rembuf, addstr, remstr,
mbuf->mb_channel->creationtime);
}
build_string(strptr, strptr_i, limitbuf, 0);
}
- if (IsServer(mbuf->mb_source))
- sendto_all_butone(mbuf->mb_connect, "%s " TOK_MODE " %s %s%s%s%s "
- TIME_T_FMT, NumServ(mbuf->mb_source),
- mbuf->mb_channel->chname, addbuf, rembuf, addstr,
- remstr, (mbuf->mb_dest & MODEBUF_DEST_HACK4) ? 0 :
- mbuf->mb_channel->creationtime);
- else
- sendto_all_butone(mbuf->mb_connect, "%s%s " TOK_MODE " %s %s%s%s%s "
- TIME_T_FMT, NumNick(mbuf->mb_source),
- mbuf->mb_channel->chname, addbuf, rembuf, addstr,
- remstr, (mbuf->mb_dest & MODEBUF_DEST_HACK4) ? 0 :
- mbuf->mb_channel->creationtime);
+ if (mbuf->mb_dest & MODEBUF_DEST_OPMODE) {
+ if (IsServer(mbuf->mb_source))
+ sendto_all_butone(mbuf->mb_connect, "%s " TOK_OPMODE " %s %s%s%s%s",
+ NumServ(mbuf->mb_source), mbuf->mb_channel->chname,
+ addbuf, rembuf, addstr, remstr);
+ else
+ sendto_all_butone(mbuf->mb_connect, "%s%s " TOK_OPMODE " %s %s%s%s%s",
+ NumNick(mbuf->mb_source), mbuf->mb_channel->chname,
+ addbuf, rembuf, addstr, remstr);
+ } else {
+ if (IsServer(mbuf->mb_source))
+ sendto_all_butone(mbuf->mb_connect, "%s " TOK_MODE " %s %s%s%s%s "
+ TIME_T_FMT, NumServ(mbuf->mb_source),
+ mbuf->mb_channel->chname, addbuf, rembuf, addstr,
+ remstr, (mbuf->mb_dest & MODEBUF_DEST_HACK4) ? 0 :
+ mbuf->mb_channel->creationtime);
+ else
+ sendto_all_butone(mbuf->mb_connect, "%s%s " TOK_MODE " %s %s%s%s%s "
+ TIME_T_FMT, NumNick(mbuf->mb_source),
+ mbuf->mb_channel->chname, addbuf, rembuf, addstr,
+ remstr, (mbuf->mb_dest & MODEBUF_DEST_HACK4) ? 0 :
+ mbuf->mb_channel->creationtime);
+ }
}
mbuf->mb_add = 0;
--- /dev/null
+/*
+ * IRC - Internet Relay Chat, ircd/m_tmpl.c
+ * Copyright (C) 1990 Jarkko Oikarinen and
+ * University of Oulu, Computing Center
+ * Copyright (C) 2000 Kevin L. Mitchell <klmitch@mit.edu>
+ *
+ * See file AUTHORS in IRC package for additional names of
+ * the programmers.
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+/*
+ * m_functions execute protocol messages on this server:
+ *
+ * cptr is always NON-NULL, pointing to a *LOCAL* client
+ * structure (with an open socket connected!). This
+ * identifies the physical socket where the message
+ * originated (or which caused the m_function to be
+ * executed--some m_functions may call others...).
+ *
+ * sptr is the source of the message, defined by the
+ * prefix part of the message if present. If not
+ * or prefix not found, then sptr==cptr.
+ *
+ * (!IsServer(cptr)) => (cptr == sptr), because
+ * prefixes are taken *only* from servers...
+ *
+ * (IsServer(cptr))
+ * (sptr == cptr) => the message didn't
+ * have the prefix.
+ *
+ * (sptr != cptr && IsServer(sptr) means
+ * the prefix specified servername. (?)
+ *
+ * (sptr != cptr && !IsServer(sptr) means
+ * that message originated from a remote
+ * user (not local).
+ *
+ * combining
+ *
+ * (!IsServer(sptr)) means that, sptr can safely
+ * taken as defining the target structure of the
+ * message in this server.
+ *
+ * *Always* true (if 'parse' and others are working correct):
+ *
+ * 1) sptr->from == cptr (note: cptr->from == cptr)
+ *
+ * 2) MyConnect(sptr) <=> sptr == cptr (e.g. sptr
+ * *cannot* be a local connection, unless it's
+ * actually cptr!). [MyConnect(x) should probably
+ * be defined as (x == x->from) --msa ]
+ *
+ * parc number of variable parameter strings (if zero,
+ * parv is allowed to be NULL)
+ *
+ * parv a NULL terminated list of parameter pointers,
+ *
+ * parv[0], sender (prefix string), if not present
+ * this points to an empty string.
+ * parv[1]...parv[parc-1]
+ * pointers to additional parameters
+ * parv[parc] == NULL, *always*
+ *
+ * note: it is guaranteed that parv[0]..parv[parc-1] are all
+ * non-NULL pointers.
+ */
+#if 0
+/*
+ * No need to include handlers.h here the signatures must match
+ * and we don't need to force a rebuild of all the handlers everytime
+ * we add a new one to the list. --Bleep
+ */
+#include "handlers.h"
+#endif /* 0 */
+#include "client.h"
+#include "hash.h"
+#include "ircd.h"
+#include "ircd_reply.h"
+#include "ircd_string.h"
+#include "numeric.h"
+#include "numnicks.h"
+#include "send.h"
+
+#include <assert.h>
+
+/*
+ * ms_clearmode - server message handler
+ */
+int ms_clearmode(struct Client* cptr, struct Client* sptr, int parc,
+ char* parv[])
+{
+ return 0;
+}
+
+/*
+ * mo_clearmode - oper message handler
+ */
+int mo_clearmode(struct Client* cptr, struct Client* sptr, int parc,
+ char* parv[])
+{
+ return 0;
+}
+
--- /dev/null
+/*
+ * IRC - Internet Relay Chat, ircd/m_tmpl.c
+ * Copyright (C) 1990 Jarkko Oikarinen and
+ * University of Oulu, Computing Center
+ * Copyright (C) 2000 Kevin L. Mitchell <klmitch@mit.edu>
+ *
+ * See file AUTHORS in IRC package for additional names of
+ * the programmers.
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+/*
+ * m_functions execute protocol messages on this server:
+ *
+ * cptr is always NON-NULL, pointing to a *LOCAL* client
+ * structure (with an open socket connected!). This
+ * identifies the physical socket where the message
+ * originated (or which caused the m_function to be
+ * executed--some m_functions may call others...).
+ *
+ * sptr is the source of the message, defined by the
+ * prefix part of the message if present. If not
+ * or prefix not found, then sptr==cptr.
+ *
+ * (!IsServer(cptr)) => (cptr == sptr), because
+ * prefixes are taken *only* from servers...
+ *
+ * (IsServer(cptr))
+ * (sptr == cptr) => the message didn't
+ * have the prefix.
+ *
+ * (sptr != cptr && IsServer(sptr) means
+ * the prefix specified servername. (?)
+ *
+ * (sptr != cptr && !IsServer(sptr) means
+ * that message originated from a remote
+ * user (not local).
+ *
+ * combining
+ *
+ * (!IsServer(sptr)) means that, sptr can safely
+ * taken as defining the target structure of the
+ * message in this server.
+ *
+ * *Always* true (if 'parse' and others are working correct):
+ *
+ * 1) sptr->from == cptr (note: cptr->from == cptr)
+ *
+ * 2) MyConnect(sptr) <=> sptr == cptr (e.g. sptr
+ * *cannot* be a local connection, unless it's
+ * actually cptr!). [MyConnect(x) should probably
+ * be defined as (x == x->from) --msa ]
+ *
+ * parc number of variable parameter strings (if zero,
+ * parv is allowed to be NULL)
+ *
+ * parv a NULL terminated list of parameter pointers,
+ *
+ * parv[0], sender (prefix string), if not present
+ * this points to an empty string.
+ * parv[1]...parv[parc-1]
+ * pointers to additional parameters
+ * parv[parc] == NULL, *always*
+ *
+ * note: it is guaranteed that parv[0]..parv[parc-1] are all
+ * non-NULL pointers.
+ */
+#if 0
+/*
+ * No need to include handlers.h here the signatures must match
+ * and we don't need to force a rebuild of all the handlers everytime
+ * we add a new one to the list. --Bleep
+ */
+#include "handlers.h"
+#endif /* 0 */
+#include "client.h"
+#include "hash.h"
+#include "ircd.h"
+#include "ircd_reply.h"
+#include "ircd_string.h"
+#include "numeric.h"
+#include "numnicks.h"
+#include "send.h"
+
+#include <assert.h>
+
+/*
+ * ms_opmode - server message handler
+ */
+int ms_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+{
+ return 0;
+}
+
+/*
+ * mo_opmode - oper message handler
+ */
+int mo_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+{
+ return 0;
+}
+
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
{ m_unregistered, m_jupe, ms_jupe, mo_jupe, m_ignore }
},
+ {
+ MSG_OPMODE,
+ TOK_OPMODE,
+ 0, MAXPARA, MFLG_SLOW, 0,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_unregistered, m_not_oper, ms_opmode, mo_opmode, m_ignore }
+ },
+ {
+ MSG_CLEARMODE,
+ TOK_CLEARMODE,
+ 0, MAXPARA, MFLG_SLOW, 0,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_unregistered, m_not_oper, ms_clearmode, mo_clearmode, m_ignore }
+ },
{
MSG_UPING,
TOK_UPING,