From bf8245a4bee9977ae5df7c6db02fbc943fac5c30 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sun, 22 Jul 2007 20:32:16 +0000 Subject: [PATCH] Monotone-Parent: a6f65fa9361ca6a3fc6870978fa9814e3c65652e Monotone-Revision: 4198b7cec911933d302e467416f80df87577acdb Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-07-22T20:32:16 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ SoObjects/SOGo/NSString+Utilities.h | 1 + SoObjects/SOGo/NSString+Utilities.m | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 263d4092a..c2e4d3118 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-07-22 Wolfgang Sourdeau + * SoObjects/SOGo/NSString+Utilities.m ([NSString + -asDavInvocation]): new method returning a dictionary with a "ns" + key representing the dav namespace and a "method" key representing + the dav method name of the request. + * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences +initialize]): scan the value of SOGoUIxUserCanChangePassword. Default is "no". diff --git a/SoObjects/SOGo/NSString+Utilities.h b/SoObjects/SOGo/NSString+Utilities.h index 29679f532..31c913ef6 100644 --- a/SoObjects/SOGo/NSString+Utilities.h +++ b/SoObjects/SOGo/NSString+Utilities.h @@ -37,6 +37,7 @@ - (NSString *) urlWithoutParameters; - (NSString *) davMethodToObjC; +- (NSDictionary *) asDavInvocation; - (NSString *) stringByDetectingURLs; diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 6a93540dc..2f1d617c0 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -108,6 +108,35 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil; return newName; } +- (NSDictionary *) asDavInvocation +{ + NSMutableDictionary *davInvocation; + NSRange nsEnclosing, methodEnclosing; + unsigned int length; + + davInvocation = nil; + if ([self hasPrefix: @"{"]) + { + nsEnclosing = [self rangeOfString: @"}"]; + length = [self length]; + if (nsEnclosing.length > 0 + && nsEnclosing.location < (length - 1)) + { + methodEnclosing = NSMakeRange(nsEnclosing.location + 1, + length - nsEnclosing.location - 1); + nsEnclosing.length = nsEnclosing.location - 1; + nsEnclosing.location = 1; + davInvocation = [NSMutableDictionary dictionaryWithCapacity: 2]; + [davInvocation setObject: [self substringWithRange: nsEnclosing] + forKey: @"ns"]; + [davInvocation setObject: [self substringWithRange: methodEnclosing] + forKey: @"method"]; + } + } + + return davInvocation; +} + - (NSRange) _rangeOfURLInRange: (NSRange) refRange { int start, length;