mu_maildir_get_new_path() did not use the right flags separator when creating new file names.
This commit is contained in:
@ -779,12 +779,24 @@ get_new_basename (void)
|
|||||||
g_get_host_name ());
|
g_get_host_name ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
get_path_separator(const char *path)
|
||||||
|
{
|
||||||
|
const char *cur;
|
||||||
|
for (cur = &path[strlen(path)-1]; cur > path; --cur) {
|
||||||
|
if ((*cur == ':' || *cur == '!' || *cur == ';') &&
|
||||||
|
(cur[1] == '2' && cur[2] == ',')) {
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
mu_maildir_get_new_path (const char *oldpath, const char *new_mdir,
|
mu_maildir_get_new_path (const char *oldpath, const char *new_mdir,
|
||||||
MuFlags newflags, gboolean new_name)
|
MuFlags newflags, gboolean new_name)
|
||||||
{
|
{
|
||||||
char *mfile, *mdir, *custom_flags, *newpath, flags_sep = ':';
|
char *mfile, *mdir, *custom_flags, *newpath, flags_sep = ':';
|
||||||
|
|
||||||
g_return_val_if_fail (oldpath, NULL);
|
g_return_val_if_fail (oldpath, NULL);
|
||||||
|
|
||||||
@ -795,26 +807,30 @@ mu_maildir_get_new_path (const char *oldpath, const char *new_mdir,
|
|||||||
if (!mdir)
|
if (!mdir)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (new_name)
|
/* determine the name of the location of the flag separator */
|
||||||
|
|
||||||
|
if (new_name) {
|
||||||
|
const char *cur;
|
||||||
mfile = get_new_basename ();
|
mfile = get_new_basename ();
|
||||||
else {
|
cur = get_path_separator (oldpath);
|
||||||
/* determine the name of the mailfile, stripped of its flags, as
|
if (cur) {
|
||||||
* well as any custom (non-standard) flags */
|
/* preserve the existing flags separator
|
||||||
char *cur;
|
* in the new file name */
|
||||||
mfile = g_path_get_basename (oldpath);
|
flags_sep = *cur;
|
||||||
for (cur = &mfile[strlen(mfile)-1]; cur > mfile; --cur) {
|
}
|
||||||
if ((*cur == ':' || *cur == '!' || *cur == ';') &&
|
} else {
|
||||||
(cur[1] == '2' && cur[2] == ',')) {
|
char *cur;
|
||||||
/* get the custom flags (if any) */
|
mfile = g_path_get_basename (oldpath);
|
||||||
custom_flags =
|
cur = (char*) get_path_separator (mfile);
|
||||||
mu_flags_custom_from_str (cur + 3);
|
if (cur) {
|
||||||
/* preserve the existing flags separator
|
/* get the custom flags (if any) */
|
||||||
* in the new file name */
|
custom_flags =
|
||||||
flags_sep = *cur;
|
mu_flags_custom_from_str (cur + 3);
|
||||||
cur[0] = '\0'; /* strip the flags */
|
/* preserve the existing flags separator
|
||||||
break;
|
* in the new file name */
|
||||||
}
|
flags_sep = *cur;
|
||||||
}
|
cur[0] = '\0'; /* strip the flags */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newpath = get_new_path (new_mdir ? new_mdir : mdir,
|
newpath = get_new_path (new_mdir ? new_mdir : mdir,
|
||||||
|
|||||||
Reference in New Issue
Block a user