Changeset 1347

Show
Ignore:
Timestamp:
12/26/06 11:27:52
Author:
pvanhoof
Message:

Various fixes, added two new things

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1340 r1347  
     12006-12-25  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Various fixes about creating and sending E-mails 
     4        * Added a TnyCamelMemStream type 
     5        * Added a msg-send test 
     6 
    172006-12-25  Philip Van Hoof <pvanhoof@gnome.org> 
    28 
  • trunk/libtinymail-camel/Makefile.am

    r1176 r1347  
    2727        tny-camel-shared.h \ 
    2828        tny-camel-send-queue.h \ 
     29        tny-camel-mem-stream.h \ 
    2930        tny-session-camel.h 
    3031 
     
    4041        tny-camel-header-priv.h \ 
    4142        tny-camel-send-queue-priv.h \ 
    42         tny-camel-folder-priv.h  
     43        tny-camel-folder-priv.h \ 
     44        tny-camel-stream-priv.h  
    4345 
    4446libtinymail_camel_1_0_la_SOURCES = \ 
     
    6264        tny-stream-camel.c \ 
    6365        tny-camel-send-queue.c \ 
     66        tny-camel-mem-stream.c \ 
    6467        tny-session-camel.c                      
    6568 
  • trunk/libtinymail-camel/tny-camel-msg.c

    r1339 r1347  
    112112        if (retval) 
    113113                g_object_ref (G_OBJECT (retval)); 
     114        else { 
     115                CamelMimeMessage *msg; 
     116                priv->header = tny_camel_header_new (); 
     117                msg = _tny_camel_msg_get_camel_mime_message (TNY_CAMEL_MSG (self)); 
     118                _tny_camel_header_set_camel_mime_message  
     119                        (TNY_CAMEL_HEADER (priv->header), msg); 
     120                retval = priv->header; 
     121        } 
    114122        g_mutex_unlock (priv->header_lock); 
    115123 
     
    146154        CamelMimeMessage *msg; 
    147155        TnyCamelMsgPriv *priv = TNY_CAMEL_MSG_GET_PRIVATE (self); 
     156        CamelInternetAddress *from, *recipients, *replyto; 
     157        const gchar *str; 
    148158 
    149159        g_assert (TNY_IS_CAMEL_HEADER (header)); 
     
    157167        priv->header = header; 
    158168 
    159         msg = _tny_camel_msg_get_camel_mime_message (TNY_CAMEL_MSG (self)); 
    160         _tny_camel_header_set_camel_mime_message (TNY_CAMEL_HEADER (priv->header), 
    161                                                   msg); 
     169        if (((TnyCamelHeader *)header)->write) 
     170        { 
     171                TnyCamelMimePartPriv *ppriv = TNY_CAMEL_MIME_PART_GET_PRIVATE (self); 
     172                g_mutex_lock (ppriv->part_lock); 
     173                if (ppriv->part) 
     174                        camel_object_unref (CAMEL_OBJECT (ppriv->part)); 
     175                /* Add a reference? */ 
     176                ppriv->part = (CamelMimePart *) ((WriteInfo*)((TnyCamelHeader *)header)->info)->msg; 
     177                g_mutex_unlock (ppriv->part_lock); 
     178        } else { 
     179                msg = _tny_camel_msg_get_camel_mime_message (TNY_CAMEL_MSG (self)); 
     180                _tny_camel_header_set_camel_mime_message  
     181                        (TNY_CAMEL_HEADER (priv->header), msg); 
     182        } 
     183 
     184/* 
     185        from = camel_internet_address_new (); 
     186        str = tny_header_get_from (header); 
     187        _foreach_email_add_to_inet_addr (str, from); 
     188        camel_mime_message_set_from (msg, from); 
     189        camel_object_unref (CAMEL_OBJECT (from)); 
     190 
     191        replyto = camel_internet_address_new (); 
     192        str = tny_header_get_replyto (header); 
     193        _foreach_email_add_to_inet_addr (str, replyto); 
     194        camel_mime_message_set_from (msg, replyto); 
     195        camel_object_unref (CAMEL_OBJECT (replyto)); 
     196 
     197        recipients = camel_internet_address_new (); 
     198        str = tny_header_get_to (header); 
     199        _foreach_email_add_to_inet_addr (str, recipients); 
     200        camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_TO, recipients); 
     201        camel_object_unref (CAMEL_OBJECT (recipients)); 
     202 
     203        str = tny_header_get_cc (header); 
     204        _foreach_email_add_to_inet_addr (str, recipients); 
     205        camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_CC, recipients); 
     206        camel_object_unref (CAMEL_OBJECT (recipients)); 
     207 
     208        str = tny_header_get_bcc (header); 
     209        _foreach_email_add_to_inet_addr (str, recipients); 
     210        camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_BCC, recipients); 
     211        camel_object_unref (CAMEL_OBJECT (recipients)); 
     212 
     213        camel_mime_message_set_subject (msg ,tny_header_get_subject (header)); 
     214*/ 
    162215 
    163216        g_mutex_unlock (priv->header_lock); 
  • trunk/libtinymail-camel/tny-camel-stream.c

    r1240 r1347  
    4040 
    4141#include <tny-camel-shared.h> 
     42#include "tny-camel-stream-priv.h" 
    4243 
    4344static GObjectClass *parent_class = NULL; 
    4445 
    45  
    46 typedef struct _TnyCamelStreamPriv TnyCamelStreamPriv; 
    47  
    48 struct _TnyCamelStreamPriv 
    49 { 
    50         CamelStream *stream; 
    51 }; 
    52  
    53 #define TNY_CAMEL_STREAM_GET_PRIVATE(o) \ 
    54         (G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_CAMEL_STREAM, TnyCamelStreamPriv)) 
    5546 
    5647static gssize 
  • trunk/tests/functional

    • Property svn:ignore changed from msg-transfer folder-lister-async tags Makefile.in folder-lister .svnignore stamp-h1 config.h .libs .deps Makefile to msg-sender msg-transfer folder-lister-async tags Makefile.in folder-lister .svnignore stamp-h1 config.h .libs .deps Makefile
  • trunk/tests/functional/.svnignore

    r1201 r1347  
     1msg-sender 
    12msg-transfer 
    23folder-lister-async 
  • trunk/tests/functional/Makefile.am

    r1179 r1347  
    1616endif 
    1717 
    18 bin_PROGRAMS = folder-lister folder-lister-async msg-transfer 
     18bin_PROGRAMS = folder-lister folder-lister-async msg-transfer msg-sender 
     19 
     20msg_sender_SOURCES = msg-sender.c 
     21msg_sender_LDADD = \ 
     22        $(TINYMAIL_LIBS) $(LIBTINYMAIL_GNOME_DESKTOP_LIBS) \ 
     23        $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \ 
     24        $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la \ 
     25        $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la \ 
     26        $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la \ 
     27        $(top_builddir)/tests/shared/libtestsshared.a 
    1928 
    2029folder_lister_SOURCES = folder-lister.c  
  • trunk/tests/functional/folder-lister-async.c

    r1336 r1347  
    130130 
    131131 
    132        if (mainloop) 
     132    if (mainloop) 
    133133        { 
    134134                g_print ("Using the Gtk+ mainloop (will wait 4 seconds in the loop)\n"); 
  • trunk/tests/shared/account-store.c

    r1336 r1347  
    101101{ 
    102102        TnyTestAccountStore *me = (TnyTestAccountStore *) self; 
    103         TnyAccount *account = TNY_ACCOUNT (tny_camel_store_account_new ())
     103        TnyAccount *account
    104104 
    105105        /* Dear visitor of the SVN-web. This is indeed a fully functional and 
    106106           working IMAP account. This does not mean that you need to fuck it up */ 
    107107 
    108         tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 
    109         camel_session_set_online ((CamelSession*)me->session, me->force_online);  
    110         tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (account), !me->force_online); 
    111  
    112         tny_account_set_proto (account, "imap"); 
    113         tny_account_set_name (account, "unit test account"); 
    114         tny_account_set_user (account, "tinymailunittest"); 
    115         tny_account_set_hostname (account, "mail.tinymail.org"); 
    116         tny_account_set_id (account, "unique"); 
    117         tny_account_set_forget_pass_func (account, per_account_forget_pass_func); 
    118         tny_account_set_pass_func (account, per_account_get_pass_func); 
    119  
    120         tny_list_prepend (list, (GObject*)account); 
    121         g_object_unref (G_OBJECT (account)); 
     108        if (types == TNY_ACCOUNT_STORE_STORE_ACCOUNTS || types == TNY_ACCOUNT_STORE_BOTH) 
     109        { 
     110                account = tny_camel_store_account_new (); 
     111 
     112                tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 
     113                camel_session_set_online ((CamelSession*)me->session, me->force_online);  
     114                tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (account), !me->force_online); 
     115 
     116                tny_account_set_proto (account, "imap"); 
     117                tny_account_set_name (account, "unit test account"); 
     118                tny_account_set_user (account, "tinymailunittest"); 
     119                tny_account_set_hostname (account, "mail.tinymail.org"); 
     120                tny_account_set_id (account, "unique_imap"); 
     121                tny_account_set_forget_pass_func (account, per_account_forget_pass_func); 
     122                tny_account_set_pass_func (account, per_account_get_pass_func); 
     123 
     124                tny_list_prepend (list, (GObject*)account); 
     125                g_object_unref (G_OBJECT (account)); 
     126        } 
     127 
     128        if (types == TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS || types == TNY_ACCOUNT_STORE_BOTH) 
     129        { 
     130                account = tny_camel_transport_account_new (); 
     131 
     132                tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 
     133                camel_session_set_online ((CamelSession*)me->session, me->force_online);  
     134                tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (account), !me->force_online); 
     135 
     136                tny_account_set_proto (account, "smtp"); 
     137                tny_account_set_name (account, "unit test account"); 
     138                tny_account_set_id (account, "unique_smtp"); 
     139                tny_account_set_url_string (account, "smtp://tinymailunittest;auth=PLAIN@mail.tinymail.org/;use_ssl=always"); 
     140 
     141                tny_account_set_forget_pass_func (account, per_account_forget_pass_func); 
     142                tny_account_set_pass_func (account, per_account_get_pass_func); 
     143 
     144                tny_list_prepend (list, (GObject*)account); 
     145                g_object_unref (G_OBJECT (account)); 
     146        } 
    122147 
    123148        return; 
  • trunk/tests/shared/platfact.c

    r1336 r1347  
    2929#include <tny-msg-view.h> 
    3030#include <tny-gtk-msg-view.h> 
     31#include <tny-camel-header.h> 
     32#include <tny-camel-mime-part.h> 
     33#include <tny-camel-msg.h> 
    3134 
    3235 
     
    3841{ 
    3942        return; 
     43} 
     44 
     45 
     46 
     47static TnyMsg* 
     48tny_test_platform_factory_new_msg (TnyPlatformFactory *self) 
     49{ 
     50        return tny_camel_msg_new (); 
     51} 
     52 
     53 
     54static TnyMimePart* 
     55tny_test_platform_factory_new_mime_part (TnyPlatformFactory *self) 
     56{ 
     57        return tny_camel_mime_part_new (); 
     58} 
     59 
     60 
     61static TnyHeader* 
     62tny_test_platform_factory_new_header (TnyPlatformFactory *self) 
     63{ 
     64        return tny_camel_header_new (); 
    4065} 
    4166 
     
    93118        klass->new_device_func = tny_test_platform_factory_new_device; 
    94119        klass->new_msg_view_func = tny_test_platform_factory_new_msg_view; 
     120        klass->new_msg_func = tny_test_platform_factory_new_msg; 
     121        klass->new_mime_part_func = tny_test_platform_factory_new_mime_part; 
     122        klass->new_header_func = tny_test_platform_factory_new_header; 
    95123 
    96124        return;