Changeset 1349

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

Bugfixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-camel/tny-camel-msg.c

    r1347 r1349  
    154154        CamelMimeMessage *msg; 
    155155        TnyCamelMsgPriv *priv = TNY_CAMEL_MSG_GET_PRIVATE (self); 
    156         CamelInternetAddress *from, *recipients, *replyto; 
    157         const gchar *str; 
     156        /* CamelInternetAddress *from, *recipients, *replyto; 
     157        const gchar *str; */ 
    158158 
    159159        g_assert (TNY_IS_CAMEL_HEADER (header)); 
     
    171171                TnyCamelMimePartPriv *ppriv = TNY_CAMEL_MIME_PART_GET_PRIVATE (self); 
    172172                g_mutex_lock (ppriv->part_lock); 
    173                 if (ppriv->part) 
     173                if (ppriv->part)  
     174                { 
     175                        /* TODO: copy old part over? */ 
    174176                        camel_object_unref (CAMEL_OBJECT (ppriv->part)); 
     177                } 
    175178                /* Add a reference? */ 
    176179                ppriv->part = (CamelMimePart *) ((WriteInfo*)((TnyCamelHeader *)header)->info)->msg; 
  • trunk/libtinymail-camel/tny-camel-send-queue.c

    r1315 r1349  
    5757        g_mutex_lock (priv->todo_lock); 
    5858        { 
     59                GError *terror = NULL; 
    5960                sentbox = tny_send_queue_get_sentbox (self); 
    6061                outbox = tny_send_queue_get_outbox (self); 
    61                 /* TODO handle and report errors here */ 
    62                 tny_folder_get_headers (outbox, list, TRUE, NULL); 
     62                tny_folder_get_headers (outbox, list, TRUE, &terror); 
     63                if (terror != NULL) 
     64                { 
     65                        g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED],  
     66                                0, NULL, terror, i, priv->total); 
     67                        g_object_unref (G_OBJECT (list)); 
     68                        goto errorhandler; 
     69                } 
     70 
    6371                length = tny_list_get_length (list); 
    6472                priv->total = length; 
     
    7583                g_mutex_lock (priv->todo_lock); 
    7684                { 
     85                        GError *ferror = NULL; 
    7786                        TnyIterator *hdriter; 
    7887                        TnyList *headers = tny_simple_list_new (); 
    79                         /* TODO handle and report errors here */ 
    80                         tny_folder_get_headers (outbox, headers, TRUE, NULL); 
     88 
     89                        tny_folder_get_headers (outbox, headers, TRUE, &ferror); 
     90 
     91                        if (ferror != NULL) 
     92                        { 
     93                                g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED],  
     94                                        0, msg, ferror, i, priv->total); 
     95                                g_object_unref (G_OBJECT (headers)); 
     96                                goto errorhandler; 
     97                        } 
     98 
    8199                        length = tny_list_get_length (headers); 
    82100 
    83101                        priv->total = length; 
     102 
    84103                        if (length <= 0) 
    85104                        { 
     
    90109                        hdriter = tny_list_create_iterator (headers); 
    91110                        header = (TnyHeader *) tny_iterator_get_current (hdriter); 
     111 
    92112                        g_object_unref (G_OBJECT (hdriter)); 
    93113                        g_object_unref (G_OBJECT (headers)); 
     
    95115                g_mutex_unlock (priv->todo_lock); 
    96116 
     117 
    97118                if (header && TNY_IS_HEADER (header)) 
    98119                { 
     
    101122 
    102123                        tny_list_prepend (hassent, G_OBJECT (header)); 
    103                         /* TODO handle and report errors here */ 
    104124                        msg = tny_folder_get_msg (outbox, header, &err); 
    105  
    106  
    107                         /* TODO handle and report errors here */ 
    108125                        g_object_unref (G_OBJECT (header));      
    109126 
    110                         if (err == NULL) 
    111                                 tny_transport_account_send (priv->trans_account, msg, NULL); 
    112                         else 
    113                                 g_print ("error: %s\n", err->message); 
     127                        if (err == NULL)  
     128                        { 
     129                                tny_transport_account_send (priv->trans_account, msg, &err); 
     130                                if (err != NULL) 
     131                                        g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED],  
     132                                                0, msg, err, i, priv->total); 
     133                        } else 
     134                                g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED],  
     135                                        0, msg, err, i, priv->total); 
    114136 
    115137                        g_mutex_lock (priv->todo_lock); 
    116138                        { 
    117                                 /* TODO handle and report errors here */ 
    118                                 tny_folder_transfer_msgs (outbox, hassent, sentbox, TRUE, NULL); 
    119                                 priv->total--; 
     139                                if (err == NULL) 
     140                                { 
     141                                        GError *newerr = NULL; 
     142                                        tny_folder_transfer_msgs (outbox, hassent, sentbox, TRUE, &newerr); 
     143                                        if (newerr != NULL) 
     144                                                g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED],  
     145                                                        0, msg, newerr, i, priv->total); 
     146 
     147                                        priv->total--; 
     148                                } 
    120149                        } 
    121150                        g_mutex_unlock (priv->todo_lock); 
     
    123152                        g_object_unref (G_OBJECT (hassent)); 
    124153 
    125                         g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_MSG_SENT],  
    126                                 0, msg, i, priv->total); 
     154                        if (err == NULL) 
     155                                g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_MSG_SENT],  
     156                                        0, msg, i, priv->total); 
    127157 
    128158                        i++; 
     
    137167                } 
    138168        } 
     169 
     170errorhandler: 
    139171 
    140172        g_object_unref (G_OBJECT (sentbox)); 
  • trunk/libtinymail/tny-send-queue.c

    r1228 r1349  
    110110                        G_TYPE_NONE, 3, TNY_TYPE_MSG, G_TYPE_UINT, G_TYPE_UINT); 
    111111 
     112/** 
     113 * TnySendQueue::error-happened 
     114 * @self: the object on which the signal is emitted 
     115 * @arg1: The message that was supposed to be sent or NULL 
     116 * @arg2: a GError containing the error that happened 
     117 * @arg3: The current nth number of the message that was supposed to be sent 
     118 * @arg4: The total amount of messages currently being processed 
     119 * 
     120 * API WARNING: This API might change 
     121 * 
     122 * Emitted when a message didn't get sent because of an error 
     123 **/ 
     124                tny_send_queue_signals[TNY_SEND_QUEUE_ERROR_HAPPENED] = 
     125                   g_signal_new ("error_happened", 
     126                        TNY_TYPE_SEND_QUEUE, 
     127                        G_SIGNAL_RUN_FIRST, 
     128                        G_STRUCT_OFFSET (TnySendQueueIface, error_happened), 
     129                        NULL, NULL, 
     130                        g_cclosure_marshal_VOID__POINTER, 
     131                        G_TYPE_NONE, 3, TNY_TYPE_MSG, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT); 
     132 
    112133                initialized = TRUE; 
    113134        } 
  • trunk/libtinymail/tny-send-queue.h

    r1228 r1349  
    4242{ 
    4343        TNY_SEND_QUEUE_MSG_SENT, 
     44        TNY_SEND_QUEUE_ERROR_HAPPENED, 
    4445        TNY_SEND_QUEUE_LAST_SIGNAL 
    4546}; 
     
    5455        /* Signals */ 
    5556        void (*msg_sent) (TnySendQueue *self, TnyMsg *msg, guint nth, guint total); 
     57        void (*error_happened) (TnySendQueue *self, TnyMsg *msg, guint nth, guint total); 
    5658 
    5759        /* methods */ 
  • trunk/tests/functional/msg-sender.c

    r1347 r1349  
    8383 
    8484        tny_stream_write (stream, TEST_STRING, strlen (TEST_STRING)); 
     85        tny_stream_reset (stream); 
    8586 
    8687        tny_mime_part_construct_from_stream (TNY_MIME_PART (retval), stream, "text/plain");  
  • trunk/tests/shared/account-store.c

    r1347 r1349  
    108108        if (types == TNY_ACCOUNT_STORE_STORE_ACCOUNTS || types == TNY_ACCOUNT_STORE_BOTH) 
    109109        { 
    110                 account = tny_camel_store_account_new (); 
     110                account = TNY_ACCOUNT (tny_camel_store_account_new ()); 
    111111 
    112112                tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 
     
    115115 
    116116                tny_account_set_proto (account, "imap"); 
    117                 tny_account_set_name (account, "unit test account"); 
     117                tny_account_set_name (account, "IMAP unit test account"); 
    118118                tny_account_set_user (account, "tinymailunittest"); 
    119119                tny_account_set_hostname (account, "mail.tinymail.org"); 
     
    128128        if (types == TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS || types == TNY_ACCOUNT_STORE_BOTH) 
    129129        { 
    130                 account = tny_camel_transport_account_new (); 
     130                account = TNY_ACCOUNT (tny_camel_transport_account_new ()); 
    131131 
    132132                tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 
     
    134134                tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (account), !me->force_online); 
    135135 
    136                 tny_account_set_proto (account, "smtp"); 
    137                 tny_account_set_name (account, "unit test account"); 
     136                tny_account_set_proto (account, "something"); 
     137                tny_account_set_name (account, "SMTP unit test account"); 
    138138                tny_account_set_id (account, "unique_smtp"); 
    139139                tny_account_set_url_string (account, "smtp://tinymailunittest;auth=PLAIN@mail.tinymail.org/;use_ssl=always");