diff --git a/include/client.h b/include/client.h index 22fda3a1c..30116b47c 100644 --- a/include/client.h +++ b/include/client.h @@ -450,6 +450,7 @@ struct ListClient #define CLICAP_TLS 0x0020 #define CLICAP_USERHOST_IN_NAMES 0x0040 #define CLICAP_CAP_NOTIFY 0x0080 +#define CLICAP_CHGHOST 0x0100 /* * flags macros. diff --git a/modules/m_cap.c b/modules/m_cap.c index 8556642d9..072be4437 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -80,6 +80,7 @@ static struct clicap _CLICAP("tls", CLICAP_TLS, 0, 0, 0), _CLICAP("userhost-in-names", CLICAP_USERHOST_IN_NAMES, 0, 0, 0), _CLICAP("cap-notify", CLICAP_CAP_NOTIFY, 0, 0, 0), + _CLICAP("chghost", CLICAP_CHGHOST, 0, 0, 0), }; #define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap)) diff --git a/src/s_user.c b/src/s_user.c index e380f66df..77577bf18 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -1431,7 +1431,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, NOCAPS, NOCAPS, ":%s!%s@%s QUIT :%s", + sendto_common_channels_local_butone(target_p, NOCAPS, CLICAP_CHGHOST, ":%s!%s@%s QUIT :%s", target_p->name, target_p->username, target_p->host, reason); @@ -1456,9 +1456,9 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use *mptr = '\0'; - sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN, chptr, + sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN | CLICAP_CHGHOST, 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, + sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, CLICAP_EXTENDED_JOIN, CLICAP_CHGHOST, 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); @@ -1474,21 +1474,24 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use /* Resend away message to away-notify enabled clients. */ if (target_p->user->away) - sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, NOCAPS, ":%s!%s@%s AWAY :%s", + sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, CLICAP_CHGHOST, ":%s!%s@%s AWAY :%s", nick, user, host, target_p->user->away); + sendto_common_channels_local_butone(target_p, CLICAP_CHGHOST, NOCAPS, + ":%s!%s@%s CHGHOST %s %s", + target_p->name, target_p->username, target_p->host, user, host); + 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); + target_p->name, user, host, nick); /* TODO: send some snotes to SNO_NCHANGE/SNO_CCONN/SNO_CCONNEXT? */ } else if(changed_case) { sendto_common_channels_local(target_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s", - target_p->name, target_p->username, - target_p->host, nick); + target_p->name, user, host, nick); if(MyConnect(target_p)) sendto_realops_snomask(SNO_NCHANGE, L_ALL,