* lib: make renaming messages upon moving them optional
This commit is contained in:
@ -766,9 +766,9 @@ get_new_basename (void)
|
||||
|
||||
char*
|
||||
mu_maildir_get_new_path (const char *oldpath, const char *new_mdir,
|
||||
MuFlags newflags)
|
||||
MuFlags newflags, gboolean new_name)
|
||||
{
|
||||
char *mfile, *mdir, *custom_flags, *newpath;/**cur;q*/
|
||||
char *mfile, *mdir, *custom_flags, *newpath;
|
||||
|
||||
g_return_val_if_fail (oldpath, NULL);
|
||||
|
||||
@ -779,21 +779,23 @@ mu_maildir_get_new_path (const char *oldpath, const char *new_mdir,
|
||||
if (!mdir)
|
||||
return NULL;
|
||||
|
||||
/* determine the name of the mailfile, stripped of its flags, as well
|
||||
* as any custom (non-standard) flags */
|
||||
/* /\* mfile = g_path_get_basename (oldpath); *\/ */
|
||||
|
||||
/* for (cur = &mfile[strlen(mfile)-1]; cur > mfile; --cur) { */
|
||||
/* if ((*cur == ':' || *cur == '!') && */
|
||||
/* (cur[1] == '2' && cur[2] == ',')) { */
|
||||
/* /\* get the custom flags (if any) *\/ */
|
||||
/* custom_flags = mu_flags_custom_from_str (cur + 3); */
|
||||
/* cur[0] = '\0'; /\* strip the flags *\/ */
|
||||
/* break; */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
mfile = get_new_basename ();
|
||||
if (new_name)
|
||||
mfile = get_new_basename ();
|
||||
else {
|
||||
/* determine the name of the mailfile, stripped of its flags, as well
|
||||
* as any custom (non-standard) flags */
|
||||
char *cur;
|
||||
mfile = g_path_get_basename (oldpath);
|
||||
for (cur = &mfile[strlen(mfile)-1]; cur > mfile; --cur) {
|
||||
if ((*cur == ':' || *cur == '!') &&
|
||||
(cur[1] == '2' && cur[2] == ',')) {
|
||||
/* get the custom flags (if any) */
|
||||
custom_flags = mu_flags_custom_from_str (cur + 3);
|
||||
cur[0] = '\0'; /* strip the flags */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newpath = get_new_path (new_mdir ? new_mdir : mdir,
|
||||
mfile, newflags, custom_flags);
|
||||
@ -859,7 +861,7 @@ msg_move (const char* src, const char *dst, GError **err)
|
||||
|
||||
gchar*
|
||||
mu_maildir_move_message (const char* oldpath, const char* targetmdir,
|
||||
MuFlags newflags, gboolean ignore_dups,
|
||||
MuFlags newflags, gboolean ignore_dups, gboolean new_name,
|
||||
GError **err)
|
||||
{
|
||||
char *newfullpath;
|
||||
@ -869,7 +871,7 @@ mu_maildir_move_message (const char* oldpath, const char* targetmdir,
|
||||
g_return_val_if_fail (oldpath, FALSE);
|
||||
|
||||
newfullpath = mu_maildir_get_new_path (oldpath, targetmdir,
|
||||
newflags);
|
||||
newflags, new_name);
|
||||
if (!newfullpath) {
|
||||
mu_util_g_set_error (err, MU_ERROR_FILE,
|
||||
"failed to determine targetpath");
|
||||
|
||||
Reference in New Issue
Block a user