X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ffolder_addmsg.c;h=1af116cb71fe580316ceb4543d060998c3ba0cfa;hp=db2b42f3f649ed6e69858aa7cf694cd1ca474c1a;hb=1bb1f6c3f38b05060bf699ea2743f7386889bf63;hpb=d76e9388aabc9946124c5d3347ff5c5333bcd7d3 diff --git a/sbr/folder_addmsg.c b/sbr/folder_addmsg.c index db2b42f..1af116c 100644 --- a/sbr/folder_addmsg.c +++ b/sbr/folder_addmsg.c @@ -20,12 +20,11 @@ int folder_addmsg (struct msgs **mpp, char *msgfile, int selected, - int unseen, int preserve, int deleting) + int unseen, int preserve, int deleting, char *from_dir) { int infd, outfd, linkerr, first_time, msgnum; char *nmsg, newmsg[BUFSIZ]; char oldmsg[BUFSIZ]; - struct msgs *op; struct msgs *mp; struct stat st1, st2; @@ -138,14 +137,12 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, * Then run the external hook on the message if one was specified in the context. * Run the refile hook if we're moving the message from one place to another. * We have to construct the from path name for this because it's not there. - * Run the add hook if the message is getting copied or lined somewhere else. + * Run the add hook if the message is getting copied or linked somewhere else. */ if (link (msgfile, newmsg) != -1) { if (deleting) { - op = folder_read(getfolder(1)); - (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", pwd(), msgfile); - folder_free(op); + (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile); (void)ext_hook("ref-hook", oldmsg, newmsg); } else @@ -200,8 +197,10 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, close (infd); close (outfd); - if (deleting) - (void)ext_hook("ref-hook", newmsg, msgfile); + if (deleting) { + (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile); + (void)ext_hook("ref-hook", oldmsg, newmsg); + } else (void)ext_hook("add-hook", newmsg, (char *)0);