send: implement echo-message

This commit is contained in:
William Pitcock 2016-02-27 02:48:37 -06:00
parent 4bdf963cdc
commit be2ce24c42
3 changed files with 11 additions and 2 deletions

View File

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

View File

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

View File

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