Changeset 2816

Show
Ignore:
Timestamp:
10/04/07 20:02:41
Author:
pvanhoof
Message:

TnyCamelSendQueue should not error if the TnyDevice went offlin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2815 r2816  
    33        - -Wall warnings 
    44        - -pedantic warnings 
     5        - TnyCamelSendQueue should not error if the TnyDevice went offline 
    56 
    672007-10-03  Jose Dapena Paz  <jdapena@igalia.com> 
  • trunk/libtinymail-camel/camel-lite/camel/camel-mime-part.c

    r2815 r2816  
    115115        g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE); 
    116116 
    117         header_formatted_table = g_hash_table_new (camel_strcase_hash, (gpointer)camel_strcase_equal); 
     117        header_formatted_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); 
    118118        g_hash_table_insert(header_formatted_table, "Content-Type", (gpointer)write_raw); 
    119119        g_hash_table_insert(header_formatted_table, "Content-Disposition", (gpointer)write_raw); 
  • trunk/libtinymail-camel/tny-camel-send-queue.c

    r2769 r2816  
    2525#include <tny-camel-shared.h> 
    2626#include <tny-camel-msg.h> 
     27#include <tny-device.h> 
    2728#include <tny-simple-list.h> 
    2829#include <tny-folder.h> 
     
    267268        guint i = 0, length = 0; 
    268269        TnyList *list = NULL; 
     270        TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account); 
     271        TnySessionCamelPriv *spriv = TNY_SESSION_CAMEL (apriv->session)->priv; 
     272        TnyDevice *device = g_object_ref (spriv->device); 
    269273 
    270274        g_object_ref (self); /* My own reference */ 
     
    298302        priv->do_continue = TRUE; 
    299303 
    300         while (length > 0 && priv->do_continue
     304        while (length > 0 && priv->do_continue && tny_device_is_online (device)
    301305        { 
    302306                TnyHeader *header = NULL; 
     
    313317                        TnyIterator *giter = NULL; 
    314318 
    315                         tny_folder_get_headers (outbox, headers, TRUE, &ferror); 
     319                        if (tny_device_is_online (device)) 
     320                                tny_folder_get_headers (outbox, headers, TRUE, &ferror); 
     321                        else { 
     322                                priv->is_running = FALSE; 
     323                                g_mutex_unlock (priv->todo_lock); 
     324                                g_mutex_unlock (priv->sending_lock); 
     325                                goto errorhandler; 
     326                        } 
    316327 
    317328                        if (ferror != NULL) 
     
    368379                g_mutex_unlock (priv->todo_lock); 
    369380 
    370                 if (header && TNY_IS_HEADER (header)
     381                if (header && TNY_IS_HEADER (header) && tny_device_is_online (device)
    371382                { 
    372383                        TnyList *hassent = tny_simple_list_new (); 
     
    387398                                        priv->do_continue = FALSE; 
    388399                                } 
    389                         } else
     400                        } else
    390401                                emit_error (self, header, msg, err, i, priv->total); 
    391402                                priv->do_continue = FALSE; 
     
    408419                                } 
    409420                        } 
     421                        g_mutex_unlock (priv->todo_lock); 
    410422 
    411423                        /* Emits msg-sent signal to inform msg has been sent */ 
    412                         /* This now happens in on_msg_sent_get_msg!  
    413  
    414                         if (priv->do_continue) 
    415                                 emit_control (self, header, msg, TNY_SEND_QUEUE_MSG_SENT, i, priv->total); */ 
    416  
    417                         g_mutex_unlock (priv->todo_lock); 
     424                        /* This now happens in on_msg_sent_get_msg! */ 
    418425 
    419426                        g_object_unref (hassent); 
     
    429436                { 
    430437                        priv->is_running = FALSE; 
    431                         /* Not good, let's just kill this thread */  
     438                        /* Not good, or we just went offline, let's just kill this thread */  
    432439                        length = 0; 
    433440                        if (header && G_IS_OBJECT (header)) 
    434441                                g_object_unref (header); 
     442                        g_mutex_unlock (priv->sending_lock); 
     443                        break; 
    435444                } 
    436445 
     
    445454        priv->is_running = FALSE; 
    446455 
     456        g_object_unref (device); 
    447457        g_object_unref (sentbox); 
    448458        g_object_unref (outbox); 
     
    572582        if (priv->total >= 1 && !priv->is_running) 
    573583                create_worker (info->self); 
    574  
    575584        if (info->self) 
    576585                g_object_unref (info->self); 
     
    725734        mdstore = camel_session_get_store(session, full_path, &ex); 
    726735 
    727         /*      mdstore = _tny_camel_account_get_service (TNY_CAMEL_ACCOUNT (priv->trans_account)); */ 
    728  
    729736        if (!camel_exception_is_set (&ex) && mdstore) 
    730737        { 
     
    735742                { 
    736743                        CamelFolderInfo *iter; 
    737  
    738                         /* camel_object_unref (CAMEL_OBJECT (cfolder)); */ 
    739744 
    740745                        iter = camel_store_get_folder_info (mdstore, name,  
     
    913918 
    914919        priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self); 
    915         if (priv->trans_account) { 
     920 
     921        if (priv->trans_account)  
     922        { 
    916923                apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account); 
    917924                _tny_session_camel_unreg_queue (apriv->session, self); 
    918925 
    919                 g_object_unref (G_OBJECT(priv->trans_account)); 
     926                g_object_unref (priv->trans_account); 
    920927 
    921928                if (priv->signal != -1) 
     
    926933        priv->signal = (gint) g_signal_connect (G_OBJECT (trans_account), 
    927934                "set-online-happened", G_CALLBACK (on_setonline_happened), self); 
    928         priv->trans_account = TNY_TRANSPORT_ACCOUNT (g_object_ref(G_OBJECT(trans_account))); 
     935        priv->trans_account = TNY_TRANSPORT_ACCOUNT (g_object_ref(trans_account)); 
    929936        apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account); 
    930937        _tny_session_camel_reg_queue (apriv->session, self); 
     
    953960        if (!priv->trans_account) 
    954961                return NULL; 
    955         g_object_ref (G_OBJECT(priv->trans_account)); 
     962        g_object_ref (priv->trans_account); 
    956963 
    957964        return TNY_CAMEL_TRANSPORT_ACCOUNT(priv->trans_account);