X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmessage.cpp;h=4f8e25bee7e0dc7a3370aeff581162be8ecd922d;hb=59b1a8955142935b02af6446005ab47fc7c3fc8c;hp=b8079d6838497631225d0da2a9484ab0f3e04977;hpb=48c05dc0dcdee55756404e5932b5ff3adf19d74e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/message.cpp b/src/message.cpp index b8079d683..4f8e25bee 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -214,7 +214,7 @@ void ChangeName(userrec* user, const char* gecos) return; FOREACH_MOD(I_OnChangeName,OnChangeName(user,gecos)); } - strlcpy(user->fullname,gecos,MAXBUF); + strlcpy(user->fullname,gecos,MAXGECOS+1); } void ChangeDisplayedHost(userrec* user, const char* host) @@ -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 */ @@ -324,6 +325,24 @@ char* cmode(userrec *user, chanrec *chan) return ""; } +int cflags(userrec *user, chanrec *chan) +{ + if ((!chan) || (!user)) + return 0; + + for (unsigned int i = 0; i < user->chans.size(); i++) + { + if (user->chans[i].channel) + { + if ((!strcasecmp(user->chans[i].channel->name,chan->name)) && (chan != NULL)) + { + return user->chans[i].uc_modes; + } + } + } + return 0; +} + /* returns the status value for a given user on a channel, e.g. STATUS_OP for * op, STATUS_VOICE for voice etc. If the user has several modes set, the * highest mode the user has must be returned. */ @@ -406,7 +425,7 @@ void TidyBan(char *ban) pos_of_pling++; pos_of_at++; - strlcpy(NICK,temp,NICKMAX); + strlcpy(NICK,temp,NICKMAX-1); strlcpy(IDENT,pos_of_pling,IDENTMAX+1); strlcpy(HOST,pos_of_at,160); @@ -424,6 +443,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 +453,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) + " "; }