Use HIS_SERVERNAME instead of cli_name(&me) for a variety of
[ircu2.10.12-pk.git] / ircd / ircd_features.c
index 26a028977290fdfdc3b90a7daa8e5a91d85eb2d1..8f5b1cea10dd9373493a18b2c1e72fa071560fe7 100644 (file)
@@ -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 @@ feature_log_reset(struct Client* from, const char* const* fields, int count)
   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 @@ static struct FeatureDesc {
   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 @@ feature_init(void)
 {
   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 */