From 6d76cc84a11eff91e2bc66d6c1214e8226c9539a Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 4 Jul 2000 03:40:58 +0000 Subject: Centralize creation of new UIDs for the summary. svn path=/trunk/; revision=3885 --- camel/ChangeLog | 9 +++++++++ camel/camel-folder-summary.c | 10 ++++++++-- camel/camel-folder-summary.h | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index c7575b5f5d..076c57e321 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2000-07-03 Ettore Perazzoli + + * camel-folder-summary.c (camel_folder_summary_next_uid_string): + New. + (camel_folder_summary_add): Use + `camel_folder_summary_next_uid_string()' instead of recomputing + the UID manually here. + (camel_folder_summary_add_from_parser): Likewise. + 2000-07-03 Ettore Perazzoli * camel-folder-summary.c (camel_folder_summary_set_uid): Removed. diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 1d4352ed67..6ccf2bc7d5 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -269,6 +269,12 @@ guint32 camel_folder_summary_next_uid(CamelFolderSummary *s) return uid; } +char * +camel_folder_summary_next_uid_string (CamelFolderSummary *s) +{ + return g_strdup_printf ("%u", camel_folder_summary_next_uid (s)); +} + /* loads the content descriptions, recursively */ static CamelMessageContentInfo * perform_content_info_load(CamelFolderSummary *s, FILE *in) @@ -412,7 +418,7 @@ void camel_folder_summary_add(CamelFolderSummary *s, CamelMessageInfo *info) return; retry: if (info->uid == NULL) { - info->uid = g_strdup_printf("%u", s->nextuid++); + info->uid = camel_folder_summary_next_uid_string (s); } if (g_hash_table_lookup(s->messages_uid, info->uid)) { g_warning("Trying to insert message with clashing uid. new uid re-assigned"); @@ -453,7 +459,7 @@ CamelMessageInfo *camel_folder_summary_add_from_parser(CamelFolderSummary *s, Ca /* FIXME: better uid assignment method? */ if (info->uid == NULL) { - info->uid = g_strdup_printf("%u", s->nextuid++); + info->uid = camel_folder_summary_next_uid_string (s); } if (p->index) { diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index ef2b036e9e..b53d645ad6 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -162,7 +162,8 @@ void camel_folder_summary_set_filename(CamelFolderSummary *, const char *); void camel_folder_summary_set_index(CamelFolderSummary *, ibex *); void camel_folder_summary_set_build_content(CamelFolderSummary *, gboolean state); -guint32 camel_folder_summary_next_uid(CamelFolderSummary *s); +guint32 camel_folder_summary_next_uid (CamelFolderSummary *s); +char *camel_folder_summary_next_uid_string (CamelFolderSummary *s); /* load/save the summary in its entirety */ int camel_folder_summary_load(CamelFolderSummary *); -- cgit