From be2ce24c42fbd427c7d84b6cbbe096a6df25d6de Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 27 Feb 2016 02:48:37 -0600 Subject: [PATCH] send: implement echo-message --- include/s_serv.h | 1 + ircd/s_serv.c | 2 ++ ircd/send.c | 10 ++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/s_serv.h b/include/s_serv.h index 62facc03..94e46a47 100644 --- a/include/s_serv.h +++ b/include/s_serv.h @@ -70,6 +70,7 @@ extern unsigned int CLICAP_AWAY_NOTIFY; extern unsigned int CLICAP_USERHOST_IN_NAMES; extern unsigned int CLICAP_CAP_NOTIFY; extern unsigned int CLICAP_CHGHOST; +extern unsigned int CLICAP_ECHO_MESSAGE; /* * XXX: this is kind of ugly, but this allows us to have backwards diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 9542249d..448965a8 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -103,6 +103,7 @@ unsigned int CLICAP_AWAY_NOTIFY; unsigned int CLICAP_USERHOST_IN_NAMES; unsigned int CLICAP_CAP_NOTIFY; unsigned int CLICAP_CHGHOST; +unsigned int CLICAP_ECHO_MESSAGE; /* * initialize our builtin capability table. --nenolod @@ -150,6 +151,7 @@ init_builtin_capabs(void) CLICAP_USERHOST_IN_NAMES = capability_put(cli_capindex, "userhost-in-names", NULL); CLICAP_CAP_NOTIFY = capability_put(cli_capindex, "cap-notify", NULL); CLICAP_CHGHOST = capability_put(cli_capindex, "chghost", NULL); + CLICAP_ECHO_MESSAGE = capability_put(cli_capindex, "echo-message", NULL); } static CNCB serv_connect_callback; diff --git a/ircd/send.c b/ircd/send.c index c512ccb2..d89c1d61 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -527,7 +527,10 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p, msptr = ptr->data; target_p = msptr->client_p; - if(IsIOError(target_p->from) || target_p->from == one) + if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one)) + continue; + + if(MyClient(source_p) && !IsCapable(source_p, CLICAP_ECHO_MESSAGE) && target_p == one) continue; if(type && ((msptr->flags & type) == 0)) @@ -624,7 +627,10 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p, msptr = ptr->data; target_p = msptr->client_p; - if(IsIOError(target_p->from) || target_p->from == one) + if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one)) + continue; + + if(MyClient(source_p) && !IsCapable(source_p, CLICAP_ECHO_MESSAGE) && target_p == one) continue; if((msptr->flags & CHFL_CHANOP) == 0)