From ee13adbf9b02b28f221261bbd253d58ffacea4e5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 11 Aug 2010 19:53:02 +0000 Subject: [PATCH] Monotone-Parent: 509b02f4f9f2961c7946b8a808d6fe29000b8cc9 Monotone-Revision: 591189cd04bcdbe3a11183a6aca2bd58edc2ebea Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-08-11T19:53:02 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ Main/SOGo+DAV.m | 26 ++++++++++++++++++++++++ SoObjects/Contacts/SOGoContactGCSEntry.m | 5 +++++ 3 files changed, 37 insertions(+) diff --git a/ChangeLog b/ChangeLog index ab7cd08a8..9b20d508d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-08-11 Wolfgang Sourdeau + * Main/SOGo+DAV.m (-davCurrentUserPrincipal): new method + implementing the "{DAV:}current-user-principal" property. + + * SoObjects/Contacts/SOGoContactGCSEntry.m (-davAddressData): new + DAV property accessor returning the card content. + * SoObjects/SOGo/WORequest+SOGo.m (-isAddressBookApp): new (hackish) test method to determine whether the client is Apple's AddressBook.app. diff --git a/Main/SOGo+DAV.m b/Main/SOGo+DAV.m index 6369e6855..131f70dec 100644 --- a/Main/SOGo+DAV.m +++ b/Main/SOGo+DAV.m @@ -504,4 +504,30 @@ return r; } +- (SOGoWebDAVValue *) davCurrentUserPrincipal +{ + NSDictionary *userHREF; + NSString *usersUrl, *login; + SOGoUser *activeUser; + SOGoWebDAVValue *davCurrentUserPrincipal; + + activeUser = [[self context] activeUser]; + login = [activeUser login]; + if ([login isEqualToString: @"anonymous"]) + davCurrentUserPrincipal = nil; + else + { + usersUrl = [NSString stringWithFormat: @"%@%@/", + [self davURLAsString], login]; + userHREF = davElementWithContent (@"href", XMLNS_WEBDAV, usersUrl); + davCurrentUserPrincipal + = [davElementWithContent (@"current-user-principal", + XMLNS_WEBDAV, + userHREF) + asWebDAVValue]; + } + + return davCurrentUserPrincipal; +} + @end diff --git a/SoObjects/Contacts/SOGoContactGCSEntry.m b/SoObjects/Contacts/SOGoContactGCSEntry.m index 22ee70bc0..03251f6ed 100644 --- a/SoObjects/Contacts/SOGoContactGCSEntry.m +++ b/SoObjects/Contacts/SOGoContactGCSEntry.m @@ -115,6 +115,11 @@ return @"text/x-vcard"; } +- (NSString *) davAddressData +{ + return [self contentAsString]; +} + /* specialized actions */ - (void) save