diff options
author | Peter Williams <peterw@ximian.com> | 2002-08-10 06:01:44 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2002-08-10 06:01:44 +0800 |
commit | f75520757a7b645cdaa34a339210a6329d818b78 (patch) | |
tree | 358db8a131b1f2210fb6ffff1133afc4e3d69733 /camel/providers/imap | |
parent | 9dc535310a4512255d05185c26bf2f08fb3c1507 (diff) | |
download | gsoc2013-evolution-f75520757a7b645cdaa34a339210a6329d818b78.tar gsoc2013-evolution-f75520757a7b645cdaa34a339210a6329d818b78.tar.gz gsoc2013-evolution-f75520757a7b645cdaa34a339210a6329d818b78.tar.bz2 gsoc2013-evolution-f75520757a7b645cdaa34a339210a6329d818b78.tar.lz gsoc2013-evolution-f75520757a7b645cdaa34a339210a6329d818b78.tar.xz gsoc2013-evolution-f75520757a7b645cdaa34a339210a6329d818b78.tar.zst gsoc2013-evolution-f75520757a7b645cdaa34a339210a6329d818b78.zip |
New function, generate a UID that has better chances of being unique.
2002-08-02 Peter Williams <peterw@ximian.com>
* providers/imap/camel-imap-folder.c (get_temp_uid): New function,
generate a UID that has better chances of being unique.
(imap_append_offline): Use it here.
(imap_transfer_offline): And here.
svn path=/trunk/; revision=17757
Diffstat (limited to 'camel/providers/imap')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 5f1cab5293..020e0e3edd 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -1052,6 +1052,23 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } +static gchar * +get_temp_uid (void) +{ + gchar *res; + + static int counter = 0; + G_LOCK_DEFINE_STATIC (lock); + + G_LOCK (lock); + res = g_strdup_printf ("tempuid-%lx-%d", + (unsigned long) time (NULL), + counter++); + G_UNLOCK (lock); + + return res; +} + static void imap_append_offline (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, char **appended_uid, @@ -1062,10 +1079,7 @@ imap_append_offline (CamelFolder *folder, CamelMimeMessage *message, CamelFolderChangeInfo *changes; char *uid; - /* We could keep a separate counter, but this one works fine. */ - CAMEL_IMAP_STORE_LOCK (imap_store, command_lock); - uid = g_strdup_printf ("append-%d", imap_store->command++); - CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock); + uid = get_temp_uid (); camel_imap_summary_add_offline (folder->summary, uid, message, info); CAMEL_IMAP_FOLDER_LOCK (folder, cache_lock); @@ -1273,8 +1287,7 @@ imap_transfer_offline (CamelFolder *source, GPtrArray *uids, for (i = 0; i < uids->len; i++) { uid = uids->pdata[i]; - destuid = g_strdup_printf ("copy-%s:%s:%d", source->full_name, uid, - store->command++); + destuid = get_temp_uid (); mi = camel_folder_summary_uid (source->summary, uid); g_return_if_fail (mi != NULL); |