Re: [Evolution-hackers] EDS: Trying to implement expunge function in camel-spool-folder.c

2007-06-26 Thread Seb James
On Mon, 2007-06-25 at 19:15 -0400, Jeffrey Stedfast wrote:
> On Mon, 2007-06-25 at 23:05 +0100, Seb James wrote:
> > Ok, now that I am debugging the right code... Yes, the expunge function
> > registered for the Trash folder is vee_expunge in camel-vee-folder.c.
> > vee_expunge has one line:
> > 
> > ((CamelFolderClass *)((CamelObject *)folder)->klass)->sync(folder, TRUE,
> > ex);
> > 
> > So, it calls the sync function. Correct me if I'm wrong, but it looks
> > like any folder which is to implement message expunging when the user
> > clicks "Empty Trash" needs to implement the _sync_ function in such as
> > way that deleted messages really can be expunged. Writing an mbox or
> > spool expunge function won't work as it won't get called via a vTrash
> > folder expunge.
> 
> sounds correct, yes.
> 
> Jeff

I'm finding my way about now. Not quite there yet, though. 

Although the flagged-deleted messages in my spool inbox show up in the
vTrash folder, the sync function for the spool folder doesn't get
called, and I haven't quite figured out why not.

The vTrash folder is constructed as evolution starts. At some point,
camel_store_get_trash() is called. If the parent store contains the
CAMEL_STORE_VTRASH flag, then the CS_CLASS(store)->get_trash() method is
called on the store to get the trash. If CAMEL_STORE_VTRASH is not set,
then camel_store_get_folder(store, CAMEL_VTRASH_NAME, 0, ex) is called.
This seems to be an important step.

I think I need to look at how the flags are set for the spool based mail
stores. Any pointers on where the right place is to set those flags?

regards,

Seb

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] EDS: Trying to implement expunge function in camel-spool-folder.c

2007-06-25 Thread Jeffrey Stedfast
On Mon, 2007-06-25 at 23:05 +0100, Seb James wrote:
> On Mon, 2007-06-25 at 14:25 +0100, Seb James wrote:
> > Hi Jeffrey,
> > 
> > On Mon, 2007-06-25 at 08:59 -0400, Jeffrey Stedfast wrote:
> > > On Sun, 2007-06-24 at 23:24 +0100, Seb James wrote:
> > [snip]
> > > from your description, it sounds like you tried to Empty the "Local
> > > Folders" Trash folder instead of the Trash folder attached to your
> > > "spool".
> > 
> > Yes, that's what I think has happened.
> > 
> > > You should also note that since the Trash folder is a virtual folder,
> > > unless both of the following conditions are met, you might not get an
> > > expunge call on the spool folder:
> > 
> > Useful to know that trash is virtual. That will help me I think. I can
> > look at the logic that the vTrash folder goes through to select expunges
> > and syncs to call.
> 
> Ok, now that I am debugging the right code... Yes, the expunge function
> registered for the Trash folder is vee_expunge in camel-vee-folder.c.
> vee_expunge has one line:
> 
> ((CamelFolderClass *)((CamelObject *)folder)->klass)->sync(folder, TRUE,
> ex);
> 
> So, it calls the sync function. Correct me if I'm wrong, but it looks
> like any folder which is to implement message expunging when the user
> clicks "Empty Trash" needs to implement the _sync_ function in such as
> way that deleted messages really can be expunged. Writing an mbox or
> spool expunge function won't work as it won't get called via a vTrash
> folder expunge.

sounds correct, yes.

Jeff


___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] EDS: Trying to implement expunge function in camel-spool-folder.c

2007-06-25 Thread Seb James
On Mon, 2007-06-25 at 14:25 +0100, Seb James wrote:
> Hi Jeffrey,
> 
> On Mon, 2007-06-25 at 08:59 -0400, Jeffrey Stedfast wrote:
> > On Sun, 2007-06-24 at 23:24 +0100, Seb James wrote:
> [snip]
> > from your description, it sounds like you tried to Empty the "Local
> > Folders" Trash folder instead of the Trash folder attached to your
> > "spool".
> 
> Yes, that's what I think has happened.
> 
> > You should also note that since the Trash folder is a virtual folder,
> > unless both of the following conditions are met, you might not get an
> > expunge call on the spool folder:
> 
> Useful to know that trash is virtual. That will help me I think. I can
> look at the logic that the vTrash folder goes through to select expunges
> and syncs to call.

Ok, now that I am debugging the right code... Yes, the expunge function
registered for the Trash folder is vee_expunge in camel-vee-folder.c.
vee_expunge has one line:

((CamelFolderClass *)((CamelObject *)folder)->klass)->sync(folder, TRUE,
ex);

