propagate from branch 'ca.inverse.sogo.1_3_10' (head 2e5b0e4a79c403ee6edc14f5ee20c4e0decb6219)

to branch 'ca.inverse.sogo' (head 4fa9d5f232411da95f6ddd4d8c85a15ca4aa18d8)

Monotone-Parent: 2e5b0e4a79c403ee6edc14f5ee20c4e0decb6219
Monotone-Parent: 4fa9d5f232411da95f6ddd4d8c85a15ca4aa18d8
Monotone-Revision: 010eef1ea5b26dac2a3c224005feae5d974cdef7

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-11-15T11:48:33
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle 2011-11-15 11:48:33 +00:00
commit f5b7591413
34 changed files with 12157 additions and 220 deletions

View file

@ -4,9 +4,7 @@ obj
err$ err$
build\.log build\.log
imgs-.* imgs-.*
diff
.*\.bak$ .*\.bak$
.*\.diff$
.*\.d$ .*\.d$
.*\.log$ .*\.log$
.*\.ifb$ .*\.ifb$

View file

@ -1,19 +1,88 @@
2011-11-13 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2011-11-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreContactsMessage.m (-getPrBody:inMemCtx:):
same as below.
* OpenChange/MAPIStoreAppointmentWrapper.m (-getPrBody:inMemCtx:):
removed parsing hack since things are now done properly from
NGCards.
* Tests/Unit/TestVersit.m (-test_rendering, -test_parsing): * Tests/Unit/TestVersit.m (-test_rendering, -test_parsing):
adapted to new NGCards data structure and improved to test further adapted to new NGCards data structure and improved to test further
important use cases. important use cases.
2011-11-10 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2011-11-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tests/Unit/TestVersit.m: new test module for versit parsing and * Tests/Unit/TestVersit.m: new test module for versit parsing and
outputting. outputting.
2011-11-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreCalendarMessage.m (-save): set the DESCRIPTION
field to the value of PR_BODY_UNICODE or, a textual version of
PR_HTML. COMMENT would be nice later.
* OpenChange/MAPIStoreAppointmentWrapper.m (-getPrBody:inMemCtx:):
make use of -[NSString asCardAttributeValues].
* OpenChange/MAPIStoreContactsMessage.m (-save): set the NOTE
field to the value of PR_BODY_UNICODE or, a textual version of
PR_HTML.
* OpenChange/MAPIStoreMessage.m (-addProperties): intercept
PR_RTF_COMPRESSED attributes and convert them automatically to a
PR_HTML attribute.
* OpenChange/MAPIStoreVolatileMessage.m (-addProperties:):
transfer the content of the "properties" ivar instead of the
"newProperties" parameter, so as to benefit from treatment that
could have happened in parent classes.
* OpenChange/MAPIStoreMailVolatileMessage.m
(_generateMailDataWithBcc:): don't write the resulting mail body
to /tmp/mimegen.eml.
2011-11-09 Francis Lachapelle <flachapelle@inverse.ca> 2011-11-09 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/SOGoRootPage.js (onLoginClick): don't * UI/WebServerResources/SOGoRootPage.js (onLoginClick): don't
assume that the checkbox rememberLogin is always part of the template. assume that the checkbox rememberLogin is always part of the template.
2011-11-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreRecurrenceUtils.m
(-fillRecurrencePattern:withStartDate:andEndDate:): fixed a crash
occurring when no byday mask was specified. We also force a value
for the monthday in the case of a yearly event without a proper
one.
2011-11-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreFolder.m (-addProperties:): we now override
this method instead of -addPropertiesFromRow:. Also, invoking
resetCache is no longer required since the "properties" ivar is
no longer used in this class.
* OpenChange/MAPIStoreObject.m (-addPropertiesFromRow:): now
invokes [self addProperties:] to modify the "properties" ivar,
instead of doing it directly. This enables subclasses to only need
overriding -addProperties:.
(-resetProperties): removed useless method.
* OpenChange/MAPIStoreVolatileMessage.m (-addPropertiesFromRow:):
removed obsolete overloading of method.
2011-11-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreMessage.m (-setReadFlag:): make overrides
optional.
* OpenChange/MAPIStoreCalendarMessage.m (-save): handle all day
events based on the value of PidLidAppointmentSubType.
Don't add the timezone component to the vCalendar in that case.
Take PidLidAppointmentStateFlags into account before building the
list of attendees. Take the organizer passed in the recipients
into account when specified.
2011-11-01 Francis Lachapelle <flachapelle@inverse.ca> 2011-11-01 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/UIxAclEditor.js (addUser): fixed CSS class * UI/WebServerResources/UIxAclEditor.js (addUser): fixed CSS class
@ -21,6 +90,9 @@
2011-11-01 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2011-11-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreCalendarMessage.m (-save): added work-around
for setting of organizer as an attendee record.
* OpenChange/MAPIStoreMailMessage.m (-setReadFlag:): implemented * OpenChange/MAPIStoreMailMessage.m (-setReadFlag:): implemented
basic method, only dealing with actual setting or unsetting of basic method, only dealing with actual setting or unsetting of
"\Seen". "\Seen".

View file

@ -7,6 +7,8 @@ include ../Version
BACKEND_VERSION = 1.0.0 BACKEND_VERSION = 1.0.0
UNRTF_VERSION = 0.21.2
### bootstrap library ### bootstrap library
MAPISTORESOGO = MAPIStoreSOGo MAPISTORESOGO = MAPIStoreSOGo
LIBRARY_NAME = $(MAPISTORESOGO) LIBRARY_NAME = $(MAPISTORESOGO)
@ -23,6 +25,12 @@ BUNDLE_NAME = $(SOGOBACKEND)
BUNDLE_EXTENSION = .MAPIStore BUNDLE_EXTENSION = .MAPIStore
BUNDLE_INSTALL_DIR = $(SOGO_LIBDIR) BUNDLE_INSTALL_DIR = $(SOGO_LIBDIR)
UNRTF_DIR = unrtf-$(UNRTF_VERSION)
$(SOGOBACKEND)_CPPFLAGS += -I$(UNRTF_DIR)/src
$(SOGOBACKEND)_SUBPROJECTS = $(UNRTF_DIR)/src
$(SOGOBACKEND)_PRINCIPAL_CLASS = MAPIApplication $(SOGOBACKEND)_PRINCIPAL_CLASS = MAPIApplication
$(SOGOBACKEND)_OBJC_FILES += \ $(SOGOBACKEND)_OBJC_FILES += \
@ -120,7 +128,28 @@ $(SOGOBACKEND)_OBJC_FILES += \
$(SOGOBACKEND)_RESOURCE_FILES += \ $(SOGOBACKEND)_RESOURCE_FILES += \
product.plist product.plist \
$(UNRTF_DIR)/charmaps/SYMBOL.charmap \
$(UNRTF_DIR)/outputs/html.conf
### unrtf
all:: $(UNRTF_DIR)/config.h $(UNRTF_DIR)/src/GNUmakefile
$(UNRTF_DIR): $(UNRTF_DIR).tar.gz $(UNRTF_DIR).diff
@echo " Extracting and patching $(UNRTF_DIR)..."
@rm -rf $(UNRTF_DIR)
@$(TAR) -xvzf $< > /dev/null
@(cd $(UNRTF_DIR) && patch -p1 < ../$(UNRTF_DIR).diff) > /dev/null
@touch $(UNRTF_DIR)
$(UNRTF_DIR)-stamp: $(UNRTF_DIR)
@touch $@
$(UNRTF_DIR)/config.h: $(UNRTF_DIR)-stamp unrtf_config_h
@cp unrtf_config_h $(UNRTF_DIR)/config.h
$(UNRTF_DIR)/src/GNUmakefile: $(UNRTF_DIR)-stamp GNUmakefile.unrtf
@cp GNUmakefile.unrtf $@
### pl reader ### pl reader
PLREADER_TOOL = plreader PLREADER_TOOL = plreader
@ -133,7 +162,7 @@ TEST_TOOL_NAME += $(PLREADER_TOOL)
LIBMAPI_CFLAGS = $(shell pkg-config libmapi --cflags) LIBMAPI_CFLAGS = $(shell pkg-config libmapi --cflags)
LIBMAPISTORE_CFLAGS = $(shell pkg-config libmapistore --cflags) -DSAMBA_PREFIX="\"$(shell pkg-config libmapistore --variable=prefix)\"" LIBMAPISTORE_CFLAGS = $(shell pkg-config libmapistore --cflags) -DSAMBA_PREFIX="\"$(shell pkg-config libmapistore --variable=prefix)\""
ifeq ($(LIBMAPISTORE_CFLAGS),) ifeq ($(LIBMAPI_CFLAGS),)
all install:: all install::
@echo "Cannot build the OpenChange SOGo backend (empty CFLAGS for libmapistore)" @echo "Cannot build the OpenChange SOGo backend (empty CFLAGS for libmapistore)"
else else
@ -160,6 +189,7 @@ SAMBA_LIB_DIR = $(shell pkg-config libmapistore --variable=libdir)
include $(GNUSTEP_MAKEFILES)/bundle.make include $(GNUSTEP_MAKEFILES)/bundle.make
include $(GNUSTEP_MAKEFILES)/library.make include $(GNUSTEP_MAKEFILES)/library.make
include $(GNUSTEP_MAKEFILES)/test-tool.make include $(GNUSTEP_MAKEFILES)/test-tool.make
include $(GNUSTEP_MAKEFILES)/aggregate.make
-include GNUmakefile.postamble -include GNUmakefile.postamble
endif endif

