This commit is contained in:
djcb 2013-12-01 20:21:44 +02:00
parent 4d45b8b54c
commit 0364433cc1
2 changed files with 17 additions and 14 deletions

View File

@ -163,10 +163,11 @@ get_target_fullpath (const char* src, const gchar *targetpath, GError **err)
srcfile = g_path_get_basename (src); srcfile = g_path_get_basename (src);
/* create targetpath; note: make the filename cough* unique by /* create targetpath; note: make the filename *cough* unique
*including a hash * of the srcname in the targetname. This * by including a hash of the srcname in the targetname. This
*helps if there are * copies of a message (which all have the * helps if there are copies of a message (which all have the
*same basename)*/ * same basename)
*/
targetfullpath = g_strdup_printf ("%s%c%s%c%u_%s", targetfullpath = g_strdup_printf ("%s%c%s%c%u_%s",
targetpath, targetpath,
G_DIR_SEPARATOR, G_DIR_SEPARATOR,
@ -700,8 +701,8 @@ mu_maildir_get_flags_from_path (const char *path)
* /home/user/Maildir/foo/bar/new/abc and flags == MU_FLAG_REPLIED * /home/user/Maildir/foo/bar/new/abc and flags == MU_FLAG_REPLIED
* => /home/user/Maildir/foo/bar/cur * => /home/user/Maildir/foo/bar/cur
* *
* so the difference is whether MuFlags matches MU_FLAG_NEW is set or * so the difference is whether MU_FLAG_NEW is set or not; and in the
* not; and in the latter case, no other flags are allowed. * latter case, no other flags are allowed.
* *
*/ */
static gchar* static gchar*
@ -749,10 +750,10 @@ mu_maildir_get_maildir_from_path (const char* path)
static char* static char*
get_new_basename (void) get_new_basename (void)
{ {
char date[9]; /* YYYYMMDD */ char date[9]; /* YYYYMMDD */
char hostname[32]; /* should be enough...*/ char hostname[32]; /* should be enough...*/
long int rnd; long int rnd;
time_t now; time_t now;
now = time(NULL); now = time(NULL);
strftime (date, sizeof(date), "%Y%m%d", localtime(&now)); strftime (date, sizeof(date), "%Y%m%d", localtime(&now));
@ -760,7 +761,8 @@ get_new_basename (void)
memcpy (hostname, "hostname", strlen("hostname")); memcpy (hostname, "hostname", strlen("hostname"));
rnd = random (); rnd = random ();
return g_strdup_printf ("%s-%06x-%s", date, (unsigned)rnd, hostname); return g_strdup_printf ("%s-%08x-%s", date,
(unsigned)rnd, hostname);
} }

View File

@ -188,7 +188,7 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid)
c2 = mu_container_new (msg, docid, fake_msgid); c2 = mu_container_new (msg, docid, fake_msgid);
c2->flags = MU_CONTAINER_FLAG_DUP; c2->flags = MU_CONTAINER_FLAG_DUP;
c = mu_container_append_children (c, c2); /*c = */ mu_container_append_children (c, c2);
g_hash_table_insert (id_table, (gpointer)fake_msgid, c2); g_hash_table_insert (id_table, (gpointer)fake_msgid, c2);
@ -266,7 +266,8 @@ handle_references (GHashTable *id_table, MuContainer *c)
as a child of the other, don't add the link. */ as a child of the other, don't add the link. */
if (child_elligible (parent, child, created)) if (child_elligible (parent, child, created))
parent = mu_container_append_children (parent, child); /*parent =*/
mu_container_append_children (parent, child);
parent = child; parent = child;
} }
@ -307,7 +308,7 @@ handle_references (GHashTable *id_table, MuContainer *c)
c->next = c->last = c->parent = NULL; c->next = c->last = c->parent = NULL;
} }
parent = mu_container_append_children (parent, c); /*parent = */mu_container_append_children (parent, c);
} }
} }