diff options
Diffstat (limited to 'camel/providers/imap')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 16 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 34 |
2 files changed, 42 insertions, 8 deletions
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; } |