View file

@ -0,0 +1,34 @@
# -*-makefile-*-
# GNUstep makefile
include $(GNUSTEP_MAKEFILES)/common.make
UNRTF = unrtf
SUBPROJECT_NAME = $(UNRTF)
$(UNRTF)_C_FILES = \
attr.c \
convert.c \
error.c \
hash.c \
malloc.c \
my_iconv.c \
output.c \
parse.c \
unicode.c \
user.c \
util.c \
word.c
$(UNRTF)_CFLAGS = -DHAVE_CONFIG_H=1 -I. -I../
# Option include to set any additional variables
-include GNUmakefile.preamble
# Include in the rules for making libraries
include $(GNUSTEP_MAKEFILES)/subproject.make
# Option include to define any additional rules
-include GNUmakefile.postamble

View file

@ -92,8 +92,6 @@ extern NSTimeZone *utcTZ;
inMemCtx: (TALLOC_CTX *) memCtx; inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPrMessageClass: (void **) data - (int) getPrMessageClass: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx; inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPrBody: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPrStartDate: (void **) data - (int) getPrStartDate: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx; inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPidLidAppointmentStateFlags: (void **) data - (int) getPidLidAppointmentStateFlags: (void **) data
@ -129,6 +127,8 @@ extern NSTimeZone *utcTZ;
inMemCtx: (TALLOC_CTX *) memCtx; inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPrImportance: (void **) data - (int) getPrImportance: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx; inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPrBody: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPidLidIsRecurring: (void **) data - (int) getPidLidIsRecurring: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx; inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getPidLidRecurring: (void **) data - (int) getPidLidRecurring: (void **) data

View file

