diff options
author | Sam Creasey <sammy@oh.verio.com> | 2001-07-03 10:54:06 +0800 |
---|---|---|
committer | Sam Creasy <sammy@src.gnome.org> | 2001-07-03 10:54:06 +0800 |
commit | 7cd517dc60d56c2203d82faffaf40dc5cc7aed5a (patch) | |
tree | b44e82ecd9cba6608dfffbe36c9d974858218a05 /camel/providers/nntp/camel-nntp-folder.c | |
parent | 29700d38aeb9a90caaed499ac010f7632e9587dc (diff) | |
download | gsoc2013-evolution-7cd517dc60d56c2203d82faffaf40dc5cc7aed5a.tar gsoc2013-evolution-7cd517dc60d56c2203d82faffaf40dc5cc7aed5a.tar.gz gsoc2013-evolution-7cd517dc60d56c2203d82faffaf40dc5cc7aed5a.tar.bz2 gsoc2013-evolution-7cd517dc60d56c2203d82faffaf40dc5cc7aed5a.tar.lz gsoc2013-evolution-7cd517dc60d56c2203d82faffaf40dc5cc7aed5a.tar.xz gsoc2013-evolution-7cd517dc60d56c2203d82faffaf40dc5cc7aed5a.tar.zst gsoc2013-evolution-7cd517dc60d56c2203d82faffaf40dc5cc7aed5a.zip |
Implemented nntp_folder_search_by_expression and nntp_folder_search_free.
2001-07-02 Sam Creasey <sammy@oh.verio.com>
* providers/nntp/camel-nntp-folder.c: Implemented
nntp_folder_search_by_expression and
nntp_folder_search_free. Basic search functionality e.g. unread
marking now works for NNTP folders.
* camel_filter_search.c (get_size): Added get-size sexp directive
to get the size of a message for filters.
* providers/nntp/camel-nntp-folder.c (camel_nntp_folder_new):
Always check with the NNTP server after summary load -- this
function now always expires old summary entries and syncs with
the news server.
* providers/nntp/camel-nntp-utils.c (camel_nntp_get_headers):
Only fetch headers for articles not already logged in
the summary file.
* providers/nntp/camel-nntp-grouplist.c
(camel_nntp_get_grouplist_from_*): change from g_list_append()
to g_list_prepend() + g_list_reverse. Traversing 40,000
element linked lists sucks.
* providers/nntp/camel-nntp-store.c (camel_nntp_command):
Should the NNTP connection die with
CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED, make a single retry
attempt. Timing out the NNTP link is less painful this way.
svn path=/trunk/; revision=10716
Diffstat (limited to 'camel/providers/nntp/camel-nntp-folder.c')
-rw-r--r-- | camel/providers/nntp/camel-nntp-folder.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 4d27771c2c..0f981be643 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -46,6 +46,7 @@ #include "camel-data-wrapper.h" #include "camel-mime-message.h" #include "camel-folder-summary.h" +#include "camel-folder-search.h" #include "camel-exception.h" @@ -183,8 +184,30 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException * static GPtrArray* nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { - g_assert (0); - return NULL; + CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); + GPtrArray *matches, *summary; + + if(nntp_folder->search == NULL) + nntp_folder->search = camel_folder_search_new(); + + camel_folder_search_set_folder(nntp_folder->search, folder); + summary = camel_folder_get_summary(folder); + camel_folder_search_set_summary(nntp_folder->search, summary); + + matches = camel_folder_search_execute_expression(nntp_folder->search, expression, ex); + + camel_folder_free_summary(folder, summary); + + return matches; +} + +static void +nntp_folder_search_free(CamelFolder *folder, GPtrArray *result) +{ + CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); + + camel_folder_search_free_result(nntp_folder->search, result); + } static void @@ -209,6 +232,7 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class) camel_folder_class->set_message_flags = nntp_folder_set_message_flags; camel_folder_class->get_message = nntp_folder_get_message; camel_folder_class->search_by_expression = nntp_folder_search_by_expression; + camel_folder_class->search_free = nntp_folder_search_free; } CamelType @@ -238,6 +262,7 @@ camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelExcepti camel_folder_construct (folder, parent, folder_name, folder_name); folder->has_summary_capability = TRUE; + folder->has_search_capability = TRUE; root_dir_path = camel_nntp_store_get_toplevel_dir (CAMEL_NNTP_STORE(folder->parent_store)); nntp_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", @@ -248,18 +273,17 @@ camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelExcepti camel_folder_summary_set_filename (folder->summary, nntp_folder->summary_file_path); - 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); - if (camel_exception_get_id (ex)) { - camel_object_unref (CAMEL_OBJECT (folder)); - return NULL; - } - - /* XXX check return value */ - camel_folder_summary_save (folder->summary); + camel_folder_summary_load (folder->summary); + + camel_nntp_get_headers (CAMEL_FOLDER( folder )->parent_store, + nntp_folder, ex); + if (camel_exception_get_id (ex)) { + camel_object_unref (CAMEL_OBJECT (folder)); + return NULL; } + /* XXX check return value */ + camel_folder_summary_save (folder->summary); + return folder; } |