[Evolution-hackers] EPlugin, export mail folder, recursive issues.



Hey again, im sorry to keep bothering you guys!

Im having problems getting it to digg through a whole tree of folders.
it can digg down to the end of one folder, but doesnt step to the next
after that.

example : 
i have setup a folder tree like : 
Inbox
Inbox/f01
Inbox/f01/f11
Inbox/f01/f11/f21
Inbox/f01/f12
Inbox/f01/f13
Inbox/f02

what it does now, is that it diggs to "f21" and then stops. I ofcourse
want it to do all the subfolders that "Inbox" contains. (otherwise it
wouldnt be recursive :) )

So, what im thinking, is that the CamelFolderInfo doesnt do all the
folders, and that i might need to use CamelFolderList, but then there is
the question on how to go from CamelFolderInfo to CamelFolderList... 
hmm.


Any pointers are welcomed, and very much appreciated!!

code follows below.

Best regards
/Nicklas
--------------
void org_gnome_export_mail_folder (EPlugin *ep, EMPopupTargetFolder
*target);
void do_export_mail_folder (char *uri);

static void
export_mail_folder (char *uri, CamelFolder *folder, gpointer data)
{
	CamelFolder **save = data;
	GPtrArray *pids;
	CamelFolderInfo *cfi;
	CamelStore *cs;
			CamelFolder *f = NULL;
			int fid2;
	CamelDList *dl;
	CamelFolderInfo *cfiold = NULL;	

	if (folder) 
	{	
		while(cfi) {
		*save = folder;
		camel_object_ref (folder);
		
		pids = (GPtrArray *) g_malloc(sizeof(GPtrArray));
		pids = camel_folder_get_uids((CamelFolder *)folder);		

		cs = (CamelStore *) g_malloc(sizeof(CamelStore));
		cfi= (CamelFolderInfo *) g_malloc(sizeof(CamelFolderInfo));

		cs = camel_folder_get_parent_store((CamelFolder *)folder);
		cfi = camel_store_get_folder_info((CamelStore
*)cs,camel_folder_get_full_name(folder),0,CAMEL_EXCEPTION_STORE_NO_FOLDER|CAMEL_EXCEPTION_STORE_INVALID|CAMEL_EXCEPTION_STORE_NULL);
		
		// for debug purpose only
		printf("%s\n", camel_folder_get_full_name(folder));
		// commented away, until working properly
		// em_utils_save_messages(0, folder, pids);

		
		if(cfi->child)
			fid2 =
mail_get_folder(cfi->child->uri,0,export_mail_folder,&folder,mail_thread_new);
		cfi = cfi->next;		
		}
	}
}

void 
do_export_mail_folder(char *uri) 
{
	CamelFolder *folder = NULL;
	int fid;

	fid =
mail_get_folder(uri,0,export_mail_folder,&folder,mail_thread_new);
}

void
org_gnome_export_mail_folder (EPlugin *ep, EMPopupTargetFolder *target)
{
	do_export_mail_folder(target->uri);
}





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]