@ -53,6 +53,7 @@
#include <gen_ndr/exchange.h> #include <gen_ndr/exchange.h>
#include <gen_ndr/property.h> #include <gen_ndr/property.h>
#include <gen_ndr/ndr_property.h> #include <gen_ndr/ndr_property.h>
#include <util/attr.h>
#include <libmapi/libmapi.h> #include <libmapi/libmapi.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
#include <mapistore/mapistore_errors.h> #include <mapistore/mapistore_errors.h>
@ -628,20 +629,6 @@ static NSCharacterSet *hexCharacterSet = nil;
return [self getYes: data inMemCtx: memCtx]; return [self getYes: data inMemCtx: memCtx];
} }
- (int) getPrBody: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
NSString *stringValue;
stringValue = [event comment];
if (!stringValue)
stringValue = @"";
*data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS;
}
- (int) getPrStartDate: (void **) data - (int) getPrStartDate: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {
@ -1034,6 +1021,22 @@ static NSCharacterSet *hexCharacterSet = nil;
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
} }
- (int) getPrBody: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
int rc = MAPISTORE_SUCCESS;
NSString *stringValue;
/* FIXME: there is a confusion in NGCards around "comment" and "description" */
stringValue = [event comment];
if ([stringValue length] > 0)
*data = [stringValue asUnicodeInMemCtx: memCtx];
else
rc = MAPISTORE_ERR_NOT_FOUND;
return rc;
}
- (int) getPidLidIsRecurring: (void **) data - (int) getPidLidIsRecurring: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {
@ -1402,7 +1405,8 @@ _fillAppointmentRecurrencePattern (struct AppointmentRecurrencePattern *arp,
{ {
startDate = [event startDate]; startDate = [event startDate];
relation = [[trigger relationType] lowercaseString]; relation = [[trigger relationType] lowercaseString];
interval = [[trigger value] durationAsTimeInterval]; interval = [[trigger flattenedValuesForKey: @""]
durationAsTimeInterval];
if ([relation isEqualToString: @"end"]) if ([relation isEqualToString: @"end"])
relationDate = [event endDate]; relationDate = [event endDate];
else else

View file

@ -25,6 +25,7 @@
- take the tz definitions from Outlook */ - take the tz definitions from Outlook */
#include <talloc.h> #include <talloc.h>
#include <util/attr.h>
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSCalendarDate.h> #import <Foundation/NSCalendarDate.h>
@ -45,6 +46,7 @@
#import <Appointments/SOGoAppointmentFolder.h> #import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentObject.h> #import <Appointments/SOGoAppointmentObject.h>
#import <Appointments/iCalEntityObject+SOGo.h> #import <Appointments/iCalEntityObject+SOGo.h>
#import <Mailer/NSString+Mail.h>
#import "MAPIStoreAppointmentWrapper.h" #import "MAPIStoreAppointmentWrapper.h"
#import "MAPIStoreCalendarAttachment.h" #import "MAPIStoreCalendarAttachment.h"
@ -240,6 +242,12 @@
return [[self appointmentWrapper] getPrImportance: data inMemCtx: memCtx]; return [[self appointmentWrapper] getPrImportance: data inMemCtx: memCtx];
} }
- (int) getPrBody: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
return [[self appointmentWrapper] getPrBody: data inMemCtx: memCtx];
}
- (int) getPidLidIsRecurring: (void **) data - (int) getPidLidIsRecurring: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {
@ -599,7 +607,9 @@
[alarm setAction: @"DISPLAY"]; [alarm setAction: @"DISPLAY"];
trigger = [iCalTrigger elementWithTag: @"trigger"]; trigger = [iCalTrigger elementWithTag: @"trigger"];
[trigger setValueType: @"DURATION"]; [trigger setValueType: @"DURATION"];
[trigger setValue: [NSString stringWithFormat: @"-PT%@M", delta]]; [trigger
setSingleValue: [NSString stringWithFormat: @"-PT%@M", delta]
forKey: @""];
[alarm setTrigger: trigger]; [alarm setTrigger: trigger];
[newEvent addToAlarms: alarm]; [newEvent addToAlarms: alarm];
[alarm release]; [alarm release];
@ -610,6 +620,7 @@
- (void) save - (void) save
{ {
iCalCalendar *vCalendar; iCalCalendar *vCalendar;
BOOL isAllDay;
iCalDateTime *start, *end; iCalDateTime *start, *end;
iCalTimeZone *tz; iCalTimeZone *tz;
NSCalendarDate *now; NSCalendarDate *now;
@ -711,9 +722,16 @@
if (value) if (value)
[newEvent setLocation: value]; [newEvent setLocation: value];
tzName = [[self ownerTimeZone] name]; isAllDay = [[properties
tz = [iCalTimeZone timeZoneForName: tzName]; objectForKey: MAPIPropertyKey (PidLidAppointmentSubType)]
[vCalendar addTimeZone: tz]; boolValue];
if (!isAllDay)
{
tzName = [[self ownerTimeZone] name];
tz = [iCalTimeZone timeZoneForName: tzName];
[vCalendar addTimeZone: tz];
}
// start // start
value = [properties objectForKey: MAPIPropertyKey (PR_START_DATE)]; value = [properties objectForKey: MAPIPropertyKey (PR_START_DATE)];
@ -723,8 +741,13 @@
if (value) if (value)
{ {
start = (iCalDateTime *) [newEvent uniqueChildWithTag: @"dtstart"]; start = (iCalDateTime *) [newEvent uniqueChildWithTag: @"dtstart"];
[start setTimeZone: tz]; if (isAllDay)
[start setDateTime: value]; [start setDate: value];
else
{
[start setTimeZone: tz];
[start setDateTime: value];
}
} }
/* end */ /* end */
@ -734,8 +757,13 @@
if (value) if (value)
{ {
end = (iCalDateTime *) [newEvent uniqueChildWithTag: @"dtend"]; end = (iCalDateTime *) [newEvent uniqueChildWithTag: @"dtend"];
[end setTimeZone: tz]; if (isAllDay)
[end setDateTime: value]; [end setDate: value];
else
{
[end setTimeZone: tz];
[end setDateTime: value];
}
} }
/* priority */ /* priority */
@ -778,6 +806,22 @@
[newEvent setTransparency: @"OPAQUE"]; [newEvent setTransparency: @"OPAQUE"];
} }
} }
/* Comment */
value = [properties objectForKey: MAPIPropertyKey (PR_BODY_UNICODE)];
if (!value)
{
value = [properties objectForKey: MAPIPropertyKey (PR_HTML)];
if (value)
{
value = [[NSString alloc] initWithData: value
encoding: NSUTF8StringEncoding];
[value autorelease];
value = [value htmlToText];
}
}
if (value)
[newEvent setComment: value];
/* recurrence */ /* recurrence */
value = [properties value = [properties
@ -793,75 +837,101 @@
/* alarm */ /* alarm */
[self _setupAlarmDataInEvent: newEvent]; [self _setupAlarmDataInEvent: newEvent];
// Organizer if ([[properties objectForKey: MAPIPropertyKey (PidLidAppointmentStateFlags)] intValue]
value = [properties objectForKey: @"recipients"]; != 0)
if (value)
{ {
NSArray *recipients; // Organizer
NSDictionary *dict; value = [properties objectForKey: @"recipients"];
iCalPerson *person; if (value)
iCalPersonPartStat newPartStat;
NSNumber *flags, *trackStatus;
int i;
/* We must set the organizer preliminarily here because, unlike what
the doc states, Outlook does not always pass the real organizer
in the recipients list. */
dict = [activeUser primaryIdentity];
person = [iCalPerson new];
[person setCn: [dict objectForKey: @"fullName"]];
[person setEmail: [dict objectForKey: @"email"]];
[newEvent setOrganizer: person];
[person release];
recipients = [value objectForKey: @"to"];
for (i = 0; i < [recipients count]; i++)
{ {
dict = [recipients objectAtIndex: i]; NSArray *recipients;
flags = [dict objectForKey: MAPIPropertyKey (PR_RECIPIENT_FLAGS)]; NSDictionary *dict;
if (!flags) NSString *orgEmail, *attEmail;
{ iCalPerson *person;
[self logWithFormat: @"no recipient flags specified"]; iCalPersonPartStat newPartStat;
break; NSNumber *flags, *trackStatus;
} int i, effective;
/* We must set the organizer preliminarily here because, unlike what
the doc states, Outlook does not always pass the real organizer
in the recipients list. */
dict = [activeUser primaryIdentity];
person = [iCalPerson new]; person = [iCalPerson new];
[person setCn: [dict objectForKey: @"fullName"]]; [person setCn: [dict objectForKey: @"fullName"]];
[person setEmail: [dict objectForKey: @"email"]]; orgEmail = [dict objectForKey: @"email"];
[person setEmail: orgEmail];
[newEvent setOrganizer: person];
[person release];
if (([flags unsignedIntValue] & 0x0002)) /* recipOrganizer */ recipients = [value objectForKey: @"to"];
[newEvent setOrganizer: person]; effective = 0;
else for (i = 0; i < [recipients count]; i++)
{ {
trackStatus dict = [recipients objectAtIndex: i];
= [dict
objectForKey: MAPIPropertyKey (PR_RECIPIENT_TRACKSTATUS)];
/* FIXME: we should provide a data converter between OL flags = [dict objectForKey: MAPIPropertyKey (PR_RECIPIENT_FLAGS)];
partstats and SOGo */ if (!flags)
switch ([trackStatus unsignedIntValue])
{ {
case 0x02: /* respTentative */ [self logWithFormat:
newPartStat = iCalPersonPartStatTentative; @"no recipient flags specified: skipping recipient"];
break; continue;
case 0x03: /* respAccepted */
newPartStat = iCalPersonPartStatAccepted;
break;
case 0x04: /* respDeclined */
newPartStat = iCalPersonPartStatDeclined;
break;
default:
newPartStat = iCalPersonPartStatNeedsAction;
} }
[person setParticipationStatus: newPartStat]; person = [iCalPerson new];
[person setRsvp: @"TRUE"]; [person setCn: [dict objectForKey: @"fullName"]];
[person setRole: @"REQ-PARTICIPANT"]; attEmail = [dict objectForKey: @"email"];
[newEvent addToAttendees: person]; [person setEmail: attEmail];
if (([flags unsignedIntValue] & 0x0002)) /* recipOrganizer */
[newEvent setOrganizer: person];
else
{
/* Work-around: it happens that Outlook still passes the
organizer as a recipient, maybe because of a feature
documented in a pre-mesozoic PDF still buried in a
cavern... In that case we remove it, and we keep the
number of effective recipients in "effective". If the
total is 0, we remove the "ORGANIZER" too. */
if ([attEmail isEqualToString: orgEmail])
{
[self logWithFormat:
@"avoiding setting organizer as recipient"];
continue;
}
trackStatus
= [dict
objectForKey: MAPIPropertyKey (PR_RECIPIENT_TRACKSTATUS)];
/* FIXME: we should provide a data converter between OL
partstats and SOGo */
switch ([trackStatus unsignedIntValue])
{
case 0x02: /* respTentative */
newPartStat = iCalPersonPartStatTentative;
break;
case 0x03: /* respAccepted */
newPartStat = iCalPersonPartStatAccepted;
break;
case 0x04: /* respDeclined */
newPartStat = iCalPersonPartStatDeclined;
break;
default:
newPartStat = iCalPersonPartStatNeedsAction;
}
[person setParticipationStatus: newPartStat];
[person setRsvp: @"TRUE"];
[person setRole: @"REQ-PARTICIPANT"];
[newEvent addToAttendees: person];
effective++;
}
[person release];
} }
[person release]; if (effective == 0) /* See work-around above */
[newEvent setOrganizer: nil];
} }
} }

View file

@ -142,7 +142,8 @@ extern NSTimeZone *utcTZ;
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {
if (!photoData) if (!photoData)
ASSIGN (photoData, [[photo value: 0] dataByDecodingBase64]); ASSIGN (photoData,
[[photo flattenedValuesForKey: @""] dataByDecodingBase64]);
*data = [photoData asBinaryInMemCtx: memCtx]; *data = [photoData asBinaryInMemCtx: memCtx];
@ -153,7 +154,8 @@ extern NSTimeZone *utcTZ;
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {
if (!photoData) if (!photoData)
ASSIGN (photoData, [[photo value: 0] dataByDecodingBase64]); ASSIGN (photoData,
[[photo flattenedValuesForKey: @""] dataByDecodingBase64]);
*data = MAPILongValue (memCtx, [photoData length]); *data = MAPILongValue (memCtx, [photoData length]);

View file

@ -27,10 +27,12 @@
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <NGExtensions/NGBase64Coding.h> #import <NGExtensions/NGBase64Coding.h>
#import <NGExtensions/NSObject+Logs.h> #import <NGExtensions/NSObject+Logs.h>
#import <NGCards/NSArray+NGCards.h>
#import <NGCards/NGVCard.h> #import <NGCards/NGVCard.h>
#import <NGCards/NGVCardPhoto.h> #import <NGCards/NGVCardPhoto.h>
#import <NGCards/NSArray+NGCards.h>
#import <NGCards/NSString+NGCards.h>
#import <Contacts/SOGoContactGCSEntry.h> #import <Contacts/SOGoContactGCSEntry.h>
#import <Mailer/NSString+Mail.h>
#import "MAPIStoreContactsAttachment.h" #import "MAPIStoreContactsAttachment.h"
#import "MAPIStoreContactsFolder.h" #import "MAPIStoreContactsFolder.h"
@ -147,18 +149,11 @@
- (int) getPrCompanyName: (void **) data - (int) getPrCompanyName: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {
NSArray *values; CardElement *org;
NSString *stringValue;
values = [[sogoObject vCard] org]; org = [[sogoObject vCard] org];
stringValue = nil; *data = [[org flattenedValueAtIndex: 0 forKey: @""]
asUnicodeInMemCtx: memCtx];
if ([values count] > 0)
stringValue = [values objectAtIndex: 0];
else
stringValue = @"";
*data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
} }
@ -166,18 +161,11 @@
- (int) getPrDepartmentName: (void **) data - (int) getPrDepartmentName: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
{ {
NSArray *values; CardElement *org;
NSString *stringValue;
values = [[sogoObject vCard] org]; org = [[sogoObject vCard] org];
stringValue = nil; *data = [[org flattenedValueAtIndex: 1 forKey: @""]
asUnicodeInMemCtx: memCtx];
if ([values count] > 1)
stringValue = [values objectAtIndex: 1];
else
stringValue = @"";
*data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
} }
@ -312,7 +300,7 @@
max = [emails count]; max = [emails count];
for (count = 0; !stringValue && count < max; count++) for (count = 0; !stringValue && count < max; count++)
{ {
email = [[emails objectAtIndex: count] value: 0]; email = [[emails objectAtIndex: count] flattenedValuesForKey: @""];
if ([email caseInsensitiveCompare: [card preferredEMail]] != NSOrderedSame) if ([email caseInsensitiveCompare: [card preferredEMail]] != NSOrderedSame)
stringValue = email; stringValue = email;
@ -372,7 +360,7 @@
ce = [elements objectAtIndex: count]; ce = [elements objectAtIndex: count];
if (!aTypeToExclude if (!aTypeToExclude
|| ![ce hasAttribute: @"type" havingValue: aTypeToExclude]) || ![ce hasAttribute: @"type" havingValue: aTypeToExclude])
stringValue = [ce value: pos]; stringValue = [ce flattenedValueAtIndex: pos forKey: @""];
} }
if (!stringValue) if (!stringValue)
@ -463,7 +451,7 @@
NSString *stringValue; NSString *stringValue;
stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-aim"] stringValue = [[[sogoObject vCard] uniqueChildWithTag: @"x-aim"]
value: 0]; flattenedValuesForKey: @""];
if (!stringValue) if (!stringValue)
stringValue = @""; stringValue = @"";
*data = [stringValue asUnicodeInMemCtx: memCtx]; *data = [stringValue asUnicodeInMemCtx: memCtx];
@ -697,7 +685,9 @@
{ {
NSString *stringValue; NSString *stringValue;
stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"] value: 0]; stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
flattenedValueAtIndex: 0
forKey: @""];
*data = [stringValue asUnicodeInMemCtx: memCtx]; *data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
@ -708,7 +698,9 @@
{ {
NSString *stringValue; NSString *stringValue;
stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"] value: 1]; stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
flattenedValueAtIndex: 1
forKey: @""];
*data = [stringValue asUnicodeInMemCtx: memCtx]; *data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
@ -719,7 +711,9 @@
{ {
NSString *stringValue; NSString *stringValue;
stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"] value: 2]; stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
flattenedValueAtIndex: 2
forKey: @""];
*data = [stringValue asUnicodeInMemCtx: memCtx]; *data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
@ -730,7 +724,9 @@
{ {
NSString *stringValue; NSString *stringValue;
stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"] value: 3]; stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
flattenedValueAtIndex: 3
forKey: @""];
*data = [stringValue asUnicodeInMemCtx: memCtx]; *data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
@ -741,7 +737,9 @@
{ {
NSString *stringValue; NSString *stringValue;
stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"] value: 4]; stringValue = [[[sogoObject vCard] firstChildWithTag: @"n"]
flattenedValueAtIndex: 4
forKey: @""];
*data = [stringValue asUnicodeInMemCtx: memCtx]; *data = [stringValue asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
@ -836,9 +834,9 @@
to: photoType]; to: photoType];
[photo setValue: 0 ofAttribute: @"encoding" [photo setValue: 0 ofAttribute: @"encoding"
to: @"b"]; to: @"b"];
[photo setValue: 0 [photo setSingleValue: [content stringByReplacingString: @"\n"
to: [content stringByReplacingString: @"\n" withString: @""]
withString: @""]]; atIndex: 0 forKey: @""];
} }
} }
} }
@ -885,7 +883,7 @@
if (value) if (value)
{ {
if ([elements count] > 0) if ([elements count] > 0)
[[elements objectAtIndex: 0] setValue: 0 to: value]; [[elements objectAtIndex: 0] setSingleValue: value forKey: @""];
else else
[newCard addEmail: value [newCard addEmail: value
types: [NSArray arrayWithObject: @"pref"]]; types: [NSArray arrayWithObject: @"pref"]];
@ -894,7 +892,7 @@
if (value) if (value)
{ {
if ([elements count] > 1) if ([elements count] > 1)
[[elements objectAtIndex: 1] setValue: 0 to: value]; [[elements objectAtIndex: 1] setSingleValue: value forKey: @""];
else else
[newCard addEmail: value types: nil]; [newCard addEmail: value types: nil];
} }
@ -902,7 +900,7 @@
if (value) if (value)
{ {
if ([elements count] > 2) if ([elements count] > 2)
[[elements objectAtIndex: 2] setValue: 0 to: value]; [[elements objectAtIndex: 2] setSingleValue: value forKey: @""];
else else
[newCard addEmail: value types: nil]; [newCard addEmail: value types: nil];
} }
@ -942,7 +940,7 @@
[element addAttribute: @"type" [element addAttribute: @"type"
value: @"pref"]; value: @"pref"];
} }
[element setValue: 0 to: value]; [element setSingleValue: value forKey: @""];
} }
elements = [newCard childrenWithTag: @"adr" elements = [newCard childrenWithTag: @"adr"
@ -960,22 +958,22 @@
[element addAttribute: @"type" value: @"pref"]; [element addAttribute: @"type" value: @"pref"];
value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressPostOfficeBox)]; value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressPostOfficeBox)];
if (value) if (value)
[element setValue: 0 to: value]; [element setSingleValue: value atIndex: 0 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressStreet)]; value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressStreet)];
if (value) if (value)
[element setValue: 2 to: value]; [element setSingleValue: value atIndex: 2 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressCity)]; value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressCity)];
if (value) if (value)
[element setValue: 3 to: value]; [element setSingleValue: value atIndex: 3 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressState)]; value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressState)];
if (value) if (value)
[element setValue: 4 to: value]; [element setSingleValue: value atIndex: 4 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressPostalCode)]; value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressPostalCode)];
if (value) if (value)
[element setValue: 5 to: value]; [element setSingleValue: value atIndex: 5 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressCountry)]; value = [properties objectForKey: MAPIPropertyKey(PidLidWorkAddressCountry)];
if (value) if (value)
[element setValue: 6 to: value]; [element setSingleValue: value atIndex: 6 forKey: @""];
// //
// home postal addresses handling // home postal addresses handling
@ -1001,7 +999,7 @@
[element addAttribute: @"type" [element addAttribute: @"type"
value: @"pref"]; value: @"pref"];
} }
[element setValue: 0 to: value]; [element setSingleValue: value forKey: @""];
} }
elements = [newCard childrenWithTag: @"adr" elements = [newCard childrenWithTag: @"adr"
@ -1020,22 +1018,22 @@
value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_POST_OFFICE_BOX_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_POST_OFFICE_BOX_UNICODE)];
if (value) if (value)
[element setValue: 0 to: value]; [element setSingleValue: value atIndex: 0 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey( PR_HOME_ADDRESS_STREET_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey( PR_HOME_ADDRESS_STREET_UNICODE)];
if (value) if (value)
[element setValue: 2 to: value]; [element setSingleValue: value atIndex: 2 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_CITY_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_CITY_UNICODE)];
if (value) if (value)
[element setValue: 3 to: value]; [element setSingleValue: value atIndex: 3 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_STATE_OR_PROVINCE_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_STATE_OR_PROVINCE_UNICODE)];
if (value) if (value)
[element setValue: 4 to: value]; [element setSingleValue: value atIndex: 4 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_POSTAL_CODE_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_POSTAL_CODE_UNICODE)];
if (value) if (value)
[element setValue: 5 to: value]; [element setSingleValue: value atIndex: 5 forKey: @""];
value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_COUNTRY_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_HOME_ADDRESS_COUNTRY_UNICODE)];
if (value) if (value)
[element setValue: 6 to: value]; [element setSingleValue: value atIndex: 6 forKey: @""];
// //
@ -1044,27 +1042,27 @@
element = [self _elementWithTag: @"tel" ofType: @"work" forCard: newCard]; element = [self _elementWithTag: @"tel" ofType: @"work" forCard: newCard];
value = [properties objectForKey: MAPIPropertyKey(PR_OFFICE_TELEPHONE_NUMBER_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_OFFICE_TELEPHONE_NUMBER_UNICODE)];
if (value) if (value)
[element setValue: 0 to: value]; [element setSingleValue: value forKey: @""];
element = [self _elementWithTag: @"tel" ofType: @"home" forCard: newCard]; element = [self _elementWithTag: @"tel" ofType: @"home" forCard: newCard];
value = [properties objectForKey: MAPIPropertyKey(PR_HOME_TELEPHONE_NUMBER_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_HOME_TELEPHONE_NUMBER_UNICODE)];
if (value) if (value)
[element setValue: 0 to: value]; [element setSingleValue: value forKey: @""];
element = [self _elementWithTag: @"tel" ofType: @"fax" forCard: newCard]; element = [self _elementWithTag: @"tel" ofType: @"fax" forCard: newCard];
value = [properties objectForKey: MAPIPropertyKey(PR_BUSINESS_FAX_NUMBER_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_BUSINESS_FAX_NUMBER_UNICODE)];
if (value) if (value)
[element setValue: 0 to: value]; [element setSingleValue: value forKey: @""];
element = [self _elementWithTag: @"tel" ofType: @"pager" forCard: newCard]; element = [self _elementWithTag: @"tel" ofType: @"pager" forCard: newCard];
value = [properties objectForKey: MAPIPropertyKey(PR_PAGER_TELEPHONE_NUMBER_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_PAGER_TELEPHONE_NUMBER_UNICODE)];
if (value) if (value)
[element setValue: 0 to: value]; [element setSingleValue: value forKey: @""];
element = [self _elementWithTag: @"tel" ofType: @"cell" forCard: newCard]; element = [self _elementWithTag: @"tel" ofType: @"cell" forCard: newCard];
value = [properties objectForKey: MAPIPropertyKey(PR_MOBILE_TELEPHONE_NUMBER_UNICODE)]; value = [properties objectForKey: MAPIPropertyKey(PR_MOBILE_TELEPHONE_NUMBER_UNICODE)];
if (value) if (value)
[element setValue: 0 to: value]; [element setSingleValue: value forKey: @""];
// //
@ -1092,15 +1090,14 @@
if (value) if (value)
{ {
[[self _elementWithTag: @"url" ofType: @"work" forCard: newCard] [[self _elementWithTag: @"url" ofType: @"work" forCard: newCard]
setValue: 0 to: value]; setSingleValue: value forKey: @""];
} }
value = [properties objectForKey: MAPIPropertyKey(PidLidInstantMessagingAddress)]; value = [properties objectForKey: MAPIPropertyKey(PidLidInstantMessagingAddress)];
if (value) if (value)
{ {
[[newCard uniqueChildWithTag: @"x-aim"] [[newCard uniqueChildWithTag: @"x-aim"]
setValue: 0 setSingleValue: value forKey: @""];
to: value];
} }
value = [properties objectForKey: MAPIPropertyKey(PR_BIRTHDAY)]; value = [properties objectForKey: MAPIPropertyKey(PR_BIRTHDAY)];
@ -1117,6 +1114,22 @@
fromProperties: [attachment properties]]; fromProperties: [attachment properties]];
} }
/* Note */
value = [properties objectForKey: MAPIPropertyKey (PR_BODY_UNICODE)];
if (!value)
{
value = [properties objectForKey: MAPIPropertyKey (PR_HTML)];
if (value)
{
value = [[NSString alloc] initWithData: value
encoding: NSUTF8StringEncoding];
[value autorelease];
value = [value htmlToText];
}
}
if (value)
[newCard setNote: value];
// //
// we save the new/modified card // we save the new/modified card
// //

