Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2005-07-15 03:03:00 UTC
Modified files:
ChangeLog include/ircd_features.h ircd/channel.c
ircd/ircd_features.c ircd/m_burst.c ircd/m_whois.c ircd/s_misc.c
Log message:
Use HIS_SERVERNAME instead of cli_name(&me) for a variety of
user-visible messages where the real source is hidden.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.662 ircu2.10/ChangeLog:1.663
--- ircu2.10/ChangeLog:1.662 Thu Jul 14 18:53:11 2005
+++ ircu2.10/ChangeLog Thu Jul 14 20:02:29 2005
@@ -1,5 +1,23 @@
2005-07-14 Michael Poole <[EMAIL PROTECTED]>
+ * include/ircd_features.h: Declare new "his" pseudo-server to hold
+ FEAT_HIS_SERVERNAME and FEAT_HIS_SERVERINFO in a convenient place.
+
+ * ircd/ircd_features.c: Initialize and update it.
+
+ * ircd/channel.c (modebuf_flush_int): Use it as the apparent
+ source for opmodes and server mode changes (also when the source
+ is me).
+
+ * ircd/m_burst.c (ms_burst): Use it as the apparent source for net
+ rider kicks.
+
+ * ircd/m_whois.c (do_whois): Use it to simplify code here.
+
+ * ircd/s_misc.c (exit_client): Use it as the apparent killer.
+
+2005-07-14 Michael Poole <[EMAIL PROTECTED]>
+
* doc/example.conf (General): Update comment about vhost to match
the code change below.
Index: ircu2.10/include/ircd_features.h
diff -u ircu2.10/include/ircd_features.h:1.37
ircu2.10/include/ircd_features.h:1.38
--- ircu2.10/include/ircd_features.h:1.37 Mon Jul 11 19:47:07 2005
+++ ircu2.10/include/ircd_features.h Thu Jul 14 20:02:32 2005
@@ -20,12 +20,14 @@
*/
/** @file
* @brief Public interfaces and declarations for dealing with configurable
features.
- * @version $Id: ircd_features.h,v 1.37 2005/07/12 02:47:07 entrope Exp $
+ * @version $Id: ircd_features.h,v 1.38 2005/07/15 03:02:32 entrope Exp $
*/
struct Client;
struct StatDesc;
+extern struct Client his;
+
/** Contains all feature settings for ircu.
* For documentation of each, see doc/readme.features.
*/
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.135 ircu2.10/ircd/channel.c:1.136
--- ircu2.10/ircd/channel.c:1.135 Thu Jul 14 18:53:12 2005
+++ ircu2.10/ircd/channel.c Thu Jul 14 20:02:48 2005
@@ -19,7 +19,7 @@
*/
/** @file
* @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.135 2005/07/15 01:53:12 entrope Exp $
+ * @version $Id: channel.c,v 1.136 2005/07/15 03:02:48 entrope Exp $
*/
#include "config.h"
@@ -1630,8 +1630,8 @@
/* Ok, if we were given the OPMODE flag, or its a server, hide the source.
*/
- if (mbuf->mb_dest & MODEBUF_DEST_OPMODE || IsServer(mbuf->mb_source))
- app_source = &me;
+ if (mbuf->mb_dest & MODEBUF_DEST_OPMODE || IsServer(mbuf->mb_source) ||
IsMe(mbuf->mb_source))
+ app_source = &his;
else
app_source = mbuf->mb_source;
Index: ircu2.10/ircd/ircd_features.c
diff -u ircu2.10/ircd/ircd_features.c:1.48 ircu2.10/ircd/ircd_features.c:1.49
--- ircu2.10/ircd/ircd_features.c:1.48 Mon Jul 11 19:47:08 2005
+++ ircu2.10/ircd/ircd_features.c Thu Jul 14 20:02:49 2005
@@ -18,7 +18,7 @@
*/
/** @file
* @brief Implementation of configurable feature support.
- * @version $Id: ircd_features.c,v 1.48 2005/07/12 02:47:08 entrope Exp $
+ * @version $Id: ircd_features.c,v 1.49 2005/07/15 03:02:49 entrope Exp $
*/
#include "config.h"
@@ -50,6 +50,8 @@
#include <stdlib.h>
#include <string.h>
+struct Client his;
+
/** List of log output types that can be set */
static struct LogTypes {
char *type; /**< Settable name. */
@@ -160,6 +162,20 @@
return 0;
}
+/** Handle an update to FEAT_HIS_SERVERNAME. */
+static void
+feature_notify_servername(void)
+{
+ ircd_strncpy(cli_name(&his), feature_str(FEAT_HIS_SERVERNAME), HOSTLEN);
+}
+
+/** Handle an update to FEAT_HIS_SERVERINFO. */
+static void
+feature_notify_serverinfo(void)
+{
+ ircd_strncpy(cli_info(&his), feature_str(FEAT_HIS_SERVERINFO), REALLEN);
+}
+
/** Report the value of a log setting.
* @param[in] from &Client asking for details.
* @param[in] fields Array of parameters to get.
@@ -381,8 +397,8 @@
F_B(HIS_REWRITE, 0, 1, 0),
F_I(HIS_REMOTE, 0, 1, 0),
F_B(HIS_NETSPLIT, 0, 1, 0),
- F_S(HIS_SERVERNAME, 0, "*.undernet.org", 0),
- F_S(HIS_SERVERINFO, 0, "The Undernet Underworld", 0),
+ F_S(HIS_SERVERNAME, 0, "*.undernet.org", feature_notify_servername),
+ F_S(HIS_SERVERINFO, 0, "The Undernet Underworld", feature_notify_serverinfo),
F_S(HIS_URLSERVERS, 0, "http://www.undernet.org/servers.php", 0),
/* Misc. random stuff */
@@ -750,6 +766,9 @@
{
int i;
+ cli_magic(&his) = CLIENT_MAGIC;
+ cli_status(&his) = STAT_SERVER;
+
for (i = 0; features[i].type; i++) {
switch (features[i].flags & FEAT_MASK) {
case FEAT_NONE: /* you're on your own */
Index: ircu2.10/ircd/m_burst.c
diff -u ircu2.10/ircd/m_burst.c:1.35 ircu2.10/ircd/m_burst.c:1.36
--- ircu2.10/ircd/m_burst.c:1.35 Thu Jun 16 20:55:13 2005
+++ ircu2.10/ircd/m_burst.c Thu Jul 14 20:02:49 2005
@@ -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_burst.c,v 1.35 2005/06/17 03:55:13 entrope Exp $
+ * $Id: m_burst.c,v 1.36 2005/07/15 03:02:49 entrope Exp $
*/
/*
@@ -249,7 +249,7 @@
&& (!(check_modes & MODE_REGONLY) || IsAccount(member->user)))
continue;
sendcmdto_serv_butone(&me, CMD_KICK, NULL, "%H %C :Net Rider",
chptr, member->user);
- sendcmdto_channel_butserv_butone(&me, CMD_KICK, chptr, NULL, 0, "%H
%C :Net Rider", chptr, member->user);
+ sendcmdto_channel_butserv_butone(&his, CMD_KICK, chptr, NULL, 0, "%H
%C :Net Rider", chptr, member->user);
make_zombie(member, member->user, &me, &me, chptr);
}
}
Index: ircu2.10/ircd/m_whois.c
diff -u ircu2.10/ircd/m_whois.c:1.35 ircu2.10/ircd/m_whois.c:1.36
--- ircu2.10/ircd/m_whois.c:1.35 Sun Mar 20 08:06:28 2005
+++ ircu2.10/ircd/m_whois.c Thu Jul 14 20:02:49 2005
@@ -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_whois.c,v 1.35 2005/03/20 16:06:28 entrope Exp $
+ * $Id: m_whois.c,v 1.36 2005/07/15 03:02:49 entrope Exp $
*/
/*
@@ -137,7 +137,8 @@
const struct User* user = cli_user(acptr);
const char* name = (!*(cli_name(acptr))) ? "?" : cli_name(acptr);
- a2cptr = user->server;
+ a2cptr = feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsAnOper(sptr)
+ && sptr != acptr ? user->server : &his;
assert(user);
send_reply(sptr, RPL_WHOISUSER, name, user->username, user->host,
cli_info(acptr));
@@ -196,13 +197,8 @@
send_reply(sptr, RPL_WHOISCHANNELS, name, buf);
}
- if (feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsAnOper(sptr) &&
- sptr != acptr)
- send_reply(sptr, RPL_WHOISSERVER, name, feature_str(FEAT_HIS_SERVERNAME),
- feature_str(FEAT_HIS_SERVERINFO));
- else
- send_reply(sptr, RPL_WHOISSERVER, name, cli_name(a2cptr),
- cli_info(a2cptr));
+ send_reply(sptr, RPL_WHOISSERVER, name, cli_name(a2cptr),
+ cli_info(a2cptr));
if (user)
{
Index: ircu2.10/ircd/s_misc.c
diff -u ircu2.10/ircd/s_misc.c:1.49 ircu2.10/ircd/s_misc.c:1.50
--- ircu2.10/ircd/s_misc.c:1.49 Mon Jun 27 06:11:51 2005
+++ ircu2.10/ircd/s_misc.c Thu Jul 14 20:02:50 2005
@@ -22,7 +22,7 @@
*/
/** @file
* @brief Miscellaneous support functions.
- * @version $Id: s_misc.c,v 1.49 2005/06/27 13:11:51 entrope Exp $
+ * @version $Id: s_misc.c,v 1.50 2005/07/15 03:02:50 entrope Exp $
*/
#include "config.h"
@@ -401,8 +401,9 @@
cli_name(killer), comment);
else
sendrawto_one(victim, MSG_ERROR " :Closing Link: %s by %s (%s)",
- cli_name(victim), IsServer(killer) ? cli_name(&me) :
- cli_name(killer), comment);
+ cli_name(victim),
+ cli_name(IsServer(killer) ? &his : killer),
+ comment);
}
}
if ((IsServer(victim) || IsHandshake(victim) || IsConnecting(victim)) &&
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches