cap: implement ircv3.2 chghost cap

This commit is contained in:
William Pitcock 2015-11-19 22:53:55 -06:00
parent 583f064fef
commit 4a5330bb4d
3 changed files with 12 additions and 7 deletions

View file

@ -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.

View file

@ -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))

View file

@ -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,