projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* test/setup-test: Run 'make clean' before building
[mmh]
/
sbr
/
folder_addmsg.c
diff --git
a/sbr/folder_addmsg.c
b/sbr/folder_addmsg.c
index
f03d386
..
f90cedf
100644
(file)
--- a/
sbr/folder_addmsg.c
+++ b/
sbr/folder_addmsg.c
@@
-20,7
+20,7
@@
int
folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
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];
{
int infd, outfd, linkerr, first_time, msgnum;
char *nmsg, newmsg[BUFSIZ];
@@
-137,12
+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.
* 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) {
*/
if (link (msgfile, newmsg) != -1) {
if (deleting) {
- (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", pwd(), msgfile);
+ (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile);
(void)ext_hook("ref-hook", oldmsg, newmsg);
}
else
(void)ext_hook("ref-hook", oldmsg, newmsg);
}
else
@@
-180,11
+180,11
@@
folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
*/
if (linkerr == EXDEV) {
if (stat (newmsg, &st1) == 0) {
*/
if (linkerr == EXDEV) {
if (stat (newmsg, &st1) == 0) {
- advise (NULL, "message %s:%s already exists", newmsg);
+ advise (NULL, "message %s:%s already exists", mp->foldpath, newmsg);
return -1;
} else {
if ((infd = open (msgfile, O_RDONLY)) == -1) {
return -1;
} else {
if ((infd = open (msgfile, O_RDONLY)) == -1) {
- advise (msgfile, "unable to open message %s");
+ advise (msgfile, "unable to open message %s", msgfile);
return -1;
}
fstat (infd, &st1);
return -1;
}
fstat (infd, &st1);
@@
-197,8
+197,10
@@
folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
close (infd);
close (outfd);
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);
else
(void)ext_hook("add-hook", newmsg, (char *)0);