mirror of
https://github.com/djcb/mu.git
synced 2024-06-27 07:35:16 +02:00
Fixed indentation and name / type conventions to match original
This commit is contained in:
parent
e47c1f4f28
commit
dd14ba64dd
|
@ -779,24 +779,24 @@ get_new_basename (void)
|
||||||
g_get_host_name ());
|
g_get_host_name ());
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char*
|
static char*
|
||||||
get_path_separator(const char *path)
|
find_path_separator(const char *path)
|
||||||
{
|
{
|
||||||
const char *cur;
|
const char *cur;
|
||||||
for (cur = &path[strlen(path)-1]; cur > path; --cur) {
|
for (cur = &path[strlen(path)-1]; cur > path; --cur) {
|
||||||
if ((*cur == ':' || *cur == '!' || *cur == ';') &&
|
if ((*cur == ':' || *cur == '!' || *cur == ';') &&
|
||||||
(cur[1] == '2' && cur[2] == ',')) {
|
(cur[1] == '2' && cur[2] == ',')) {
|
||||||
return cur;
|
return (char*)cur;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return NULL;
|
||||||
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, *cur, *newpath, flags_sep = ':';
|
||||||
|
|
||||||
g_return_val_if_fail (oldpath, NULL);
|
g_return_val_if_fail (oldpath, NULL);
|
||||||
|
|
||||||
|
@ -807,30 +807,27 @@ mu_maildir_get_new_path (const char *oldpath, const char *new_mdir,
|
||||||
if (!mdir)
|
if (!mdir)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* determine the name of the location of the flag separator */
|
/* determine the name of the location of the flag separator */
|
||||||
|
|
||||||
if (new_name) {
|
if (new_name) {
|
||||||
const char *cur;
|
|
||||||
mfile = get_new_basename ();
|
mfile = get_new_basename ();
|
||||||
cur = get_path_separator (oldpath);
|
cur = find_path_separator (oldpath);
|
||||||
if (cur) {
|
if (cur) {
|
||||||
/* preserve the existing flags separator
|
/* preserve the existing flags separator
|
||||||
* in the new file name */
|
* in the new file name */
|
||||||
flags_sep = *cur;
|
flags_sep = *cur;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *cur;
|
mfile = g_path_get_basename (oldpath);
|
||||||
mfile = g_path_get_basename (oldpath);
|
cur = find_path_separator (mfile);
|
||||||
cur = (char*) get_path_separator (mfile);
|
if (cur) {
|
||||||
if (cur) {
|
/* get the custom flags (if any) */
|
||||||
/* get the custom flags (if any) */
|
custom_flags = mu_flags_custom_from_str (cur + 3);
|
||||||
custom_flags =
|
/* preserve the existing flags separator
|
||||||
mu_flags_custom_from_str (cur + 3);
|
* in the new file name */
|
||||||
/* preserve the existing flags separator
|
flags_sep = *cur;
|
||||||
* in the new file name */
|
cur[0] = '\0'; /* strip the flags */
|
||||||
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,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user