]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Add operator::vhost option.
authorB.Greenham <redacted>
Tue, 2 Mar 2010 23:46:08 +0000 (18:46 -0500)
committerB.Greenham <redacted>
Tue, 2 Mar 2010 23:46:08 +0000 (18:46 -0500)
TODO-SHADOW
doc/example.conf
doc/reference.conf
include/s_newconf.h
src/newconf.c
src/s_user.c

index da318006a658429cc5e93b3404dfb7cb00d92638..3b1f247909444f035c551551268a63f14efe401c 100644 (file)
@@ -6,7 +6,6 @@ Todo list for ShadowIRCd 6.0
 * kicknorejoin (+J in inspircd chmode)
 * operoverride umode (+p), steal this from ircd-seven
 * immune cmode (+M), steal this from ircd-seven too
-* host-on-operup: vhost that gets applied to you on oper-up. A surprising number of people want this.
 * Anything else we think of between now and release. :P
 
 Todo list for ShadowIRCd 6.1
index 1e9234b6407736fdc87846a877d37cc467563500..acf17509a89c58a4d73676fa45f07bd281b9a140 100755 (executable)
@@ -272,6 +272,12 @@ operator "god" {
         */
        snomask = "+Zbfkrsuy";
 
+       /* vhost: defines the vhost that this oper will get on oper up.
+        * this must be a valid hostmask. If this is specified the oper
+        * will not be given default_operhost.
+        */
+       vhost = "is.an.oper";
+
        /* flags: misc options for the operator.  You may prefix an option
         * with ~ to disable it, e.g. ~encrypted.
         *
index 5642ad79e7ec7aface5544c5a9233928b6ae3706..7978cb4b5af5d1b7c285b4cbbf4e5261895a567b 100755 (executable)
@@ -485,6 +485,12 @@ operator "god" {
         */
        snomask = "+Zbfkrsuy";
 
+       /* vhost: defines the vhost that this oper will get on oper up.
+        * this must be a valid hostmask. If this is specified the oper
+        * will not be given default_operhost.
+        */
+       vhost = "is.an.oper";
+
        /* flags: misc options for the operator.  You may prefix an option
         * with ~ to disable it, e.g. ~encrypted.
         *
index 9b76f1e876249e74782a4e98c4fe4e1b94db29e7..847826ea5201b632b2e44524743a51ce603b7a0e 100644 (file)
@@ -119,6 +119,8 @@ struct oper_conf
 
        unsigned int snomask;
 
+       char *vhost;
+
        struct PrivilegeSet *privset;
 
 #ifdef HAVE_LIBCRYPTO
index ffdc34b8c5372a6700861972a860ef6ef8b9cb81..ebe7437f0b1aeaaf954bb3cb9b77fa0faa4e611a 100644 (file)
@@ -571,6 +571,10 @@ conf_end_oper(struct TopConf *tc)
                yy_tmpoper->flags = yy_oper->flags;
                yy_tmpoper->umodes = yy_oper->umodes;
                yy_tmpoper->snomask = yy_oper->snomask;
+               if(valid_hostname(yy_oper->vhost))
+                       yy_tmpoper->vhost = rb_strdup(yy_oper->vhost);
+               else
+                       conf_report_error("Ignoring vhost setting for oper %s -- invalid hostmask.", yy_oper->name);
                yy_tmpoper->privset = yy_oper->privset;
 
 #ifdef HAVE_LIBCRYPTO
@@ -700,6 +704,12 @@ conf_set_oper_snomask(void *data)
        yy_oper->snomask = parse_snobuf_to_mask(0, (const char *) data);
 }
 
+static void
+conf_set_oper_vhost(void *data)
+{
+       yy_oper->vhost = rb_strdup((char *) data);
+}
+
 static int
 conf_begin_class(struct TopConf *tc)
 {
@@ -2066,6 +2076,7 @@ static struct ConfEntry conf_operator_table[] =
        { "umodes",     CF_STRING | CF_FLIST, conf_set_oper_umodes,     0, NULL },
        { "privset",    CF_QSTRING, conf_set_oper_privset,      0, NULL },
        { "snomask",    CF_QSTRING, conf_set_oper_snomask,      0, NULL },
+       { "vhost",      CF_QSTRING, conf_set_oper_vhost,        0, NULL },
        { "user",       CF_QSTRING, conf_set_oper_user,         0, NULL },
        { "password",   CF_QSTRING, conf_set_oper_password,     0, NULL },
        { "fingerprint",        CF_QSTRING, conf_set_oper_fingerprint,  0, NULL },
index 062b0ed12efd61207de82194750c7b1ebb3f4e1e..c1ec57de8b75169f78508dc72e83554dced54820 100644 (file)
@@ -1310,9 +1310,12 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
        else
                source_p->umodes |= DEFAULT_OPER_UMODES;
 
-       if(!EmptyString(ConfigFileEntry.default_operhost))
+       if(oper_p->vhost || !EmptyString(ConfigFileEntry.default_operhost))
        {
-               change_nick_user_host(source_p, source_p->name, source_p->username, ConfigFileEntry.default_operhost, 0, "Changing host");
+               if(oper_p->vhost)
+                       change_nick_user_host(source_p, source_p->name, source_p->username, oper_p->vhost, 0, "Changing host");
+               else
+                       change_nick_user_host(source_p, source_p->name, source_p->username, ConfigFileEntry.default_operhost, 0, "Changing host");
                
                sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host (set by %s)", source_p->host, source_p->servptr->name);