View file

@ -56,6 +56,7 @@
#undef DEBUG #undef DEBUG
#include <stdbool.h> #include <stdbool.h>
#include <gen_ndr/exchange.h> #include <gen_ndr/exchange.h>
#include <util/attr.h>
#include <libmapiproxy.h> #include <libmapiproxy.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
#include <mapistore/mapistore_errors.h> #include <mapistore/mapistore_errors.h>

View file

@ -26,6 +26,8 @@
#import "MAPIStoreFAIMessage.h" #import "MAPIStoreFAIMessage.h"
#undef DEBUG #undef DEBUG
#include <talloc.h>
#include <util/time.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
@implementation MAPIStoreFAIMessage @implementation MAPIStoreFAIMessage

View file

@ -28,6 +28,8 @@
#import "MAPIStoreFAIMessageTable.h" #import "MAPIStoreFAIMessageTable.h"
#undef DEBUG #undef DEBUG
#include <talloc.h>
#include <util/time.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
static Class MAPIStoreFAIMessageK = Nil; static Class MAPIStoreFAIMessageK = Nil;

View file

@ -34,9 +34,6 @@
#import "MAPIStoreFSBaseContext.h" #import "MAPIStoreFSBaseContext.h"
#undef DEBUG
#include <mapistore/mapistore.h>
static Class MAPIStoreFSFolderK; static Class MAPIStoreFSFolderK;
@implementation MAPIStoreFSBaseContext @implementation MAPIStoreFSBaseContext

