Re: [evolution-patches] Proposed patch that fixes code that makes no sense in Camel



On Thu, 2006-08-24 at 02:53 -0600, Sankar P wrote:

> The above code-snippet tries to return a NULL list when get_folder_info
> is called with store in offline state. This is because we dont want the
> user to attempt editing subscriptions when he is in offline state.

> The reason why it was not done in the camel_store_subscribe_folder and
> camel_store_unsubscribe_folder is because they are APIs exposed outside
> and it is upto the implementations that use these APIs to check the
> status (online/offline).  Whereas, this function is a static function
> limited only to this file. So we know at what circumstances this will be
> called. 

Well, for the IMAP provider (which is the most used one), the function
gets called (and causes a NULL return in case you are offline and you
want a list a folders that aren't perse subscribed) when you do
get_folder_info on CamelStore: camel_store_get_folder_info.

Almost one to one (I don't think there's a lot code in between them,
just function-pointer lookups)

That makes disco_get_folder_info an implementation being used and being
exposed by the API (being hidden behind camel_store_get_folder_info, but
that doesn't really matter).

Both the NNTP and the IMAP provider use this.


> And, get_folder_info_offline will NOT return the list of non-subscribed
> folders. It is to get the folders list from the cache. This will be
> returned when the store does not support subscriptions and when this
> function is called with store on offline status.
> 
> As to your question on why camel_disco_store_check_online is called
> inside the loop before returning NULL, it is to set the corresponding
> exception.
> 
> However, I wonder why you took up this code piece for analysis.
> CamelDisco is an older interface and CamelOffline should be used in
> newer implementations. If you are interested you can try rewriting IMAP
> with CamelOfflineStore support.



-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




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