Hi

Attached is a patch for dcc.c. I found that dcc_getfile_resume and
dcc_getfile_resume_start weren't minding DCC_STORE_PATH and so it
only worked when using the current directory (home dir in my case).

I basically just copied the code from dcc_getfile into both places
and made the tweaks necessary to make it fit. It could probably be
a little cleaner than this. *shrug*

Let me know if I inadvertently broke anything that I didn't catch.

Thanks,

-c

*** dcc.c       Sun Dec 30 22:52:41 2001
--- dcc.c.new   Sun Dec 30 23:25:34 2001
***************
*** 2798,2803 ****
--- 2798,2806 ----
  {
        char            *user;
        char            *filename = NULL;
+       char            *fullname = NULL;
+       char            pathname[MAXPATHLEN * 2 + 1];
+       char            *realname = NULL;
        DCC_list        *Client;
        char            *passwd = NULL;
        struct stat     sb;
***************
*** 2830,2842 ****
         * because this violates the protocol, and send_ctcp checks
         * for that.  Ugh.
         */
-       if (stat(filename, &sb) == -1)
-       {
-               /* File doesnt exist.  Sheesh. */
-               say("DCC RESUME: Cannot use DCC RESUME if the file doesnt exist. 
[%s|%s]", filename, strerror(errno));
-               return;
-       }
- 
  
        if (!(Client = dcc_searchlist(filename, user, DCC_FILEREAD, 0, NULL, 0)))
        {
--- 2833,2838 ----
***************
*** 2847,2852 ****
--- 2843,2869 ----
                return;
        }
  
+       *pathname = 0;
+       if (get_string_var(DCC_STORE_PATH_VAR))
+       {
+               strmcpy(pathname, get_string_var(DCC_STORE_PATH_VAR), 
+                                       MAXPATHLEN * 2);
+               strlcat(pathname, "/", MAXPATHLEN * 2);
+       }
+ 
+       realname = dcc_urldecode(Client->description);
+       strlcat(pathname, realname, MAXPATHLEN * 2);
+       new_free(&realname);
+ 
+       malloc_strcpy(&fullname, pathname);
+ 
+       if (stat(fullname, &sb) == -1)
+       {
+               /* File doesnt exist.  Sheesh. */
+               say("DCC RESUME: Cannot use DCC RESUME if the file doesnt exist. 
+[%s|%s]", filename, strerror(errno));
+               return;
+       }
+ 
        if ((Client->flags & DCC_ACTIVE) || (Client->flags & DCC_MY_OFFER))
        {
                say("A previous DCC GET:%s to %s exists", filename?filename:"<any>", 
user);
***************
*** 2935,2940 ****
--- 2952,2959 ----
  {
        DCC_list        *Client;
        char            *fullname;
+       char            pathname[MAXPATHLEN * 2 + 1];
+       char            *realname;
  
        if (!get_int_var(MIRC_BROKEN_DCC_RESUME_VAR))
                return;
***************
*** 2952,2959 ****
        if (!dcc_open(Client))
                return;
  
!       if (!(fullname = expand_twiddle(Client->description)))
!               malloc_strcpy(&fullname, Client->description);
  
        if (!(Client->file = open(fullname, O_WRONLY | O_APPEND, 0644)))
        {
--- 2971,2990 ----
        if (!dcc_open(Client))
                return;
  
!       *pathname = 0;
!       if (get_string_var(DCC_STORE_PATH_VAR))
!       {
!               strmcpy(pathname, get_string_var(DCC_STORE_PATH_VAR), 
!                                       MAXPATHLEN * 2);
!               strlcat(pathname, "/", MAXPATHLEN * 2);
!       }
! 
!       realname = dcc_urldecode(Client->description);
!       strlcat(pathname, realname, MAXPATHLEN * 2);
!       new_free(&realname);
! 
!       if (!(fullname = expand_twiddle(pathname)))
!               malloc_strcpy(&fullname, pathname);
  
        if (!(Client->file = open(fullname, O_WRONLY | O_APPEND, 0644)))
        {

Reply via email to