From bc22c33ee2e0648493d7dc5208f8fb12c466b716 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 12 Jul 2000 04:13:21 +0000 Subject: Updated to emit the message_changed signal. (imap_delete_message): Updated 2000-07-12 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (imap_set_message_flags): Updated to emit the message_changed signal. (imap_delete_message): Updated to use imap_set_message_flags (). (imap_move_message_to): Updated to use imap_set_message_flags () and to emit the folder_changed signal on the destination folder. (imap_copy_message_to): Updated to emit the folder_changed signal on the destination folder. (imap_append_message): Updated to emit the folder_changed signal on the destination folder. svn path=/trunk/; revision=4105 --- camel/ChangeLog | 12 +++++++++++ camel/providers/imap/camel-imap-folder.c | 16 ++++++++++++--- camel/providers/imap/camel-imap-store.c | 34 +++++++++++++++++++++++++++----- 3 files changed, 54 insertions(+), 8 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 5d3dec98b9..5340f5cef2 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,15 @@ +2000-07-12 Jeffrey Stedfast + + * providers/imap/camel-imap-folder.c (imap_set_message_flags): + Updated to emit the message_changed signal. + (imap_delete_message): Updated to use imap_set_message_flags (). + (imap_move_message_to): Updated to use imap_set_message_flags () + and to emit the folder_changed signal on the destination folder. + (imap_copy_message_to): Updated to emit the folder_changed signal + on the destination folder. + (imap_append_message): Updated to emit the folder_changed signal + on the destination folder. + 2000-07-11 Jeffrey Stedfast * camel-folder.c (camel_folder_append_message): Now takes a diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 5dd7926503..a102f28b19 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -350,6 +350,8 @@ imap_expunge (CamelFolder *folder, CamelException *ex) return; } + gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed"); + g_free (result); } @@ -538,6 +540,8 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, guint32 fla g_free (result); g_free (folder_path); + + gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed"); } static void @@ -570,6 +574,8 @@ imap_copy_message_to (CamelFolder *source, const char *uid, CamelFolder *destina g_free (result); g_free (folder_path); + + gtk_signal_emit_by_name (GTK_OBJECT (destination), "folder_changed"); } /* FIXME: Duplication of code! */ @@ -614,7 +620,9 @@ imap_move_message_to (CamelFolder *source, const char *uid, CamelFolder *destina return; } - info->flags |= CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED; + imap_set_message_flags (source, uid, CAMEL_MESSAGE_DELETED, ~(info->flags), ex); + + gtk_signal_emit_by_name (GTK_OBJECT (destination), "folder_changed"); } static GPtrArray * @@ -783,7 +791,7 @@ imap_delete_message (CamelFolder *folder, const gchar *uid, CamelException *ex) return; } - info->flags |= CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED; + imap_set_message_flags (folder, uid, CAMEL_MESSAGE_DELETED, ~(info->flags), ex); } static CamelMimeMessage * @@ -1455,6 +1463,8 @@ imap_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, gui } info->flags = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED; + + gtk_signal_emit_by_name (GTK_OBJECT (folder), "message_changed", uid); } static gboolean @@ -1466,5 +1476,5 @@ imap_get_message_user_flag (CamelFolder *folder, const char *uid, const char *na static void imap_set_message_user_flag (CamelFolder *folder, const char *uid, const char *name, gboolean value, CamelException *ex) { - return; + gtk_signal_emit_by_name (GTK_OBJECT (folder), "message_changed", uid); } diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index e7c9d98673..d516694c6e 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -530,7 +530,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char if (folder && store->current_folder != folder && strncmp (fmt, "STATUS", 6) && strncmp (fmt, "CREATE", 5) && strcmp (fmt, "CAPABILITY")) { /* We need to select the correct mailbox first */ - char *r, *folder_path; + char *r, *folder_path, *recent; int s; if (url && url->path && strcmp (folder->full_name, "INBOX")) @@ -540,7 +540,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char s = camel_imap_command_extended (store, folder, &r, "SELECT %s", folder_path); g_free (folder_path); - if (s != CAMEL_IMAP_OK) { + if (!r || s != CAMEL_IMAP_OK) { *ret = r; return s; } else { @@ -548,7 +548,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char #if 0 char *p; - p = strstr (result, "\n"); + p = strstr (r, "\n"); while (p) { if (*(p + 1) == '*') p = strstr (p, "\n"); @@ -562,6 +562,18 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char } #endif } +#if 0 + if ((recent = strstrcase (r, "RECENT"))) { + char *p; + + for (p = recent; p > r && *p != '*'; p--); + for ( ; *p && (*p < '0' || *p > '9') && p < recent; p++); + + if (atoi (p) > 0) + gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed"); + } +#endif + g_free (r); store->current_folder = folder; } @@ -649,7 +661,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** strncmp (fmt, "EXAMINE", 7) && strncmp (fmt, "STATUS", 6) && strncmp (fmt, "CREATE", 6) && strcmp (fmt, "CAPABILITY")) { /* We need to select the correct mailbox first */ - char *r, *folder_path; + char *r, *folder_path, *recent; int s; if (url && url->path && strcmp (folder->full_name, "INBOX")) @@ -659,10 +671,22 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** s = camel_imap_command_extended (store, folder, &r, "SELECT %s", folder_path); g_free (folder_path); - if (s != CAMEL_IMAP_OK) { + if (!r || s != CAMEL_IMAP_OK) { *ret = r; return s; } +#if 0 + if ((recent = strstrcase (r, "RECENT"))) { + char *p; + + for (p = recent; p > r && *p != '*'; p--); + for ( ; *p && (*p < '0' || *p > '9') && p < recent; p++); + + if (atoi (p) > 0) + gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed"); + } +#endif + g_free (r); store->current_folder = folder; } -- cgit v1.2.3