Changeset 2120

Show
Ignore:
Timestamp:
06/11/07 13:56:45
Author:
pvanhoof
Message:

Added tny_camel_pop_store_account_reconnect

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2115 r2120  
    1111        removed (for whatever reason in the TnyFolderMonitor): more robust 
    1212        * Fixed some IDLE deadlocks 
     13        * Added tny_camel_pop_store_account_reconnect 
     14 
     15        * This was a minor API change 
    1316 
    14172007-06-08  Sergio Villar Senin  <svillar@igalia.com> 
  • trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-stream.c

    r1943 r2120  
    6464                        return is->end - is->ptr; 
    6565                } else { 
    66                         dd(printf("POP3_STREAM_FILL(ERROR): '%s'\n", strerror (errno))); 
     66                        pop3_debug ("POP3_STREAM_FILL(ERROR): '%s'\n", strerror (errno)); 
    6767                        return -1; 
    6868                } 
     
    106106                                is->mode = CAMEL_POP3_STREAM_EOD; 
    107107                                is->state = 0; 
    108                                 dd(printf("POP3_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer)); 
     108                                pop3_debug ("POP3_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer); 
    109109                                return o-buffer; 
    110110                        } 
     
    139139        is->state = state; 
    140140 
    141         dd(printf("POP3_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer)); 
     141        pop3_debug ("POP3_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer); 
    142142 
    143143        return o-buffer; 
     
    148148{ 
    149149        CamelPOP3Stream *is = (CamelPOP3Stream *)stream; 
    150          
    151         if (strncmp (buffer, "PASS ", 5) != 0) 
    152                 dd(printf("POP3_STREAM_WRITE(%d):\n%.*s\n", (int)n, (int)n, buffer)); 
    153         else 
    154                 dd(printf("POP3_STREAM_WRITE(%d):\nPASS xxxxxxxx\n", (int)n)); 
    155          
     150 
     151        if (strncmp (buffer, "PASS ", 5) != 0) { 
     152                pop3_debug("POP3_STREAM_WRITE(%d):\n%.*s\n", (int)n, (int)n, buffer); 
     153        } else { 
     154                pop3_debug("POP3_STREAM_WRITE(%d):\nPASS xxxxxxxx\n", (int)n); 
     155        } 
     156 
    156157        return camel_stream_write(is->source, buffer, n); 
    157158} 
  • trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-stream.h

    r1943 r2120  
    2626 
    2727#include <camel/camel-stream.h> 
     28 
     29#ifdef DEBUG 
     30#define pop3_debug      g_print  
     31#else 
     32#define pop3_debug(o,...)        
     33#endif 
     34 
    2835 
    2936#define CAMEL_POP3_STREAM(obj)         CAMEL_CHECK_CAST (obj, camel_pop3_stream_get_type (), CamelPOP3Stream) 
  • trunk/libtinymail-camel/tny-camel-pop-store-account.c

    r2074 r2120  
    3737#include <camel/camel-session.h> 
    3838#include <camel/camel-store.h> 
     39#include <camel/camel-service.h> 
     40 
    3941#include <camel/providers/pop3/camel-pop3-store.h> 
    4042 
     
    145147} 
    146148 
     149/** 
     150 * tny_camel_pop_store_account_reconnect: 
     151 * @self: a #TnyCamelPOPStoreAccount instance 
     152 *  
     153 * Reconnect to the POP3 service. The reason why this API exists is because 
     154 * certain services (like GMail in 2007) suddenly give you more messages in the 
     155 * LIST result of POP after you disconnected and reconnect. 
     156 **/ 
     157void  
     158tny_camel_pop_store_account_reconnect (TnyCamelPOPStoreAccount *self) 
     159{ 
     160        CamelException ex = CAMEL_EXCEPTION_INITIALISER; 
     161        TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (self); 
     162        const CamelService *service = _tny_camel_account_get_service (TNY_CAMEL_ACCOUNT (self)); 
     163         
     164        g_mutex_lock (priv->lock); 
     165        camel_service_disconnect ((CamelService *) service, TRUE, &ex); 
     166        if (camel_exception_is_set (&ex)) 
     167                camel_exception_clear (&ex); 
     168        camel_service_connect ((CamelService *) service, &ex); 
     169        g_mutex_unlock (priv->lock); 
     170 
     171        return; 
     172} 
    147173 
    148174static void  
  • trunk/libtinymail-camel/tny-camel-pop-store-account.h

    r2069 r2120  
    5454void tny_camel_pop_store_account_set_leave_messages_on_server (TnyCamelPOPStoreAccount *self, gboolean enabled); 
    5555 
     56void tny_camel_pop_store_account_reconnect (TnyCamelPOPStoreAccount *self); 
     57 
    5658G_END_DECLS 
    5759