]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/send.c
Cleanups to 005 code, from ratbox (androsyn).
[irc/rqf/shadowircd.git] / src / send.c
index bd4adea8e457449c5efccd490a294a6e57ac5c74..d33e16ce8aa008e215f82111246c8291d8dc33c8 100644 (file)
@@ -108,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;
 }
 
@@ -124,30 +124,7 @@ send_linebuf_remote(struct Client *to, struct Client *from, buf_head_t *linebuf)
        if(to->from)
                to = to->from;
 
-       /* test for fake direction */
-       if(!MyClient(from) && IsPerson(to) && (to == from->from))
-       {
-               if(IsServer(from))
-               {
-                       sendto_realops_snomask(SNO_GENERAL, L_ALL,
-                                            "Send message to %s[%s] dropped from %s(Fake Dir)",
-                                            to->name, to->from->name, from->name);
-                       return;
-               }
-
-               sendto_realops_snomask(SNO_GENERAL, L_ALL,
-                                    "Ghosted: %s[%s@%s] from %s[%s@%s] (%s)",
-                                    to->name, to->username, to->host,
-                                    from->name, from->username, from->host, to->from->name);
-               kill_client_serv_butone(NULL, to, "%s (%s[%s@%s] Ghosted %s)",
-                                       me.name, to->name, to->username,
-                                       to->host, to->from->name);
-
-               to->flags |= FLAGS_KILLED;
-
-               exit_client(NULL, to, &me, "Ghosted client");
-               return;
-       }
+       /* we assume the caller has already tested for fake direction */
 
        _send_linebuf(to, linebuf);
        return;
@@ -168,6 +145,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;
@@ -182,7 +163,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