diff options
author | Chris Toshok <toshok@helixcode.com> | 2000-09-01 09:58:56 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2000-09-01 09:58:56 +0800 |
commit | 71eb39b730cd190c690647d3806d567d55424026 (patch) | |
tree | e18c42836d84857e879cefae8263302e018b96a0 /camel/providers/nntp/camel-nntp-folder.c | |
parent | 3cf4f0d243e0c84b519fe027a3299a925e7075fb (diff) | |
download | gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.gz gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.bz2 gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.lz gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.xz gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.zst gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.zip |
use camel_remote_store_recv_line.
2000-08-31 Chris Toshok <toshok@helixcode.com>
* providers/nntp/camel-nntp-utils.c (get_OVER_headers): use
camel_remote_store_recv_line.
* providers/nntp/camel-nntp-folder.c (nntp_folder_get_message):
use camel_remote_store_recv_line to build message. also, free our
buffer so we don't leak like mad.
* providers/nntp/camel-nntp-store.c:
(camel_nntp_store_get_additional_data) remove.
(camel_nntp_store_get_extensions): use
camel_remote_store_recv_line.
(camel_nntp_store_get_overview_fmt): same. also, don't rely on
_get_additional_data anymore since it's easier to parse without.
(camel_nntp_command): use camel_remote_store_send_string and
camel_remote_store_recv_line.
* providers/nntp/camel-nntp-store.h: CamelRemoteStore is the
parent class now. remove istream/ostream since CamelRemoteStore
takes care of that for us. also remove the prototype for
camel_nntp_store_get_additional_data.
* providers/nntp/camel-nntp-newsrc.c (camel_nntp_newsrc_write):
make sure to clear dirty bit.
(camel_nntp_newsrc_read_for_server): don't worry about continually
trying to open the file - if it fails we just return an
unpopulated .newsrc file.
svn path=/trunk/; revision=5153
Diffstat (limited to 'camel/providers/nntp/camel-nntp-folder.c')
-rw-r--r-- | camel/providers/nntp/camel-nntp-folder.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 371c4698e2..43209758a7 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -42,7 +42,6 @@ #include "string-utils.h" #include "camel-stream-mem.h" -#include "camel-stream-buffer.h" #include "camel-data-wrapper.h" #include "camel-mime-message.h" #include "camel-folder-summary.h" @@ -196,8 +195,7 @@ nntp_folder_set_message_flags (CamelFolder *folder, const char *uid, static CamelMimeMessage * nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex) { - CamelStream *nntp_istream; - CamelStream *message_stream; + CamelStream *message_stream = NULL; CamelMimeMessage *message = NULL; CamelStore *parent_store; char *buf; @@ -213,8 +211,6 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException * message_id = strchr (uid, ',') + 1; status = camel_nntp_command (CAMEL_NNTP_STORE( parent_store ), NULL, "ARTICLE %s", message_id); - nntp_istream = CAMEL_NNTP_STORE (parent_store)->istream; - /* if the message_id was not found, raise an exception and return */ if (status != CAMEL_NNTP_OK) { camel_exception_setv (ex, @@ -234,8 +230,13 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException * buf[0] = 0; while (!done) { - char *line = camel_stream_buffer_read_line ( CAMEL_STREAM_BUFFER ( nntp_istream )); int line_length; + char *line; + + if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (parent_store), &line, ex) < 0) { + g_error ("recv_line failed while building message\n"); + break; + } /* XXX check exception */ @@ -261,24 +262,16 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException * message_stream = camel_stream_mem_new_with_buffer(buf, buf_len); message = camel_mime_message_new (); - if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)message, message_stream) == -1) { - camel_object_unref (CAMEL_OBJECT (message)); - camel_object_unref (CAMEL_OBJECT (message_stream)); - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INVALID_UID, /* XXX */ - "Could not create message for message_id %s.", message_id); + camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER(message), message_stream); - return NULL; - } camel_object_unref (CAMEL_OBJECT (message_stream)); - /* init other fields? */ - camel_object_ref (CAMEL_OBJECT (folder)); - #if 0 gtk_signal_connect (CAMEL_OBJECT (message), "message_changed", message_changed, folder); #endif + g_free (buf); + return message; } |