Changeset 3439

Show
Ignore:
Timestamp:
03/01/08 13:23:38
Author:
pvanhoof
Message:

2008-03-01 Philip Van Hoof <pvanhoof@gnome.org>

        • Fixes in the POP code for POP servers that return invalid CAPA

responses (like pop.sina.com)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3437 r3439  
     12008-03-01  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Fixes in the POP code for POP servers that return invalid CAPA 
     4        responses (like pop.sina.com) 
     5 
    162008-02-28  Jose Dapena Paz  <jdapena@igalia.com> 
    27 
  • trunk/docs/devel/reference/tmpl/tny-account-store.sgml

    r3415 r3439  
    4949 
    5050</para> 
    51  
    52 @: 
    5351 
    5452@tnyaccountstore: the object which received the signal. 
  • trunk/docs/devel/reference/tmpl/tny-account.sgml

    r3415 r3439  
    2828 
    2929</para> 
     30 
     31@: 
    3032 
    3133@tnyaccount: the object which received the signal. 
  • trunk/docs/devel/reference/tmpl/tny-device.sgml

    r3415 r3439  
    3636 
    3737</para> 
    38  
    39 @:  
    40 @: 
    4138 
    4239@tnydevice: the object which received the signal. 
  • trunk/docs/devel/reference/tmpl/tny-send-queue.sgml

    r3415 r3439  
    4040</para> 
    4141 
     42@:  
     43@:  
     44@:  
     45@: 
     46 
    4247@tnysendqueue: the object which received the signal. 
    4348@arg1:  
     
    4954 
    5055</para> 
     56 
     57@:  
     58@:  
     59@:  
     60@:  
     61@: 
    5162 
    5263@tnysendqueue: the object which received the signal. 
     
    6172</para> 
    6273 
     74@:  
     75@:  
     76@:  
     77@:  
     78@: 
     79 
    6380@tnysendqueue: the object which received the signal. 
    6481@arg1:  
     
    7289</para> 
    7390 
    74 @: 
    75  
    7691@tnysendqueue: the object which received the signal. 
    7792 
     
    8095 
    8196</para> 
    82  
    83 @: 
    8497 
    8598@tnysendqueue: the object which received the signal. 
  • trunk/docs/devel/reference/tmpl/tny-shared.sgml

    r3415 r3439  
    5454</para> 
    5555 
    56 @tnyaccountstore: the object which received the signal. 
     56@:  
    5757 
    5858<!-- ##### STRUCT TnyAccountStoreIface ##### --> 
     
    262262</para> 
    263263 
    264 @:  
     264@tnyaccount: the object which received the signal. 
    265265 
    266266<!-- ##### SIGNAL TnyAccount::connection-status-changed ##### --> 
     
    321321</para> 
    322322 
    323 @tnydevice: the object which received the signal. 
    324 @arg1:  
     323@:  
     324@:  
    325325 
    326326<!-- ##### STRUCT TnyDeviceIface ##### --> 
     
    493493</para> 
    494494 
     495@tnysendqueue: the object which received the signal. 
     496@arg1:  
     497@arg2:  
     498@arg3:  
     499 
     500<!-- ##### SIGNAL TnySendQueue::msg-sending ##### --> 
     501<para> 
     502 
     503</para> 
     504 
     505@tnysendqueue: the object which received the signal. 
     506@arg1:  
     507@arg2:  
     508@arg3:  
     509@arg4:  
     510 
     511<!-- ##### SIGNAL TnySendQueue::msg-sent ##### --> 
     512<para> 
     513 
     514</para> 
     515 
     516@tnysendqueue: the object which received the signal. 
     517@arg1:  
     518@arg2:  
     519@arg3:  
     520@arg4:  
     521 
     522<!-- ##### SIGNAL TnySendQueue::queue-start ##### --> 
     523<para> 
     524 
     525</para> 
     526 
    495527@:  
     528 
     529<!-- ##### SIGNAL TnySendQueue::queue-stop ##### --> 
     530<para> 
     531 
     532</para> 
     533 
    496534@:  
    497 @:  
    498 @:  
    499  
    500 <!-- ##### SIGNAL TnySendQueue::msg-sending ##### --> 
    501 <para> 
    502  
    503 </para> 
    504  
    505 @:  
    506 @:  
    507 @:  
    508 @:  
    509 @:  
    510  
    511 <!-- ##### SIGNAL TnySendQueue::msg-sent ##### --> 
    512 <para> 
    513  
    514 </para> 
    515  
    516 @:  
    517 @:  
    518 @:  
    519 @:  
    520 @:  
    521  
    522 <!-- ##### SIGNAL TnySendQueue::queue-start ##### --> 
    523 <para> 
    524  
    525 </para> 
    526  
    527 @tnysendqueue: the object which received the signal. 
    528  
    529 <!-- ##### SIGNAL TnySendQueue::queue-stop ##### --> 
    530 <para> 
    531  
    532 </para> 
    533  
    534 @tnysendqueue: the object which received the signal. 
    535535 
    536536<!-- ##### STRUCT TnySendQueueIface ##### --> 
  • trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-engine.c

    r3235 r3439  
    295295                        camel_pop3_engine_command_free (pe, pc); 
    296296                } 
     297 
     298                if (pe->capa == 0) { 
     299                        /* Ugly assumptions */ 
     300                        pe->capa |= CAMEL_POP3_CAP_TOP; 
     301                } 
    297302        } 
    298303 
  • trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c

    r3427 r3439  
    183183                h = camel_mime_parser_headers_raw(mp); 
    184184                while (h) { 
    185                         if (g_ascii_strcasecmp(h->name, "status") != 0 
     185                        if (h->name && g_ascii_strcasecmp(h->name, "status") != 0 
    186186                            && g_ascii_strcasecmp(h->name, "x-status") != 0) { 
    187187                                md5_update(&md5, (const guchar*) h->name, strlen(h->name)); 
     
    357357                        } 
    358358 
    359                         if (pop3_store->engine && pop3_store->engine->capa & CAMEL_POP3_CAP_TOP) 
     359                        if (pop3_store->engine && pop3_store->engine->capa & CAMEL_POP3_CAP_TOP) { 
    360360                                msg = pop3_get_top (folder, fi->uid, NULL); 
    361                         else if (pop3_store->engine) 
    362                                 msg = pop3_get_message (folder, fi->uid, CAMEL_FOLDER_RECEIVE_PARTIAL, -1, NULL); 
     361                                if (!msg && (!(pop3_store->engine->capa & CAMEL_POP3_CAP_TOP))) 
     362                                        msg = pop3_get_message (folder, fi->uid, CAMEL_FOLDER_RECEIVE_FULL, -1, NULL); 
     363                        } else if (pop3_store->engine) 
     364                                msg = pop3_get_message (folder, fi->uid, CAMEL_FOLDER_RECEIVE_FULL, -1, NULL); 
    363365 
    364366                        g_static_rec_mutex_unlock (pop3_store->eng_lock); 
     
    456458                { 
    457459                        CamelPOP3FolderInfo *fi2 = pop3_store->uids->pdata[t]; 
    458                         if (fi2 && fi2->uid && !strcmp (fi2->uid, info->uid)) { 
     460                        if (info && fi2 && fi2->uid && info->uid && !strcmp (fi2->uid, info->uid)) { 
    459461                                found = TRUE; 
    460462                                break; 
     
    603605                        { 
    604606                                CamelPOP3FolderInfo *fi2 = pop3_store->uids->pdata[t]; 
    605                                 if (fi2 && fi2->uid && !strcmp (fi2->uid, info->uid)) { 
     607                                if (info && fi2 && fi2->uid && info->uid && !strcmp (fi2->uid, info->uid)) { 
    606608                                        found = TRUE; 
    607609                                        break; 
     
    756758 
    757759                /* heuristics */ 
    758                 if (camel_strstrcase (buffer, "Content-Disposition: attachment") != NULL) 
     760                if (buffer && camel_strstrcase (buffer, "Content-Disposition: attachment") != NULL) 
    759761                        fi->has_attachments = TRUE; 
    760                 else if (camel_strstrcase (buffer, "filename=") != NULL && 
     762                else if (buffer && camel_strstrcase (buffer, "filename=") != NULL && 
    761763                         strchr (buffer, '.')) 
    762764                        fi->has_attachments = TRUE; 
    763                 else if (camel_strstrcase (buffer, "Content-Type: message/rfc822") != NULL) 
     765                else if (buffer && camel_strstrcase (buffer, "Content-Type: message/rfc822") != NULL) 
    764766                        fi->has_attachments = TRUE; 
    765767 
     
    817819 
    818820                /* heuristics */ 
    819                 if (camel_strstrcase ((const char *) buffer, "Content-Disposition: attachment") != NULL) 
     821                if (buffer && camel_strstrcase ((const char *) buffer, "Content-Disposition: attachment") != NULL) 
    820822                        fi->has_attachments = TRUE; 
    821                 else if (camel_strstrcase ((const char *) buffer, "filename=") != NULL && 
     823                else if (buffer && camel_strstrcase ((const char *) buffer, "filename=") != NULL && 
    822824                         strchr ((const char *) buffer, '.')) 
    823825                        fi->has_attachments = TRUE; 
    824                 else if (camel_strstrcase ((const char *) buffer, "Content-Type: message/rfc822") != NULL) 
     826                else if (buffer && camel_strstrcase ((const char *) buffer, "Content-Type: message/rfc822") != NULL) 
    825827                        fi->has_attachments = TRUE; 
    826828 
    827                 if (boundary == NULL
     829                if (boundary == NULL && buffer
    828830                { 
    829831                           CamelContentType *ct = NULL; 
     
    844846                                        boundary = g_strdup (bound); 
    845847                           } 
    846                 } else if (strstr ((const char*) buffer, (const char*) boundary)) 
     848                } else if (buffer && strstr ((const char*) buffer, (const char*) boundary)) 
    847849                { 
    848850                        if (occurred) 
     
    858860                } 
    859861 
    860                 if (!theend
     862                if (!theend && buffer
    861863                { 
    862864                    n = camel_stream_write(fi->stream, (const char*) buffer, len); 
     
    14111413                if (i == -1) 
    14121414                        fi->err = errno; 
     1415 
     1416                if (pcr->state == CAMEL_POP3_COMMAND_ERR) { 
     1417                        fi->err = -1; 
     1418                        pop3_store->engine->capa &= ~CAMEL_POP3_CAP_TOP; 
     1419                } 
     1420 
    14131421                camel_pop3_engine_command_free(pop3_store->engine, pcr); 
    14141422 
  • trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c

    r3301 r3439  
    861861                camel_pop3_engine_command_free(store->engine, pcu); 
    862862 
     863        /* camel_pop3_engine_reget_capabilities (store->engine); */ 
     864 
    863865        return status; 
    864866} 
  • trunk/libtinymail-camel/tny-camel-send-queue-priv.h

    r3425 r3439  
    3333        gint signal; 
    3434        GThread *thread; 
    35         GMutex *todo_lock, *sending_lock;  
     35        GStaticRecMutex *todo_lock, *sending_lock;  
    3636        gboolean do_continue, is_running; 
    3737        gboolean observer_attached; 
  • trunk/libtinymail-camel/tny-camel-send-queue.c

    r3425 r3439  
    347347        list = tny_simple_list_new (); 
    348348 
    349         g_mutex_lock (priv->todo_lock); 
     349        g_static_rec_mutex_lock (priv->todo_lock); 
    350350        { 
    351351                GError *terror = NULL; 
     
    363363                                "software."); 
    364364                        priv->is_running = FALSE; 
    365                         g_mutex_unlock (priv->todo_lock); 
     365                        g_static_rec_mutex_unlock (priv->todo_lock); 
    366366                        goto errorhandler; 
    367367                } 
     
    374374                        g_error_free (terror); 
    375375                        g_object_unref (list); 
    376                         g_mutex_unlock (priv->todo_lock); 
     376                        g_static_rec_mutex_unlock (priv->todo_lock); 
    377377                        goto errorhandler; 
    378378                } 
     
    381381                priv->total = length; 
    382382        } 
    383         g_mutex_unlock (priv->todo_lock); 
     383        g_static_rec_mutex_unlock (priv->todo_lock); 
    384384 
    385385        g_object_unref (list); 
     
    392392                TnyMsg *msg = NULL; 
    393393 
    394                 g_mutex_lock (priv->sending_lock); 
    395  
    396                 g_mutex_lock (priv->todo_lock); 
     394                g_static_rec_mutex_lock (priv->sending_lock); 
     395 
     396                g_static_rec_mutex_lock (priv->todo_lock); 
    397397                { 
    398398                        GError *ferror = NULL; 
     
    406406                        else { 
    407407                                priv->is_running = FALSE; 
    408                                 g_mutex_unlock (priv->todo_lock); 
    409                                 g_mutex_unlock (priv->sending_lock); 
     408                                g_static_rec_mutex_unlock (priv->todo_lock); 
     409                                g_static_rec_mutex_unlock (priv->sending_lock); 
    410410                                goto errorhandler; 
    411411                        } 
     
    417417                                g_error_free (ferror); 
    418418                                g_object_unref (headers); 
    419                                 g_mutex_unlock (priv->todo_lock); 
    420                                 g_mutex_unlock (priv->sending_lock); 
     419                                g_static_rec_mutex_unlock (priv->todo_lock); 
     420                                g_static_rec_mutex_unlock (priv->sending_lock); 
    421421                                goto errorhandler; 
    422422                        } 
     
    457457                                priv->is_running = FALSE; 
    458458                                g_object_unref (headers); 
    459                                 g_mutex_unlock (priv->todo_lock); 
    460                                 g_mutex_unlock (priv->sending_lock); 
     459                                g_static_rec_mutex_unlock (priv->todo_lock); 
     460                                g_static_rec_mutex_unlock (priv->sending_lock); 
    461461                                break; 
    462462                        } 
     
    468468                        g_object_unref (headers); 
    469469                } 
    470                 g_mutex_unlock (priv->todo_lock); 
     470                g_static_rec_mutex_unlock (priv->todo_lock); 
    471471 
    472472                if (header && TNY_IS_HEADER (header) && tny_device_is_online (device)) 
     
    501501                        } 
    502502 
    503                         g_mutex_lock (priv->todo_lock); 
     503                        g_static_rec_mutex_lock (priv->todo_lock); 
    504504                        { 
    505505                                if (err == NULL) 
     
    516516                                } 
    517517                        } 
    518                         g_mutex_unlock (priv->todo_lock); 
     518                        g_static_rec_mutex_unlock (priv->todo_lock); 
    519519 
    520520                        /* Emits msg-sent signal to inform msg has been sent */ 
     
    537537                        if (header && G_IS_OBJECT (header)) 
    538538                                g_object_unref (header); 
    539                         g_mutex_unlock (priv->sending_lock); 
     539                        g_static_rec_mutex_unlock (priv->sending_lock); 
    540540                        break; 
    541541                } 
    542542 
    543                 g_mutex_unlock (priv->sending_lock); 
     543                g_static_rec_mutex_unlock (priv->sending_lock); 
    544544 
    545545        } 
     
    611611        TnyIterator *iter; 
    612612 
    613         g_mutex_lock (priv->sending_lock); 
     613        g_static_rec_mutex_lock (priv->sending_lock); 
    614614 
    615615        priv->is_running = FALSE; 
     
    623623                g_object_unref (headers); 
    624624                g_object_unref (outbox); 
    625                 g_mutex_unlock (priv->sending_lock); 
     625                g_static_rec_mutex_unlock (priv->sending_lock); 
    626626                return; 
    627627        } 
     
    644644                        g_object_unref (headers); 
    645645                        g_object_unref (outbox); 
    646                         g_mutex_unlock (priv->sending_lock); 
     646                        g_static_rec_mutex_unlock (priv->sending_lock); 
    647647                        return; 
    648648                } 
     
    657657        g_object_unref (outbox); 
    658658 
    659         g_mutex_unlock (priv->sending_lock); 
     659        g_static_rec_mutex_unlock (priv->sending_lock); 
    660660 
    661661        return; 
     
    715715        g_assert (TNY_IS_CAMEL_MSG (msg)); 
    716716 
    717         g_mutex_lock (priv->todo_lock); 
     717        g_static_rec_mutex_lock (priv->todo_lock); 
    718718        { 
    719719                TnyFolder *outbox; 
     
    731731                                "This problem indicates a bug in the software.")); 
    732732                        g_object_unref (headers); 
    733                         g_mutex_unlock (priv->todo_lock); 
     733                        g_static_rec_mutex_unlock (priv->todo_lock); 
    734734                        return; 
    735735                } 
     
    741741                        g_object_unref (headers); 
    742742                        g_object_unref (outbox); 
    743                         g_mutex_unlock (priv->todo_lock); 
     743                        g_static_rec_mutex_unlock (priv->todo_lock); 
    744744                        return; 
    745745                } 
     
    757757                g_object_unref (outbox); 
    758758        } 
    759         g_mutex_unlock (priv->todo_lock); 
     759        g_static_rec_mutex_unlock (priv->todo_lock); 
    760760 
    761761        return; 
     
    778778        g_assert (TNY_IS_CAMEL_MSG (msg)); 
    779779 
    780         g_mutex_lock (priv->todo_lock); 
     780        g_static_rec_mutex_lock (priv->todo_lock); 
    781781        { 
    782782                TnyFolder *outbox; 
     
    794794                                "This problem indicates a bug in the software.")); 
    795795                        g_object_unref (headers); 
    796                         g_mutex_unlock (priv->todo_lock); 
     796                        g_static_rec_mutex_unlock (priv->todo_lock); 
    797797                        return; 
    798798                } 
     
    804804                        g_object_unref (headers); 
    805805                        g_object_unref (outbox); 
    806                         g_mutex_unlock (priv->todo_lock); 
     806                        g_static_rec_mutex_unlock (priv->todo_lock); 
    807807                        return; 
    808808                } 
     
    822822                g_object_unref (outbox); 
    823823        } 
    824         g_mutex_unlock (priv->todo_lock); 
     824        g_static_rec_mutex_unlock (priv->todo_lock); 
    825825 
    826826        return; 
     
    965965        } 
    966966 
    967         g_mutex_lock (priv->todo_lock); 
     967        g_static_rec_mutex_lock (priv->todo_lock); 
    968968 
    969969        if (priv->signal != -1) 
     
    975975                g_object_unref (priv->outbox_cache); 
    976976 
    977         g_mutex_unlock (priv->todo_lock); 
    978  
    979         g_mutex_free (priv->todo_lock); 
    980         g_mutex_free (priv->sending_lock); 
     977        g_static_rec_mutex_unlock (priv->todo_lock); 
     978 
     979        g_free (priv->todo_lock); 
     980        priv->todo_lock = NULL; 
     981 
     982        g_free (priv->sending_lock); 
     983        priv->sending_lock = NULL; 
     984 
    981985        g_object_unref (priv->trans_account); 
    982986 
     
    11421146        priv->sentbox_cache = NULL; 
    11431147        priv->outbox_cache = NULL; 
    1144         priv->todo_lock = g_mutex_new (); 
    1145         priv->sending_lock = g_mutex_new (); 
     1148 
     1149        priv->todo_lock = g_new0 (GStaticRecMutex, 1); 
     1150        g_static_rec_mutex_init (priv->todo_lock); 
     1151        priv->sending_lock = g_new0 (GStaticRecMutex, 1); 
     1152        g_static_rec_mutex_init (priv->sending_lock); 
     1153 
    11461154        priv->is_running = FALSE; 
    11471155        priv->thread = NULL;