]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/message.cpp
Tidying of snotices (adding '***' to start of WriteOpers texts)
[user/henk/code/inspircd.git] / src / message.cpp
index eb95bde56f46aa38f50407e37c1be363daf89797..b8351ea7e982461f7e643644d14da288791ddb15 100644 (file)
@@ -228,6 +228,7 @@ void ChangeDisplayedHost(userrec* user, const char* host)
                FOREACH_MOD(I_OnChangeHost,OnChangeHost(user,host));
         }
        strlcpy(user->dhost,host,160);
+       WriteServ(user->fd,"396 %s %s :is now your hidden host",user->nick,user->dhost);
 }
 
 /* verify that a user's ident and nickname is valid */
@@ -243,7 +244,7 @@ int isident(const char* n)
         {
                 return 0;
         }
-        for (char* i = n; *i; i++)
+        for (char* i = (char*)n; *i; i++)
         {
                 if ((*i >= 'A') && (*i <= '}'))
                 {
@@ -269,7 +270,7 @@ int isnick(const char* n)
        {
                return 0;
        }
-       for (char* i = n; *i; i++)
+       for (char* i = (char*)n; *i; i++)
        {
                /* can occur anywhere in a nickname */
                if ((*i >= 'A') && (*i <= '}'))
@@ -424,6 +425,7 @@ std::string chlist(userrec *user,userrec* source)
        {
                return lst;
        }
+       bool userinvisible = (strchr(user->modes,'i'));
        for (unsigned int i = 0; i < user->chans.size(); i++)
        {
                if (user->chans[i].channel != NULL)
@@ -433,8 +435,9 @@ std::string chlist(userrec *user,userrec* source)
                                cmp = std::string(user->chans[i].channel->name) + " ";
                                if (!strstr(lst.c_str(),cmp.c_str()))
                                {
-                                       // if the channel is NOT private/secret, OR the source user is on the channel
-                                       if (((!(user->chans[i].channel->binarymodes & CM_PRIVATE)) && (!(user->chans[i].channel->binarymodes & CM_SECRET))) || (has_channel(source,user->chans[i].channel)))
+                                       // if the channel is NOT private/secret, OR the source user is on the channel, AND the user is not invisible.
+                                       // if the user is the same as the source, shortcircuit the comparison.
+                                       if ((source == user) || ((((!(user->chans[i].channel->binarymodes & CM_PRIVATE)) && (!(user->chans[i].channel->binarymodes & CM_SECRET)) && (!userinvisible)) || (has_channel(source,user->chans[i].channel)))))
                                        {
                                                lst = lst + std::string(cmode(user,user->chans[i].channel)) + std::string(user->chans[i].channel->name) + " ";
                                        }