]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_user.c
Add is_halfop() and is_owner() and start using them in the new functions.
[irc/rqf/shadowircd.git] / src / s_user.c
index 862e9c71adefde9d5900031ecd36dc863135615b..198249c8f7c196fc5d043317d16560f9201db24a 100644 (file)
@@ -68,12 +68,12 @@ 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 */
-       0,                      /* C */
+       UMODE_BOT,              /* B */
+       UMODE_NOCTCP,           /* C */
        UMODE_DEAF,             /* D */
        0,                      /* E */
        0,                      /* F */
-       0,                      /* G */
+       UMODE_SCALLERID,        /* G */
        0,                      /* H */
        0,                      /* I */
        0,                      /* J */
@@ -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 */
@@ -420,7 +420,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
           (xconf = find_xline(source_p->info, 1)) != NULL)
        {
                ServerStats.is_ref++;
-               add_reject(source_p, xconf->name, NULL);
+               add_reject(source_p, xconf->host, NULL);
                exit_client(client_p, source_p, &me, "Bad user info");
                return CLIENT_EXITED;
        }
@@ -561,7 +561,9 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
 
        /* they get a reduced limit */
        if(find_tgchange(source_p->sockhost))
-               USED_TARGETS(source_p) = 6;
+               source_p->localClient->targets_free = TGCHANGE_INITIAL_LOW;
+       else
+               source_p->localClient->targets_free = TGCHANGE_INITIAL;
 
        monitor_signon(source_p);
        user_welcome(source_p);
@@ -589,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);
@@ -633,6 +636,11 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
                      IsIPSpoof(source_p) ? "0" : sockhost,
                      source_p->id, source_p->info);
 
+       if(!EmptyString(source_p->certfp))
+               sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
+                               ":%s ENCAP * CERTFP :%s",
+                               use_id(source_p), source_p->certfp);
+
        if (IsDynSpoof(source_p))
        {
                sendto_server(client_p, NULL, CAP_TS6, use_euid ? CAP_EUID : NOCAPS, ":%s ENCAP * REALHOST %s",
@@ -696,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;
 }
 
@@ -1119,6 +1138,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;
@@ -1274,6 +1299,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);
 
@@ -1335,6 +1361,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);
 }
 
@@ -1403,7 +1441,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;