After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674310 - Allow camel imapx provider to be subclassed
Allow camel imapx provider to be subclassed
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Mailer
3.6.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2012-04-18 09:11 UTC by Chenthill P
Modified: 2013-09-14 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Registers a callback which would be called if token cannot be matched in imapx and allows subclassed imapx provider to handle the same. (2.38 KB, patch)
2012-04-18 09:15 UTC, Chenthill P
none Details | Review
Split camel-imapx library and its provider, allow imapx camel libraries to be subclassed. (17.70 KB, patch)
2012-04-18 09:17 UTC, Chenthill P
none Details | Review
attached the camel-gwimap-provider.c, camel-gwimap-store.[ch], camel-gwimap-settings.[ch] for you take a look.. (17.15 KB, patch)
2012-04-24 04:27 UTC, Chenthill P
none Details | Review

Description Chenthill P 2012-04-18 09:11:21 UTC
Split the camel-imapx library and camel-provider so that it can be subclassed.
Providers such as kolab, groupwise etc. can use imapx backend for mail, over-ride its behavior if necessary.

Register a callback to hook into the untagged responses from the server so that the subclasses can implement extended features for imap.
Comment 1 Chenthill P 2012-04-18 09:15:29 UTC
Created attachment 212268 [details] [review]
Registers a callback which would be called if token cannot be matched in imapx and allows subclassed imapx provider to handle the same.
Comment 2 Chenthill P 2012-04-18 09:17:14 UTC
Created attachment 212269 [details] [review]
Split camel-imapx library and its provider, allow imapx camel libraries to be subclassed.
Comment 3 Milan Crha 2012-04-18 16:52:08 UTC
I didn't test it, but looks good. Only do not use
hander   , but
handler  in the first patch :)

I'm CC'ing Christian, in case he would like to have more things exposed in public, though I guess you have this discussed already.
Comment 4 Matthew Barnes 2012-04-18 17:16:21 UTC
The code changes look fine, my only thought is maybe we should just move the subclassable parts of IMAPX into libcamel proper and forego the awkward "providers/imapx/provider" and separate shared library arrangement.  IMAPX doesn't bring any extra dependencies (except maybe gperf), so it's not like it would add bloat to libcamel.
Comment 5 Chenthill P 2012-04-23 10:00:20 UTC
@mbarnes, fine with me. 

I have encountered another problem in implementing the derived imapx provider using these changes. It is w.r.t the CamelSettings. The g_object_bind_property_full used in account-editor looks for properties in a particular GObject type. 

Say if I want to add some settings on top of CamelIMAPXSettings and I derive
CamelGwIMAPSettings->CamelIMAPXSettings, the properties from the parent IMAPX are not recognized. Warning such as below indicates it,

"GLib-GObject-WARNING **: gbinding.c:860: The source object of type CamelGwImapSettings has no property called 'auth-mechanism'"

I see two options,
1) Add some custom properties with names "custom-1", "custom-2" etc. and allow the derived provider to use that for adding settings on top of imapx
or
2) Duplicate the camel-imapx-properties.[ch] and add props there..

I prefer 1) solution. Do you see any other solution here ?
Comment 6 Christian Hilberg 2012-04-23 10:36:13 UTC
Hi,

on a very short note, I've been on leave last week and still am this week, but will look into this as soon as I'm back in the office. Promising thing! :-)
Comment 7 Matthew Barnes 2012-04-23 12:23:39 UTC
(In reply to comment #5)
> Say if I want to add some settings on top of CamelIMAPXSettings and I derive
> CamelGwIMAPSettings->CamelIMAPXSettings, the properties from the parent IMAPX
> are not recognized. Warning such as below indicates it,
> 
> "GLib-GObject-WARNING **: gbinding.c:860: The source object of type
> CamelGwImapSettings has no property called 'auth-mechanism'"

CamelServiceClass has a "GType settings_type" struct member which is used to instantiate the correct CamelSettings type for the service.  camel_groupwise_store_class_init() sets this to CAMEL_TYPE_GROUPWISE_SETTINGS.  That's probably where the problem lies.

When subclassing CamelIMAPXStore, be sure to set the "settings_type" class member in your class_init() function to CAMEL_TYPE_GW_IMAP_SETTINGS or whatever it's called.
Comment 8 Chenthill P 2012-04-24 04:27:45 UTC
Created attachment 212660 [details] [review]
attached the camel-gwimap-provider.c, camel-gwimap-store.[ch], camel-gwimap-settings.[ch] for you take a look..

@mbarnes have done exactly that.