Changeset 1368

Show
Ignore:
Timestamp:
01/08/07 16:48:31
Author:
pvanhoof
Message:

Implemented partial message retrieval first parts and pop support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1366 r1368  
     12007-01-08  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Implemented first pieces of the partial message retrieval 
     4        * Further implemented TnyCamelPopFolder and TnyCamelPopAccount 
     5 
    162007-01-04  Philip Van Hoof <pvanhoof@gnome.org> 
    27 
  • trunk/libtinymail-camel/Makefile.am

    r1359 r1368  
    3333 
    3434libtinymail_camel_priv_headers = \ 
     35        tny-camel-pop-store-account-priv.h \ 
    3536        tny-session-camel-priv.h \ 
    3637        tny-camel-common.c \ 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c

    r1366 r1368  
    136136static CamelObjectClass *parent_class; 
    137137 
     138 
    138139static GData *parse_fetch_response (CamelImapFolder *imap_folder, char *msg_att); 
     140 
     141static GData *parse_partial_fetch_response (CamelImapFolder *imap_folder, char *response, GData *data, const gchar *part_spec); 
    139142 
    140143#ifdef G_OS_WIN32 
     
    17191722                                      const char *uid, 
    17201723                                      CamelMessageContentInfo *ci, 
    1721                                       CamelException *ex); 
     1724                                      gboolean full, CamelException *ex); 
    17221725 
    17231726struct _part_spec_stack { 
     
    18401843                g_free(part_spec); 
    18411844                 
    1842                 stream = camel_imap_folder_fetch_data (imap_folder, uid, spec, FALSE, ex); 
     1845                /* TNY TODO: partial message retrieval exception */ 
     1846                stream = camel_imap_folder_fetch_data (imap_folder, uid, spec, FALSE, TRUE, ex); 
    18431847                if (stream) { 
    18441848                        ret = camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (body_mp), stream); 
     
    18771881                while (ci) { 
    18781882                        sprintf (child_spec + speclen, "%d.MIME", num++); 
    1879                         stream = camel_imap_folder_fetch_data (imap_folder, uid, child_spec, FALSE, ex); 
     1883                        /* TNY TODO: partial message retrieval exception */ 
     1884                        stream = camel_imap_folder_fetch_data (imap_folder, uid, child_spec, FALSE, TRUE, ex); 
    18801885                        if (stream) { 
    18811886                                int ret; 
     
    19331938                return (CamelDataWrapper *) body_mp; 
    19341939        } else if (camel_content_type_is (ci->type, "message", "rfc822")) { 
    1935                 content = (CamelDataWrapper *) get_message (imap_folder, uid, ci->childs, ex); 
     1940                /* TNY TODO: partial message retrieval exception */ 
     1941                content = (CamelDataWrapper *) get_message (imap_folder, uid, ci->childs, TRUE, ex); 
    19361942                g_free (part_spec); 
    19371943                return content; 
     
    19571963get_message (CamelImapFolder *imap_folder, const char *uid, 
    19581964             CamelMessageContentInfo *ci, 
    1959              CamelException *ex) 
     1965             gboolean full, CamelException *ex) 
    19601966{ 
    19611967        CamelImapStore *store = CAMEL_IMAP_STORE (CAMEL_FOLDER (imap_folder)->parent_store); 
     
    19711977                                        store->server_level >= IMAP_LEVEL_IMAP4REV1 ? "HEADER" : "0"); 
    19721978 
    1973         stream = camel_imap_folder_fetch_data (imap_folder, uid, section_text, FALSE, ex); 
     1979        /* TNY: partial message retrieval */ 
     1980        stream = camel_imap_folder_fetch_data (imap_folder, uid, section_text, FALSE, full, ex); 
    19741981        g_free (section_text); 
    19751982        g_free(part_spec); 
     
    20112018static CamelMimeMessage * 
    20122019get_message_simple (CamelImapFolder *imap_folder, const char *uid, 
    2013                     CamelStream *stream, CamelException *ex) 
     2020                    CamelStream *stream, gboolean full, CamelException *ex) 
    20142021{ 
    20152022        CamelMimeMessage *msg; 
     
    20182025        if (!stream) { 
    20192026                stream = camel_imap_folder_fetch_data (imap_folder, uid, "", 
    2020                                                        FALSE, ex); 
     2027                                                       FALSE, full, ex); 
    20212028                if (!stream) 
    20222029                        return NULL; 
     
    20772084        /* If its cached in full, just get it as is, this is only a shortcut, 
    20782085           since we get stuff from the cache anyway.  It affects a busted connection though. */ 
    2079         if ( (stream = camel_imap_folder_fetch_data(imap_folder, uid, "", TRUE, NULL)) 
    2080              && (msg = get_message_simple(imap_folder, uid, stream, ex))) 
     2086        if ( (stream = camel_imap_folder_fetch_data(imap_folder, uid, "", TRUE, full, NULL)) 
     2087             && (msg = get_message_simple(imap_folder, uid, stream, full, ex))) 
    20812088                goto done; 
    20822089 
     
    20952102#endif 
    20962103                    || (!content_info_incomplete(mi->info.content) && !mi->info.content->childs)) { 
    2097                         msg = get_message_simple (imap_folder, uid, NULL, ex); 
     2104                        msg = get_message_simple (imap_folder, uid, NULL, full, ex); 
    20982105                } else { 
    20992106                        if (content_info_incomplete (mi->info.content)) { 
     
    21612168                         */ 
    21622169                        if (content_info_incomplete (mi->info.content)) 
    2163                                 msg = get_message_simple (imap_folder, uid, NULL, ex); 
     2170                                msg = get_message_simple (imap_folder, uid, NULL, full, ex); 
    21642171                        else 
    2165                                 msg = get_message (imap_folder, uid, mi->info.content, ex); 
     2172                                msg = get_message (imap_folder, uid, mi->info.content, full, ex); 
    21662173                } 
    21672174        } while (msg == NULL 
     
    21852192        CamelStream *stream; 
    21862193 
    2187         stream = camel_imap_folder_fetch_data (imap_folder, uid, "", FALSE, ex); 
     2194        /* TNY TODO: partial message retrieval exception */ 
     2195        stream = camel_imap_folder_fetch_data (imap_folder, uid, "", FALSE, TRUE, ex); 
    21882196        if (stream) 
    21892197                camel_object_unref (CAMEL_OBJECT (stream)); 
     
    26832691} 
    26842692 
     2693typedef struct { 
     2694        const gchar *part_spec; 
     2695        GData *data; 
     2696} PartialRetrieveInfo; 
    26852697 
    26862698CamelStream * 
    26872699camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid, 
    26882700                              const char *section_text, gboolean cache_only, 
    2689                               CamelException *ex) 
     2701                              gboolean full, CamelException *ex) 
    26902702{ 
    26912703        CamelFolder *folder = CAMEL_FOLDER (imap_folder); 
     
    26932705        CamelImapResponse *response; 
    26942706        CamelStream *stream; 
    2695         GData *fetch_data
    2696         char *found_uid
    2697         int i; 
     2707        GData *fetch_data=NULL
     2708        char *found_uid = NULL, *boundary = NULL
     2709        int i; gboolean free_fuid = FALSE; 
    26982710         
    26992711        /* EXPUNGE responses have to modify the cache, which means 
     
    27092721        CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock); 
    27102722        stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text, ex); 
    2711         if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0"))) { 
     2723        if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0")))  
     2724        { 
    27122725                camel_exception_clear (ex); 
    27132726                stream = camel_imap_message_cache_get (imap_folder->cache, uid, "", ex); 
     
    27322745         
    27332746        camel_exception_clear (ex); 
    2734         if (store->server_level < IMAP_LEVEL_IMAP4REV1 && !*section_text) { 
     2747 
     2748        if (full) 
     2749        { 
     2750            if (store->server_level < IMAP_LEVEL_IMAP4REV1 && !*section_text) { 
     2751                    response = camel_imap_command (store, folder, ex, 
     2752                                                   "UID FETCH %s RFC822.PEEK", 
     2753                                                   uid); 
     2754            } else { 
     2755                    response = camel_imap_command (store, folder, ex, 
     2756                                                   "UID FETCH %s BODY.PEEK[%s]", 
     2757                                                   uid, section_text); 
     2758            } 
     2759            /* We won't need the connect_lock again after this. */ 
     2760            CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); 
     2761             
     2762            if (!response) { 
     2763                    CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
     2764                    return NULL; 
     2765            } 
     2766             
     2767            for (i = 0; i < response->untagged->len; i++) { 
     2768                    fetch_data = parse_fetch_response (imap_folder, response->untagged->pdata[i]); 
     2769                    found_uid = g_datalist_get_data (&fetch_data, "UID"); 
     2770                    stream = g_datalist_get_data (&fetch_data, "BODY_PART_STREAM"); 
     2771                    if (found_uid && stream && !strcmp (uid, found_uid)) 
     2772                            break; 
     2773                     
     2774                    g_datalist_clear (&fetch_data); 
     2775                    stream = NULL; 
     2776            } 
     2777            camel_imap_response_free (store, response); 
     2778        } else  
     2779        { 
     2780 
     2781            /* Partial message retrieval feature  
     2782               { HEADER boundary 1.HEADER 1 boundary } */ 
     2783 
     2784            int t = 0, boundary_len = 0; 
     2785            PartialRetrieveInfo infos[3] = { 
     2786                { "HEADER", NULL }, 
     2787                { "1.HEADER", NULL },  
     2788                { "1", NULL }, 
     2789            }; 
     2790 
     2791/* TODO: It's better to use BODYSTRUCTURE to get 1.HEADER (Cyrus doesn't support 1.HEADER, Courier does) 
     2792 * * 1 FETCH (BODYSTRUCTURE (("TEXT" "PLAIN" NIL NIL NIL "7BIT" 144 9 NIL NIL NIL)("IMAGE" "PNG" ("NAME" "drawing.png") NIL NIL "BASE64" 1005522 NIL ("ATTACHMENT" ("FILENAME" "drawing.png")) NIL) "MIXED" ("BOUNDARY" "=-7wX60rl1FvrW91cX0wLC") NIL NIL)) 
     2793 */ 
     2794            for (t=0; t < 3; t++) 
     2795            { 
    27352796                response = camel_imap_command (store, folder, ex, 
    2736                                                "UID FETCH %s RFC822.PEEK", 
    2737                                                uid); 
    2738         } else { 
    2739                 response = camel_imap_command (store, folder, ex, 
    2740                                                "UID FETCH %s BODY.PEEK[%s]", 
    2741                                                uid, section_text); 
    2742         } 
    2743         /* We won't need the connect_lock again after this. */ 
    2744         CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); 
    2745          
    2746         if (!response) { 
     2797                           "UID FETCH %s BODY.PEEK[%s]", uid, infos[t].part_spec); 
     2798 
     2799                if (!response) 
     2800                    goto errorh; 
     2801 
     2802                for (i = 0; i < response->untagged->len; i++) 
     2803                    infos[t].data = parse_partial_fetch_response (imap_folder, response->untagged->pdata[0], infos[t].data, infos[t].part_spec); 
     2804                camel_imap_response_free (store, response); 
     2805 
     2806                if (!boundary) { 
     2807                        boundary = g_strdup (g_datalist_get_data (&(infos[t].data), "BOUNDARY")); 
     2808                        if (boundary) boundary_len = strlen (boundary); 
     2809                } 
     2810                if (!found_uid) { 
     2811                        found_uid = g_strdup (g_datalist_get_data (&(infos[t].data), "UID")); 
     2812                        free_fuid = TRUE; 
     2813                } 
     2814            } 
     2815 
     2816                 
     2817            CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); 
     2818 
     2819            stream = NULL; 
     2820 
     2821            if (found_uid) 
     2822            { 
     2823                CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock); 
     2824 
     2825                for (t=0; t < 3; t++) 
     2826                { 
     2827                    gchar *data = g_datalist_get_data (&(infos[t].data), "PART_BODY"); 
     2828                    size_t len = GPOINTER_TO_INT (g_datalist_get_data (&(infos[t].data), "PART_LEN")); 
     2829 
     2830                    if (!stream) 
     2831                    { 
     2832                            stream = camel_imap_message_cache_insert (imap_folder->cache,  
     2833                                found_uid, "", (len>0&&data)?data:"", len, NULL); 
     2834                            if (stream == NULL) 
     2835                                    stream = camel_stream_mem_new_with_buffer ((len>0&&data)?data:"", len); 
     2836                            if (stream == NULL) { /* wtf? */ 
     2837                                int x=0; 
     2838                                for (x=0; x < 3; x++) 
     2839                                   g_datalist_clear (&(infos[x].data));  
     2840                                goto errorh;  
     2841                            } 
     2842                    } else  
     2843                    { 
     2844                            camel_seekable_stream_seek (CAMEL_SEEKABLE_STREAM (stream), 0, CAMEL_STREAM_END); 
     2845 
     2846                            if (boundary && !strcmp (infos[t].part_spec, "1.HEADER"))  
     2847                            { 
     2848                                    camel_stream_write (stream, "\n--", 3); 
     2849                                    camel_stream_write (stream, boundary, boundary_len); 
     2850                                    camel_stream_write (stream, "\n", 1); 
     2851                            } 
     2852                            camel_stream_write (stream, data, len); 
     2853                            if (boundary && !strcmp (infos[t].part_spec, "1")) 
     2854                            { 
     2855                                    camel_stream_write (stream, "\n--", 3); 
     2856                                    camel_stream_write (stream, boundary, boundary_len); 
     2857                                    camel_stream_write (stream, "\n", 1); 
     2858                            } 
     2859                    } 
     2860 
     2861                    g_datalist_clear (&(infos[t].data)); 
     2862                } 
     2863 
     2864                if (stream) 
     2865                        camel_stream_reset (stream); 
     2866 
    27472867                CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
     2868            } else { 
     2869                int x=0; 
     2870                for (x=0; x < 3; x++)  
     2871                        g_datalist_clear (&(infos[x].data));  
     2872                goto errorh; 
     2873            } 
     2874 
     2875        } 
     2876 
     2877errorh: 
     2878 
     2879        CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
     2880 
     2881        if (!stream) camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
     2882                    _("Could not find message body in FETCH response.")); 
     2883 
     2884        if (free_fuid) 
     2885                g_free (found_uid); 
     2886 
     2887        if (boundary) 
     2888                g_free (boundary); 
     2889 
     2890        return stream; 
     2891} 
     2892 
     2893 
     2894 
     2895static GData * 
     2896parse_partial_fetch_response (CamelImapFolder *imap_folder, char *response, GData *data, const gchar *part_spec) 
     2897{ 
     2898        if (*response != '(')  
     2899        { 
     2900                long seq; 
     2901                 
     2902                if (*response != '*' || *(response + 1) != ' ') 
     2903                        return NULL; 
     2904                seq = strtol (response + 2, &response, 10); 
     2905                if (seq == 0) 
     2906                        return NULL; 
     2907                if (g_ascii_strncasecmp (response, " FETCH (", 8) != 0) 
     2908                        return NULL; 
     2909                response += 7;           
     2910        } 
     2911 
     2912        do { 
     2913                /* Skip the initial '(' or the ' ' between elements */ 
     2914                response++; 
     2915                 
     2916                if (!g_ascii_strncasecmp (response, "FLAGS ", 6))                        
     2917                        response += 6; 
     2918                else if (!g_ascii_strncasecmp (response, "RFC822.SIZE ", 12))  
     2919                { /* REMOVE THIS? */ 
     2920                        unsigned long size; 
     2921                        response += 12; 
     2922                        size = strtoul (response, &response, 10); 
     2923                        g_datalist_set_data (&data, "RFC822.SIZE", GUINT_TO_POINTER (size)); 
     2924                } else if (!g_ascii_strncasecmp (response, "BODY[", 5) || 
     2925                           !g_ascii_strncasecmp (response, "RFC822 ", 7))  
     2926                { 
     2927                        char *body = NULL, *p = NULL, *boundary = NULL; 
     2928                        size_t body_len = 0; 
     2929 
     2930                        if (*response == 'B')  
     2931                        { 
     2932                                response += 5; 
     2933                                p = strchr (response, ']'); 
     2934                                if (!p || *(p + 1) != ' ') 
     2935                                        break; 
     2936                                response = p + 2; 
     2937                        } else  
     2938                                response += 7; 
     2939                         
     2940                        body = imap_parse_nstring ((const char **) &response, &body_len); 
     2941 
     2942                        if (!response) break; 
     2943                        if (!body) body = g_strdup (""); 
     2944 
     2945                        if (!strcmp (part_spec, "HEADER")) 
     2946                        { 
     2947                           CamelContentType *ct = NULL; 
     2948                           const char *bound=NULL; 
     2949                           char *pstr = (char*)strcasestr (body, "Content-Type:"); 
     2950 
     2951                           if (pstr) {  
     2952                                pstr = strchr (pstr, ':');  
     2953                                if (pstr) { pstr++; 
     2954                                ct = camel_content_type_decode(pstr); }  
     2955                           } 
     2956 
     2957                           if (ct) {  
     2958                                bound = camel_content_type_param(ct, "boundary"); 
     2959                                if (bound) { 
     2960                                        boundary = g_strdup (bound); 
     2961                                        g_datalist_set_data_full (&data, "BOUNDARY", boundary, g_free); 
     2962                                } 
     2963                           } 
     2964                        } 
     2965 
     2966                        g_datalist_set_data_full (&data, "PART_BODY", body, g_free); 
     2967                        g_datalist_set_data (&data, "PART_LEN", GINT_TO_POINTER (body_len)); 
     2968 
     2969 
     2970                } else if (!g_ascii_strncasecmp (response, "UID ", 4))  
     2971                { 
     2972                        int len = strcspn (response + 4, " )"); 
     2973                        char *uid = g_strndup (response + 4, len); 
     2974                        g_datalist_set_data_full (&data, "UID", uid, g_free); 
     2975                        response += 4 + len; 
     2976                } else { 
     2977                        g_warning ("Unexpected FETCH response from server: (%s", response); 
     2978                        break; 
     2979                } 
     2980        } while (response && *response != ')'); 
     2981         
     2982        if (!response || *response != ')')  
     2983        { 
     2984                g_warning ("Unexpected FETCH response from server: (%s", response); 
     2985                g_datalist_clear (&data); 
    27482986                return NULL; 
    27492987        } 
    27502988         
    2751         for (i = 0; i < response->untagged->len; i++) { 
    2752                 fetch_data = parse_fetch_response (imap_folder, response->untagged->pdata[i]); 
    2753                 found_uid = g_datalist_get_data (&fetch_data, "UID"); 
    2754                 stream = g_datalist_get_data (&fetch_data, "BODY_PART_STREAM"); 
    2755                 if (found_uid && stream && !strcmp (uid, found_uid)) 
    2756                         break; 
    2757                  
    2758                 g_datalist_clear (&fetch_data); 
    2759                 stream = NULL; 
    2760         } 
    2761         camel_imap_response_free (store, response); 
    2762         CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
    2763         if (!stream) { 
    2764                 camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
    2765                                       _("Could not find message body in FETCH response.")); 
    2766         } else { 
    2767                 camel_object_ref (CAMEL_OBJECT (stream)); 
    2768                 g_datalist_clear (&fetch_data); 
    2769         } 
    2770          
    2771         return stream; 
     2989        return data; 
    27722990} 
    27732991 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.h

    r1052 r1368  
    8181                                           const char *section_text, 
    8282                                           gboolean cache_only, 
    83                                            CamelException *ex); 
     83                                           gboolean full, CamelException *ex); 
    8484 
    8585/* Standard Camel function */ 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r1063 r1368  
    673673        } 
    674674         
     675 
     676        /* Tinymail hack: always use IMAP4, not IMAP4rev1 (sorry) */ 
     677 
     678        force_imap4 = TRUE; 
     679        store->braindamaged = TRUE; 
     680 
     681        /* end of hack :) */ 
     682 
    675683        g_free (buf); 
    676684         
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-wrapper.c

    r1014 r1368  
    142142                CamelStream *datastream; 
    143143                 
     144                /* TNY TODO: partial message retrieval exception */ 
    144145                datastream = camel_imap_folder_fetch_data ( 
    145146                        imap_wrapper->folder, imap_wrapper->uid, 
    146                         imap_wrapper->part_spec, FALSE, NULL); 
     147                        imap_wrapper->part_spec, FALSE, TRUE, NULL); 
    147148                if (!datastream) { 
    148149                        CAMEL_IMAP_WRAPPER_UNLOCK (imap_wrapper, lock); 
     
    189190 
    190191        /* Try the cache. */ 
     192        /* TNY TODO: Partial message retrieval exception */ 
    191193        stream = camel_imap_folder_fetch_data (imap_folder, uid, part_spec, 
    192                                                TRUE, NULL); 
     194                                               TRUE, TRUE, NULL); 
    193195        if (stream) { 
    194196                imap_wrapper_hydrate (imap_wrapper, stream); 
  • trunk/libtinymail-camel/tny-camel-account.c

    r1305 r1368  
    5252tny_camel_account_get_account_type (TnyAccount *self) 
    5353{ 
     54        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_account_type_func (self); 
     55} 
     56 
     57static TnyAccountType 
     58tny_camel_account_get_account_type_default (TnyAccount *self) 
     59{ 
    5460        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    5561 
     
    7076tny_camel_account_add_option (TnyCamelAccount *self, const gchar *option) 
    7177{ 
     78        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->add_option_func (self, option); 
     79} 
     80 
     81void  
     82tny_camel_account_add_option_default (TnyCamelAccount *self, const gchar *option) 
     83{ 
    7284        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    7385 
     
    8294static void 
    8395tny_camel_account_set_url_string (TnyAccount *self, const gchar *url_string) 
     96{ 
     97        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_url_string_func (self, url_string); 
     98} 
     99 
     100static void 
     101tny_camel_account_set_url_string_default (TnyAccount *self, const gchar *url_string) 
    84102{ 
    85103        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     
    101119tny_camel_account_get_url_string (TnyAccount *self) 
    102120{ 
     121        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_url_string_func (self); 
     122} 
     123 
     124static const gchar* 
     125tny_camel_account_get_url_string_default (TnyAccount *self) 
     126{ 
    103127        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    104128 
     
    109133static void 
    110134tny_camel_account_set_name (TnyAccount *self, const gchar *name) 
     135{ 
     136        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_name_func (self, name); 
     137} 
     138 
     139static void 
     140tny_camel_account_set_name_default (TnyAccount *self, const gchar *name) 
    111141{ 
    112142        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     
    122152static const gchar* 
    123153tny_camel_account_get_name (TnyAccount *self) 
     154{ 
     155        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_name_func (self); 
     156} 
     157 
     158static const gchar* 
     159tny_camel_account_get_name_default (TnyAccount *self) 
    124160{ 
    125161        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     
    212248tny_camel_account_is_connected (TnyAccount *self) 
    213249{ 
     250        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->is_connected_func (self); 
     251} 
     252 
     253static gboolean  
     254tny_camel_account_is_connected_default (TnyAccount *self) 
     255{ 
    214256        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    215257        return priv->connected; 
     
    238280} 
    239281 
    240  
    241282static void 
    242283tny_camel_account_set_id (TnyAccount *self, const gchar *id) 
     284{ 
     285        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_id_func (self, id); 
     286} 
     287 
     288static void 
     289tny_camel_account_set_id_default (TnyAccount *self, const gchar *id) 
    243290{ 
    244291        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     
    259306tny_camel_account_set_proto (TnyAccount *self, const gchar *proto) 
    260307{ 
     308        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_proto_func (self, proto); 
     309} 
     310 
     311static void 
     312tny_camel_account_set_proto_default (TnyAccount *self, const gchar *proto) 
     313{ 
    261314        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    262315 
     
    278331tny_camel_account_set_user (TnyAccount *self, const gchar *user) 
    279332{ 
     333        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_user_func (self, user); 
     334} 
     335 
     336static void 
     337tny_camel_account_set_user_default (TnyAccount *self, const gchar *user) 
     338{ 
    280339        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    281340         
     
    297356tny_camel_account_set_hostname (TnyAccount *self, const gchar *host) 
    298357{ 
     358        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_hostname_func (self, host); 
     359} 
     360 
     361static void 
     362tny_camel_account_set_hostname_default (TnyAccount *self, const gchar *host) 
     363{ 
    299364        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    300365         
     
    315380static void 
    316381tny_camel_account_set_pass_func (TnyAccount *self, TnyGetPassFunc get_pass_func) 
     382{ 
     383        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_pass_func_func (self, get_pass_func); 
     384} 
     385 
     386static void 
     387tny_camel_account_set_pass_func_default (TnyAccount *self, TnyGetPassFunc get_pass_func) 
    317388{ 
    318389        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     
    337408tny_camel_account_set_forget_pass_func (TnyAccount *self, TnyForgetPassFunc get_forget_pass_func) 
    338409{ 
     410        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_forget_pass_func_func (self, get_forget_pass_func); 
     411} 
     412 
     413static void 
     414tny_camel_account_set_forget_pass_func_default (TnyAccount *self, TnyForgetPassFunc get_forget_pass_func) 
     415{ 
    339416        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    340417 
     
    353430tny_camel_account_get_id (TnyAccount *self) 
    354431{ 
     432        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_id_func (self); 
     433} 
     434 
     435static const gchar* 
     436tny_camel_account_get_id_default (TnyAccount *self) 
     437{ 
    355438        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self);        
    356439        const gchar *retval; 
     
    366449tny_camel_account_get_proto (TnyAccount *self) 
    367450{ 
     451        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_proto_func (self); 
     452} 
     453 
     454static const gchar* 
     455tny_camel_account_get_proto_default (TnyAccount *self) 
     456{ 
    368457        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    369458        const gchar *retval; 
     
    379468tny_camel_account_get_user (TnyAccount *self) 
    380469{ 
     470        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_user_func (self); 
     471} 
     472 
     473static const gchar* 
     474tny_camel_account_get_user_default (TnyAccount *self) 
     475{ 
    381476        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    382477        const gchar *retval; 
     
    391486static const gchar* 
    392487tny_camel_account_get_hostname (TnyAccount *self) 
     488{ 
     489        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_hostname_func (self); 
     490} 
     491 
     492static const gchar* 
     493tny_camel_account_get_hostname_default (TnyAccount *self) 
    393494{ 
    394495        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self);        
     
    405506tny_camel_account_get_pass_func (TnyAccount *self) 
    406507{ 
     508        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_pass_func_func (self); 
     509} 
     510 
     511static TnyGetPassFunc 
     512tny_camel_account_get_pass_func_default (TnyAccount *self) 
     513{ 
    407514        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    408515        TnyGetPassFunc retval; 
     
    417524static TnyForgetPassFunc 
    418525tny_camel_account_get_forget_pass_func (TnyAccount *self) 
     526{ 
     527        return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_forget_pass_func_func (self); 
     528} 
     529 
     530static TnyForgetPassFunc 
     531tny_camel_account_get_forget_pass_func_default (TnyAccount *self) 
    419532{ 
    420533        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     
    492605void  
    493606tny_camel_account_set_online_status (TnyCamelAccount *self, gboolean offline) 
     607{ 
     608        TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_online_status_func (self, offline); 
     609} 
     610 
     611void  
     612tny_camel_account_set_online_status_default (TnyCamelAccount *self, gboolean offline) 
    494613{ 
    495614        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     
    636755        object_class = (GObjectClass*) class; 
    637756 
     757 
     758        class->get_hostname_func = tny_camel_account_get_hostname_default; 
     759        class->set_hostname_func = tny_camel_account_set_hostname_default; 
     760        class->get_proto_func = tny_camel_account_get_proto_default; 
     761        class->set_proto_func = tny_camel_account_set_proto_default; 
     762        class->get_user_func = tny_camel_account_get_user_default; 
     763        class->set_user_func = tny_camel_account_set_user_default; 
     764        class->get_pass_func_func = tny_camel_account_get_pass_func_default; 
     765        class->set_pass_func_func = tny_camel_account_set_pass_func_default; 
     766        class->get_forget_pass_func_func = tny_camel_account_get_forget_pass_func_default; 
     767        class->set_forget_pass_func_func = tny_camel_account_set_forget_pass_func_default; 
     768        class->set_id_func = tny_camel_account_set_id_default; 
     769        class->get_id_func = tny_camel_account_get_id_default; 
     770        class->is_connected_func = tny_camel_account_is_connected_default; 
     771        class->set_url_string_func = tny_camel_account_set_url_string_default; 
     772        class->get_url_string_func = tny_camel_account_get_url_string_default; 
     773        class->get_name_func = tny_camel_account_get_name_default; 
     774        class->set_name_func = tny_camel_account_set_name_default; 
     775        class->get_account_type_func = tny_camel_account_get_account_type_default; 
     776 
     777        class->add_option_func = tny_camel_account_add_option_default; 
     778        class->set_online_status_func = tny_camel_account_set_online_status_default; 
     779 
    638780        object_class->finalize = tny_camel_account_finalize; 
    639781 
  • trunk/libtinymail-camel/tny-camel-account.h

    r1148 r1368  
    5353 
    5454        void (*reconnect_func) (TnyCamelAccount *self); 
     55 
     56        /* Virtual methods */ 
     57 
     58        gboolean (*is_connected_func)(TnyAccount *self); 
     59        void (*set_id_func) (TnyAccount *self, const gchar *id); 
     60        void (*set_name_func) (TnyAccount *self, const gchar *name); 
     61        void (*set_proto_func) (TnyAccount *self, const gchar *proto); 
     62        void (*set_user_func) (TnyAccount *self, const gchar *user); 
     63        void (*set_hostname_func) (TnyAccount *self, const gchar *host); 
     64        void (*set_url_string_func) (TnyAccount *self, const gchar *url_string); 
     65        void (*set_pass_func_func) (TnyAccount *self, TnyGetPassFunc get_pass_func); 
     66        void (*set_forget_pass_func_func) (TnyAccount *self, TnyForgetPassFunc get_forget_pass_func); 
     67        TnyGetPassFunc (*get_pass_func_func) (TnyAccount *self); 
     68        TnyForgetPassFunc (*get_forget_pass_func_func) (TnyAccount *self); 
     69        const gchar* (*get_id_func) (TnyAccount *self); 
     70        const gchar* (*get_name_func) (TnyAccount *self); 
     71        const gchar* (*get_proto_func) (TnyAccount *self); 
     72        const gchar* (*get_user_func) (TnyAccount *self); 
     73        const gchar* (*get_hostname_func) (TnyAccount *self); 
     74        const gchar* (*get_url_string_func) (TnyAccount *self); 
     75        TnyAccountType (*get_account_type_func) (TnyAccount *self); 
     76 
     77        void (*add_option_func) (TnyCamelAccount *self, const gchar *option); 
     78        void (*set_online_status_func) (TnyCamelAccount *self, gboolean offline); 
     79 
    5580}; 
    5681 
  • trunk/libtinymail-camel/tny-camel-folder-priv.h

    r1359 r1368  
    6565void _tny_camel_folder_set_iter (TnyCamelFolder *folder, CamelFolderInfo *iter); 
    6666void _tny_camel_folder_set_account (TnyCamelFolder *self, TnyAccount *account); 
    67  
     67gboolean _tny_camel_folder_load_folder_no_lock (TnyCamelFolderPriv *priv); 
    6868void _tny_camel_folder_set_folder (TnyCamelFolder *self, CamelFolder *camel_folder); 
    6969 
  • trunk/libtinymail-camel/tny-camel-folder.c

    r1359 r1368  
    220220         
    221221        return TRUE; 
     222} 
     223 
     224gboolean  
     225_tny_camel_folder_load_folder_no_lock (TnyCamelFolderPriv *priv) 
     226{ 
     227        return load_folder_no_lock (priv); 
    222228} 
    223229 
     
    23192325 
    23202326        priv->remove_strat = tny_camel_msg_remove_strategy_new (); 
    2321         priv->receive_strat = tny_camel_full_msg_receive_strategy_new (); 
     2327        priv->receive_strat = tny_camel_partial_msg_receive_strategy_new (); 
    23222328 
    23232329        return; 
  • trunk/libtinymail-camel/tny-camel-pop-folder.c

    <
    r900 r1368  
    1818 */ 
    1919 
    20 /* TODO: Refactor to a TnyPOPStoreAccount, TnyPOPStoreAccount and  
    21 TnyNNTPStoreAccount. Maybe also add a TnyExchangeStoreAccount? This file can  
    22 stay as an abstract TnyStoreAccount type. */ 
    2320 
    2421#include <config.h> 
     
    3835 
    3936#include <tny-folder.h> 
     37#include <tny-camel-pop-store-account.h> 
    4038 
    4139#include "tny-camel-account-priv.h"