]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/send.c
'rb_dlink_list global_channel_list' declaration moved to channel.c
[irc/rqf/shadowircd.git] / src / send.c
index d2d603fde4ce423349e6f4b4a052445645129a1c..dbb4a7f2bcdf1e91f561deedcf1c858d04e0d0f0 100644 (file)
 #include "class.h"
 #include "client.h"
 #include "common.h"
-#include "irc_string.h"
+#include "match.h"
 #include "ircd.h"
 #include "numeric.h"
 #include "s_serv.h"
-#include "sprintf_irc.h"
 #include "s_conf.h"
 #include "s_newconf.h"
 #include "logger.h"
@@ -149,12 +148,12 @@ send_queued(struct Client *to)
        if(IsIOError(to))
                return;
 
-       /* Something wants us to not send anything currently */\r
-       /* if(IsCork(to))\r
-               return; */\r
-\r
-       /* try to flush later when the write event resets this */\r
-       if(IsFlush(to))\r
+       /* Something wants us to not send anything currently */
+       /* if(IsCork(to))
+               return; */
+
+       /* try to flush later when the write event resets this */
+       if(IsFlush(to))
                return;
 
 #ifdef USE_IODEBUG_HOOKS
@@ -204,25 +203,25 @@ send_queued(struct Client *to)
                }
        }
 
-       if(rb_linebuf_len(&to->localClient->buf_sendq))\r
-       {\r
-               SetFlush(to);\r
-               rb_setselect(to->localClient->F, RB_SELECT_WRITE,\r
-                              send_queued_write, to);\r
-       }\r
-       else\r
+       if(rb_linebuf_len(&to->localClient->buf_sendq))
+       {
+               SetFlush(to);
+               rb_setselect(to->localClient->F, RB_SELECT_WRITE,
+                              send_queued_write, to);
+       }
+       else
                ClearFlush(to);
 }
 