View file

@ -80,7 +80,7 @@
[sogoObject appendProperties: properties]; [sogoObject appendProperties: properties];
[sogoObject save]; [sogoObject save];
[self resetProperties]; [properties removeAllObjects];
} }
- (NSDate *) creationTime - (NSDate *) creationTime

View file

@ -51,6 +51,7 @@
#include <gen_ndr/exchange.h> #include <gen_ndr/exchange.h>
#undef DEBUG #undef DEBUG
#include <util/attr.h>
#include <libmapiproxy.h> #include <libmapiproxy.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
#include <mapistore/mapistore_nameid.h> #include <mapistore/mapistore_nameid.h>
@ -898,33 +899,28 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
return rc; return rc;
} }
- (int) addPropertiesFromRow: (struct SRow *) aRow - (void) addProperties: (NSDictionary *) newProperties
{ {
static enum MAPITAGS bannedProps[] = { PR_MID, PR_FID, PR_PARENT_FID, static enum MAPITAGS bannedProps[] = { PR_MID, PR_FID, PR_PARENT_FID,
PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY,
PR_CHANGE_KEY, 0x00000000 }; PR_CHANGE_KEY, 0x00000000 };
enum MAPITAGS *currentProp; enum MAPITAGS *currentProp;
int rc; NSMutableDictionary *propsCopy;
rc = [super addPropertiesFromRow: aRow];
/* TODO: this should no longer be required once mapistore v2 API is in /* TODO: this should no longer be required once mapistore v2 API is in
place, when we can then do this from -dealloc below */ place, when we can then do this from -dealloc below */
if ([properties count] > 0)
{
currentProp = bannedProps;
while (*currentProp)
{
[properties removeObjectForKey: MAPIPropertyKey (*currentProp)];
currentProp++;
}
[propsMessage appendProperties: properties]; propsCopy = [newProperties mutableCopy];
[propsMessage save]; currentProp = bannedProps;
[self resetProperties]; while (*currentProp)
{
[propsCopy removeObjectForKey: MAPIPropertyKey (*currentProp)];
currentProp++;
} }
return rc; [propsMessage appendProperties: propsCopy];
[propsMessage save];
[propsCopy release];
} }
- (void) dealloc - (void) dealloc

