diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 13 | ||||
-rw-r--r-- | camel/camel-folder-summary.c | 21 | ||||
-rw-r--r-- | camel/camel-folder-summary.h | 4 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 6 | ||||
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 15 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-folder.c | 8 |
6 files changed, 53 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 6e04660b28..0082e38a61 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,16 @@ +2000-12-05 Dan Winship <danw@helixcode.com> + + * providers/imap/camel-imap-folder.c (imap_set_message_flags): Fix + the check for "flags aren't actually changing". + + * providers/local/camel-local-folder.c (local_set_message_flags, + local_set_message_user_flag, local_set_message_user_tag): Don't + emit message_changed unless the flags actually changed. + + * providers/nntp/camel-nntp-folder.c + (nntp_folder_set_message_flags): Don't emit message_changed unless + the flags actually changed. Fix the check for marked as seen. + 2000-12-05 Not Zed <NotZed@HelixCode.com> * camel-seekable-substream.c (stream_flush): stream_flush does diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 8ea51a7bbf..9a6a96c273 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -1977,8 +1977,10 @@ camel_flag_get(CamelFlag **list, const char *name) * @value: * * Set the state of a flag @name in the list @list to @value. + * + * Return value: Whether or not it changed. **/ -void +gboolean camel_flag_set(CamelFlag **list, const char *name, gboolean value) { CamelFlag *flag, *tmp; @@ -1992,7 +1994,7 @@ camel_flag_set(CamelFlag **list, const char *name, gboolean value) flag->next = tmp->next; g_free(tmp); } - return; + return !value; } flag = tmp; } @@ -2003,6 +2005,7 @@ camel_flag_set(CamelFlag **list, const char *name, gboolean value) tmp->next = 0; flag->next = tmp; } + return value; } /** @@ -2046,7 +2049,8 @@ camel_flag_list_free(CamelFlag **list) *list = NULL; } -const char *camel_tag_get(CamelTag **list, const char *name) +const char +*camel_tag_get(CamelTag **list, const char *name) { CamelTag *tag; @@ -2066,8 +2070,11 @@ const char *camel_tag_get(CamelTag **list, const char *name) * @value: * * Set the tag @name in the tag list @list to @value. + * + * Return value: whether or not it changed **/ -void camel_tag_set(CamelTag **list, const char *name, const char *value) +gboolean +camel_tag_set(CamelTag **list, const char *name, const char *value) { CamelTag *tag, *tmp; @@ -2080,11 +2087,13 @@ void camel_tag_set(CamelTag **list, const char *name, const char *value) tag->next = tmp->next; g_free(tmp->value); g_free(tmp); + return TRUE; } else if (strcmp(tmp->value, value)) { /* has it changed? */ g_free(tmp->value); tmp->value = g_strdup(value); + return TRUE; } - return; + return FALSE; } tag = tmp; } @@ -2095,7 +2104,9 @@ void camel_tag_set(CamelTag **list, const char *name, const char *value) tmp->value = g_strdup(value); tmp->next = 0; tag->next = tmp; + return TRUE; } + return FALSE; } /** diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index bc47484699..9e3d132c50 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -264,7 +264,7 @@ int camel_folder_summary_decode_token(FILE *, char **); /* message flag operations */ gboolean camel_flag_get(CamelFlag **list, const char *name); -void camel_flag_set(CamelFlag **list, const char *name, gboolean state); +gboolean camel_flag_set(CamelFlag **list, const char *name, gboolean state); int camel_flag_list_size(CamelFlag **list); void camel_flag_list_free(CamelFlag **list); @@ -273,7 +273,7 @@ gboolean camel_system_flag_get (guint32 flags, const char *name); /* message tag operations */ const char *camel_tag_get(CamelTag **list, const char *name); -void camel_tag_set(CamelTag **list, const char *name, const char *value); +gboolean camel_tag_set(CamelTag **list, const char *name, const char *value); int camel_tag_list_size(CamelTag **list); void camel_tag_list_free(CamelTag **list); diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 892eb71d50..5d882856e2 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -799,14 +799,16 @@ imap_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, gui { CamelImapFolder *imap_folder = (CamelImapFolder *)folder; CamelMessageInfo *info; + guint32 new; info = camel_folder_summary_uid (imap_folder->summary, uid); g_return_if_fail (info != NULL); - if ((info->flags & set) == flags) + new = (info->flags & ~flags) | (set & flags); + if (new == info->flags) return; - info->flags = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED; + info->flags = new | CAMEL_MESSAGE_FOLDER_FLAGGED; camel_folder_summary_touch (imap_folder->summary); camel_object_trigger_event (CAMEL_OBJECT (folder), "message_changed", diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index c1c3256865..931c95a114 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -436,11 +436,16 @@ local_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, gui { CamelMessageInfo *info; CamelLocalFolder *mf = CAMEL_LOCAL_FOLDER(folder); + guint32 new; info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid); g_return_if_fail(info != NULL); - info->flags = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED; + new = (info->flags & ~flags) | (set & flags); + if (new == info->flags) + return; + + info->flags = new | CAMEL_MESSAGE_FOLDER_FLAGGED; camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); @@ -467,7 +472,9 @@ local_set_message_user_flag(CamelFolder *folder, const char *uid, const char *na info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid); g_return_if_fail(info != NULL); - camel_flag_set(&info->user_flags, name, value); + if (!camel_flag_set(&info->user_flags, name, value)) + return; + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE; camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); @@ -494,7 +501,9 @@ local_set_message_user_tag(CamelFolder *folder, const char *uid, const char *nam info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid); g_return_if_fail(info != NULL); - camel_tag_set(&info->user_tags, name, value); + if (!camel_tag_set(&info->user_tags, name, value)) + return; + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE; camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index ba469583e3..f918317502 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -97,10 +97,14 @@ nntp_folder_set_message_flags (CamelFolder *folder, const char *uid, { CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); CamelMessageInfo *info = camel_folder_summary_uid (nntp_folder->summary, uid); + guint32 new; - info->flags = set; + new = (info->flags & ~flags) | (set & flags); + if (new == info->flags) + return; - if (set & CAMEL_MESSAGE_SEEN) { + info->flags = new; + if (flags & set & CAMEL_MESSAGE_SEEN) { int article_num; CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (camel_folder_get_parent_store (folder)); |