CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_11_03
Commit time: 2002-12-03 20:57:27 UTC
Modified files:
Tag: u2_10_11_03
include/handlers.h include/msg.h include/send.h
include/supported.h ircd/Makefile.in ircd/m_wallchops.c
ircd/parse.c ircd/send.c
Added files:
Tag: u2_10_11_03
ircd/m_wallvoices.c
Log message:
Author: hikari <[EMAIL PROTECTED]>
Log message:
Addition of a WALLVOICES command to go with WALLCHOPS. A WALLVOICES will
go to all +v and +o users on a channel. Command format is the same as
WALLCHOPS.
/me places a little red teapot in the centre of the CVS repository.
---------------------- diff included ----------------------
Index: ircu2.10/include/handlers.h
diff -u ircu2.10/include/handlers.h:1.12.2.5 ircu2.10/include/handlers.h:1.12.2.5.8.1
--- ircu2.10/include/handlers.h:1.12.2.5 Fri Jun 7 08:56:36 2002
+++ ircu2.10/include/handlers.h Tue Dec 3 12:56:58 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: handlers.h,v 1.12.2.5 2002/06/07 15:56:36 vampire Exp $
+ * $Id: handlers.h,v 1.12.2.5.8.1 2002/12/03 20:56:58 shad0w Exp $
*/
#ifndef INCLUDED_handlers_h
#define INCLUDED_handlers_h
@@ -132,6 +132,7 @@
extern int m_userip(struct Client*, struct Client*, int, char*[]);
extern int m_version(struct Client*, struct Client*, int, char*[]);
extern int m_wallchops(struct Client*, struct Client*, int, char*[]);
+extern int m_wallvoices(struct Client*, struct Client*, int, char*[]);
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*[]);
@@ -215,6 +216,7 @@
extern int ms_uping(struct Client*, struct Client*, int, char*[]);
extern int ms_version(struct Client*, struct Client*, int, char*[]);
extern int ms_wallchops(struct Client*, struct Client*, int, char*[]);
+extern int ms_wallvoices(struct Client*, struct Client*, int, char*[]);
extern int ms_wallops(struct Client*, struct Client*, int, char*[]);
extern int ms_wallusers(struct Client*, struct Client*, int, char*[]);
extern int ms_whois(struct Client*, struct Client*, int, char*[]);
Index: ircu2.10/include/msg.h
diff -u ircu2.10/include/msg.h:1.11.2.2 ircu2.10/include/msg.h:1.11.2.2.8.1
--- ircu2.10/include/msg.h:1.11.2.2 Fri Jun 7 08:56:36 2002
+++ ircu2.10/include/msg.h Tue Dec 3 12:57:00 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: msg.h,v 1.11.2.2 2002/06/07 15:56:36 vampire Exp $
+ * $Id: msg.h,v 1.11.2.2.8.1 2002/12/03 20:57:00 shad0w Exp $
*/
#ifndef INCLUDED_msg_h
#define INCLUDED_msg_h
@@ -197,6 +197,10 @@
#define MSG_WALLCHOPS "WALLCHOPS" /* WC */
#define TOK_WALLCHOPS "WC"
#define CMD_WALLCHOPS MSG_WALLCHOPS, TOK_WALLCHOPS
+
+#define MSG_WALLVOICES "WALLVOICES" /* WV */
+#define TOK_WALLVOICES "WV"
+#define CMD_WALLVOICES MSG_WALLVOICES, TOK_WALLVOICES
#define MSG_CPRIVMSG "CPRIVMSG" /* CPRI */
#define TOK_CPRIVMSG "CP"
Index: ircu2.10/include/send.h
diff -u ircu2.10/include/send.h:1.15.2.3 ircu2.10/include/send.h:1.15.2.3.8.1
--- ircu2.10/include/send.h:1.15.2.3 Sun May 5 12:18:37 2002
+++ ircu2.10/include/send.h Tue Dec 3 12:57:01 2002
@@ -1,7 +1,7 @@
/*
* send.h
*
- * $Id: send.h,v 1.15.2.3 2002/05/05 19:18:37 kev Exp $
+ * $Id: send.h,v 1.15.2.3.8.1 2002/12/03 20:57:01 shad0w Exp $
*/
#ifndef INCLUDED_send_h
#define INCLUDED_send_h
@@ -72,6 +72,8 @@
#define SKIP_DEAF 0x01 /* skip users that are +d */
#define SKIP_BURST 0x02 /* skip users that are bursting */
#define SKIP_NONOPS 0x04 /* skip users that aren't chanops */
+#define SKIP_NONVOICES 0x08 /* skip users that aren't voiced (includes
+ chanops) */
/* Send command to all users having a particular flag set */
extern void sendwallto_group_butone(struct Client *from, int type,
Index: ircu2.10/include/supported.h
diff -u ircu2.10/include/supported.h:1.9.2.5 ircu2.10/include/supported.h:1.9.2.5.4.1
--- ircu2.10/include/supported.h:1.9.2.5 Sat Sep 14 13:44:32 2002
+++ ircu2.10/include/supported.h Tue Dec 3 12:57:02 2002
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: supported.h,v 1.9.2.5 2002/09/14 20:44:32 kev Exp $
+ * $Id: supported.h,v 1.9.2.5.4.1 2002/12/03 20:57:02 shad0w Exp $
*
* Description: This file has the featureset that ircu announces on connecting
* a client. It's in this .h because it's likely to be appended
@@ -34,6 +34,7 @@
#define FEATURES1 \
"WHOX"\
" WALLCHOPS"\
+ " WALLVOICES"\
" USERIP"\
" CPRIVMSG"\
" CNOTICE"\
Index: ircu2.10/ircd/Makefile.in
diff -u ircu2.10/ircd/Makefile.in:1.37.2.9 ircu2.10/ircd/Makefile.in:1.37.2.9.8.1
--- ircu2.10/ircd/Makefile.in:1.37.2.9 Thu Aug 22 14:00:51 2002
+++ ircu2.10/ircd/Makefile.in Tue Dec 3 12:57:04 2002
@@ -166,6 +166,7 @@
m_userip.c \
m_version.c \
m_wallchops.c \
+ m_wallvoices.c \
m_wallops.c \
m_wallusers.c \
m_who.c \
@@ -957,6 +958,13 @@
../include/s_user.h ../include/send.h ../include/supported.h \
../include/channel.h ../include/version.h
m_wallchops.o: m_wallchops.c ../config.h ../include/channel.h \
+ ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \
+ ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
+ ../include/hash.h ../include/ircd.h ../include/struct.h \
+ ../include/ircd_reply.h ../include/ircd_string.h \
+ ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \
+ ../include/numnicks.h ../include/s_user.h ../include/send.h
+m_wallvoices.o: m_wallvoices.c ../config.h ../include/channel.h \
../include/ircd_defs.h ../include/client.h ../include/dbuf.h \
../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
../include/hash.h ../include/ircd.h ../include/struct.h \
Index: ircu2.10/ircd/m_wallchops.c
diff -u ircu2.10/ircd/m_wallchops.c:1.5.10.1 ircu2.10/ircd/m_wallchops.c:1.5.10.2
--- ircu2.10/ircd/m_wallchops.c:1.5.10.1 Sat Nov 23 11:05:09 2002
+++ ircu2.10/ircd/m_wallchops.c Tue Dec 3 12:57:11 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_wallchops.c,v 1.5.10.1 2002/11/23 19:05:09 klmitch Exp $
+ * $Id: m_wallchops.c,v 1.5.10.2 2002/12/03 20:57:11 shad0w Exp $
*/
/*
@@ -120,7 +120,7 @@
return 0;
sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
- "%H :%s", chptr, parv[parc - 1]);
+ "%H :@ %s", chptr, parv[parc - 1]);
}
else
send_reply(sptr, ERR_CANNOTSENDTOCHAN, parv[1]);
@@ -147,7 +147,7 @@
if (client_can_send_to_channel(sptr, chptr)) {
sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
- "%H :%s", chptr, parv[parc - 1]);
+ "%H :@ %s", chptr, parv[parc - 1]);
} else
send_reply(sptr, ERR_CANNOTSENDTOCHAN, parv[1]);
}
Index: ircu2.10/ircd/m_wallvoices.c
diff -u /dev/null ircu2.10/ircd/m_wallvoices.c:1.1.2.1
--- /dev/null Tue Dec 3 12:57:29 2002
+++ ircu2.10/ircd/m_wallvoices.c Tue Dec 3 12:57:12 2002
@@ -0,0 +1,154 @@
+/*
+ * IRC - Internet Relay Chat, ircd/m_wallvoices.c
+ * Copyright (c) 2002 hikari
+ *
+ * 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_wallvoices.c,v 1.1.2.1 2002/12/03 20:57:12 shad0w Exp $
+ */
+
+/*
+ * 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.
+ */
+#include "config.h"
+
+#include "channel.h"
+#include "client.h"
+#include "hash.h"
+#include "ircd.h"
+#include "ircd_reply.h"
+#include "ircd_string.h"
+#include "msg.h"
+#include "numeric.h"
+#include "numnicks.h"
+#include "s_user.h"
+#include "send.h"
+
+#include <assert.h>
+
+/*
+ * m_wallvoices - local generic message handler
+ */
+int m_wallvoices(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+{
+ struct Channel *chptr;
+
+ assert(0 != cptr);
+ assert(cptr == sptr);
+
+ cli_flags(sptr) &= ~FLAGS_TS8;
+
+ if (parc < 2 || EmptyString(parv[1]))
+ return send_reply(sptr, ERR_NORECIPIENT, "WALLVOICES");
+
+ if (parc < 3 || EmptyString(parv[parc - 1]))
+ return send_reply(sptr, ERR_NOTEXTTOSEND);
+
+ if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
+ if (client_can_send_to_channel(sptr, chptr)) {
+ if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
+ check_target_limit(sptr, chptr, chptr->chname, 0))
+ return 0;
+ sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr,
+ SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES,
+ "%H :+ %s", chptr, parv[parc - 1]);
+ }
+ else
+ send_reply(sptr, ERR_CANNOTSENDTOCHAN, parv[1]);
+ }
+ else
+ send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]);
+
+ return 0;
+}
+
+/*
+ * ms_wallvoices - server message handler
+ */
+int ms_wallvoices(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+{
+ struct Channel *chptr;
+ assert(0 != cptr);
+ assert(0 != sptr);
+
+ if (parc < 3 || !IsUser(sptr))
+ return 0;
+
+ if ((chptr = FindChannel(parv[1]))) {
+ if (client_can_send_to_channel(sptr, chptr)) {
+ sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr,
+ SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES,
+ "%H :+ %s", chptr, parv[parc - 1]);
+ } else
+ send_reply(sptr, ERR_CANNOTSENDTOCHAN, parv[1]);
+ }
+ return 0;
+}
Index: ircu2.10/ircd/parse.c
diff -u ircu2.10/ircd/parse.c:1.30.2.7 ircu2.10/ircd/parse.c:1.30.2.7.8.1
--- ircu2.10/ircd/parse.c:1.30.2.7 Wed Jul 17 15:55:41 2002
+++ ircu2.10/ircd/parse.c Tue Dec 3 12:57:13 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: parse.c,v 1.30.2.7 2002/07/17 22:55:41 kev Exp $
+ * $Id: parse.c,v 1.30.2.7.8.1 2002/12/03 20:57:13 shad0w Exp $
*/
#include "config.h"
@@ -91,6 +91,13 @@
0, MAXPARA, MFLG_SLOW, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
{ m_unregistered, m_wallchops, ms_wallchops, m_wallchops, m_ignore }
+ },
+ {
+ MSG_WALLVOICES,
+ TOK_WALLVOICES,
+ 0, MAXPARA, MFLG_SLOW, 0,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_unregistered, m_wallvoices, ms_wallvoices, m_wallvoices, m_ignore }
},
{
MSG_CPRIVMSG,
Index: ircu2.10/ircd/send.c
diff -u ircu2.10/ircd/send.c:1.44.2.8.8.1 ircu2.10/ircd/send.c:1.44.2.8.8.2
--- ircu2.10/ircd/send.c:1.44.2.8.8.1 Sat Nov 23 11:05:10 2002
+++ ircu2.10/ircd/send.c Tue Dec 3 12:57:14 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: send.c,v 1.44.2.8.8.1 2002/11/23 19:05:10 klmitch Exp $
+ * $Id: send.c,v 1.44.2.8.8.2 2002/12/03 20:57:14 shad0w Exp $
*/
#include "config.h"
@@ -480,8 +480,8 @@
/* Build buffer to send to users */
va_start(vd.vd_args, pattern);
- user_mb = msgq_make(0, skip & SKIP_NONOPS ? "%:#C %s @%v" : "%:#C %s %v",
- from, skip & SKIP_NONOPS ? MSG_NOTICE : cmd, &vd);
+ user_mb = msgq_make(0, skip & (SKIP_NONOPS | SKIP_NONVOICES) ? "%:#C %s @%v" :
+"%:#C %s %v",
+ from, skip & (SKIP_NONOPS | SKIP_NONVOICES) ? MSG_NOTICE : cmd, &vd);
va_end(vd.vd_args);
/* Build buffer to send to servers */
@@ -496,6 +496,7 @@
if (cli_from(member->user) == one || IsZombie(member) ||
(skip & SKIP_DEAF && IsDeaf(member->user)) ||
(skip & SKIP_NONOPS && !IsChanOp(member)) ||
+ (skip & SKIP_NONVOICES && !HasVoice(member) && !IsChanOp(member)) ||
(skip & SKIP_BURST && IsBurstOrBurstAck(cli_from(member->user))) ||
cli_fd(cli_from(member->user)) < 0 ||
sentalong[cli_fd(cli_from(member->user))] == sentalong_marker)
----------------------- End of diff -----------------------