On Thursday 01 January 2009 12:10:00 pm Jelmer Vernooij wrote:
> - IsMailboxFolder(): false can mean two things - error executing this
> operation *and* folder is not a mailbox. What do you think is the best
> way to work around this?
For consistency, I'd like to see this take an extra argument bool*
folderIsMailbox, and return an enum MAPISTATUS.
I haven't tested this, but indicatively:
--- libmapi/simple_mapi.c (revision 957)
+++ libmapi/simple_mapi.c (working copy)
@@ -307,28 +307,32 @@
\param obj_store pointer to the store object
\param fid reference to the folder identifier to check
+ \param folderIsMailbox set if folder is a mailbox (return value)
\param olFolder pointer to the returned olFolder
\return true on success, otherwise false
*/
-_PUBLIC_ bool IsMailboxFolder(mapi_object_t *obj_store,
- uint64_t fid,
- uint32_t *olFolder)
+_PUBLIC_ enum MAPISTATUS IsMailboxFolder(mapi_object_t *obj_store,
+ uint64_t fid,
+ bool* folderIsMailbox,
+ uint32_t *olFolder)
{
enum MAPISTATUS retval;
mapi_object_store_t *store;
uint32_t olFolderNum;
- bool ret = true;
- if (!obj_store) return false;
+ *folderIsMailbox = false;
+ OPENCHANGE_RETVAL_IF((!obj_store), MAPI_E_INVALID_PARAMETER, 0);
store = (mapi_object_store_t *) obj_store->private_data;
- if (!store) return false;
+ OPENCHANGE_RETVAL_IF(!store, MAPI_E_NOT_INITIALIZED, NULL);
if (store->cached_mailbox_fid == false) {
retval = CacheDefaultFolders(obj_store);
- if (retval) return false;
+ OPENCHANGE_RETVAL_IF(retval, retval, 0)
}
+ *folderIsMailbox = true;
+
if(fid == store->fid_top_information_store) {
olFolderNum = olFolderTopInformationStore;
} else if (fid == store->fid_deleted_items) {
@@ -357,11 +361,12 @@
olFolderNum = olFolderFinder;
} else {
olFolderNum = -1;
- ret = false;
+ *folderIsMailbox = false;
}
if (olFolder) *olFolder = olFolderNum;
- return ret;
+
+ return MAPI_E_SUCCESS;
}
/**
Brad
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel