Add an s2s cap for ECHO (#141)

This commit is contained in:
Ed Kellett 2021-04-20 12:22:50 +01:00 committed by GitHub
parent e6e26343c3
commit 4cac091255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,6 +56,8 @@ static void echo_msg(struct Client *, struct Client *, enum message_type, const
static void expire_tgchange(void *unused); static void expire_tgchange(void *unused);
static struct ev_entry *expire_tgchange_event; static struct ev_entry *expire_tgchange_event;
static unsigned int CAP_ECHO;
static int static int
modinit(void) modinit(void)
{ {
@ -85,7 +87,12 @@ struct Message echo_msgtab = {
mapi_clist_av1 message_clist[] = { &privmsg_msgtab, &notice_msgtab, &echo_msgtab, NULL }; mapi_clist_av1 message_clist[] = { &privmsg_msgtab, &notice_msgtab, &echo_msgtab, NULL };
DECLARE_MODULE_AV2(message, modinit, moddeinit, message_clist, NULL, NULL, NULL, NULL, message_desc); mapi_cap_list_av2 message_cap_list[] = {
{ MAPI_CAP_SERVER, "ECHO", NULL, &CAP_ECHO },
{ 0, NULL, NULL, NULL }
};
DECLARE_MODULE_AV2(message, modinit, moddeinit, message_clist, NULL, NULL, message_cap_list, NULL, message_desc);
struct entity struct entity
{ {
@ -742,6 +749,9 @@ echo_msg(struct Client *source_p, struct Client *target_p,
return; return;
} }
if (!(target_p->from->serv->caps & CAP_ECHO))
return;
sendto_one(target_p, ":%s ECHO %c %s :%s", sendto_one(target_p, ":%s ECHO %c %s :%s",
use_id(source_p), use_id(source_p),
msgtype == MESSAGE_TYPE_PRIVMSG ? 'P' : 'N', msgtype == MESSAGE_TYPE_PRIVMSG ? 'P' : 'N',