Changeset 3657

Show
Ignore:
Timestamp:
05/12/08 18:02:09
Author:
vivek
Message:
  • Merged the PE1 fixes from trunk into the modest releases folder.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • releases/modest/diablo-pe1/ChangeLog

    r3653 r3657  
     12008-05-12  Rob Taylor  <rob.taylor@codethink.co.uk> 
     2 
     3        * libtinymail/tny-error.c: Fix documentation 
     4 
     52008-05-12  Rob Taylor  <rob.taylor@codethink.co.uk> 
     6 
     7        * m4/ticonv.m4: Add --with-iconv-detect-h option to allow the passing 
     8        of a pre-generated iconv-detect.h rather than generating it at 
     9        configure time. 
     10 
     112008-05-12  Rob Taylor  <rob.taylor@codethink.co.uk> 
     12 
     13        * libtinymail-camel/tny-camel-bs-msg-receive-strategy.c: 
     14        * libtinymail-camel/tny-camel-folder.c: 
     15        * libtinymail-camel/tny-camel-nntp-folder.c: 
     16        * libtinymail-camel/tny-camel-mime-part.c: 
     17        * libtinymail-camel/tny-camel-send-queue.c: 
     18        * libtinymail-camel/tny-camel-pop-store-account.c: 
     19        * libtinymail-camel/tny-camel-pop-folder.c: 
     20        * libtinymail-camel/tny-camel-common.c: 
     21        * libtinymail-camel/tny-camel-nntp-store-account.c: 
     22        * libtinymail-camel/tny-camel-store-account.c: 
     23        * libtinymail-camel/tny-camel-transport-account.c: 
     24        * libtinymail-camel/tny-camel-account.c: 
     25        * libtinymail/tny-error.c: 
     26        * libtinymail/tny-error.h: 
     27        * libtinymail/tny-merge-folder.c: Fix tinymail's GError usage. Use an 
     28        actual GQuark for the domain, have one domain for tinymail as a whole. 
     29        Removes the pointless GType for the error. 
     30 
    1312008-05-12  Sergio Villar Senin  <svillar@igalia.com> 
    232 
     
    434        sentbox and outbox while sending, as we can get unreasons and have 
    535        then crash because the message cache is freed. (Based on a previous 
    6         patch by Dape).                                 
     36        patch by Dape) 
    737 
    8382008-05-09  Jose Dapena Paz  <jdapena@igalia.com> 
     
    16462008-05-06  Jose Dapena Paz  <jdapena@igalia.com> 
    1747 
     48        * libtinymail-camel/camel-lite/camel/camel-certdb-cst.c 
     49        Fix some leaks in CST certificate manager support. 
     50 
     51        * libtinymail-camel/tny-camel-folder.c: 
     52        Reason the camel folder while we're getting its size and count, 
     53        avoiding some crashes. 
     54 
    1855        * libtinymail-camel/camel-lite/camel/camel-tcp-stream-ssl.c: 
    1956        Protect PR_Reads and writes to avoid calls to PR_Close before one of 
     
    3471        Use weak references to folders in accesses to store. 
    3572 
     732008-04-30  Philip Van Hoof <pvanhoof@gnome.org> 
     74 
     75        * Enlarged a lock for the transport-account in camel 
     76 
    36772008-04-30  Sergio Villar Senin  <svillar@igalia.com> 
    3778 
    3879        * libtinymail-camel/tny-camel-send-queue.c: 
    39         (on_added): place correctly two swapped parameters when 
    40         calling the user callback                
     80        (on_added): place correctly two swapped parameters when calling the 
     81        user callback 
     82 
     832008-04-29  Philip Van Hoof <pvanhoof@gnome.org> 
     84 
     85        * Extra robustness in TnyCamelSendQueue 
     86 
     872008-04-29  Jose Dapena Paz  <jdapena@igalia.com> 
     88 
     89        * libtinymail-camel/camel-lite/camel/camel-folder.c 
     90        (transfer_message_to): preserve flags on transferring the message to 
     91        a new folder. 
     92 
     93        * libtinymail-camel/camel-lite/camel/camel-folder-summary.h: 
     94        add some comments to flags enumeration to remember that it should be 
     95        kept sync with flags masks. 
     96 
     972008-04-28  Jose Dapena Paz  <jdapena@igalia.com>, Sergio Villar Senin <svillar@igalia.com> 
     98 
     99        * libtinymail/tny-folder.[ch]: new method find_msg_async. This makes find_msg synchronous 
     100        version be deprecated now. 
     101 
     102        * libtinymail-camel/tny-camel-folder.[ch], 
     103        libtinymail/tny-merge-folder.[ch]: 
     104        Added implementations of find_msg_async method. 
     105 
     1062008-04-25  Philip Van Hoof <pvanhoof@gnome.org> 
     107 
     108        * Error reporting when sending a message without From, and a crash-fix 
     109        about it too 
     110        * Added tny_camel_transport_account_get_from and 
     111        tny_camel_transport_account_set_from 
     112 
     113        * This was a minor API change 
     114 
     1152008-04-24  Philip Van Hoof <pvanhoof@gnome.org> 
     116 
     117        * Removed all synchronous API usage in TnyCamelSendQueue 
    41118 
    421192008-04-24  Sergio Villar Senin  <svillar@igalia.com> 
  • releases/modest/diablo-pe1/libtinymail-camel/camel-lite/camel/camel-folder-summary.h

    r3526 r3657  
    7373        CAMEL_MESSAGE_PARTIAL = 1<<7, /* used                TNY_HEADER_FLAG_PARTIAL     */ 
    7474        CAMEL_MESSAGE_EXPUNGED = 1<<8, /* used               TNY_HEADER_FLAG_EXPUNGED    */ 
     75 
     76        /* CAMEL_MESSAGE_PRIORITY_MASK flags */ 
    7577        CAMEL_MESSAGE_HIGH_PRIORITY = 0<<9|1<<10, /* used    TNY_HEADER_FLAG_HIGH_PRIORITY    */ 
    7678        CAMEL_MESSAGE_NORMAL_PRIORITY = 0<<9|0<<10, /* used  TNY_HEADER_FLAG_NORMAL_PRIORITY    */ 
    7779        CAMEL_MESSAGE_LOW_PRIORITY = 1<<9|0<<10, /* used     TNY_HEADER_FLAG_LOW_PRIORITY    */ 
     80 
    7881        CAMEL_MESSAGE_SUSPENDED = 1<<11, /*                  TNY_HEADER_FLAG_SUSPENDED    */ 
    7982 
    80         /* internally used */ 
     83        /* WARNING: just keep updated the CAMEL_MESSAGE_SYSTEM_MASK and CAMEL_MESSAGE_PRIORITY_MASK 
     84         * to make them be sync'd */ 
     85 
     86        /* internally used (CAMEL_MESSAGE_SYSTEM_MASK flags)*/ 
    8187        CAMEL_MESSAGE_INFO_NEEDS_FREE = 1<<13,/* internally used */ 
    8288        CAMEL_MESSAGE_INFO_UNUSED = 1<<14, /* internally used but available */ 
  • releases/modest/diablo-pe1/libtinymail-camel/camel-lite/camel/camel-folder.c

    r3615 r3657  
    14851485                camel_folder_free_message_info(source, minfo); 
    14861486        } else */ 
    1487                 info = camel_message_info_new_from_header(NULL, ((CamelMimePart *)msg)->headers); 
     1487        info = camel_message_info_new_from_header(NULL, ((CamelMimePart *)msg)->headers); 
     1488 
     1489        /*copying flags */ 
     1490        if ((source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) && 
     1491            (minfo = camel_folder_get_message_info (source, uid))) { 
     1492                camel_message_info_set_flags (info, ~CAMEL_MESSAGE_SYSTEM_MASK, camel_message_info_flags (minfo)); 
     1493                camel_folder_free_message_info (source, minfo); 
     1494        } 
    14881495 
    14891496        /* we don't want to retain the deleted flag */ 
  • releases/modest/diablo-pe1/libtinymail-camel/tny-camel-send-queue.c

    r3653 r3657  
    391391} 
    392392 
     393 
     394 
     395typedef struct { 
     396        TnyFolder *from, *to; 
     397        TnyList *list; 
     398        GError **err; 
     399 
     400        GCond* condition; 
     401        gboolean had_callback; 
     402        GMutex *mutex; 
     403 
     404} TransferSync; 
     405 
     406static void  
     407transfer_async (TnyFolder *folder, gboolean cancelled, GError *err, gpointer user_data) 
     408{ 
     409        TransferSync *info = (TransferSync *) user_data; 
     410 
     411        if (err && info->err) 
     412                *info->err = g_error_copy (err); 
     413 
     414        g_mutex_lock (info->mutex); 
     415        g_cond_broadcast (info->condition); 
     416        info->had_callback = TRUE; 
     417        g_mutex_unlock (info->mutex); 
     418} 
     419 
     420static void 
     421transfer_sync (TnyFolder *from, TnyList *list, TnyFolder *to, gboolean delete_originals, GError **err) 
     422{ 
     423        TransferSync *info = g_slice_new0 (TransferSync); 
     424 
     425        info->mutex = g_mutex_new (); 
     426        info->condition = g_cond_new (); 
     427        info->had_callback = FALSE; 
     428 
     429        info->from = g_object_ref (from); 
     430        info->to = g_object_ref (to); 
     431        info->list = g_object_ref (list); 
     432        info->err = err; 
     433 
     434        tny_folder_transfer_msgs_async (info->from, info->list, info->to,  
     435                delete_originals, transfer_async, NULL, info); 
     436 
     437        g_mutex_lock (info->mutex); 
     438        if (!info->had_callback) 
     439                g_cond_wait (info->condition, info->mutex); 
     440        g_mutex_unlock (info->mutex); 
     441 
     442        g_mutex_free (info->mutex); 
     443        g_cond_free (info->condition); 
     444 
     445        g_object_unref (info->from); 
     446        g_object_unref (info->to); 
     447        g_object_unref (info->list); 
     448        g_slice_free (TransferSync, info); 
     449} 
     450 
     451 
     452typedef struct { 
     453        TnyFolder *folder; 
     454        TnyHeader *header; 
     455        TnyMsg *msg; 
     456        GError **err; 
     457 
     458        GCond* condition; 
     459        gboolean had_callback; 
     460        GMutex *mutex; 
     461 
     462} GetSync; 
     463 
     464static void  
     465get_async (TnyFolder *folder, gboolean cancelled, TnyMsg *msg, GError *err, gpointer user_data) 
     466{ 
     467        GetSync *info = (GetSync *) user_data; 
     468 
     469        if (err && info->err) 
     470                *info->err = g_error_copy (err); 
     471 
     472        if (msg) 
     473                info->msg = g_object_ref (msg); 
     474 
     475        g_mutex_lock (info->mutex); 
     476        g_cond_broadcast (info->condition); 
     477        info->had_callback = TRUE; 
     478        g_mutex_unlock (info->mutex); 
     479} 
     480 
     481static TnyMsg* 
     482get_sync (TnyFolder *folder, TnyHeader *header, GError **err) 
     483{ 
     484        GetSync *info = g_slice_new0 (GetSync); 
     485        TnyMsg *retval = NULL; 
     486 
     487        info->mutex = g_mutex_new (); 
     488        info->condition = g_cond_new (); 
     489        info->had_callback = FALSE; 
     490 
     491        info->folder = g_object_ref (folder); 
     492        info->header = g_object_ref (header); 
     493        info->err = err; 
     494 
     495        tny_folder_get_msg_async (info->folder, info->header,  
     496                get_async, NULL, info); 
     497 
     498        g_mutex_lock (info->mutex); 
     499        if (!info->had_callback) 
     500                g_cond_wait (info->condition, info->mutex); 
     501        g_mutex_unlock (info->mutex); 
     502 
     503        g_mutex_free (info->mutex); 
     504        g_cond_free (info->condition); 
     505 
     506        if (info->msg) 
     507                retval = g_object_ref (info->msg); 
     508 
     509        g_object_unref (info->folder); 
     510        g_object_unref (info->header); 
     511        g_object_unref (info->msg); 
     512 
     513        g_slice_free (GetSync, info); 
     514        return retval; 
     515} 
     516 
     517 
     518 
     519 
     520typedef struct { 
     521        TnyFolder *folder; 
     522        GError **err; 
     523 
     524        GCond* condition; 
     525        gboolean had_callback; 
     526        GMutex *mutex; 
     527 
     528} SyncSync; 
     529 
     530static void  
     531sync_async (TnyFolder *folder, gboolean cancelled, GError *err, gpointer user_data) 
     532{ 
     533        SyncSync *info = (SyncSync *) user_data; 
     534 
     535        if (err && info->err) 
     536                *info->err = g_error_copy (err); 
     537 
     538        g_mutex_lock (info->mutex); 
     539        g_cond_broadcast (info->condition); 
     540        info->had_callback = TRUE; 
     541        g_mutex_unlock (info->mutex); 
     542} 
     543 
     544static void 
     545sync_sync (TnyFolder *self, gboolean expunge, GError **err) 
     546{ 
     547        SyncSync *info = g_slice_new0 (SyncSync); 
     548 
     549        info->mutex = g_mutex_new (); 
     550        info->condition = g_cond_new (); 
     551        info->had_callback = FALSE; 
     552 
     553        info->folder = g_object_ref (self); 
     554        info->err = err; 
     555 
     556        tny_folder_sync_async (info->folder, expunge, sync_async, NULL, info); 
     557 
     558        g_mutex_lock (info->mutex); 
     559        if (!info->had_callback) 
     560                g_cond_wait (info->condition, info->mutex); 
     561        g_mutex_unlock (info->mutex); 
     562 
     563        g_mutex_free (info->mutex); 
     564        g_cond_free (info->condition); 
     565 
     566        g_object_unref (info->folder); 
     567        g_slice_free (SyncSync, info); 
     568} 
     569 
    393570static gpointer 
    394571thread_main (gpointer data) 
     
    431608        { 
    432609                TnyHeader *header = NULL; 
    433                 TnyMsg *msg = NULL; 
    434610 
    435611                g_static_rec_mutex_lock (priv->sending_lock); 
     
    520696                        TnyList *hassent = tny_simple_list_new (); 
    521697                        GError *err = NULL; 
     698                        TnyMsg *msg = NULL; 
    522699 
    523700                        tny_list_prepend (hassent, G_OBJECT (header)); 
    524                         msg = tny_folder_get_msg (info->outbox, header, &err); 
    525  
    526                         /* Emits msg-sending signal to inform a new msg is being sent */ 
    527                         emit_control (self, header, msg, TNY_SEND_QUEUE_MSG_SENDING, i, priv->total); 
    528  
    529                         if (err == NULL)  
    530                         { 
     701                        msg = get_sync (info->outbox, header, &err); 
     702 
     703                        if (err == NULL) { 
     704                                /* Emits msg-sending signal to inform a new msg is being sent */ 
     705                                emit_control (self, header, msg, TNY_SEND_QUEUE_MSG_SENDING, i, priv->total); 
     706 
    531707                                _tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (info->trans_account), 
    532708                                                                          NULL, NULL, "Sending message"); 
     
    549725                        } 
    550726 
     727                        if (msg) 
     728                                g_object_unref (msg); 
     729                        msg = NULL; 
     730 
    551731                        g_static_rec_mutex_lock (priv->todo_lock); 
    552732                        { 
    553                                 if (err == NULL) 
    554                                 { 
     733                                if (err == NULL) { 
    555734                                        GError *newerr = NULL; 
     735                                        GError *serr = NULL; 
    556736                                        priv->cur_i = i; 
    557737                                        tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN); 
    558738                                        tny_header_set_flag (header, TNY_HEADER_FLAG_ANSWERED); 
    559                                         tny_folder_transfer_msgs (info->outbox, hassent, info->sentbox, TRUE, &newerr); 
     739 
     740                                        sync_sync (info->outbox, TRUE, &serr);  
     741                                        if (serr) 
     742                                                g_error_free (serr); 
     743 
     744                                        transfer_sync (info->outbox, hassent, info->sentbox, TRUE, &newerr); 
    560745                                        if (newerr != NULL) { 
    561                                                 emit_error (self, header, msg, newerr, i, priv->total); 
     746                                                emit_error (self, header, NULL, newerr, i, priv->total); 
    562747                                                g_error_free (newerr); 
    563748                                        }  
     
    609794        g_object_unref (info->self); 
    610795 
     796        if (TNY_IS_CAMEL_FOLDER (info->sentbox)) { 
     797                TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox); 
     798                _tny_camel_folder_unreason (spriv); 
     799        } 
     800 
    611801        if (TNY_IS_CAMEL_FOLDER (info->outbox)) { 
    612802                TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox); 
    613803                _tny_camel_folder_unreason (opriv); 
    614         } 
    615         if (TNY_IS_CAMEL_FOLDER (info->sentbox)) { 
    616                 TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox); 
    617                 _tny_camel_folder_unreason (spriv); 
    618804        } 
    619805 
     
    659845                        if (!info->outbox || !info->sentbox) { 
    660846 
    661                                 g_set_error (err, TNY_SERVICE_ERROR,  
     847                                g_set_error (err, TNY_ERROR_DOMAIN, 
    662848                                        TNY_SERVICE_ERROR_ADD_MSG, FOLDERSNOTREADY); 
    663849                                g_warning (FOLDERSNOTREADY); 
     
    677863                        info->trans_account = (TnyTransportAccount *) g_object_ref (priv->trans_account); 
    678864 
    679                         if (TNY_IS_CAMEL_FOLDER (info->outbox)) { 
    680                                 TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox); 
    681                                 _tny_camel_folder_reason (opriv); 
    682                        
    683                         if (TNY_IS_CAMEL_FOLDER (info->sentbox)) { 
    684                                 TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox); 
    685                                 _tny_camel_folder_reason (spriv); 
    686                         }                       
     865                       if (TNY_IS_CAMEL_FOLDER (info->outbox)) { 
     866                               TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox); 
     867                               _tny_camel_folder_reason (opriv); 
     868                       
     869                       if (TNY_IS_CAMEL_FOLDER (info->sentbox)) { 
     870                               TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox); 
     871                               _tny_camel_folder_reason (spriv); 
     872                       } 
    687873 
    688874                        emit_queue_control_signals (self, TNY_SEND_QUEUE_START); 
     
    8481034                if (!outbox || !TNY_IS_FOLDER (outbox)) 
    8491035                { 
    850                         g_set_error (err, TNY_SERVICE_ERROR,  
     1036                        g_set_error (err, TNY_ERROR_DOMAIN, 
    8511037                                TNY_SERVICE_ERROR_ADD_MSG, 
    8521038                                _("Operating can't continue: send queue not ready " 
     
    9061092 
    9071093        if (!outbox || !TNY_IS_FOLDER (outbox)) { 
    908                 g_set_error (&err, TNY_SERVICE_ERROR,  
     1094                g_set_error (&err, TNY_ERROR_DOMAIN, 
    9091095                        TNY_SERVICE_ERROR_ADD_MSG, 
    9101096                        _("Operating can't continue: send queue not ready " 
  • releases/modest/diablo-pe1/libtinymail-camel/tny-camel-transport-account.c

    r3480 r3657  
    251251        camel_service_disconnect (apriv->service, TRUE, &ex); 
    252252 
     253        g_static_rec_mutex_unlock (apriv->service_lock); 
     254 
    253255        camel_object_unref (recipients); 
    254256        camel_object_unref (from);