Thanks Milan.

The problem I'm having now is when I ask for the folderinfo it returns
a null pointer at the point indicated below.
Evolution is set-up with a gmail pop account. When I tried it with the
IMAP settings it worked and I managed to get the CamelFolders.

The other thing I don't understand is the threading thing. Could
someone please explain that.

One more question, I cant seem to compile the devel-guide, is there an
online version of it? I've just been grepping everything and wanted to
know if there is some kind of API out there that makes it easier.

//mail grabbing entry point
gboolean pimp_mail_init(void)
        EAccountList* accounts;
        EIterator* accIter;
        //get accounts
        if(!(accounts = mail_config_get_accounts()))
                return FALSE;
        //foreach account
        accIter = e_list_get_iterator((EList *) accounts);
                EAccount *acc = (EAccount *) e_iterator_get(accIter);
                //get store
                mail_get_store(e_account_get_string(acc, E_ACCOUNT_SOURCE_URL),
NULL, pimp_mail_get_store, NULL);
        return TRUE;

static void pimp_mail_get_store(char *uri, CamelStore *store, void *user_data)
        if(store == NULL)
        //get folderinfo
        mail_get_folderinfo(store, NULL, pimp_mail_get_folderinfo, NULL);

static gboolean pimp_mail_get_folderinfo(CamelStore *store,
CamelFolderInfo *info, void *data)
        if(info == NULL)
                return FALSE;
        //function call to get other folderinfo's
        return TRUE;

static void pimp_mail_get_folderinfo_recursive(CamelFolderInfo *info)
        //does this recursion work???? is it the right way to do it?
        if(info->child != NULL)
        if(info->next != NULL)
        mail_get_folder(info->uri, 0, pimp_mail_get_folder, NULL,
mail_msg_unordered_push/*dunno what this does*/);

static void pimp_mail_get_folder(char *uri, CamelFolder *folder, void *data)
        if(folder != NULL)
                camel calls in here

On Fri, Jun 19, 2009 at 4:17 PM, Milan Crha<> wrote:
> On Fri, 2009-06-19 at 12:22 +0200, Filipe Nepomuceno wrote:
>> Hey all,
>> I'm currently making a plugin for evolution as a final year project
>> that gets all the messages and contacts from evolution and then displays
>> them as a mind-map.
>> The (major) problem I'm having is getting a list of ALL the e-mails in
>> ALL the folders. From the plugins and documentation that I've read I can
>> get a list of a single folder provided it is in the plugins context i.e.
>> you right click on the folder and launch the plugin.
>> Is what I'm trying to do possible and if so could someone please point
>> me in the right direction?
>> Regards,
>> Filipe
>        Hi,
> you can do that in your event by couple of steps:
> a) obtain list of all configured accounts with mail_config_get_accounts
> b) for all enabled accounts ask for the CamelStore with mail_get_store
> c) for each CamelStore ask for a folder info with call of
>   mail_get_folderinfo , where you'll receive a folder hierarchy
>   for all the folders in the given store
> d) then for each folder info ask for a CamelFolder with
>   mail_get_folder
> e) and finally for messages in a returned folder.
> Just take care of not calling camel functions in a main thread. Those
> mail_* functions from the above take care of it itself, as they are
> async, but I guess the e) will be pure camel call(s) for you.
> You can do the same also by only-camel-calls in one thread, except
> of a), just mimic working parts of those mentioned functions above.
>        Hope that helps,
>        Milan
> _______________________________________________
> Evolution-hackers mailing list

If practice makes you perfect and no one is perfect then why practice?
Evolution-hackers mailing list

Reply via email to