diff options
author | Bertrand Guiheneuf <bertrand@src.gnome.org> | 2000-03-06 17:38:42 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 2000-03-06 17:38:42 +0800 |
commit | 7c164f12b9ae13cd2f7e068b1b8626701ab8390f (patch) | |
tree | 4027d784956aee7e7b28b78b563edcb639645cd5 /camel | |
parent | ffad0d32ceef317c2995378f654e8214629948f0 (diff) | |
download | gsoc2013-evolution-7c164f12b9ae13cd2f7e068b1b8626701ab8390f.tar.gz gsoc2013-evolution-7c164f12b9ae13cd2f7e068b1b8626701ab8390f.tar.zst gsoc2013-evolution-7c164f12b9ae13cd2f7e068b1b8626701ab8390f.zip |
More changes than a man can remember.
The UI works now.
svn path=/trunk/; revision=2074
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 10 | ||||
-rw-r--r-- | camel/camel-formatter.c | 79 | ||||
-rw-r--r-- | camel/camel-multipart.c | 1 | ||||
-rw-r--r-- | camel/camel-seekable-substream.c | 28 | ||||
-rw-r--r-- | camel/camel-session.c | 8 | ||||
-rw-r--r-- | camel/camel-session.h | 36 | ||||
-rw-r--r-- | camel/camel-stream-fs.c | 6 | ||||
-rw-r--r-- | camel/gmime-utils.c | 2 |
8 files changed, 106 insertions, 64 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 18e245364f..ba5b29d876 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,7 +1,15 @@ +2000-03-06 bertrand <bertrand@helixcode.com> + + * camel-stream-fs.c (_seek): fix a bogus calculation + in the return position. + 2000-03-05 bertrand <bertrand@helixcode.com> + * camel-session.h: cosmetic fixes. + * camel-stream-fs.c (_read): - (_seek): + (_seek): fixed the current position so that it refers + to the current position in the stream, not in its parent. 2000-03-04 NotZed <NotZed@HelixCode.com> diff --git a/camel/camel-formatter.c b/camel/camel-formatter.c index 277de3956d..3ab86b7435 100644 --- a/camel/camel-formatter.c +++ b/camel/camel-formatter.c @@ -462,20 +462,22 @@ write_field_to_stream (const gchar* description, const gchar* value, gchar *s; guint ev_length; gchar* encoded_value = value?text_to_html ( - value, strlen(value), &ev_length):""; + value, strlen(value), &ev_length):g_strdup (""); int i; - for (i = 0; i < strlen (value); i++) - if (!isprint(encoded_value[i])) - encoded_value[i] = 'Z'; - g_assert (description && value); + if (value) + for (i = 0; i < strlen (value); i++) + if (!isprint(encoded_value[i])) + encoded_value[i] = 'Z'; + + g_assert (description); s = g_strdup_printf ("%s<b>%s</b>%s%s%s\n", as_table_row?"<tr><td>":"", description, as_table_row?"</td><td>":" ", encoded_value, - as_table_row?"</td></tr>":"<br>"); + as_table_row?"</td></tr>":""); camel_stream_write_string (stream, s); g_free (encoded_value); @@ -523,45 +525,70 @@ write_header_info_to_stream (CamelMimeMessage* mime_message, g_assert (mime_message && stream); - camel_stream_write_string (stream, "<table>"); + camel_stream_write_string (stream, "<table WIDTH=\"100\%\">"); /* A few fields will probably be available from the mime_message; for each one that's available, write it to the output stream with a helper function, 'write_field_to_stream'. */ - if ((s = (gchar*)camel_mime_message_get_subject (mime_message))) { - write_field_to_stream ("Subject: ", s, stream, TRUE); - } - - if ((s = (gchar*)camel_mime_message_get_from (mime_message))) { - write_field_to_stream ("From: ", s, stream, TRUE); - } - if ((s = (gchar*)camel_mime_message_get_received_date (mime_message))) { - write_field_to_stream ("Received Date: ", s, stream, TRUE); - } + /* blame me for the bad code - rhon rhon ! */ + /* first row : "From" and "To" */ + camel_stream_write_string (stream, "<tr>"); + camel_stream_write_string (stream, "<td>"); + s = (gchar*)camel_mime_message_get_from (mime_message); + write_field_to_stream ("From: ", s, stream, FALSE); + + camel_stream_write_string (stream, "</td>"); + camel_stream_write_string (stream, "<td>"); - if ((s = (gchar*)camel_mime_message_get_sent_date (mime_message))) { - write_field_to_stream ("Sent Date: ", s, stream, TRUE); - } - /* Fill out the "To:" recipients line */ recipients = camel_mime_message_get_recipients ( mime_message, CAMEL_RECIPIENT_TYPE_TO); if (recipients) - write_recipients_to_stream ("To:", recipients, stream, TRUE); + write_recipients_to_stream ("To:", recipients, stream, FALSE); + camel_stream_write_string (stream, "</td>"); + camel_stream_write_string (stream, "</tr>"); + + + + /* second row : "Subject" and "CC" */ + camel_stream_write_string (stream, "<tr>"); + camel_stream_write_string (stream, "<td>"); + s = (gchar*)camel_mime_message_get_subject (mime_message); + write_field_to_stream ("Subject: ", s, stream, FALSE); + + camel_stream_write_string (stream, "</td>"); + camel_stream_write_string (stream, "<td>"); + /* Fill out the "CC:" recipients line */ recipients = camel_mime_message_get_recipients ( mime_message, CAMEL_RECIPIENT_TYPE_CC); if (recipients) - write_recipients_to_stream ("CC:", recipients, stream, TRUE); + write_recipients_to_stream ("CC:", recipients, stream, FALSE); + + camel_stream_write_string (stream, "</td>"); + camel_stream_write_string (stream, "</tr>"); + + +#if FOR_LATER_EXTENSION + if ((s = (gchar*)camel_mime_message_get_received_date (mime_message))) { + write_field_to_stream ("Received Date: ", s, stream, TRUE); + } + + if ((s = (gchar*)camel_mime_message_get_sent_date (mime_message))) { + write_field_to_stream ("Sent Date: ", s, stream, TRUE); + } + + /* Fill out the "BCC:" recipients line */ recipients = camel_mime_message_get_recipients ( mime_message, CAMEL_RECIPIENT_TYPE_BCC); if (recipients) write_recipients_to_stream ("BCC:", recipients, stream, TRUE); +#endif camel_stream_write_string (stream, "</table>"); } @@ -633,7 +660,7 @@ handle_text_plain (CamelFormatter *formatter, CamelDataWrapper *wrapper) nb_bytes_read = camel_stream_read (wrapper_output_stream, tmp_buffer, 4096); - + /* If there's any text, write it to the stream */ if (nb_bytes_read > 0) { @@ -838,7 +865,9 @@ print_camel_body_part (CamelMimeBodyPart* body_part, call_handler_function (formatter, contents, MIME_TYPE_WHOLE (body_part), MIME_TYPE_MAIN (body_part)); - camel_stream_write_string (formatter->priv->stream, "\n<hr>\n"); + camel_stream_write_string (formatter->priv->stream, "\n\n"); + /* use this when gtktmhl is fixed */ + /* camel_stream_write_string (formatter->priv->stream, "\n<hr>\n"); */ } diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c index d5c8f383aa..e6dbd40928 100644 --- a/camel/camel-multipart.c +++ b/camel/camel-multipart.c @@ -580,6 +580,7 @@ my_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) /* add the body part to the multipart object */ camel_multipart_add_part (multipart, body_part); + printf ("New Part\n"); } diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c index df09e81ba5..b3628fa490 100644 --- a/camel/camel-seekable-substream.c +++ b/camel/camel-seekable-substream.c @@ -291,8 +291,6 @@ _read (CamelStream *stream, gchar *buffer, gint n) and is incompatible with buffering. */ - printf ("in CamelSeekable::read stream=(%p) cur position : %d\n", seekable_stream, seekable_stream->cur_pos); - parent_stream_current_position = camel_seekable_stream_get_current_position (seekable_substream->parent_stream); @@ -307,19 +305,24 @@ _read (CamelStream *stream, gchar *buffer, gint n) MIN (seekable_substream->sup_bound - position_in_parent, n); else nb_to_read = n; - + //printf ("Nb to read = %d\n", n); if (!nb_to_read) { + seekable_substream->eos = TRUE; return 0; } + /*printf ("In SeekableSubstream(%p)::read, the position has to be changed\n", stream); + printf ("--- parent_stream_current_position=%d, position_in_parent=%d\n", + parent_stream_current_position, position_in_parent); + printf ("--- seekable_substream->inf_bound=%d\n", seekable_substream->inf_bound); + printf ("--- seekable_substream->sup_bound=%d\n", seekable_substream->sup_bound); + printf ("--- seekable_substream->parent_stream=%p\n", seekable_substream->parent_stream); + */ /* go to our position in the parent stream */ if (parent_stream_current_position != position_in_parent) { - printf ("In SeekableSubstream(%p)::read, the position has to be changed\n", stream); - printf ("--- parent_stream_current_position=%d, position_in_parent=%d\n", parent_stream_current_position, position_in_parent); - printf ("--- seekable_substream->inf_bound=%d\n", seekable_substream->inf_bound); - printf ("--- seekable_substream->sup_bound=%d\n", seekable_substream->sup_bound); - printf ("--- seekable_substream->parent_stream=%p\n", seekable_substream->parent_stream); + + camel_seekable_stream_seek (seekable_substream->parent_stream, position_in_parent, CAMEL_STREAM_SET); @@ -330,7 +333,6 @@ _read (CamelStream *stream, gchar *buffer, gint n) camel_seekable_stream_get_current_position (seekable_substream->parent_stream); if (parent_stream_current_position != position_in_parent) { - printf ("Unable to set the position in the parent\n"); seekable_substream->eos = TRUE; return 0; } @@ -352,7 +354,7 @@ _read (CamelStream *stream, gchar *buffer, gint n) seekable_stream->cur_pos += v; - + /* printf ("Nb Bytes Read : %d\n",v); */ /* return the number of bytes read */ return v; } @@ -430,7 +432,6 @@ _eos (CamelStream *stream) g_assert (stream); - printf ("** %% ** (%p)\n", stream); if (seekable_substream->eos) eos = TRUE; else { @@ -443,9 +444,7 @@ _eos (CamelStream *stream) } } - if (eos) - printf (" EOS\n"); - + return eos; } @@ -514,7 +513,6 @@ _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) seekable_stream->cur_pos = MIN (real_offset, substream_len); } else seekable_stream->cur_pos = 0; - printf ("** set in substream %p, offset=%lld\n", stream, real_offset); } diff --git a/camel/camel-session.c b/camel/camel-session.c index 6b93cc1d3f..b40de13714 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -23,6 +23,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ + + + + #include <config.h> #include "camel-session.h" #include "camel-store.h" @@ -32,8 +36,12 @@ #include "url-util.h" #include "hash-table-utils.h" + + static GtkObjectClass *parent_class=NULL; + + /* Returns the class for a CamelSession */ #define CSS_CLASS(so) CAMEL_SESSION_CLASS (GTK_OBJECT(so)->klass) diff --git a/camel/camel-session.h b/camel/camel-session.h index 838731b03c..282af88ffa 100644 --- a/camel/camel-session.h +++ b/camel/camel-session.h @@ -72,24 +72,24 @@ typedef struct { /* public methods */ /* Standard Gtk function */ -GtkType camel_session_get_type (void); - - -CamelSession *camel_session_new (CamelAuthCallback authenticator); -void camel_session_set_provider (CamelSession *session, CamelProvider *provider); -CamelStore *camel_session_get_store_for_protocol (CamelSession *session, - const gchar *protocol, - CamelException *ex); -CamelStore *camel_session_get_store (CamelSession *session, - const char *url_string, - CamelException *ex); -CamelTransport *camel_session_get_transport_for_protocol (CamelSession *session, - const char *protocol, - CamelException *ex); -char *camel_session_query_authenticator (CamelSession *session, char *prompt, - gboolean secret, - CamelService *service, char *item, - CamelException *ex); +GtkType camel_session_get_type (void); + + +CamelSession * camel_session_new (CamelAuthCallback authenticator); +void camel_session_set_provider (CamelSession *session, CamelProvider *provider); +CamelStore * camel_session_get_store_for_protocol (CamelSession *session, + const gchar *protocol, + CamelException *ex); +CamelStore * camel_session_get_store (CamelSession *session, + const char *url_string, + CamelException *ex); +CamelTransport * camel_session_get_transport_for_protocol (CamelSession *session, + const char *protocol, + CamelException *ex); +char * camel_session_query_authenticator (CamelSession *session, char *prompt, + gboolean secret, + CamelService *service, char *item, + CamelException *ex); #ifdef __cplusplus } diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index 16c5da2ba6..5f533dad8a 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -161,7 +161,6 @@ static void _set_bounds (CamelStreamFs *stream_fs, guint32 inf_bound, guint32 sup_bound) { - printf ("sup_bounds = %u\n", sup_bound); /* store the bounds */ stream_fs->inf_bound = inf_bound; stream_fs->sup_bound = sup_bound; @@ -529,12 +528,11 @@ _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) - printf ("***** Seeking : real_offset=%d, whence=%d\n", real_offset, whence); return_position = lseek (stream_fs->fd, real_offset, whence) - stream_fs->inf_bound; - if (((CAMEL_SEEKABLE_STREAM (stream)->cur_pos + stream_fs->inf_bound) != return_position) && stream_fs->eof) + if (((CAMEL_SEEKABLE_STREAM (stream)->cur_pos) != return_position) && stream_fs->eof) stream_fs->eof = FALSE; - CAMEL_SEEKABLE_STREAM (stream)->cur_pos = return_position - stream_fs->inf_bound; + CAMEL_SEEKABLE_STREAM (stream)->cur_pos = return_position; return return_position; diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c index 69534ebdc0..989364fba9 100644 --- a/camel/gmime-utils.c +++ b/camel/gmime-utils.c @@ -271,7 +271,7 @@ gmime_read_line_from_stream (CamelStream *stream) new_line = g_string_new (""); do { nb_char_read = camel_stream_read (stream, &next_char, 1); - printf ("Nb char read: %d\n", nb_char_read); + if (nb_char_read>0) { switch (next_char) { |