So, it calls the sync function. Correct me if I'm wrong, but it looks
like any folder which is to implement message expunging when the user
clicks "Empty Trash" needs to implement the _sync_ function in such as
way that deleted messages really can be expunged. Writing an mbox or
spool expunge function won't work as it won't get called via a vTrash
folder expunge.

Seb

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] EDS: Trying to implement expunge function in camel-spool-folder.c

2007-06-25 Thread Seb James
Hi Jeffrey,

On Mon, 2007-06-25 at 08:59 -0400, Jeffrey Stedfast wrote:
> On Sun, 2007-06-24 at 23:24 +0100, Seb James wrote:
[snip]
> from your description, it sounds like you tried to Empty the "Local
> Folders" Trash folder instead of the Trash folder attached to your
> "spool".

Yes, that's what I think has happened.

> You should also note that since the Trash folder is a virtual folder,
> unless both of the following conditions are met, you might not get an
> expunge call on the spool folder:

Useful to know that trash is virtual. That will help me I think. I can
look at the logic that the vTrash folder goes through to select expunges
and syncs to call.

> 1. you have opened the spool folder (at one point, not sure if it is
> still true, vTrash folders, for performance reasons, would not 'notice'
> physical folders until they had been opened)

Yes, I definitely opened the spool folder - it's my default inbox.

> 2. the spool folder has messages marked for deletion (vTrash might have
> logic to skip folders that contain no deleted messages when calling
> expunge on all their source folders)

11800 messages flagged for deletion. You see why I'm trying to fix this?
I think I am seeing bug 213072 regularly, but as a side effect of having
so many undeleted messages in my 158 MB spool file inbox.

I'll poke around some more tonight.

> 
> It might be better to invoke "Expunge Folder" on the physical spool
> folder itself while debugging this as there is a lot less indirection.
> 
> > 
> > 
> > I'm also having trouble debugging eds using gdb and the edsdebug script
> > that I got from the evolution website. If I try to break on
> > camel_folder_sync, gdb tells me it doesn't know where it is...
> > 
> > (gdb) b camel_folder_expunge
> > Function "camel_folder_expunge" not defined.
> > Make breakpoint pending on future shared library load? (y or [n])
> > 
> > But some camel functions are available:
> > 
> > (gdb) b camel_f[TAB]
> > camel_file_util_decode_fixed_int32  camel_file_util_decode_uint32 [snip
> > rest of camel_file_ functions]
> > 
> > Can anyone tell me what I'm doing wrong here?
> > 
> 
> you don't want to be gdbing e-d-s, e-d-s barely uses camel at all - just
> uses a few functions (perhaps that's why those are defined and the
> others not). e-d-s is a daemon process that serves up calendar and
> addressbook data, it doesn't serve up mail.
> 
> You want to gdb evolution itself.

Ok that would explain the missing camel_folder functions. But it really
looks like when I "Empty Trash" in evolution, it sends a message to
e-d-s. Is that not the case? Well, I can have a good look now.
Interesting that e-d-s doesn't serve mail. Would the camel source would
be better placed in the evolution tree?

Many thanks for the reply.

Seb

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] EDS: Trying to implement expunge function in camel-spool-folder.c

2007-06-25 Thread Jeffrey Stedfast
On Sun, 2007-06-24 at 23:24 +0100, Seb James wrote:
[snip]
> 
> All I'm trying to do to start with is get a message to print out on
> stdout. In the function camel_spool_folder_class_init() I create a
> CamelFolderClass pointer to the CamelSpoolFolderClass passed in, so that
> I can then replace the expunge function pointer in that
> class/structure. 
> 
> When I run evolution, and try to expunge the spool based inbox by
> right-clicking on the Trash folder and selecting "Empty
> Wastebasket" (that might read "Empty Trash" for a US locale), then a
> debugging message that I placed in camel-folder.c tells me this:
> 
> camel-folder.c(562): camel_folder_expunge called for folder->name
> 'Trash', with parent_store->parent_service name 'Local mail
> file /home/seb/.evolution/mail/local/', path
> 'mbox/home/seb/.evolution/mail/local'
> 
> What this is saying is that eds is not trying to call the
> CamelSpoolFolderClass version of expunge, instead it is calling the
> expunge which relates to the local mail file mentioned. This means that
> eds then goes on to call camel_folder_sync for all the local folders,
> instead of calling the CamelSpoolFolderClass implementation of expunge.
> 
> Can anyone tell me how to get the CamelLocalFolder/CamelSpoolFolder
> expunge to be called? How come the trash icon that gets placed next to
> my spool INBOX doesn't cause a spool based expunge to be called?
> 

from your description, it sounds like you tried to Empty the "Local
Folders" Trash folder instead of the Trash folder attached to your
"spool".

