Merge branch 'master' of git.dolda2000.com:/srv/git/r/doldaconnect
authorFredrik Tolf <fredrik@dolda2000.com>
Thu, 6 Mar 2008 23:59:30 +0000 (00:59 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Thu, 6 Mar 2008 23:59:30 +0000 (00:59 +0100)
daemon/fnet-dc.c
daemon/transfer.c
doc/man/hubmgr.1
lib/guile/hubmgr

index 43820fc..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);
index 328fb33..d5b03e1 100644 (file)
@@ -605,7 +605,7 @@ static void filterexit(pid_t pid, int status, void *data)
 
 int forkfilter(struct transfer *transfer)
 {
-    char *filtername, *filename, *peerid, *buf;
+    char *filtername, *filename, *peerid, *buf, *p;
     wchar_t *wfilename;
     struct passwd *pwent;
     pid_t pid;
@@ -659,6 +659,12 @@ int forkfilter(struct transfer *transfer)
        peerid = sprintf2("utf8-%s", buf);
        free(buf);
     }
+    for(p = filename; *p; p++) {
+       if(*p == '/')
+           *p = '_';
+       else if((p == filename) && (*p == '.'))
+           *p = '_';
+    }
     if((pid = forksess(transfer->owner, transfer->auth, filterexit, NULL, FD_PIPE, 0, O_WRONLY, &inpipe, FD_PIPE, 1, O_RDONLY, &outpipe, FD_FILE, 2, O_RDWR, "/dev/null", FD_END)) < 0)
     {
        flog(LOG_WARNING, "could not fork session for filter for transfer %i: %s", transfer->id, strerror(errno));
index 9292bb3..6a7d23c 100644 (file)
@@ -21,7 +21,7 @@
 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
 .\" USA.
 .\"
-.TH HUBMGR 1 "2007-11-18" "" "Dolda Connect manual"
+.TH HUBMGR 1 "2008-03-03" "" "Dolda Connect manual"
 .SH NAME
 hubmgr \- Automatic hub manager for Dolda Connect
 .SH SYNOPSIS
@@ -40,6 +40,12 @@ upon receipt of either one of them. It will also listen for messages
 on the name \fBhubmgr\fP and exit if it receives a message with the
 first token being \fBexit\fP. Upon exit, it will disconnect all
 managed hubs.
+.P
+\fBhubmgr\fP will check its configuration file (which is described
+below in the FILES section) for updates on a regular basis. If the
+file has changed, it will be reread and \fBhubmgr\fP will connect to
+any new hubs encountered, as well as disconnect from hubs that have
+been removed from the file.
 .SH OPTIONS
 .TP
 .B -d
index e323992..ea7e474 100755 (executable)
@@ -79,9 +79,6 @@
                        (same (car delta))
                        (del (cadr delta))
                        (new (caddr delta)))
-                  (display same) (newline)
-                  (display del) (newline)
-                  (display new) (newline)
                   (for-each (lambda (o)
                               (let ((el (assq o connlist)))
                                 (if el