View file

@ -64,6 +64,7 @@
static Class SOGoMailFolderK; static Class SOGoMailFolderK;
#undef DEBUG #undef DEBUG
#include <util/attr.h>
#include <libmapi/libmapi.h> #include <libmapi/libmapi.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
#include <mapistore/mapistore_errors.h> #include <mapistore/mapistore_errors.h>

View file

@ -759,7 +759,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts,
messageData = cleanedMessage; messageData = cleanedMessage;
} }
[messageData writeToFile: @"/tmp/mimegen.eml" atomically: NO]; // [messageData writeToFile: @"/tmp/mimegen.eml" atomically: NO];
return messageData; return messageData;
} }
@ -812,7 +812,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts,
mapping = [[self context] mapping]; mapping = [[self context] mapping];
[mapping unregisterURLWithID: [self objectId]]; [mapping unregisterURLWithID: [self objectId]];
[self setIsNew: NO]; [self setIsNew: NO];
[self resetProperties]; [properties removeAllObjects];
[[self container] cleanupCaches]; [[self container] cleanupCaches];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;

View file

@ -21,6 +21,7 @@
*/ */
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSData.h> #import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h> #import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
@ -42,6 +43,8 @@
#import "MAPIStoreMessage.h" #import "MAPIStoreMessage.h"
#include <unrtf.h>
#undef DEBUG #undef DEBUG
#include <stdbool.h> #include <stdbool.h>
#include <gen_ndr/exchange.h> #include <gen_ndr/exchange.h>
@ -49,6 +52,8 @@
#include <mapistore/mapistore_errors.h> #include <mapistore/mapistore_errors.h>
#include <mapistore/mapistore_nameid.h> #include <mapistore/mapistore_nameid.h>
static NSString *resourcesDir = nil;
NSData * NSData *
MAPIStoreInternalEntryId (NSString *username) MAPIStoreInternalEntryId (NSString *username)
{ {
@ -147,6 +152,64 @@ MAPIStoreExternalEntryId (NSString *cn, NSString *email)
return entryId; return entryId;
} }
/* rtf conversion via unrtf */
static int
unrtf_data_output (void *data, const char *str, size_t str_len)
{
NSMutableData *rtfData = data;
[rtfData appendBytes: str length: str_len];
return str_len;
}
static NSData *
uncompressRTF (NSData *compressedRTF)
{
NSData *rtfData = nil;
DATA_BLOB *rtf;
TALLOC_CTX *mem_ctx;
mem_ctx = talloc_zero (NULL, TALLOC_CTX);
rtf = talloc_zero (mem_ctx, DATA_BLOB);
if (uncompress_rtf (mem_ctx,
(uint8_t *) [compressedRTF bytes], [compressedRTF length],
rtf)
== MAPI_E_SUCCESS)
rtfData = [NSData dataWithBytes: rtf->data length: rtf->length];
talloc_free (mem_ctx);
return rtfData;
}
static NSData *
rtf2html (NSData *compressedRTF)
{
NSData *rtf;
NSMutableData *html = nil;
int rc;
struct unRTFOptions unrtfOptions;
rtf = uncompressRTF (compressedRTF);
if (rtf)
{
html = [NSMutableData data];
memset (&unrtfOptions, 0, sizeof (struct unRTFOptions));
unrtf_set_output_device (&unrtfOptions, unrtf_data_output, html);
unrtfOptions.config_directory = [resourcesDir UTF8String];
unrtfOptions.output_format = "html";
unrtfOptions.nopict_mode = YES;
rc = unrtf_convert_from_string (&unrtfOptions,
[rtf bytes], [rtf length]);
if (!rc)
html = nil;
}
return html;
}
@interface SOGoObject (MAPIStoreProtocol) @interface SOGoObject (MAPIStoreProtocol)
- (NSString *) davEntityTag; - (NSString *) davEntityTag;
@ -156,6 +219,15 @@ MAPIStoreExternalEntryId (NSString *cn, NSString *email)
@implementation MAPIStoreMessage @implementation MAPIStoreMessage
+ (void) initialize
{
if (!resourcesDir)
{
resourcesDir = [[NSBundle bundleForClass: self] resourcePath];
[resourcesDir retain];
}
}
- (id) init - (id) init
{ {
if ((self = [super init])) if ((self = [super init]))
@ -304,6 +376,38 @@ MAPIStoreExternalEntryId (NSString *cn, NSString *email)
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
} }
- (void) addProperties: (NSDictionary *) newNewProperties
{
NSData *htmlData, *rtfData;
static NSNumber *htmlKey = nil, *rtfKey = nil;
[super addProperties: newNewProperties];
if (!htmlKey)
{
htmlKey = MAPIPropertyKey (PR_HTML);
[htmlKey retain];
}
if (!rtfKey)
{
rtfKey = MAPIPropertyKey (PR_RTF_COMPRESSED);
[rtfKey retain];
}
if (![properties objectForKey: htmlKey])
{
rtfData = [properties objectForKey: rtfKey];
if (rtfData)
{
htmlData = rtf2html (rtfData);
[properties setObject: htmlData forKey: htmlKey];
[properties removeObjectForKey: rtfKey];
[properties removeObjectForKey: MAPIPropertyKey (PR_RTF_IN_SYNC)];
}
}
}
- (MAPIStoreAttachment *) createAttachment - (MAPIStoreAttachment *) createAttachment
{ {
MAPIStoreAttachment *newAttachment; MAPIStoreAttachment *newAttachment;
@ -460,7 +564,7 @@ MAPIStoreExternalEntryId (NSString *cn, NSString *email)
[[containerTables objectAtIndex: count] [[containerTables objectAtIndex: count]
notifyChangesForChild: self]; notifyChangesForChild: self];
[self setIsNew: NO]; [self setIsNew: NO];
[self resetProperties]; [properties removeAllObjects];
[container cleanupCaches]; [container cleanupCaches];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
@ -744,7 +848,7 @@ MAPIStoreExternalEntryId (NSString *cn, NSString *email)
- (int) setReadFlag: (uint8_t) flag - (int) setReadFlag: (uint8_t) flag
{ {
[self subclassResponsibility: _cmd]; // [self subclassResponsibility: _cmd];
return MAPISTORE_ERROR; return MAPISTORE_ERROR;
} }

View file

@ -86,7 +86,6 @@
- (void) addProperties: (NSDictionary *) newProperties; - (void) addProperties: (NSDictionary *) newProperties;
- (NSDictionary *) properties; - (NSDictionary *) properties;
- (void) resetProperties;
/* ops */ /* ops */
- (int) getAvailableProperties: (struct SPropTagArray **) propertiesP - (int) getAvailableProperties: (struct SPropTagArray **) propertiesP

View file

@ -235,11 +235,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
return properties; return properties;
} }
- (void) resetProperties
{
[properties removeAllObjects];
}
- (int) getProperty: (void **) data - (int) getProperty: (void **) data
withTag: (enum MAPITAGS) propTag withTag: (enum MAPITAGS) propTag
inMemCtx: (TALLOC_CTX *) memCtx inMemCtx: (TALLOC_CTX *) memCtx
@ -451,14 +446,18 @@ static Class NSExceptionK, MAPIStoreFolderK;
{ {
struct SPropValue *cValue; struct SPropValue *cValue;
NSUInteger counter; NSUInteger counter;
NSMutableDictionary *newProperties;
newProperties = [NSMutableDictionary dictionaryWithCapacity: aRow->cValues];
for (counter = 0; counter < aRow->cValues; counter++) for (counter = 0; counter < aRow->cValues; counter++)
{ {
cValue = aRow->lpProps + counter; cValue = aRow->lpProps + counter;
[properties setObject: NSObjectFromSPropValue (cValue) [newProperties setObject: NSObjectFromSPropValue (cValue)
forKey: MAPIPropertyKey (cValue->ulPropTag)]; forKey: MAPIPropertyKey (cValue->ulPropTag)];
} }
[self addProperties: newProperties];
return MAPISTORE_SUCCESS; return MAPISTORE_SUCCESS;
} }

