* mu-maildir: start maildirs (for the maildir: search param) with a slash

(well, G_DIR_SEPARATOR); thus, we can find mails in the 'root' maildir as
  well. When indexing under (say) ~/Maildir, a mail in cur will have maildir
  '/', and in foo/cur will have '/foo'
This commit is contained in:
Dirk-Jan C. Binnema
2010-02-15 20:24:00 +02:00
parent 01d6fbb257
commit 451be4394d

View File

@ -384,11 +384,11 @@ static gchar*
get_mdir_for_path (const gchar *old_mdir, const gchar *dir) get_mdir_for_path (const gchar *old_mdir, const gchar *dir)
{ {
if (dir[0] != 'n' && dir[0] != 'c' && if (dir[0] != 'n' && dir[0] != 'c' &&
strcmp(dir, "cur") != 0 && strcmp(dir, "new") != 0) strcmp(dir, "cur") != 0 && strcmp(dir, "new") != 0)
return g_strconcat (old_mdir, strlen(old_mdir)?G_DIR_SEPARATOR_S:"", return g_strconcat (old_mdir ? old_mdir : "",
dir, NULL); G_DIR_SEPARATOR_S, dir, NULL);
else else
return strdup (old_mdir); return strdup (old_mdir ? old_mdir : G_DIR_SEPARATOR_S);
} }
@ -553,11 +553,12 @@ mu_maildir_walk (const char *path, MuMaildirWalkMsgCallback cb_msg,
/* skip the final slash from dirnames */ /* skip the final slash from dirnames */
mypath = g_strdup (path); mypath = g_strdup (path);
/* strip the final / or \ */ /* strip the final / or \ */
if (mypath[strlen(mypath)-1] == G_DIR_SEPARATOR) if (mypath[strlen(mypath)-1] == G_DIR_SEPARATOR)
mypath[strlen(mypath)-1] = '\0'; mypath[strlen(mypath)-1] = '\0';
rv = process_dir (mypath, "", cb_msg, cb_dir, data); rv = process_dir (mypath, NULL, cb_msg,
cb_dir, data);
g_free (mypath); g_free (mypath);
return rv; return rv;
@ -584,8 +585,9 @@ clear_links (const gchar* dirname, DIR *dir)
if (entry->d_type != DT_LNK && entry->d_type != DT_DIR) if (entry->d_type != DT_LNK && entry->d_type != DT_DIR)
continue; continue;
/* we have to copy the buffer from fullpath_s, because it /* we have to copy the buffer from fullpath_s, because
* returns a static buffer and we are recursive*/ * it returns a static buffer and we are
* recursive*/
fp = fullpath_s (dirname, entry->d_name); fp = fullpath_s (dirname, entry->d_name);
fullpath = g_newa (char, strlen(fp) + 1); fullpath = g_newa (char, strlen(fp) + 1);
strcpy (fullpath, fp); strcpy (fullpath, fp);