2010-12-13 18:03:25 +01:00
|
|
|
/* MAPIStoreContext.h - this file is part of SOGo
|
2010-10-01 20:54:30 +02:00
|
|
|
*
|
2010-10-08 20:38:12 +02:00
|
|
|
* Copyright (C) 2010 Inverse inc.
|
2010-10-01 20:54:30 +02:00
|
|
|
*
|
|
|
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
|
|
*
|
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2010-10-18 14:57:31 +02:00
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
2010-10-01 20:54:30 +02:00
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MAPISTORECONTEXT_H
|
|
|
|
#define MAPISTORECONTEXT_H
|
|
|
|
|
|
|
|
#import <Foundation/NSObject.h>
|
|
|
|
|
2010-10-01 23:24:15 +02:00
|
|
|
@class NSArray;
|
2010-11-26 22:48:52 +01:00
|
|
|
@class NSFileHandle;
|
2010-12-03 23:31:56 +01:00
|
|
|
@class NSMutableArray;
|
2010-10-01 20:54:30 +02:00
|
|
|
@class NSMutableDictionary;
|
|
|
|
@class NSString;
|
2011-02-24 21:32:27 +01:00
|
|
|
@class NSURL;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
2010-12-03 23:31:56 +01:00
|
|
|
@class EOQualifier;
|
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
@class WOContext;
|
|
|
|
|
|
|
|
@class SOGoFolder;
|
2010-12-30 15:18:42 +01:00
|
|
|
@class SOGoMAPIFSFolder;
|
2010-10-01 20:54:30 +02:00
|
|
|
@class SOGoObject;
|
|
|
|
|
|
|
|
@class MAPIStoreAuthenticator;
|
2011-02-24 21:32:27 +01:00
|
|
|
@class MAPIStoreFolder;
|
2010-11-22 17:12:41 +01:00
|
|
|
@class MAPIStoreMapping;
|
2010-12-30 15:18:42 +01:00
|
|
|
@class MAPIStoreTable;
|
2010-12-03 23:31:56 +01:00
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
@interface MAPIStoreContext : NSObject
|
|
|
|
{
|
2010-10-12 23:40:54 +02:00
|
|
|
struct mapistore_context *memCtx;
|
2011-05-31 07:01:43 +02:00
|
|
|
struct mapistore_connection_info *connInfo;
|
2010-10-13 23:40:50 +02:00
|
|
|
|
2011-03-07 22:33:13 +01:00
|
|
|
NSURL *contextUrl;
|
|
|
|
uint64_t contextFid;
|
2010-10-13 23:40:50 +02:00
|
|
|
|
2011-06-04 01:53:30 +02:00
|
|
|
MAPIStoreMapping *mapping;
|
|
|
|
|
2010-10-01 22:35:29 +02:00
|
|
|
MAPIStoreAuthenticator *authenticator;
|
|
|
|
WOContext *woContext;
|
2010-12-30 15:18:42 +01:00
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
MAPIStoreFolder *baseFolder;
|
2010-12-03 23:31:56 +01:00
|
|
|
|
2010-12-30 15:18:42 +01:00
|
|
|
/* for active messages (NSDictionary instances) */
|
|
|
|
NSMutableDictionary *messages;
|
2011-06-07 02:17:46 +02:00
|
|
|
|
|
|
|
/* for active folders (NSDictionary instances) */
|
|
|
|
NSMutableDictionary *folders;
|
|
|
|
|
|
|
|
/* hackish table cache */
|
|
|
|
MAPIStoreTable *cachedTable;
|
|
|
|
MAPIStoreFolder *cachedFolder;
|
|
|
|
uint64_t cachedTableFID;
|
|
|
|
uint8_t cachedTableType;
|
2010-10-01 20:54:30 +02:00
|
|
|
}
|
|
|
|
|
2010-10-13 23:40:50 +02:00
|
|
|
+ (id) contextFromURI: (const char *) newUri
|
2011-05-31 07:01:43 +02:00
|
|
|
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
2011-03-07 22:33:13 +01:00
|
|
|
andFID: (uint64_t) fid
|
2010-10-13 23:40:50 +02:00
|
|
|
inMemCtx: (struct mapistore_context *) newMemCtx;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
2011-05-31 07:01:43 +02:00
|
|
|
- (id) initFromURL: (NSURL *) newUri
|
|
|
|
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
|
|
|
andFID: (uint64_t) fid
|
|
|
|
inMemCtx: (struct mapistore_context *) newMemCtx;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
|
|
|
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator;
|
|
|
|
- (MAPIStoreAuthenticator *) authenticator;
|
|
|
|
|
2011-04-13 21:55:17 +02:00
|
|
|
- (NSURL *) url;
|
2011-05-31 07:01:43 +02:00
|
|
|
- (struct mapistore_connection_info *) connectionInfo;
|
2011-04-13 21:55:17 +02:00
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
- (WOContext *) woContext;
|
2011-06-04 01:53:30 +02:00
|
|
|
- (MAPIStoreMapping *) mapping;
|
2011-02-24 21:32:27 +01:00
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
- (void) setupRequest;
|
|
|
|
- (void) tearDownRequest;
|
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
// - (id) lookupObject: (NSString *) objectURLString;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
|
|
|
/* backend methods */
|
2010-10-13 23:40:50 +02:00
|
|
|
- (int) getPath: (char **) path
|
|
|
|
ofFMID: (uint64_t) fmid
|
|
|
|
withTableType: (uint8_t) tableType;
|
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
- (int) getFID: (uint64_t *) fid
|
|
|
|
byName: (const char *) foldername
|
|
|
|
inParentFID: (uint64_t) parent_fid;
|
|
|
|
|
2010-12-30 15:18:42 +01:00
|
|
|
- (int) setRestrictions: (const struct mapi_SRestriction *) res
|
2010-12-13 18:03:25 +01:00
|
|
|
withFID: (uint64_t) fid
|
2010-12-30 15:18:42 +01:00
|
|
|
andTableType: (uint8_t) tableType
|
2010-12-03 23:31:56 +01:00
|
|
|
getTableStatus: (uint8_t *) tableStatus;
|
2011-02-06 17:45:34 +01:00
|
|
|
- (int) setSortOrder: (const struct SSortOrderSet *) set
|
|
|
|
withFID: (uint64_t) fid andTableType: (uint8_t) type
|
|
|
|
getTableStatus: (uint8_t *) tableStatus;
|
2010-12-03 23:31:56 +01:00
|
|
|
|
2010-11-30 17:17:50 +01:00
|
|
|
- (enum MAPISTATUS) getTableProperty: (void **) data
|
|
|
|
withTag: (enum MAPITAGS) proptag
|
|
|
|
atPosition: (uint32_t) pos
|
|
|
|
withTableType: (uint8_t) tableType
|
2010-12-13 18:03:25 +01:00
|
|
|
andQueryType: (enum table_query_type) queryType
|
2010-11-30 17:17:50 +01:00
|
|
|
inFID: (uint64_t) fid;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
|
|
|
- (int) mkDir: (struct SRow *) aRow
|
|
|
|
withFID: (uint64_t) fid
|
|
|
|
inParentFID: (uint64_t) parentFID;
|
|
|
|
- (int) rmDirWithFID: (uint64_t) fid
|
|
|
|
inParentFID: (uint64_t) parentFid;
|
2011-06-04 01:59:02 +02:00
|
|
|
- (int) openDir: (uint64_t) fid;
|
2010-10-01 20:54:30 +02:00
|
|
|
- (int) closeDir;
|
|
|
|
- (int) readCount: (uint32_t *) rowCount
|
|
|
|
ofTableType: (uint8_t) tableType
|
|
|
|
inFID: (uint64_t) fid;
|
|
|
|
- (int) openMessage: (struct mapistore_message *) msg
|
|
|
|
withMID: (uint64_t) mid
|
|
|
|
inFID: (uint64_t) fid;
|
2011-02-24 21:32:27 +01:00
|
|
|
- (int) createMessageWithMID: (uint64_t) mid
|
|
|
|
inFID: (uint64_t) fid
|
|
|
|
isAssociated: (BOOL) isAssociated;
|
2010-10-01 20:54:30 +02:00
|
|
|
- (int) saveChangesInMessageWithMID: (uint64_t) mid
|
|
|
|
andFlags: (uint8_t) flags;
|
|
|
|
- (int) submitMessageWithMID: (uint64_t) mid
|
|
|
|
andFlags: (uint8_t) flags;
|
|
|
|
- (int) getProperties: (struct SPropTagArray *) SPropTagArray
|
2010-11-19 22:18:58 +01:00
|
|
|
ofTableType: (uint8_t) tableType
|
2010-10-01 20:54:30 +02:00
|
|
|
inRow: (struct SRow *) aRow
|
2010-11-19 22:18:58 +01:00
|
|
|
withMID: (uint64_t) fmid;
|
2011-06-07 02:02:54 +02:00
|
|
|
- (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
|
|
|
ofTableType: (uint8_t) type;
|
2010-11-17 15:12:54 +01:00
|
|
|
- (int) setPropertiesWithFMID: (uint64_t) fmid
|
2010-11-19 22:18:58 +01:00
|
|
|
ofTableType: (uint8_t) tableType
|
2010-11-17 15:12:54 +01:00
|
|
|
inRow: (struct SRow *) aRow;
|
2010-11-24 20:28:45 +01:00
|
|
|
- (int) modifyRecipientsWithMID: (uint64_t) mid
|
|
|
|
inRows: (struct ModifyRecipientRow *) rows
|
|
|
|
withCount: (NSUInteger) max;
|
2010-10-01 20:54:30 +02:00
|
|
|
- (int) deleteMessageWithMID: (uint64_t) mid
|
2011-02-03 23:39:02 +01:00
|
|
|
inFID: (uint64_t) fid
|
2010-10-01 20:54:30 +02:00
|
|
|
withFlags: (uint8_t) flags;
|
2010-12-13 18:03:25 +01:00
|
|
|
- (int) releaseRecordWithFMID: (uint64_t) fmid
|
|
|
|
ofTableType: (uint8_t) tableType;
|
2010-12-30 15:18:42 +01:00
|
|
|
- (int) getFoldersList: (struct indexing_folders_list **) folders_list
|
|
|
|
withFMID: (uint64_t) fmid;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
2010-11-30 22:04:05 +01:00
|
|
|
/* util methods */
|
2010-12-30 15:18:42 +01:00
|
|
|
- (NSString *) extractChildNameFromURL: (NSString *) childURL
|
|
|
|
andFolderURLAt: (NSString **) folderURL;
|
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
- (uint64_t) idForObjectWithKey: (NSString *) key
|
|
|
|
inFolderURL: (NSString *) folderURL;
|
2010-11-30 22:04:05 +01:00
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
/* subclass methods */
|
2010-11-22 22:32:11 +01:00
|
|
|
+ (NSString *) MAPIModuleName;
|
2011-02-24 21:32:27 +01:00
|
|
|
- (void) setupBaseFolder: (NSURL *) newURL;
|
2010-10-01 20:54:30 +02:00
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
/* proof of concept */
|
2011-03-07 20:15:16 +01:00
|
|
|
- (int) getTable: (void **) table
|
|
|
|
andRowCount: (uint32_t *) count
|
|
|
|
withFID: (uint64_t) fid
|
|
|
|
tableType: (uint8_t) tableType
|
|
|
|
andHandleId: (uint32_t) handleId;
|
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
- (int) getAttachmentTable: (void **) table
|
|
|
|
andRowCount: (uint32_t *) count
|
|
|
|
withMID: (uint64_t) mid;
|
|
|
|
- (int) getAttachment: (void **) attachment
|
|
|
|
withAID: (uint32_t) aid
|
|
|
|
inMID: (uint64_t) mid;
|
2010-11-30 17:17:50 +01:00
|
|
|
|
2010-10-13 23:40:50 +02:00
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
- (int) createAttachment: (void **) attachmentPtr
|
|
|
|
inAID: (uint32_t *) aid
|
|
|
|
withMessage: (uint64_t) mid;
|
2010-12-03 23:31:56 +01:00
|
|
|
|
2010-10-01 20:54:30 +02:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif /* MAPISTORECONTEXT_H */
|