View file

@ -26,9 +26,6 @@
#import <NGCards/iCalCalendar.h> #import <NGCards/iCalCalendar.h>
#import <NGCards/iCalRecurrenceRule.h> #import <NGCards/iCalRecurrenceRule.h>
#include <stdbool.h>
#include <gen_ndr/property.h>
@class NSCalendarDate; @class NSCalendarDate;
@class iCalRepeatableEntityObject; @class iCalRepeatableEntityObject;
@class iCalRecurrenceRule; @class iCalRecurrenceRule;

View file

@ -32,6 +32,10 @@
#import "NSDate+MAPIStore.h" #import "NSDate+MAPIStore.h"
#import "MAPIStoreRecurrenceUtils.h" #import "MAPIStoreRecurrenceUtils.h"
#include <talloc.h>
#include <util/time.h>
#include <gen_ndr/property.h>
@implementation iCalCalendar (MAPIStoreRecurrence) @implementation iCalCalendar (MAPIStoreRecurrence)
- (void) setupRecurrenceWithMasterEntity: (iCalRepeatableEntityObject *) entity - (void) setupRecurrenceWithMasterEntity: (iCalRepeatableEntityObject *) entity
@ -92,7 +96,7 @@
[rule setFrequency: iCalRecurrenceFrequenceYearly]; [rule setFrequency: iCalRecurrenceFrequenceYearly];
[rule setRepeatInterval: rp->Period / 12]; [rule setRepeatInterval: rp->Period / 12];
month = [NSString stringWithFormat: @"%d", [startDate monthOfYear]]; month = [NSString stringWithFormat: @"%d", [startDate monthOfYear]];
[rule setNamedValue: @"bymonth" to: month]; [rule setSingleValue: month forKey: @"bymonth"];
} }
else else
[self errorWithFormat: [self errorWithFormat:
@ -112,7 +116,7 @@
else else
monthDay = [NSString stringWithFormat: @"%d", monthDay = [NSString stringWithFormat: @"%d",
rp->PatternTypeSpecific.MonthRecurrencePattern.N]; rp->PatternTypeSpecific.MonthRecurrencePattern.N];
[rule setNamedValue: @"bymonthday" to: monthDay]; [rule setSingleValue: monthDay forKey: @"bymonthday"];
} }
else if ((rp->PatternTypeSpecific.MonthRecurrencePattern.WeekRecurrencePattern else if ((rp->PatternTypeSpecific.MonthRecurrencePattern.WeekRecurrencePattern
== 0x3e) /* Nth week day */ == 0x3e) /* Nth week day */
@ -135,8 +139,9 @@
else else
bySetPos = rp->PatternTypeSpecific.MonthRecurrencePattern.N; bySetPos = rp->PatternTypeSpecific.MonthRecurrencePattern.N;
[rule setNamedValue: @"bysetpos" [rule
to: [NSString stringWithFormat: @"%d", bySetPos]]; setSingleValue: [NSString stringWithFormat: @"%d", bySetPos]
forKey: @"bysetpos"];
} }
else else
{ {
@ -163,9 +168,10 @@
|| (rp->PatternType & 4) == 4) || (rp->PatternType & 4) == 4)
{ {
/* MonthEnd, HjMonth and HjMonthEnd */ /* MonthEnd, HjMonth and HjMonthEnd */
[rule setNamedValue: @"bymonthday" [rule
to: [NSString stringWithFormat: @"%d", setSingleValue: [NSString stringWithFormat: @"%d",
rp->PatternTypeSpecific.Day]]; rp->PatternTypeSpecific.Day]
forKey: @"bymonthday"];
} }
else else
[self errorWithFormat: @"invalid value for PatternType: %.4x", [self errorWithFormat: @"invalid value for PatternType: %.4x",
@ -305,6 +311,14 @@
rp->FirstDateTime = [moduloDate asMinutesSince1601]; rp->FirstDateTime = [moduloDate asMinutesSince1601];
byMonthDay = [[self byMonthDay] objectAtIndex: 0]; byMonthDay = [[self byMonthDay] objectAtIndex: 0];
if (!byMonthDay && (freq == iCalRecurrenceFrequenceYearly))
{
byMonthDay = [NSString stringWithFormat: @"%d", [startDate dayOfMonth]];
[self warnWithFormat: @"no month day specified in yearly"
@" recurrence: we deduce it from the start date: %@",
byMonthDay];
}
if (byMonthDay) if (byMonthDay)
{ {
if ([byMonthDay intValue] < 0) if ([byMonthDay intValue] < 0)
@ -325,15 +339,18 @@
{ {
rp->PatternType = PatternType_MonthNth; rp->PatternType = PatternType_MonthNth;
byDayMask = [self byDayMask]; byDayMask = [self byDayMask];
days = [byDayMask weekDayOccurrences];
mask = 0; mask = 0;
for (count = 0; count < 7; count++) days = [byDayMask weekDayOccurrences];
if (days[0][count]) if (days)
mask |= 1 << count; {
for (count = 0; count < 7; count++)
if (days[0][count])
mask |= 1 << count;
}
if (mask) if (mask)
{ {
rp->PatternTypeSpecific.MonthRecurrencePattern.WeekRecurrencePattern = mask; rp->PatternTypeSpecific.MonthRecurrencePattern.WeekRecurrencePattern = mask;
bySetPos = [self namedValue: @"bysetpos"]; bySetPos = [self flattenedValuesForKey: @"bysetpos"];
if ([bySetPos length]) if ([bySetPos length])
rp->PatternTypeSpecific.MonthRecurrencePattern.N rp->PatternTypeSpecific.MonthRecurrencePattern.N
= ([bySetPos hasPrefix: @"-"] = ([bySetPos hasPrefix: @"-"]

View file

@ -26,6 +26,8 @@
#import <Foundation/NSValue.h> #import <Foundation/NSValue.h>
#include <stdbool.h> #include <stdbool.h>
#include <talloc.h>
#include <util/time.h>
#include <gen_ndr/exchange.h> #include <gen_ndr/exchange.h>
@class NSData; @class NSData;

View file

@ -20,13 +20,6 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#undef DEBUG
#include <talloc.h>
#include <mapistore/mapistore.h>
#include <mapistore/mapistore_errors.h>
#include <libmapi/libmapi.h>
#include <libmapiproxy.h>
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h> #import <Foundation/NSDictionary.h>
#import <Foundation/NSException.h> #import <Foundation/NSException.h>
@ -38,6 +31,10 @@
#import "MAPIStoreTypes.h" #import "MAPIStoreTypes.h"
#undef DEBUG
#include <mapistore/mapistore.h>
#include <mapistore/mapistore_errors.h>
uint8_t * uint8_t *
MAPIBoolValue (void *memCtx, BOOL value) MAPIBoolValue (void *memCtx, BOOL value)
{ {

View file

@ -80,25 +80,10 @@ Class NSNumberK;
[super dealloc]; [super dealloc];
} }
- (int) addPropertiesFromRow: (struct SRow *) aRow
{
int rc;
rc = [super addPropertiesFromRow: aRow];
if (rc == MAPISTORE_SUCCESS)
{
[sogoObject appendProperties: properties];
[properties removeAllObjects];
ASSIGN (lastModificationTime, [NSDate date]);
}
return rc;
}
- (void) addProperties: (NSDictionary *) newProperties - (void) addProperties: (NSDictionary *) newProperties
{ {
[super addProperties: newProperties]; [super addProperties: newProperties];
[sogoObject appendProperties: newProperties]; [sogoObject appendProperties: properties];
[properties removeAllObjects]; [properties removeAllObjects];
ASSIGN (lastModificationTime, [NSDate date]); ASSIGN (lastModificationTime, [NSDate date]);
} }

View file

@ -28,6 +28,7 @@
#undef DEBUG #undef DEBUG
#include <talloc.h> #include <talloc.h>
#include <util/time.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
@implementation NSArray (MAPIStoreFolders) @implementation NSArray (MAPIStoreFolders)

View file

@ -24,8 +24,9 @@
#undef DEBUG #undef DEBUG
#include <stdbool.h> #include <stdbool.h>
#include <gen_ndr/exchange.h>
#include <talloc.h> #include <talloc.h>
#include <util/time.h>
#include <gen_ndr/exchange.h>
@implementation NSData (MAPIStoreDataTypes) @implementation NSData (MAPIStoreDataTypes)

View file

@ -27,8 +27,9 @@
#import "NSDate+MAPIStore.h" #import "NSDate+MAPIStore.h"
#undef DEBUG #undef DEBUG
#include <mapistore/mapistore.h>
#include <talloc.h> #include <talloc.h>
#include <util/time.h>
#include <mapistore/mapistore.h>
static NSCalendarDate *refDate = nil; static NSCalendarDate *refDate = nil;

View file

@ -28,6 +28,8 @@
#import "NSString+MAPIStore.h" #import "NSString+MAPIStore.h"
#undef DEBUG #undef DEBUG
#include <talloc.h>
#include <util/time.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
@implementation NSString (MAPIStoreDataTypes) @implementation NSString (MAPIStoreDataTypes)

View file

@ -35,6 +35,8 @@
#import "SOGoMAPIFSFolder.h" #import "SOGoMAPIFSFolder.h"
#undef DEBUG #undef DEBUG
#include <talloc.h>
#include <util/time.h>
#include <mapistore/mapistore.h> #include <mapistore/mapistore.h>
#include <mapistore/mapistore_errors.h> #include <mapistore/mapistore_errors.h>
#include <libmapiproxy.h> #include <libmapiproxy.h>

View file

@ -81,6 +81,8 @@ h_template = """/* %(filename)s (auto-generated) - this file is part of SOGo
#import <Foundation/NSObjCRuntime.h> #import <Foundation/NSObjCRuntime.h>
#include <stdbool.h> #include <stdbool.h>
#include <talloc.h>
#include <util/time.h>
#include <gen_ndr/exchange.h> #include <gen_ndr/exchange.h>
extern const NSUInteger MAPIStorePropertyGettersCount; extern const NSUInteger MAPIStorePropertyGettersCount;

11531
OpenChange/unrtf-0.21.2.diff Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

75
OpenChange/unrtf_config_h Normal file
View file

@ -0,0 +1,75 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strstr' function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
#define PACKAGE "unrtf"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-unrtf@gnu.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "unrtf"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "unrtf 0.21.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "unrtf"
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.21.2"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.21.2"
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */