Changeset 64

Show
Ignore:
Timestamp:
12/02/07 18:23:02
Author:
pvanhoof
Message:

2007-12-02 Philip Van Hoof <pvanhoof@gnome.org>

        • Creating multipart messages correctly
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r57 r64  
     12007-12-02  Philip Van Hoof  <pvanhoof@gnome.org> 
     2 
     3        * Creating multipart messages correctly 
     4 
    152007-11-15  Philip Van Hoof  <pvanhoof@gnome.org> 
    26 
  • trunk/src/tmut-msg-creator.c

    r48 r64  
    3535#include <tny-camel-mem-stream.h> 
    3636#include <tny-camel-send-queue.h> 
     37#include <tny-camel-mime-part.h> 
    3738 
    3839#include <string.h> 
     
    169170                        TnyStream *stream = tny_camel_mem_stream_new (); 
    170171                        TnyHeader *header = tny_msg_get_header (msg); 
    171                         TnyIterator *iter = tny_list_create_iterator (priv->attachments); 
    172172 
    173173                        tny_header_set_subject (header, gtk_entry_get_text (priv->subject_entry)); 
     
    181181                        tny_stream_write (stream, text, strlen (text)); 
    182182                        tny_stream_reset (stream); 
    183                         tny_mime_part_construct_from_stream (TNY_MIME_PART (msg), stream, "text/plain");  
     183 
     184                        tny_mime_part_set_header_pair (TNY_MIME_PART (msg), "X-Mailer", "TMut - " VERSION); 
     185 
     186                        if (tny_list_get_length (priv->attachments) > 0) { 
     187                                TnyIterator *iter = tny_list_create_iterator (priv->attachments); 
     188                                TnyMimePart *msg_part = tny_camel_mime_part_new (); 
     189 
     190                                tny_mime_part_construct_from_stream (msg_part, stream, "text/plain"); 
     191                                tny_mime_part_add_part (TNY_MIME_PART (msg), msg_part); 
     192                                g_object_unref (msg_part); 
     193 
     194                                while (!tny_iterator_is_done (iter)) { 
     195                                        TnyMimePart *part = TNY_MIME_PART (tny_iterator_get_current (iter)); 
     196                                        tny_mime_part_add_part (TNY_MIME_PART (msg), part); 
     197                                        g_object_unref (part); 
     198                                        tny_iterator_next (iter); 
     199                                } 
     200                                g_object_unref (iter); 
     201                        } else 
     202                                tny_mime_part_construct_from_stream (TNY_MIME_PART (msg), stream, "text/plain");  
     203 
    184204                        g_object_unref (stream); 
    185  
    186                         tny_mime_part_set_header_pair (TNY_MIME_PART (msg), "X-Mailer", "TMut - " VERSION); 
    187  
    188                         while (!tny_iterator_is_done (iter)) { 
    189                                 TnyMimePart *part = TNY_MIME_PART (tny_iterator_get_current (iter)); 
    190                                 tny_mime_part_add_part (TNY_MIME_PART (msg), part); 
    191                                 g_object_unref (part); 
    192                                 tny_iterator_next (iter); 
    193                         } 
    194                         g_object_unref (iter); 
    195  
    196205                        tny_send_queue_add (send_queue, msg, NULL); 
    197206 
     
    199208                        g_object_unref (send_queue); 
    200209                        g_object_unref (account); 
     210 
    201211                } else  
    202212                        not_ready = TRUE;