2011-02-24 21:30:01 +01:00
|
|
|
/* MAPIStoreFSMessage.m - this file is part of SOGo
|
2011-02-07 18:49:47 +01:00
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Inverse inc
|
|
|
|
*
|
|
|
|
* 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
|
2011-08-12 17:02:01 +02:00
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
2011-02-07 18:49:47 +01: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/NSDictionary.h>
|
2011-08-01 20:07:00 +02:00
|
|
|
#import <Foundation/NSValue.h>
|
2011-09-27 21:26:12 +02:00
|
|
|
#import <NGExtensions/NSObject+Logs.h>
|
2011-02-07 18:49:47 +01:00
|
|
|
|
2011-07-28 00:04:49 +02:00
|
|
|
#import "MAPIStoreContext.h"
|
2011-06-07 02:17:46 +02:00
|
|
|
#import "MAPIStorePropertySelectors.h"
|
2011-02-24 21:30:01 +01:00
|
|
|
#import "SOGoMAPIFSMessage.h"
|
2011-02-07 18:49:47 +01:00
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
#import "MAPIStoreFSMessage.h"
|
2011-10-26 23:33:51 +02:00
|
|
|
#import "MAPIStoreTypes.h"
|
|
|
|
#import "NSData+MAPIStore.h"
|
2011-02-07 18:49:47 +01:00
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
#undef DEBUG
|
2011-07-28 00:04:49 +02:00
|
|
|
#include <mapistore/mapistore.h>
|
2011-06-07 02:17:46 +02:00
|
|
|
#include <mapistore/mapistore_errors.h>
|
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
@implementation MAPIStoreFSMessage
|
2011-02-07 18:49:47 +01:00
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
+ (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
2011-07-12 23:47:20 +02:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
|
|
|
struct SPropTagArray *properties;
|
|
|
|
NSUInteger count;
|
|
|
|
enum MAPITAGS faiProperties[] = { 0x68350102, 0x683c0102, 0x683e0102,
|
|
|
|
0x683f0102, 0x68410003, 0x68420102,
|
|
|
|
0x68450102, 0x68460003 };
|
|
|
|
|
2011-07-12 23:47:20 +02:00
|
|
|
properties = talloc_zero (memCtx, struct SPropTagArray);
|
2011-06-07 02:17:46 +02:00
|
|
|
properties->cValues = MAPIStoreSupportedPropertiesCount + 8;
|
2011-10-27 17:59:50 +02:00
|
|
|
properties->aulPropTag = talloc_array (properties, enum MAPITAGS,
|
2011-06-07 02:17:46 +02:00
|
|
|
MAPIStoreSupportedPropertiesCount + 8);
|
|
|
|
|
|
|
|
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
|
|
|
|
properties->aulPropTag[count] = MAPIStoreSupportedProperties[count];
|
|
|
|
|
|
|
|
/* FIXME (hack): append a few undocumented properties that can be added to
|
|
|
|
FAI messages */
|
|
|
|
for (count = 0; count < 8; count++)
|
|
|
|
properties->aulPropTag[MAPIStoreSupportedPropertiesCount+count] = faiProperties[count];
|
|
|
|
|
|
|
|
*propertiesP = properties;
|
|
|
|
|
|
|
|
return MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:30:01 +01:00
|
|
|
- (void) save
|
2011-02-07 18:49:47 +01:00
|
|
|
{
|
2011-07-28 00:04:49 +02:00
|
|
|
uint64_t newVersion;
|
|
|
|
|
2011-07-15 22:22:27 +02:00
|
|
|
if ([attachmentKeys count] > 0)
|
2011-10-26 17:15:17 +02:00
|
|
|
[properties setObject: attachmentParts forKey: @"attachments"];
|
2011-07-28 00:04:49 +02:00
|
|
|
|
|
|
|
newVersion = exchange_globcnt ([[self context] getNewChangeNumber] >> 16);
|
2011-10-26 17:15:17 +02:00
|
|
|
[properties setObject: [NSNumber numberWithUnsignedLongLong: newVersion]
|
2011-07-28 00:04:49 +02:00
|
|
|
forKey: @"version"];
|
2011-09-27 21:26:12 +02:00
|
|
|
|
2011-10-26 17:15:17 +02:00
|
|
|
[self logWithFormat: @"%d props in dict", [properties count]];
|
2011-09-27 21:26:12 +02:00
|
|
|
|
2011-10-26 17:15:17 +02:00
|
|
|
[sogoObject appendProperties: properties];
|
2011-02-24 21:30:01 +01:00
|
|
|
[sogoObject save];
|
2011-11-07 16:11:22 +01:00
|
|
|
[properties removeAllObjects];
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSDate *) creationTime
|
|
|
|
{
|
|
|
|
return [sogoObject creationTime];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSDate *) lastModificationTime
|
|
|
|
{
|
|
|
|
return [sogoObject lastModificationTime];
|
2011-02-07 18:49:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|