char *nm_header_get_fullpath(HEADER *h, char *buf, size_t bufsz)
{
snprintf(buf, bufsz, "%s/%s", nm_header_get_folder(h), h->path);
- dprint(2, (debugfile, "nm: returns fullpath '%s'\n", buf));
+ /*dprint(2, (debugfile, "nm: returns fullpath '%s'\n", buf));*/
return buf;
}
FREE(&h->path);
FREE(&data->folder);
- p -= 3;
+ p -= 3; /* skip subfolder (e.g. "new") */
h->path = safe_strdup(p);
- data->folder = strndup(path, p - path - 1);
+
+ for (; p > path && *(p - 1) == '/'; p--);
+
+ data->folder = strndup(path, p - path);
dprint(2, (debugfile, "nm: folder='%s', file='%s'\n", data->folder, h->path));
return 0;
strncmp(p - 3, "tmp", 3) == 0)) {
p -= 3;
- return strndup(path, p - path - 1);
+ for (; p > path && *(p - 1) == '/'; p--);
+
+ return strndup(path, p - path);
}
return NULL;
if (st == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID ||
st == NOTMUCH_STATUS_SUCCESS) {
dprint(2, (debugfile, "nm: remove filename '%s'\n", old));
- notmuch_database_remove_message(db, old);
+ st = notmuch_database_remove_message(db, old);
+ if (st != NOTMUCH_STATUS_SUCCESS ||
+ st != NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
+ dprint(2, (debugfile, "nm: failed to remove '%s'\n", old));
}
if (msg)
notmuch_message_maildir_flags_to_tags(msg);