Conditional compiling for fnet-adc.c.
[doldaconnect.git] / daemon / fnet-dc.c
index a8faf28..b79e84d 100644 (file)
  * considering it was developed without i18n support under Windows */
 #define DCCHARSET "windows-1252"
 
-#ifdef DCPP_MASQUERADE
-/*
- * I honestly don't want to pretend being a client that I'm not, but
- * there are so many hubs that simply do not accept any clients
- * outside their whitelists, for no obvious reasons, so I feel that I
- * am left with little choice. Anyhow, as long as I actually support
- * all the features that my faked DC++ version does, there should be
- * very little harm done.
- */
-#define DCIDTAG "++"
-#define DCIDTAGV "0.674"
-#define DCIDFULL "DC++ 0.674"
-#else
-#define DCIDTAG "Dolda"
-#define DCIDTAGV VERSION
-#define DCIDFULL "DoldaConnect " VERSION
-#endif
-
 #define PEER_CMD 0
 #define PEER_STOP 1
 #define PEER_TRNS 2
@@ -3014,7 +2996,7 @@ static void hubread(struct socket *sk, struct fnetnode *fn)
     free(newbuf);
     p = hub->inbuf;
     hub->inbufdata += datalen;
-    while((datalen > 0) && ((p2 = memchr(p, '|', datalen)) != NULL))
+    while((p - hub->inbuf < hub->inbufdata) && ((p2 = memchr(p, '|', hub->inbufdata - (p - hub->inbuf))) != NULL))
     {
        *(p2++) = 0;
        for(cmd = hubcmds; cmd->handler != NULL; cmd++)
@@ -3025,7 +3007,6 @@ static void hubread(struct socket *sk, struct fnetnode *fn)
        }
        if((cmd->limit == 0) || (hub->queue.size < cmd->limit))
            newqcmd(&hub->queue, p);
-       datalen -= p2 - p;
        p = p2;
     }
     memmove(hub->inbuf, p, hub->inbufdata -= p - hub->inbuf);
@@ -3140,7 +3121,6 @@ static void freedcpeer(struct dcpeer *peer)
            peer->transfer->close = 1;
        if(peer->transfer->dir == TRNSD_DOWN)
            resettransfer(peer->transfer);
-       transferdetach(peer->transfer);
     }
     if(peer->timeout != NULL)
        canceltimer(peer->timeout);
@@ -3222,15 +3202,6 @@ static void hubkill(struct fnetnode *fn)
     hub->sk->close = 1;
 }
 
-static wchar_t *dcbasename(wchar_t *filename)
-{
-    wchar_t *ret;
-    
-    if((ret = wcsrchr(filename, L'/')) != NULL)
-       return(ret + 1);
-    return(filename);
-}
-
 static struct transferiface dctransfer =
 {
     .detach = (void (*)(struct transfer *, void *))dctransdetach,
@@ -3249,7 +3220,6 @@ static struct fnet dcnet =
     .reqconn = hubreqconn,
     .sendchat = hubsendchat,
     .search = hubsearch,
-    .filebasename = dcbasename
 };
 
 static void peerread(struct socket *sk, struct dcpeer *peer)