]> jfr.im git - solanum.git/commitdiff
send: implement echo-message
authorWilliam Pitcock <redacted>
Sat, 27 Feb 2016 08:48:37 +0000 (02:48 -0600)
committerWilliam Pitcock <redacted>
Sat, 27 Feb 2016 08:48:37 +0000 (02:48 -0600)
include/s_serv.h
ircd/s_serv.c
ircd/send.c

index 62facc03555efe8e7bc8349879e91d64c2164416..94e46a47a3b9fba5643f215b73c9bf5195d07773 100644 (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
index 9542249dede05fb7a9df12c02b337fcb48ef6205..448965a88a1afd1c9e663d958f6df2810844cf0b 100644 (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;
index c512ccb203edadb3e3f1b494610dbef53e2e13a5..d89c1d610c34dbbdd37ad9c11f23bb2b590ab8fd 100644 (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)