+2005-07-14 Michael Poole <mdpoole@troilus.org>
+
+ * 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 <mdpoole@troilus.org>
* doc/example.conf (General): Update comment about vhost to match
struct Client;
struct StatDesc;
+extern struct Client his;
+
/** Contains all feature settings for ircu.
* For documentation of each, see doc/readme.features.
*/
/* 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;
#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. */
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.
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 */
{
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 */
&& (!(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);
}
}
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));
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)
{
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)) &&