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



On Wed, 2006-08-23 at 17:18 +0200, Philip Van Hoof wrote: 
> Removed code that makes no sense and blocks getting a list of
> non-subscribed folders when the store is offline.
> 
> Waiting for approval to commit.

 case CAMEL_DISCO_STORE_OFFLINE:
-               /* Can't edit subscriptions while offline */
-               if ((store->flags & CAMEL_STORE_SUBSCRIPTIONS) &&
-                   !(flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED)) {
-                       camel_disco_store_check_online (disco_store,
ex);
-                       return NULL;
-               }
-               

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. 

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.

Sankar

 Novell, Inc. 
Software for the Open Enterprise™
http://www.novell.com



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