mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-04 21:08:51 +00:00
Monotone-Parent: 17790db0c2368364683e4074a491e7107c6cf071
Monotone-Revision: 96b5a2580e3b0b6ba57af91d0fed6f513f8e13f0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-02-24T20:32:27 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -20,31 +20,12 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <Appointments/SOGoAppointmentFolder.h>
|
||||
#import <Appointments/SOGoAppointmentFolders.h>
|
||||
#import <Appointments/SOGoAppointmentObject.h>
|
||||
|
||||
#import <NGCards/iCalPerson.h>
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
#import "MAPIStoreAuthenticator.h"
|
||||
#import "MAPIStoreCalendarMessageTable.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "SOGoGCSFolder+MAPIStore.h"
|
||||
#import "MAPIStoreCalendarFolder.h"
|
||||
|
||||
#import "MAPIStoreCalendarContext.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
|
||||
@implementation MAPIStoreCalendarContext
|
||||
|
||||
@@ -59,107 +40,19 @@
|
||||
withID: 0x190001];
|
||||
}
|
||||
|
||||
- (void) setupModuleFolder
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
SOGoUserFolder *userFolder;
|
||||
SOGoAppointmentFolders *parentFolder;
|
||||
|
||||
userFolder = [SOGoUserFolder objectWithName: [authenticator username]
|
||||
inContainer: MAPIApp];
|
||||
[parentFoldersBag addObject: userFolder];
|
||||
[woContext setClientObject: userFolder];
|
||||
|
||||
parentFolder = [userFolder lookupName: @"Calendar"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[parentFoldersBag addObject: parentFolder];
|
||||
[woContext setClientObject: parentFolder];
|
||||
|
||||
moduleFolder = [parentFolder lookupName: @"personal"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[moduleFolder retain];
|
||||
baseFolder = [MAPIStoreCalendarFolder baseFolderWithURL: newURL
|
||||
inContext: self];
|
||||
[baseFolder retain];
|
||||
}
|
||||
|
||||
- (id) createMessageOfClass: (NSString *) messageClass
|
||||
inFolderAtURL: (NSString *) folderURL;
|
||||
|
||||
- (int) readCount: (uint32_t *) rowCount
|
||||
ofTableType: (uint8_t) tableType
|
||||
inFID: (uint64_t) fid
|
||||
{
|
||||
SOGoAppointmentFolder *parentFolder;
|
||||
SOGoAppointmentObject *newEntry;
|
||||
NSString *name;
|
||||
|
||||
parentFolder = [self lookupObject: folderURL];
|
||||
name = [NSString stringWithFormat: @"%@.ics",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
newEntry = [SOGoAppointmentObject objectWithName: name
|
||||
inContainer: parentFolder];
|
||||
[newEntry setIsNew: YES];
|
||||
|
||||
return newEntry;
|
||||
}
|
||||
|
||||
- (Class) messageTableClass
|
||||
{
|
||||
return [MAPIStoreCalendarMessageTable class];
|
||||
}
|
||||
|
||||
- (int) openMessage: (struct mapistore_message *) msg
|
||||
forKey: (NSString *) childKey
|
||||
inTable: (MAPIStoreTable *) table
|
||||
{
|
||||
NSString *name, *email;
|
||||
NSArray *attendees;
|
||||
iCalPerson *person;
|
||||
id event;
|
||||
struct SRowSet *recipients;
|
||||
int count, max, rc;
|
||||
|
||||
rc = [super openMessage: msg forKey: childKey inTable: table];
|
||||
|
||||
if (rc == MAPI_E_SUCCESS && table == messageTable)
|
||||
{
|
||||
event = [[table lookupChild: childKey] component: NO secure: NO];
|
||||
attendees = [event attendees];
|
||||
max = [attendees count];
|
||||
|
||||
recipients = msg->recipients;
|
||||
recipients->cRows = max;
|
||||
recipients->aRow = talloc_array (recipients, struct SRow, max);
|
||||
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
recipients->aRow[count].ulAdrEntryPad = 0;
|
||||
recipients->aRow[count].cValues = 3;
|
||||
recipients->aRow[count].lpProps = talloc_array (recipients->aRow,
|
||||
struct SPropValue,
|
||||
3);
|
||||
|
||||
// TODO (0x01 = primary recipient)
|
||||
set_SPropValue_proptag (&(recipients->aRow[count].lpProps[0]),
|
||||
PR_RECIPIENT_TYPE,
|
||||
MAPILongValue (memCtx, 0x01));
|
||||
|
||||
person = [attendees objectAtIndex: count];
|
||||
|
||||
name = [person cn];
|
||||
if (!name)
|
||||
name = @"";
|
||||
|
||||
email = [person email];
|
||||
if (!email)
|
||||
email = @"";
|
||||
|
||||
set_SPropValue_proptag (&(recipients->aRow[count].lpProps[1]),
|
||||
PR_DISPLAY_NAME,
|
||||
[name asUnicodeInMemCtx: recipients->aRow[count].lpProps]);
|
||||
set_SPropValue_proptag (&(recipients->aRow[count].lpProps[2]),
|
||||
PR_EMAIL_ADDRESS,
|
||||
[email asUnicodeInMemCtx: recipients->aRow[count].lpProps]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
return [super readCount: rowCount ofTableType: tableType inFID: fid];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user