From 7a7f86d3445f86a6bb2fb399c95485ed5e0c7f21 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 15 Dec 2010 23:04:57 -0600 Subject: [PATCH] Rough implementation of the new account-notify client capability. This replaces identify-msg in ircd-seven. --- include/client.h | 1 + modules/m_cap.c | 3 ++- modules/m_services.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/client.h b/include/client.h index 4a28a307..14ee9c00 100644 --- a/include/client.h +++ b/include/client.h @@ -443,6 +443,7 @@ struct ListClient #define CLICAP_MULTI_PREFIX 0x0001 #define CLICAP_SASL 0x0002 +#define CLICAP_ACCOUNT_NOTIFY 0x0004 /* * flags macros. diff --git a/modules/m_cap.c b/modules/m_cap.c index 6e06ef73..aa2693a8 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -69,7 +69,8 @@ static struct clicap int namelen; } clicap_list[] = { _CLICAP("multi-prefix", CLICAP_MULTI_PREFIX, 0, 0), - _CLICAP("sasl", CLICAP_SASL, 0, 0) + _CLICAP("sasl", CLICAP_SASL, 0, 0), + _CLICAP("account-notify", CLICAP_ACCOUNT_NOTIFY, 0, 0) }; #define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap)) diff --git a/modules/m_services.c b/modules/m_services.c index 03436edb..e3545d5b 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -107,6 +107,10 @@ me_su(struct Client *client_p, struct Client *source_p, else rb_strlcpy(target_p->user->suser, parv[2], sizeof(target_p->user->suser)); + sendto_common_channels_local_butone(target_p, CLICAP_ACCOUNT_NOTIFY, ":%s!%s@%s ACCOUNT :%s", + target_p->name, target_p->username, target_p->host, + EmptyString(target_p->user->suser) ? "*" : target_p->user->suser); + invalidate_bancache_user(target_p); return 0;