From be3a423e9bdaf02c6ed9067e3cc27f12d773e02d Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 4 Jul 2008 18:22:06 +0000 Subject: [PATCH] Monotone-Parent: 3edbc90046db007b2cea7d85505ba6bcecec6dd7 Monotone-Revision: 99eb9661017e4e4371b678e9d5c89d54eb0762c5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-07-04T18:22:06 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 +++ .../Appointments/SOGoAppointmentFolder.m | 26 +++++------- SoObjects/SOGo/SOGoObject.h | 5 +++ SoObjects/SOGo/SOGoObject.m | 42 ++++++++++++------- 4 files changed, 49 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8972a646..e0d2c508e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-04 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoObject.m ([SOGoObject + -POSTAction:localContext]): take the content type as well as the + request and pass them as parameter to the new method below. + 2008-06-30 Wolfgang Sourdeau * SoObjects/Appointments/SOGoAppointmentFolder.m diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index be529fc51..2117fd843 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -1901,27 +1901,23 @@ _selectorForProperty (NSString *property) return [self _caldavScheduleResponse: tags]; } -- (id) POSTAction: (id) localContext +- (id) davPOSTRequest: (WORequest *) request + withContentType: (NSString *) cType + inContext: (WOContext *) localContext { id obj; - NSString *cType; - WORequest *rq; iCalCalendar *calendar; - obj = nil; - - rq = [localContext request]; - if ([rq isSoWebDAVRequest]) + if ([cType hasPrefix: @"text/calendar"]) { - cType = [rq headerForKey: @"content-type"]; - if ([cType hasPrefix: @"text/calendar"]) - { - calendar - = [iCalCalendar parseSingleFromSource: [rq contentAsString]]; - obj = [self caldavScheduleRequest: rq - withCalendar: calendar]; - } + calendar + = [iCalCalendar parseSingleFromSource: [request contentAsString]]; + obj = [self caldavScheduleRequest: request + withCalendar: calendar]; } + else + obj = [super davPOSTRequest: request withContentType: cType + inContext: localContext]; return obj; } diff --git a/SoObjects/SOGo/SOGoObject.h b/SoObjects/SOGo/SOGoObject.h index f6b04cc7d..4dc554da9 100644 --- a/SoObjects/SOGo/SOGoObject.h +++ b/SoObjects/SOGo/SOGoObject.h @@ -52,6 +52,7 @@ @class NSURL; @class WOContext; +@class WORequest; @class GCSFolderManager; @class GCSFolder; @@ -136,6 +137,10 @@ - (NSArray *) davComplianceClassesInContext: (WOContext *) localContext; +- (id) davPOSTRequest: (WORequest *) request + withContentType: (NSString *) cType + inContext: (WOContext *) localContext; + /* dav acls */ - (SOGoWebDAVValue *) davCurrentUserPrivilegeSet; diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index 585051683..5d611b5b7 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -771,30 +771,42 @@ static NSDictionary *reportMap = nil; return [NSString stringWithFormat: @"%@:", command]; } -- (id) POSTAction: (id) localContext +- (id) davPOSTRequest: (WORequest *) request + withContentType: (NSString *) cType + inContext: (WOContext *) localContext { id obj; - NSString *cType, *command; id document; SEL commandSel; - WORequest *rq; + NSString *command; obj = nil; + if ([cType hasPrefix: @"application/xml"] + || [cType hasPrefix: @"text/xml"]) + { + document = [request contentAsDOMDocument]; + command = [[self _parseXMLCommand: document] davMethodToObjC]; + commandSel = NSSelectorFromString (command); + if ([self respondsToSelector: commandSel]) + obj = [self performSelector: commandSel withObject: localContext]; + } + + return obj; +} + +- (id) POSTAction: (id) localContext +{ + WORequest *rq; + id obj; + rq = [localContext request]; if ([rq isSoWebDAVRequest]) - { - cType = [rq headerForKey: @"content-type"]; - if ([cType hasPrefix: @"application/xml"] - || [cType hasPrefix: @"text/xml"]) - { - document = [rq contentAsDOMDocument]; - command = [[self _parseXMLCommand: document] davMethodToObjC]; - commandSel = NSSelectorFromString (command); - if ([self respondsToSelector: commandSel]) - obj = [self performSelector: commandSel withObject: localContext]; - } - } + obj = [self davPOSTRequest: rq + withContentType: [rq headerForKey: @"content-type"] + inContext: localContext]; + else + obj = nil; return obj; }