]> jfr.im git - solanum.git/blobdiff - src/s_user.c
Fix various printf arg types.
[solanum.git] / src / s_user.c
index 7d7bc1b94cc8af544c7754d7ceef750f6a5ecd97..120088484a8b17aaa678ed787d2c1add48cc8882 100644 (file)
@@ -54,6 +54,7 @@
 #include "blacklist.h"
 #include "substitution.h"
 #include "chmode.h"
+#include "s_assert.h"
 
 static void report_and_set_user_flags(struct Client *, struct ConfItem *);
 void user_welcome(struct Client *source_p);
@@ -152,16 +153,18 @@ show_lusers(struct Client *source_p)
 
        sendto_one_numeric(source_p, RPL_LUSERCLIENT, form_str(RPL_LUSERCLIENT),
                           (Count.total - Count.invisi),
-                          Count.invisi, rb_dlink_list_length(&global_serv_list));
+                          Count.invisi,
+                          (int)rb_dlink_list_length(&global_serv_list));
 
        if(rb_dlink_list_length(&oper_list) > 0)
                sendto_one_numeric(source_p, RPL_LUSEROP, 
-                                  form_str(RPL_LUSEROP), rb_dlink_list_length(&oper_list));
+                                  form_str(RPL_LUSEROP),
+                                  (int)rb_dlink_list_length(&oper_list));
 
        if(rb_dlink_list_length(&unknown_list) > 0)
                sendto_one_numeric(source_p, RPL_LUSERUNKNOWN, 
                                   form_str(RPL_LUSERUNKNOWN),
-                                  rb_dlink_list_length(&unknown_list));
+                                  (int)rb_dlink_list_length(&unknown_list));
 
        if(rb_dlink_list_length(&global_channel_list) > 0)
                sendto_one_numeric(source_p, RPL_LUSERCHANNELS, 
@@ -169,14 +172,14 @@ show_lusers(struct Client *source_p)
                                   rb_dlink_list_length(&global_channel_list));
 
        sendto_one_numeric(source_p, RPL_LUSERME, form_str(RPL_LUSERME),
-                          rb_dlink_list_length(&lclient_list),
-                          rb_dlink_list_length(&serv_list));
+                          (int)rb_dlink_list_length(&lclient_list),
+                          (int)rb_dlink_list_length(&serv_list));
 
        sendto_one_numeric(source_p, RPL_LOCALUSERS, 
                           form_str(RPL_LOCALUSERS),
-                          rb_dlink_list_length(&lclient_list),
+                          (int)rb_dlink_list_length(&lclient_list),
                           Count.max_loc,
-                          rb_dlink_list_length(&lclient_list),
+                          (int)rb_dlink_list_length(&lclient_list),
                           Count.max_loc);
 
        sendto_one_numeric(source_p, RPL_GLOBALUSERS, form_str(RPL_GLOBALUSERS),
@@ -260,8 +263,6 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
                return -1;
 
        client_p->localClient->last = rb_current_time();
-       /* Straight up the maximum rate of flooding... */
-       source_p->localClient->allow_read = MAX_FLOOD_BURST;
 
        /* XXX - fixme. we shouldnt have to build a users buffer twice.. */
        if(!IsGotId(source_p) && (strchr(username, '[') != NULL))
@@ -336,7 +337,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
                }
 
                /* dont replace username if its supposed to be spoofed --fl */
-               if(!IsConfDoSpoofIp(aconf) || !strchr(aconf->name, '@'))
+               if(!IsConfDoSpoofIp(aconf) || !strchr(aconf->info.name, '@'))
                {
                        p = username;
 
@@ -374,7 +375,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
                else
                        encr = source_p->localClient->passwd;
 
-               if(strcmp(encr, aconf->passwd))
+               if(encr == NULL || strcmp(encr, aconf->passwd))
                {
                        ServerStats.is_ref++;
                        sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), me.name, source_p->name);
