Re: [evolution-patches] Re: New hook for junk plugin (improved)



Looks much better, its on the right track I think.

Things to flesh out i guess:
 - the get_name method should just return the plugin name (or you could
supply a 'name' argument to the hook - i think the former is a better
idea though) - its currently a void function, it has to return a string.
On the other hand, is this used anywhere?  It could probably just be
removed entirely.
 - you do no checking that each callback name is actually set.  you
either need to make sure they're all supplied and refuse to load it at
all (in construct_item), or check it and no-op the function in the
various callbacks.  e.g. maybe commit-reports could be optional, but
report_junk/non_junk can't be.
 - it would probably be better if the item was allocated rather than
global, even if you enforce only one to be enabled at a time, it
probably has to deal with loading more than one from xml files, or
otherwise preventing others from being loaded.

I dont really like this bulky syntax for calling function pointers:
                (* parent_class->dispose) (object);
much nicer just to do:
	parent_class->dispose(object);

Another hint, if you put the structure after all the functions, you dont
have to worry about that bulk of forward references at the top (believe
me, after a while the maintenance on those stupid things is a real
pita).

I'm still not 100% on the way its hooked into mail-session; but that is
a minor detail.

It is coming along fine.

 Michael


On Fri, 2005-06-24 at 14:33 +0530, Vivek Jain wrote:
> Hi,
> 
> Now I am passing the CamelJunkPlugin object to the callbacks and
> subclassing it into the EMJunkHookItem, so that I can get the "item"
> when methods are invoked.
> 
> The camel/camel-junk-plugin.[ch] files have to be patched for this.
> I have attached the improved em-junk-hook.[ch] files and a patch to
> camel.
> 
> Please let me know if this looks ok.
> 
> Thanks,
> Vivek Jain
> 
> 
> On Thu, 2005-06-23 at 21:11 +0530, Vivek Jain wrote:
> > hi,
> > 
> > I have created a hook that wraps up camelJunkPlugin and allows its
> > methods to be exposed to the plugins. Using this hook one can write a
> > plugin to use its own method for spam handling. As an example I have
> > moved the spamassasin junk mail handling to a plugin which used this new
> > hook.
> > 
> > I have added two files em-format-hook.c em-format-hook.h in the /mail
> > and removed em-junk-filter.[ch] from here. I have moved em-junk-filter.c
> > to the newly written sa-junk-plugin.
> > 
> > I am attaching the following:
> > 
> > 1. Patch for mail/
> > 2. two new files
> > 3. sa-junk-plugin
> > 
> > 
> > Thanks,
> > Vivek Jain
> > 
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches




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