diff --git a/ChangeLog b/ChangeLog index e5c67527b..7524cf4b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2006-07-25 Wolfgang Sourdeau + + * SoObjects/Mailer/SOGoUser+Mail.m: if only one identity is to be + returned, put it in an NSArray before returning it (fixes + bug#217). + +2006-07-24 Wolfgang Sourdeau + + * UI/SOGoUI/NSString+URL.m ([NSString -hostlessURL]): new method + that returns a url string stripped from its "http://hostname" + prefix. + + * UI/SOGoUI/NSDictionary+URL.[hm]: moved from UI/Common. + + * UI/SOGoUI/NSString+URL.[hm]: moved from UI/Common. + 2006-07-17 Wolfgang Sourdeau * UI/MailerUI/WOContext+UIxMailer.m ([WOContext diff --git a/SoObjects/Mailer/SOGoUser+Mail.m b/SoObjects/Mailer/SOGoUser+Mail.m index db6ce1900..2b3c6834f 100644 --- a/SoObjects/Mailer/SOGoUser+Mail.m +++ b/SoObjects/Mailer/SOGoUser+Mail.m @@ -88,7 +88,7 @@ identity = [self primaryMailIdentity]; shares = [self valueForKey:@"additionalIMAP4AccountsAndEMails"]; if ([shares count] == 0) - return identity; + return [NSArray arrayWithObject: identity]; identities = [NSMutableArray arrayWithCapacity:[shares count] + 1]; if (identity != nil) [identities addObject:identity]; diff --git a/UI/Common/GNUmakefile b/UI/Common/GNUmakefile index 73ba23129..3e8cdb023 100644 --- a/UI/Common/GNUmakefile +++ b/UI/Common/GNUmakefile @@ -9,9 +9,6 @@ CommonUI_PRINCIPAL_CLASS = CommonUIProduct CommonUI_LANGUAGES = English French CommonUI_OBJC_FILES += \ - NSString+URL.m \ - NSDictionary+URL.m \ - \ CommonUIProduct.m \ UIxPageFrame.m \ UIxPrintPageFrame.m \ diff --git a/UI/Common/NSString+URL.m b/UI/Common/NSString+URL.m deleted file mode 100644 index ca5728f76..000000000 --- a/UI/Common/NSString+URL.m +++ /dev/null @@ -1,26 +0,0 @@ -#import "NSString+URL.h" -#import "NSDictionary+URL.h" - -@implementation NSString (SOGoURLExtension) - -- (NSString *) composeURLWithAction: (NSString *) action - parameters: (NSDictionary *) urlParameters - andHash: (BOOL) useHash -{ - NSMutableString *completeURL; - - completeURL = [NSMutableString new]; - [completeURL autorelease]; - - [completeURL appendString: self]; - if (![completeURL hasSuffix: @"/"]) - [completeURL appendString: @"/"]; - [completeURL appendString: action]; - [completeURL appendString: [urlParameters asURLParameters]]; - if (useHash) - [completeURL appendString: @"#"]; - - return completeURL; -} - -@end diff --git a/UI/SOGoUI/GNUmakefile b/UI/SOGoUI/GNUmakefile index f8c064626..7910b9646 100644 --- a/UI/SOGoUI/GNUmakefile +++ b/UI/SOGoUI/GNUmakefile @@ -12,6 +12,10 @@ libSOGoUI_HEADER_FILES_INSTALL_DIR = /SOGoUI FHS_HEADER_DIRS = SOGoUI libSOGoUI_HEADER_FILES += \ + \ + NSDictionary+URL.h \ + NSString+URL.h \ + \ UIxComponent.h \ SOGoDateFormatter.h \ SOGoAptFormatter.h \ @@ -19,6 +23,10 @@ libSOGoUI_HEADER_FILES += \ WOContext+UIx.h \ libSOGoUI_OBJC_FILES += \ + \ + NSDictionary+URL.m \ + NSString+URL.m \ + \ UIxComponent.m \ SOGoDateFormatter.m \ SOGoAptFormatter.m \ diff --git a/UI/Common/NSDictionary+URL.h b/UI/SOGoUI/NSDictionary+URL.h similarity index 100% rename from UI/Common/NSDictionary+URL.h rename to UI/SOGoUI/NSDictionary+URL.h diff --git a/UI/Common/NSDictionary+URL.m b/UI/SOGoUI/NSDictionary+URL.m similarity index 100% rename from UI/Common/NSDictionary+URL.m rename to UI/SOGoUI/NSDictionary+URL.m diff --git a/UI/Common/NSString+URL.h b/UI/SOGoUI/NSString+URL.h similarity index 97% rename from UI/Common/NSString+URL.h rename to UI/SOGoUI/NSString+URL.h index 13926c254..32e941a96 100644 --- a/UI/Common/NSString+URL.h +++ b/UI/SOGoUI/NSString+URL.h @@ -32,6 +32,8 @@ - (NSString *) composeURLWithAction: (NSString *) action parameters: (NSDictionary *) urlParameters andHash: (BOOL) useHash; +- (NSString *) hostlessURL; + @end #endif /* NSSTRING_URL_H */ diff --git a/UI/SOGoUI/NSString+URL.m b/UI/SOGoUI/NSString+URL.m new file mode 100644 index 000000000..943608aaf --- /dev/null +++ b/UI/SOGoUI/NSString+URL.m @@ -0,0 +1,66 @@ +/* NSString+URL.m - this file is part of SOGo + * + * Copyright (C) 2006 Inverse group conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import "NSString+URL.h" +#import "NSDictionary+URL.h" + +@implementation NSString (SOGoURLExtension) + +- (NSString *) composeURLWithAction: (NSString *) action + parameters: (NSDictionary *) urlParameters + andHash: (BOOL) useHash +{ + NSMutableString *completeURL; + + completeURL = [NSMutableString new]; + [completeURL autorelease]; + + [completeURL appendString: self]; + if (![completeURL hasSuffix: @"/"]) + [completeURL appendString: @"/"]; + [completeURL appendString: action]; + [completeURL appendString: [urlParameters asURLParameters]]; + if (useHash) + [completeURL appendString: @"#"]; + + return completeURL; +} + +- (NSString *) hostlessURL +{ + NSString *newURL; + NSRange hostR, locationR; + + if ([self hasPrefix: @"/"]) + newURL = [self copy]; + else + { + hostR = [self rangeOfString: @"://"]; + locationR = [[self substringFromIndex: (hostR.location + hostR.length)] + rangeOfString: @"/"]; + newURL = [self substringFromIndex: (hostR.location + hostR.length + locationR.location)]; + } + + return newURL; +} + +@end