]> jfr.im git - solanum.git/blobdiff - ircd/send.c
Resolve shfit/reduce conflict in timespec production (#54)
[solanum.git] / ircd / send.c
index 7b036996cdcf08530e079fdebfe82ad0b4381825..4205276c74ae4fdfea369814ecf3fb229a8e7277 100644 (file)
@@ -598,22 +598,23 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p,
        build_msgbuf_tags(&msgbuf, source_p);
 
        current_serial++;
+       const char *statusmsg_prefix = (ConfigChannel.opmod_send_statusmsg ? "@" : "");
 
        if(IsServer(source_p)) {
                msgbuf_cache_initf(&msgbuf_cache, &msgbuf, &strings,
-                              ":%s %s %s :",
-                              source_p->name, command, chptr->chname);
+                              ":%s %s %s%s :",
+                              source_p->name, command, statusmsg_prefix, chptr->chname);
        } else {
                msgbuf_cache_initf(&msgbuf_cache, &msgbuf, &strings,
-                              ":%s!%s@%s %s %s :",
+                              ":%s!%s@%s %s %s%s :",
                               source_p->name, source_p->username,
-                              source_p->host, command, chptr->chname);
+                              source_p->host, command, statusmsg_prefix, chptr->chname);
        }
 
        if (chptr->mode.mode & MODE_MODERATED) {
                linebuf_put_msgf(&rb_linebuf_old, &strings,
-                              ":%s %s %s :",
-                              use_id(source_p), command, chptr->chname, text);
+                              ":%s %s %s%s :",
+                              use_id(source_p), command, statusmsg_prefix, chptr->chname, text);
        } else {
                linebuf_put_msgf(&rb_linebuf_old, &strings,
                               ":%s NOTICE @%s :<%s:%s> ",
@@ -623,7 +624,6 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p,
        linebuf_put_msgf(&rb_linebuf_new, &strings,
                       ":%s %s =%s :",
                       use_id(source_p), command, chptr->chname);
-
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head)
        {
                msptr = ptr->data;
@@ -675,44 +675,39 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p,
        msgbuf_cache_free(&msgbuf_cache);
 }
 
-/* sendto_channel_local()
+/* _sendto_channel_local
  *
- * inputs      - source, flags to send to, channel to send to, va_args
+ * inputs      - source, flags to send to, privs to send to, channel to send to, va_args
  * outputs     - message to local channel members
  * side effects -
  */
 void
-sendto_channel_local(struct Client *source_p, int type, struct Channel *chptr, const char *pattern, ...)
+_sendto_channel_local(struct Client *source_p, int type, const char *priv, struct Channel *chptr, const char *pattern, va_list *args)
 {
-       va_list args;
        struct membership *msptr;
        struct Client *target_p;
        rb_dlink_node *ptr;
        rb_dlink_node *next_ptr;
        struct MsgBuf msgbuf;
        struct MsgBuf_cache msgbuf_cache;
-       rb_strf_t strings = { .format = pattern, .format_args = &args, .next = NULL };
+       rb_strf_t strings = { .format = pattern, .format_args = args, .next = NULL };
 
        build_msgbuf_tags(&msgbuf, source_p);
 
-       va_start(args, pattern);
        msgbuf_cache_init(&msgbuf_cache, &msgbuf, &strings);
-       va_end(args);
 
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
        {
                msptr = ptr->data;
                target_p = msptr->client_p;
 
-               if(IsIOError(target_p))
+               if (IsIOError(target_p))
                        continue;
 
-               if(type == ONLY_OPERS)
-               {
-                       if (!IsOper(target_p))
-                               continue;
-               }
-               else if(type && ((msptr->flags & type) == 0))
+               if (type && ((msptr->flags & type) == 0))
+                       continue;
+
+               if (priv != NULL && !HasPrivilege(target_p, priv))
                        continue;
 
                _send_linebuf(target_p, msgbuf_cache_get(&msgbuf_cache, CLIENT_CAPS_ONLY(target_p)));
@@ -721,6 +716,36 @@ sendto_channel_local(struct Client *source_p, int type, struct Channel *chptr, c
        msgbuf_cache_free(&msgbuf_cache);
 }
 
+/* sendto_channel_local_priv()
+ *
+ * inputs      - source, flags to send to, privs to send to, channel to send to, va_args
+ * outputs     - message to local channel members
+ * side effects -
+ */
+void
+sendto_channel_local_priv(struct Client *source_p, int type, const char *priv, struct Channel *chptr, const char *pattern, ...)
+{
+       va_list args;
+       va_start(args, pattern);
+       _sendto_channel_local(source_p, type, priv, chptr, pattern, &args);
+       va_end(args);
+}
+
+/* sendto_channel_local()
+ *
+ * inputs      - source, flags to send to, channel to send to, va_args
+ * outputs     - message to local channel members
+ * side effects -
+ */
+void
+sendto_channel_local(struct Client *source_p, int type, struct Channel *chptr, const char *pattern, ...)
+{
+       va_list args;
+       va_start(args, pattern);
+       _sendto_channel_local(source_p, type, NULL, chptr, pattern, &args);
+       va_end(args);
+}
+
 /*
  * _sendto_channel_local_with_capability_butone()
  *