]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/send.c
Remove various obsolete ConfItem statuses (types) and flags.
[irc/rqf/shadowircd.git] / src / send.c
index e32e7fb032977d1f29e7d5dbb1c362a52b0c8f54..c094cdf97d74b4ef89e5898e1b25a930f7460c74 100644 (file)
@@ -21,7 +21,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: send.c 3161 2007-01-25 07:23:01Z nenolod $
+ *  $Id: send.c 3520 2007-06-30 22:15:35Z jilles $
  */
 
 #include "stdinc.h"
@@ -43,6 +43,7 @@
 #include "s_log.h"
 #include "memory.h"
 #include "hook.h"
+#include "monitor.h"
 
 #define LOG_BUFSIZE 2048
 
@@ -107,7 +108,7 @@ _send_linebuf(struct Client *to, buf_head_t *linebuf)
        to->localClient->sendM += 1;
        me.localClient->sendM += 1;
        if(linebuf_len(&to->localClient->buf_sendq) > 0)
-               send_queued_write(to->localClient->fd, to);
+               send_queued_write(to->localClient->F->fd, to);
        return 0;
 }
 
@@ -167,6 +168,10 @@ send_queued_write(int fd, void *data)
 #ifdef USE_IODEBUG_HOOKS
        hook_data_int hd;
 #endif
+       fde_t *F = comm_locate_fd(to->localClient->F->fd);
+       if (!F)
+               return;
+
        /* cant write anything to a dead socket. */
        if(IsIOError(to))
                return;
@@ -181,7 +186,7 @@ send_queued_write(int fd, void *data)
        if(linebuf_len(&to->localClient->buf_sendq))
        {
                while ((retlen =
-                       linebuf_flush(to->localClient->fd, &to->localClient->buf_sendq)) > 0)
+                       linebuf_flush(F, &to->localClient->buf_sendq)) > 0)
                {
                        /* We have some data written .. update counters */
 #ifdef USE_IODEBUG_HOOKS
@@ -928,6 +933,40 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
        linebuf_donebuf(&linebuf_name);
 }
 
+/* sendto_monitor()
+ *
+ * inputs      - monitor nick to send to, format, va_args
+ * outputs     - message to local users monitoring the given nick
+ * side effects -
+ */
+void
+sendto_monitor(struct monitor *monptr, const char *pattern, ...)
+{
+       va_list args;
+       buf_head_t linebuf;
+       struct Client *target_p;
+       dlink_node *ptr;
+       dlink_node *next_ptr;
+       
+       linebuf_newbuf(&linebuf); 
+       
+       va_start(args, pattern);
+       linebuf_putmsg(&linebuf, pattern, &args, NULL);
+       va_end(args);
+
+       DLINK_FOREACH_SAFE(ptr, next_ptr, monptr->users.head)
+       {
+               target_p = ptr->data;
+
+               if(IsIOError(target_p))
+                       continue;
+
+               _send_linebuf(target_p, &linebuf);
+       }
+
+       linebuf_donebuf(&linebuf);
+}
+
 /* sendto_anywhere()
  *
  * inputs      - target, source, va_args