@@ -545,8 +546,6 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
        if(++Count.total > Count.max_tot)
                Count.max_tot = Count.total;
 
-       source_p->localClient->allow_read = MAX_FLOOD_BURST;
-
        Count.totalrestartcount++;
 
        s_assert(source_p->localClient != NULL);
@@ -561,7 +560,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);
@@ -633,6 +634,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",
@@ -647,8 +653,8 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
 
        if(MyConnect(source_p) && source_p->localClient->passwd)
        {
-               if (ConfigFileEntry.identifyservice[0] != '\0' &&
-                               ConfigFileEntry.identifycommand[0] != '\0')
+               if (!EmptyString(ConfigFileEntry.identifyservice) &&
+                               !EmptyString(ConfigFileEntry.identifycommand))
                {
                        /* use user@server */
                        p = strchr(ConfigFileEntry.identifyservice, '@');
@@ -1066,7 +1072,8 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
                        }
                        /* FALLTHROUGH */
                default:
-                       if (MyConnect(source_p) && *pm == 'Q' && !ConfigChannel.use_forward) {
+                       if (MyConnect(source_p) && *pm == 'Q' && !ConfigChannel.use_forward)
+                       {
                                badflag = YES;
                                break;
                        }
@@ -1422,7 +1429,7 @@ change_nick_user_host(struct Client *target_p,    const char *nick, const char *use
                vsnprintf(reason, 255, format, ap);
                va_end(ap);
 
-               sendto_common_channels_local_butone(target_p, ":%s!%s@%s QUIT :%s",
+               sendto_common_channels_local_butone(target_p, NOCAPS, ":%s!%s@%s QUIT :%s",
                                target_p->name, target_p->username, target_p->host,
                                reason);
 
@@ -1447,8 +1454,13 @@ change_nick_user_host(struct Client *target_p,   const char *nick, const char *use
 
                        *mptr = '\0';
 
-                       sendto_channel_local_butone(target_p, ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
-                                       nick, user, host, chptr->chname);
+                       sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN, chptr,
+                                                                   ":%s!%s@%s JOIN %s", nick, user, host, chptr->chname);
+                       sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, CLICAP_EXTENDED_JOIN, NOCAPS, chptr,
+                                                                   ":%s!%s@%s JOIN %s %s :%s", nick, user, host, chptr->chname,
+                                                                   EmptyString(target_p->user->suser) ? "*" : target_p->user->suser,
+                                                                   target_p->info);
+
                        if(*mode)
                                sendto_channel_local_butone(target_p, ALL_MEMBERS, chptr,
                                                ":%s MODE %s +%s %s",
@@ -1458,15 +1470,29 @@ change_nick_user_host(struct Client *target_p,  const char *nick, const char *use
                        *modeval = '\0';
                }
 
+               /* Resend away message to away-notify enabled clients. */
+               if (target_p->user->away)
+                       sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, ":%s!%s@%s AWAY :%s",
+                                                           target_p->name, target_p->username, target_p->host,
+                                                           target_p->user->away);
+
                if(MyClient(target_p) && changed_case)
                        sendto_one(target_p, ":%s!%s@%s NICK %s",
                                        target_p->name, target_p->username, target_p->host, nick);
+
+               /* TODO: send some snotes to SNO_NCHANGE/SNO_CCONN/SNO_CCONNEXT? */
        }
        else if(changed_case)
        {
-               sendto_common_channels_local(target_p, ":%s!%s@%s NICK :%s",
+               sendto_common_channels_local(target_p, NOCAPS, ":%s!%s@%s NICK :%s",
                                target_p->name, target_p->username,
                                target_p->host, nick);
+
+               if(MyConnect(target_p))
+                       sendto_realops_snomask(SNO_NCHANGE, L_ALL,
+                                       "Nick change: From %s to %s [%s@%s]",
+                                       target_p->name, nick,
+                                       target_p->username, target_p->host);
        }
 
        rb_strlcpy(target_p->username, user, sizeof target_p->username);