You should also note that since the Trash folder is a virtual folder,
unless both of the following conditions are met, you might not get an
expunge call on the spool folder:

1. you have opened the spool folder (at one point, not sure if it is
still true, vTrash folders, for performance reasons, would not 'notice'
physical folders until they had been opened)

2. the spool folder has messages marked for deletion (vTrash might have
logic to skip folders that contain no deleted messages when calling
expunge on all their source folders)


It might be better to invoke "Expunge Folder" on the physical spool
folder itself while debugging this as there is a lot less indirection.

> 
> 
> I'm also having trouble debugging eds using gdb and the edsdebug script
> that I got from the evolution website. If I try to break on
> camel_folder_sync, gdb tells me it doesn't know where it is...
> 
> (gdb) b camel_folder_expunge
> Function "camel_folder_expunge" not defined.
> Make breakpoint pending on future shared library load? (y or [n])
> 
> But some camel functions are available:
> 
> (gdb) b camel_f[TAB]
> camel_file_util_decode_fixed_int32  camel_file_util_decode_uint32 [snip
> rest of camel_file_ functions]
> 
> Can anyone tell me what I'm doing wrong here?
> 

you don't want to be gdbing e-d-s, e-d-s barely uses camel at all - just
uses a few functions (perhaps that's why those are defined and the
others not). e-d-s is a daemon process that serves up calendar and
addressbook data, it doesn't serve up mail.

You want to gdb evolution itself.

Jeff


___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


[Evolution-hackers] EDS: Trying to implement expunge function in camel-spool-folder.c

2007-06-24 Thread Seb James
Hi List,

In January this year, I emailed the list asking about implementing an
expunge function for CamelSpoolFolder. Philip Van Hoof helpfully replied
with some information about how to go about this. That conversation is
here:

http://www.mail-archive.com/evolution-hackers@gnome.org/msg01404.html

I've only just managed to find time to work on this (family life,
necessity of earning a living, etc, etc...)

I'm having trouble getting my skeleton expunge function to run. I
modified camel_spool_folder_class_init() in camel_spool_folder.c like
this, following Philip Van Hoof's advice:

8<--8< 
static void
camel_spool_folder_class_init(CamelSpoolFolderClass *camel_spool_folder_class)
{
d(printf ("%s called\n", __FUNCTION__));
/* Modified, somewhat as suggested by Philip Van Hoof */

CamelFolderClass *camel_folder_class = 
CAMEL_FOLDER_CLASS(camel_spool_folder_class);
CamelLocalFolderClass *lklass = (CamelLocalFolderClass 
*)camel_spool_folder_class;

/* virtual method overload */
camel_folder_class->expunge = spool_expunge;

lklass->create_summary = spool_create_summary;
lklass->lock = spool_lock;
lklass->unlock = spool_unlock;
}

/* Then implement */
static void
spool_expunge(CamelFolder *folder, CamelException *ex)
{
printf ("In %s to expunge!\n", __FUNCTION__);
return;
}
8<--8<

All I'm trying to do to start with is get a message to print out on
stdout. In the function camel_spool_folder_class_init() I create a
CamelFolderClass pointer to the CamelSpoolFolderClass passed in, so that
I can then replace the expunge function pointer in that
class/structure. 

When I run evolution, and try to expunge the spool based inbox by
right-clicking on the Trash folder and selecting "Empty
Wastebasket" (that might read "Empty Trash" for a US locale), then a
debugging message that I placed in camel-folder.c tells me this:

camel-folder.c(562): camel_folder_expunge called for folder->name
'Trash', with parent_store->parent_service name 'Local mail
file /home/seb/.evolution/mail/local/', path
'mbox/home/seb/.evolution/mail/local'

What this is saying is that eds is not trying to call the
CamelSpoolFolderClass version of expunge, instead it is calling the
expunge which relates to the local mail file mentioned. This means that
eds then goes on to call camel_folder_sync for all the local folders,
instead of calling the CamelSpoolFolderClass implementation of expunge.

Can anyone tell me how to get the CamelLocalFolder/CamelSpoolFolder
expunge to be called? How come the trash icon that gets placed next to
my spool INBOX doesn't cause a spool based expunge to be called?



I'm also having trouble debugging eds using gdb and the edsdebug script
that I got from the evolution website. If I try to break on
camel_folder_sync, gdb tells me it doesn't know where it is...

(gdb) b camel_folder_expunge
Function "camel_folder_expunge" not defined.
Make breakpoint pending on future shared library load? (y or [n])

But some camel functions are available:

(gdb) b camel_f[TAB]
camel_file_util_decode_fixed_int32  camel_file_util_decode_uint32 [snip
rest of camel_file_ functions]

Can anyone tell me what I'm doing wrong here?



with best regards,

Seb James


___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers