aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2012-01-20 08:41:40 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2012-01-20 08:41:40 +0000
commit93330622a3ff0e391fdd2482ddcce0dd39038eb6 (patch)
tree60522ec41176bf24a4c2f08e359b8a8a6ce3cab4
parent430f45f16d2c4e4b610aa347869a53eb225acd20 (diff)
emit signals for IMAP.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3017 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--libsylph/imap.c27
2 files changed, 32 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9308fa5f..5df6f83a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-01-20
+ * libsylph/imap.c: emit "add-msg", "remove-msg", "remove-all-msg",
+ "move-folder" and "remove-folder" signals.
+
+2012-01-20
+
* libsylph/news.c
libsylph/nntp.[ch]: supported SOCKS proxy.
diff --git a/libsylph/imap.c b/libsylph/imap.c
index eb329076..c090384f 100644
--- a/libsylph/imap.c
+++ b/libsylph/imap.c
@@ -36,6 +36,7 @@
# include <iconv.h>
#endif
+#include "sylmain.h"
#include "imap.h"
#include "socket.h"
#include "socks.h"
@@ -1417,6 +1418,9 @@ static gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list,
return -1;
}
+ if (syl_app_get())
+ g_signal_emit_by_name(syl_app_get(), "add-msg", dest, fileinfo->file, new_uid);
+
if (!session->uidplus)
last_uid++;
else if (last_uid < new_uid)
@@ -1552,6 +1556,10 @@ static gint imap_do_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist,
for (cur = msglist; cur != NULL; cur = cur->next) {
msginfo = (MsgInfo *)cur->data;
+
+ if (syl_app_get())
+ g_signal_emit_by_name(syl_app_get(), "add-msg", dest, NULL, 0);
+
dest->total++;
if (MSG_IS_NEW(msginfo->flags))
dest->new++;
@@ -1731,6 +1739,9 @@ static gint imap_remove_msgs(Folder *folder, FolderItem *item, GSList *msglist)
MsgInfo *msginfo = (MsgInfo *)cur->data;
guint32 uid = msginfo->msgnum;
+ if (syl_app_get())
+ g_signal_emit_by_name(syl_app_get(), "remove-msg", item, NULL, uid);
+
if (dir_exist)
remove_numbered_files(dir, uid, uid);
item->total--;
@@ -1782,6 +1793,9 @@ static gint imap_remove_all_msg(Folder *folder, FolderItem *item)
return ok;
}
+ if (syl_app_get())
+ g_signal_emit_by_name(syl_app_get(), "remove-all-msg", item);
+
item->new = item->unread = item->total = 0;
item->updated = TRUE;
@@ -2491,6 +2505,7 @@ static gint imap_rename_folder_real(Folder *folder, FolderItem *item,
gint ok;
gint exists, recent, unseen;
guint32 uid_validity;
+ gchar *old_id, *new_id;
g_return_val_if_fail(folder != NULL, -1);
g_return_val_if_fail(item != NULL, -1);
@@ -2565,6 +2580,8 @@ static gint imap_rename_folder_real(Folder *folder, FolderItem *item,
return -1;
}
+ old_id = folder_item_get_identifier(item);
+
if (new_parent) {
g_node_unlink(item->node);
g_node_append(new_parent->node, item->node);
@@ -2595,6 +2612,13 @@ static gint imap_rename_folder_real(Folder *folder, FolderItem *item,
g_free(real_oldpath);
g_free(real_newpath);
+ new_id = folder_item_get_identifier(item);
+ if (syl_app_get())
+ g_signal_emit_by_name(syl_app_get(), "move-folder", item,
+ old_id, new_id);
+ g_free(new_id);
+ g_free(old_id);
+
return 0;
}
@@ -2647,6 +2671,9 @@ static gint imap_remove_folder(Folder *folder, FolderItem *item)
if (is_dir_exist(cache_dir) && remove_dir_recursive(cache_dir) < 0)
g_warning("can't remove directory '%s'\n", cache_dir);
g_free(cache_dir);
+
+ if (syl_app_get())
+ g_signal_emit_by_name(syl_app_get(), "remove-folder", item);
folder_item_remove(item);
return 0;