]> jfr.im git - solanum.git/blobdiff - src/send.c
ssld: use uint64_t explicitly when we want 64-bit counters
[solanum.git] / src / send.c
index 062150c195e6fc8ecb43d8ff772a63ca11081bb9..cb2112054a73e6d673a6f7583f263a51ecb3ddb6 100644 (file)
@@ -778,6 +778,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr,
  *
  * inputs      - pointer to client
  *              - capability mask
+ *             - negated capability mask
  *             - pattern to send
  * output      - NONE
  * side effects        - Sends a message to all people on local server who are
@@ -785,7 +786,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr,
  *               used by m_nick.c and exit_one_client.
  */
 void
-sendto_common_channels_local(struct Client *user, int cap, const char *pattern, ...)
+sendto_common_channels_local(struct Client *user, int cap, int negcap, const char *pattern, ...)
 {
        va_list args;
        rb_dlink_node *ptr;
@@ -817,7 +818,8 @@ sendto_common_channels_local(struct Client *user, int cap, const char *pattern,
 
                        if(IsIOError(target_p) ||
                           target_p->serial == current_serial ||
-                          !IsCapable(target_p, cap))
+                          !IsCapable(target_p, cap) ||
+                          !NotCapable(target_p, negcap))
                                continue;
 
                        target_p->serial = current_serial;
@@ -839,13 +841,14 @@ sendto_common_channels_local(struct Client *user, int cap, const char *pattern,
  *
  * inputs      - pointer to client
  *              - capability mask
+ *             - negated capability mask
  *             - pattern to send
  * output      - NONE
  * side effects        - Sends a message to all people on local server who are
  *               in same channel with user, except for user itself.
  */
 void
-sendto_common_channels_local_butone(struct Client *user, int cap, const char *pattern, ...)
+sendto_common_channels_local_butone(struct Client *user, int cap, int negcap, const char *pattern, ...)
 {
        va_list args;
        rb_dlink_node *ptr;
@@ -879,7 +882,8 @@ sendto_common_channels_local_butone(struct Client *user, int cap, const char *pa
 
                        if(IsIOError(target_p) ||
                           target_p->serial == current_serial ||
-                          !IsCapable(target_p, cap))
+                          !IsCapable(target_p, cap) ||
+                          !NotCapable(target_p, negcap))
                                continue;
 
                        target_p->serial = current_serial;
@@ -1021,6 +1025,39 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
        rb_linebuf_donebuf(&rb_linebuf_id);
 }
 
+/* sendto_local_clients_with_capability()
+ *
+ * inputs       - caps needed, pattern, va_args
+ * outputs      -
+ * side effects - message is sent to matching local clients with caps.
+ */
+void
+sendto_local_clients_with_capability(int cap, const char *pattern, ...)
+{
+       va_list args;
+       rb_dlink_node *ptr;
+       struct Client *target_p;
+       buf_head_t linebuf;
+
+       rb_linebuf_newbuf(&linebuf);
+
+       va_start(args, pattern);
+       rb_linebuf_putmsg(&linebuf, pattern, &args, NULL);
+       va_end(args);
+
+       RB_DLINK_FOREACH(ptr, lclient_list.head)
+       {
+               target_p = ptr->data;
+
+               if(IsIOError(target_p) || !IsCapable(target_p, cap))
+                       continue;
+
+               send_linebuf(target_p, &linebuf);
+       }
+
+       rb_linebuf_donebuf(&linebuf);
+}
+
 /* sendto_monitor()
  *
  * inputs      - monitor nick to send to, format, va_args