-void\r
-send_pop_queue(struct Client *to)\r
-{\r
-       if(to->from != NULL)\r
-               to = to->from;\r
-       if(!MyConnect(to) || IsIOError(to))\r
-               return;\r
-       if(rb_linebuf_len(&to->localClient->buf_sendq) > 0)\r
-               send_queued(to);\r
+void
+send_pop_queue(struct Client *to)
+{
+       if(to->from != NULL)
+               to = to->from;
+       if(!MyConnect(to) || IsIOError(to))
+               return;
+       if(rb_linebuf_len(&to->localClient->buf_sendq) > 0)
+               send_queued(to);
 }
 
 /* send_queued_write()
@@ -468,7 +467,6 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
        static char buf[BUFSIZE];
        va_list args;
        buf_head_t rb_linebuf_local;
-       buf_head_t rb_linebuf_name;
        buf_head_t rb_linebuf_id;
        struct Client *target_p;
        struct membership *msptr;
@@ -476,7 +474,6 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
        rb_dlink_node *next_ptr;
 
        rb_linebuf_newbuf(&rb_linebuf_local);
-       rb_linebuf_newbuf(&rb_linebuf_name);
        rb_linebuf_newbuf(&rb_linebuf_id);
 
        current_serial++;
@@ -494,7 +491,6 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
                               source_p->name, source_p->username, 
                               source_p->host, buf);
 
-       rb_linebuf_putmsg(&rb_linebuf_name, NULL, NULL, ":%s %s", source_p->name, buf);
        rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s %s", use_id(source_p), buf);
 
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head)
@@ -521,11 +517,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
 
                        if(target_p->from->serial != current_serial)
                        {
-                               if(has_id(target_p->from))
-                                       send_linebuf_remote(target_p, source_p, &rb_linebuf_id);
-                               else
-                                       send_linebuf_remote(target_p, source_p, &rb_linebuf_name);
-
+                               send_linebuf_remote(target_p, source_p, &rb_linebuf_id);
                                target_p->from->serial = current_serial;
                        }
                }
@@ -534,7 +526,6 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
        }
 
        rb_linebuf_donebuf(&rb_linebuf_local);
-       rb_linebuf_donebuf(&rb_linebuf_name);
        rb_linebuf_donebuf(&rb_linebuf_id);
 }
 
@@ -750,11 +741,9 @@ sendto_match_butone(struct Client *one, struct Client *source_p,
        rb_dlink_node *ptr;
        rb_dlink_node *next_ptr;
        buf_head_t rb_linebuf_local;
-       buf_head_t rb_linebuf_name;
        buf_head_t rb_linebuf_id;
 
        rb_linebuf_newbuf(&rb_linebuf_local);
-       rb_linebuf_newbuf(&rb_linebuf_name);
        rb_linebuf_newbuf(&rb_linebuf_id);
 
        va_start(args, pattern);
@@ -770,7 +759,6 @@ sendto_match_butone(struct Client *one, struct Client *source_p,
                               source_p->name, source_p->username, 
                               source_p->host, buf);
 
-       rb_linebuf_putmsg(&rb_linebuf_name, NULL, NULL, ":%s %s", source_p->name, buf);
        rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s %s", use_id(source_p), buf);
 
        if(what == MATCH_HOST)
@@ -800,15 +788,11 @@ sendto_match_butone(struct Client *one, struct Client *source_p,
                if(target_p == one)
                        continue;
 
-               if(has_id(target_p))
-                       send_linebuf_remote(target_p, source_p, &rb_linebuf_id);
-               else
-                       send_linebuf_remote(target_p, source_p, &rb_linebuf_name);
+               send_linebuf_remote(target_p, source_p, &rb_linebuf_id);
        }
 
        rb_linebuf_donebuf(&rb_linebuf_local);
        rb_linebuf_donebuf(&rb_linebuf_id);
-       rb_linebuf_donebuf(&rb_linebuf_name);
 }
 
 /* sendto_match_servs()
@@ -826,13 +810,11 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
        rb_dlink_node *ptr;
        struct Client *target_p;
        buf_head_t rb_linebuf_id;
-       buf_head_t rb_linebuf_name;
 
        if(EmptyString(mask))
                return;
 
        rb_linebuf_newbuf(&rb_linebuf_id);
-       rb_linebuf_newbuf(&rb_linebuf_name);
 
        va_start(args, pattern);
        rb_vsnprintf(buf, sizeof(buf), pattern, args);
@@ -840,8 +822,6 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
 
        rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, 
                        ":%s %s", use_id(source_p), buf);
-       rb_linebuf_putmsg(&rb_linebuf_name, NULL, NULL, 
-                       ":%s %s", source_p->name, buf);
 
        current_serial++;
 
@@ -869,15 +849,11 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
                        if(nocap && !NotCapable(target_p->from, nocap))
                                continue;
 
-                       if(has_id(target_p->from))
-                               _send_linebuf(target_p->from, &rb_linebuf_id);
-                       else
-                               _send_linebuf(target_p->from, &rb_linebuf_name);
+                       _send_linebuf(target_p->from, &rb_linebuf_id);
                }
        }
 
        rb_linebuf_donebuf(&rb_linebuf_id);
-       rb_linebuf_donebuf(&rb_linebuf_name);
 }
 
 /* sendto_monitor()
@@ -958,46 +934,6 @@ sendto_anywhere(struct Client *target_p, struct Client *source_p,
        rb_linebuf_donebuf(&linebuf);
 }
 
-/* sendto_realops_flags()
- *
- * inputs      - umode needed, level (opers/admin), va_args
- * output      -
- * side effects - message is sent to opers with matching umodes
- */
-void
-sendto_realops_flags(int flags, int level, const char *pattern, ...)
-{
-       struct Client *client_p;
-       rb_dlink_node *ptr;
-       rb_dlink_node *next_ptr;
-       va_list args;
-       buf_head_t linebuf;
-
-       rb_linebuf_newbuf(&linebuf);
-
-       va_start(args, pattern);
-       rb_linebuf_putmsg(&linebuf, pattern, &args, 
-                      ":%s NOTICE * :*** Notice -- ", me.name);
-       va_end(args);
-
-       RB_DLINK_FOREACH_SAFE(ptr, next_ptr, local_oper_list.head)
-       {
-               client_p = ptr->data;
-
-               /* If we're sending it to opers and theyre an admin, skip.
-                * If we're sending it to admins, and theyre not, skip.
-                */
-               if(((level == L_ADMIN) && !IsOperAdmin(client_p)) ||
-                  ((level == L_OPER) && IsOperAdmin(client_p)))
-                       continue;
-
-               if(client_p->umodes & flags)
-                       _send_linebuf(client_p, &linebuf);
-       }
-
-       rb_linebuf_donebuf(&linebuf);
-}
-
 /* sendto_realops_snomask()
  *
  * inputs      - snomask needed, level (opers/admin), va_args
@@ -1029,14 +965,9 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...)
                                ":%s NOTICE * :*** Notice -- %s", me.name, buf);
                snobuf = construct_snobuf(flags);
                if (snobuf[1] != '\0')
-               {
                        sendto_server(NULL, NULL, CAP_ENCAP|CAP_TS6, NOCAPS,
                                        ":%s ENCAP * SNOTE %c :%s",
                                        me.id, snobuf[1], buf);
-                       sendto_server(NULL, NULL, CAP_ENCAP, CAP_TS6,
-                                       ":%s ENCAP * SNOTE %c :%s",
-                                       me.name, snobuf[1], buf);
-               }
        }
        else
        {
@@ -1191,17 +1122,13 @@ kill_client_serv_butone(struct Client *one, struct Client *target_p, const char
        rb_dlink_node *ptr;
        rb_dlink_node *next_ptr;
        buf_head_t rb_linebuf_id;
-       buf_head_t rb_linebuf_name;
 
-       rb_linebuf_newbuf(&rb_linebuf_name);
        rb_linebuf_newbuf(&rb_linebuf_id);
        
        va_start(args, pattern);
        rb_vsnprintf(buf, sizeof(buf), pattern, args);
        va_end(args);
 
-       rb_linebuf_putmsg(&rb_linebuf_name, NULL, NULL, ":%s KILL %s :%s",
-                      me.name, target_p->name, buf);
        rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s KILL %s :%s",
                       use_id(&me), use_id(target_p), buf);
 
@@ -1216,12 +1143,8 @@ kill_client_serv_butone(struct Client *one, struct Client *target_p, const char
                        (!has_id(client_p) || !has_id(target_p)))
                        continue;
 
-               if(has_id(client_p))
-                       _send_linebuf(client_p, &rb_linebuf_id);
-               else
-                       _send_linebuf(client_p, &rb_linebuf_name);
+               _send_linebuf(client_p, &rb_linebuf_id);
        }
 
        rb_linebuf_donebuf(&rb_linebuf_id);
-       rb_linebuf_donebuf(&rb_linebuf_name);
 }