diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-12-24 08:46:20 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-12-24 08:46:20 +0800 |
commit | 6de256c2a2b23f30d35e4a2213ad5839bf141d06 (patch) | |
tree | a34d8be64c0718070c4e1ea9548282912f37b387 /camel/providers/nntp/camel-nntp-folder.c | |
parent | 6183d89039ba67a7f3869f460c13aff09a548471 (diff) | |
download | gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.gz gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.bz2 gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.lz gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.xz gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.zst gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.zip |
Lock the command channel while searching. (imap_body_contains): If
2000-12-24 Not Zed <NotZed@HelixCode.com>
* providers/imap/camel-imap-search.c (imap_body_contains): Lock
the command channel while searching.
(imap_body_contains): If performing a whole uid search, then add
references to our own summary items, dont look it up in the
folder. This way they can't vanish unexpectedly.
* providers/imap/camel-imap-folder.h (CamelImapFolder): Added a
private field.
* providers/imap/camel-imap-private.h: Added lock for imap
searches.
* Merge from camel-mt-branch.
* providers/imap/camel-imap-folder.c (imap_update_summary): Merge
fix, use the folder->summary.
(imap_get_message_flags, imap_set_message_flags,
imap_get_message_user_flag, imap_set_message_user_flag): Removed
again.
(camel_imap_folder_init): Setup private data/lock.
(imap_finalize): Free private data/search lock.
(imap_search_free): Lock the search_lock.
(imap_search_by_expression): Lock the search lock when using the
search object. Also copy/ref hte summary, rather than getting it
directly.
(imap_refresh_info): Free any info lookups. Use folder->summary
not imap_folder->summary. And lock around commands.
svn path=/trunk/; revision=7150
Diffstat (limited to 'camel/providers/nntp/camel-nntp-folder.c')
-rw-r--r-- | camel/providers/nntp/camel-nntp-folder.c | 87 |
1 files changed, 9 insertions, 78 deletions
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index f918317502..7edc4a98fd 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -63,7 +63,7 @@ nntp_folder_sync (CamelFolder *folder, gboolean expunge, { CamelNNTPStore *store; - camel_folder_summary_save (CAMEL_NNTP_FOLDER(folder)->summary); + camel_folder_summary_save (folder->summary); store = CAMEL_NNTP_STORE (camel_folder_get_parent_store (folder)); @@ -71,39 +71,12 @@ nntp_folder_sync (CamelFolder *folder, gboolean expunge, camel_nntp_newsrc_write (store->newsrc); } -static gint -nntp_folder_get_message_count (CamelFolder *folder) -{ - CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER(folder); - - g_assert (folder); - g_assert (nntp_folder->summary); - - return camel_folder_summary_count(nntp_folder->summary); -} - -static guint32 -nntp_folder_get_message_flags (CamelFolder *folder, const char *uid) -{ - CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); - CamelMessageInfo *info = camel_folder_summary_uid (nntp_folder->summary, uid); - - return info->flags; -} - static void nntp_folder_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, guint32 set) { - CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); - CamelMessageInfo *info = camel_folder_summary_uid (nntp_folder->summary, uid); - guint32 new; - - new = (info->flags & ~flags) | (set & flags); - if (new == info->flags) - return; + ((CamelFolderClass *)parent_class)->set_message_flags(folder, uid, flags, set); - info->flags = new; if (flags & set & CAMEL_MESSAGE_SEEN) { int article_num; CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (camel_folder_get_parent_store (folder)); @@ -114,8 +87,6 @@ nntp_folder_set_message_flags (CamelFolder *folder, const char *uid, folder->name, article_num); } - - camel_folder_summary_touch (nntp_folder->summary); } static CamelMimeMessage * @@ -151,6 +122,9 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException * return NULL; } + /* this could probably done fairly easily with an nntp stream that + returns eof after '.' */ + /* XXX ick ick ick. read the entire message into a buffer and then create a stream_mem for it. */ buf_alloc = 2048; @@ -206,34 +180,6 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException * return message; } -static GPtrArray * -nntp_folder_get_uids (CamelFolder *folder) -{ - CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); - GPtrArray *out; - CamelMessageInfo *message_info; - int i; - int count = camel_folder_summary_count (nntp_folder->summary); - - out = g_ptr_array_new (); - g_ptr_array_set_size (out, count); - - for (i = 0; i < count; i++) { - message_info = camel_folder_summary_index (nntp_folder->summary, i); - out->pdata[i] = g_strdup (camel_message_info_uid(message_info)); - } - - return out; -} - -static GPtrArray * -nntp_folder_get_summary (CamelFolder *folder) -{ - CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); - - return nntp_folder->summary->messages; -} - static GPtrArray* nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { @@ -241,14 +187,6 @@ nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, C return NULL; } -static const CamelMessageInfo* -nntp_folder_get_message_info (CamelFolder *folder, const char *uid) -{ - CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); - - return camel_folder_summary_uid (nntp_folder->summary, uid); -} - static void nntp_folder_finalize (CamelObject *object) { @@ -268,16 +206,9 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class) /* virtual method overload */ camel_folder_class->sync = nntp_folder_sync; - camel_folder_class->get_message_count = nntp_folder_get_message_count; camel_folder_class->set_message_flags = nntp_folder_set_message_flags; - camel_folder_class->get_message_flags = nntp_folder_get_message_flags; camel_folder_class->get_message = nntp_folder_get_message; - camel_folder_class->get_uids = nntp_folder_get_uids; - camel_folder_class->free_uids = camel_folder_free_deep; - camel_folder_class->get_summary = nntp_folder_get_summary; - camel_folder_class->free_summary = camel_folder_free_nop; camel_folder_class->search_by_expression = nntp_folder_search_by_expression; - camel_folder_class->get_message_info = nntp_folder_get_message_info; } CamelType @@ -313,11 +244,11 @@ camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelExcepti root_dir_path, folder->name); - nntp_folder->summary = camel_folder_summary_new (); - camel_folder_summary_set_filename (nntp_folder->summary, + folder->summary = camel_folder_summary_new (); + camel_folder_summary_set_filename (folder->summary, nntp_folder->summary_file_path); - if (-1 == camel_folder_summary_load (nntp_folder->summary)) { + if (-1 == camel_folder_summary_load (folder->summary)) { /* Bad or nonexistant summary file */ camel_nntp_get_headers (CAMEL_FOLDER( folder )->parent_store, nntp_folder, ex); @@ -327,7 +258,7 @@ camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelExcepti } /* XXX check return value */ - camel_folder_summary_save (nntp_folder->summary); + camel_folder_summary_save (folder->summary); } return folder; |