]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_user.c
Add chmode +G, which blocks messages in all caps.
[irc/rqf/shadowircd.git] / src / s_user.c
index 1a0bff50cc4fe429eef1be28e0b3384934376cd1..8c9683e9cafb4380bf4493655f94932c3544b9ba 100644 (file)
@@ -68,8 +68,8 @@ int user_modes[256] = {
        /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x3F */
        0,                      /* @ */
        0,                      /* A */
-       0,                      /* B */
-       UMODE_NOCTCP,   /* C */
+       UMODE_BOT,              /* B */
+       UMODE_NOCTCP,           /* C */
        UMODE_DEAF,             /* D */
        0,                      /* E */
        0,                      /* F */
@@ -88,7 +88,7 @@ int user_modes[256] = {
        UMODE_SERVICE,          /* S */
        0,                      /* T */
        0,                      /* U */
-       0,                      /* V */
+       UMODE_NOINVITE,         /* V */
        0,                      /* W */
        0,                      /* X */
        0,                      /* Y */
@@ -109,7 +109,7 @@ int user_modes[256] = {
        0,                      /* m */
        0,                      /* n */
        UMODE_OPER,             /* o */
-       0,                      /* p */
+       UMODE_OVERRIDE,         /* p */
        0,                      /* q */
        0,                      /* r */
        UMODE_SERVNOTICE,       /* s */
@@ -591,6 +591,7 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
        hook_data_umode_changed hdata;
        hook_data_client hdata2;
        char sockhost[HOSTLEN];
+       struct ConfItem *aconf;
 
        if(MyClient(source_p))
                send_umode(source_p, source_p, 0, 0, ubuf);
@@ -703,6 +704,17 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
        hdata2.target = source_p;
        call_hook(h_introduce_client, &hdata2);
 
+       /* Do all the auth::autojoin wizardry once we're connected */
+       if(MyConnect(source_p))
+       {
+               aconf = source_p->localClient->att_conf;
+
+               if(aconf->autojoin != NULL)
+               {
+                       user_join(client_p, source_p, aconf->autojoin, NULL);
+               }
+       }
+
        return 0;
 }
 
@@ -869,6 +881,15 @@ report_and_set_user_flags(struct Client *source_p, struct ConfItem *aconf)
        }
 }
 
+static void
+expire_umode_p(void *data)
+{
+       struct Client *source_p = data;
+       char *parv[4] = {source_p->name, source_p->name, "-p", NULL};
+       source_p->localClient->override_timeout_event = NULL;
+       user_mode(source_p, source_p, 3, parv);
+}
+
 static void
 show_other_user_mode(struct Client *source_p, struct Client *target_p)
 {
@@ -1126,6 +1147,12 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
                source_p->umodes &= ~UMODE_ADMIN;
        }
 
+       if(MyConnect(source_p) && (source_p->umodes & UMODE_OVERRIDE) && (!IsOperOverride(source_p)))
+       {
+               sendto_one_notice(source_p, ":*** You need oper and the override flag for +p");
+               source_p->umodes &= ~UMODE_OVERRIDE;
+       }
+
        /* let modules providing usermodes know that we've changed our usermode --nenolod */
        hdata.client = source_p;
        hdata.oldumodes = setflags;
@@ -1145,6 +1172,17 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
                sendto_one_numeric(source_p, RPL_SNOMASK, form_str(RPL_SNOMASK),
                        construct_snobuf(source_p->snomask));
 
+       if(ConfigFileEntry.expire_override_time && MyClient(source_p) && (source_p->umodes & ~setflags) & UMODE_OVERRIDE)
+       {
+               source_p->localClient->override_timeout_event =
+                       rb_event_addonce("expire_override", expire_umode_p, source_p, ConfigFileEntry.expire_override_time);
+       }
+       else if(MyClient(source_p) && source_p->localClient->override_timeout_event && (setflags & ~source_p->umodes) & UMODE_OVERRIDE)
+       {
+               rb_event_delete(source_p->localClient->override_timeout_event);
+               source_p->localClient->override_timeout_event = NULL;
+       }
+
        return (0);
 }
 
@@ -1281,6 +1319,7 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
 {
        unsigned int old = source_p->umodes, oldsnomask = source_p->snomask;
        hook_data_umode_changed hdata;
+       struct ConfItem *aconf;
 
        SetOper(source_p);
 
@@ -1342,6 +1381,18 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
        sendto_one_notice(source_p, ":*** Oper privs are %s", oper_p->privset->privs);
        send_oper_motd(source_p);
 
+       aconf = source_p->localClient->att_conf;
+
+       /* Do the auth::autojoin_opers wizardry here */
+       if(aconf->autojoin_opers != NULL)
+       {
+               /* opers should never be banned from the opers channel.
+                * Plus this is post-umode being set so you'll pass +I $o or +O.
+                * Hence why we're making this a normal clean join. --jdhore
+                */
+               user_join(&me, source_p, aconf->autojoin_opers, NULL);
+       }
+
        return (1);
 }
 
@@ -1410,7 +1461,7 @@ change_nick_user_host(struct Client *target_p,    const char *nick, const char *use
        struct membership *mscptr;
        int changed = irccmp(target_p->name, nick);
        int changed_case = strcmp(target_p->name, nick);
-       int do_qjm = irccmp(target_p->username, user) || irccmp(target_p->host, host);
+       int do_qjm = irccmp(target_p->username, user) || (irccmp(target_p->host, host) && ConfigChannel.cycle_host_change);
        char mode[10], modeval[NICKLEN * 2 + 2], reason[256], *mptr;
        va_list ap;