]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1246 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 7 Nov 2007 23:36:41 +0000 (23:36 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 7 Nov 2007 23:36:41 +0000 (23:36 +0000)
15 files changed:
ChangeLog
SoObjects/Appointments/SOGoFreeBusyObject.h
SoObjects/Contacts/GNUmakefile
SoObjects/Contacts/SOGoContactFolder.h
SoObjects/Contacts/SOGoContactFolders.m
SoObjects/Contacts/SOGoContactGCSFolder.h
SoObjects/Contacts/SOGoContactGCSFolder.m
SoObjects/Contacts/SOGoContactLDAPFolder.h
SoObjects/Contacts/SOGoContactLDAPFolder.m
SoObjects/Contacts/SOGoFolder+CardDAV.h [moved from SoObjects/Contacts/NSObject+CardDAV.h with 92% similarity]
SoObjects/Contacts/SOGoFolder+CardDAV.m [moved from SoObjects/Contacts/NSObject+CardDAV.m with 97% similarity]
SoObjects/SOGo/SOGoFolder.h
SoObjects/SOGo/SOGoFolder.m
SoObjects/SOGo/SOGoGCSFolder.h
SoObjects/SOGo/SOGoGCSFolder.m

index 3e2a6bc8121c2eb2a02eb1f8bd87922467e9edd1..392b9c753b29d4c7bb942f6ca52fd514907ab614 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2007-11-07  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
+       * SoObjects/SOGo/SOGoGCSFolder.m ([-compare:otherFolder]): method
+       moved into the SOGoFolder class.
+
+       * SoObjects/Appointments/SOGoAppointmentObject.m
+       ([SOGoAppointmentObject -saveContentString:_iCalinUIDs:_uids]):
+       simplified method by directly building a similar appointment
+       object with the current folder as container.
+
+       * SoObjects/Contacts/SOGoContactLDAPFolder.m
+       ([SOGoContactLDAPFolder
+       -appendObject:objectwithBaseURL:baseURLtoREPORTResponse:r]):
+       take the content of an object returned by
+       lookupName:inContext:acquire: instead of the dictionary passed as
+       parameter since it represents a flattened entry return by
+       lookupContactsWithFilter...
+
+       * SoObjects/Contacts/SOGoFolder+CardDAV.m: NSObject+CardDAV
+       category renamed to SOGoFolder+CardDAV.
+
        * SoObjects/SOGo/SOGoParentFolder.m: no longer a subclass of
        SOGoObject, but of SOGoFolder instead.
 
index c76a2b494b3e416593f4fa5db3a14da108d02e2b..174e5dacbf8f3223c04ec5a88b7a96f8a489935a 100644 (file)
@@ -18,7 +18,6 @@
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
-// $Id$
 
 
 #ifndef        __Appointments_SOGoFreeBusyObject_H_
index 37c9ad23fd2589049bd9e6a6e63fcee9568498c1..3f08626cf8f3dcf88a86c3f95027927490b7e2ee 100644 (file)
@@ -8,8 +8,8 @@ BUNDLE_NAME = Contacts
 Contacts_PRINCIPAL_CLASS = SOGoContactsProduct
 
 Contacts_OBJC_FILES =                  \
-       NSObject+CardDAV.m              \
        Product.m                       \
+       SOGoFolder+CardDAV.m            \
        SOGoContactFolders.m            \
        SOGoContactGCSEntry.m           \
        SOGoContactGCSFolder.m          \
index 709e4ae620c2b22af57bd381be4dff4a8a1b9ffe..0b6f4a6ced78c3ffb09a9f1f9129875a0cd6c00d 100644 (file)
 
 #import <Foundation/NSObject.h>
 
-@class NSString, NSArray;
-@class SOGoContactObject;
-@class SOGoObject;
-@class WOResponse;
-
-@protocol SOGoContactObject;
-
 #import <SoObjects/SOGo/SOGoFolder.h>
 
+@class NSArray;
+@class NSDictionary;
+@class NSString;
+@class WOResponse;
+
 @protocol SOGoContactFolder <NSObject>
 
 - (void) appendObject: (NSDictionary *) object
index 2d75c8f0c489dd87c3ba93f3d49d7521769d5f64..234e24af3697275aabe03c8ce62f033967a9ed6c 100644 (file)
 {
   LDAPUserManager *um;
   NSEnumerator *sourceIDs;
-  NSString *currentSourceID, *displayName;
+  NSString *currentSourceID, *srcDisplayName;
   SOGoContactLDAPFolder *currentFolder;
 
   um = [LDAPUserManager sharedUserManager];
   sourceIDs = [[um addressBookSourceIDs] objectEnumerator]; 
   currentSourceID = [sourceIDs nextObject];
-  while (currentSourceID)
+  while ((currentSourceID = [sourceIDs nextObject]))
     {
-      displayName = [um displayNameForSourceWithID: currentSourceID];
+      srcDisplayName = [um displayNameForSourceWithID: currentSourceID];
       currentFolder = [SOGoContactLDAPFolder folderWithName: currentSourceID
-                                            andDisplayName: displayName
+                                            andDisplayName: srcDisplayName
                                             inContainer: self];
       [currentFolder setLDAPSource: [um sourceWithID: currentSourceID]];
       [subFolders setObject: currentFolder forKey: currentSourceID];
-      currentSourceID = [sourceIDs nextObject];
     }
 }
 
index a6f6f0eed14a1ebae1bce08f0e74e9e786935875..06690a022641cca5d853fb06da841e58ffac641b 100644 (file)
@@ -25,7 +25,7 @@
 #import <SoObjects/SOGo/SOGoGCSFolder.h>
 
 #import "SOGoContactFolder.h"
-#import "NSObject+CardDAV.h"
+#import "SOGoFolder+CardDAV.h"
 
 @class NSArray;
 @class NSString;
index f248f51461656534782a8786f17e796d890153c8..e917d40ccc0b7150b3095e8bf8efbbda804e69e0 100644 (file)
   return records;
 }
 
+#warning this should be unified within SOGoFolder
 - (void) appendObject: (NSDictionary *) object
           withBaseURL: (NSString *) baseURL
      toREPORTResponse: (WOResponse *) r
 {
   SOGoContactGCSEntry *component;
-  Class componentClass;
   NSString *name, *etagLine, *contactString;
 
   name = [object objectForKey: @"c_name"];
-  componentClass = [SOGoContactGCSEntry class];
-
-  component = [componentClass objectWithName: name inContainer: self];
+  component = [self lookupName: name inContext: context acquire: NO];
 
   [r appendContentString: @"  <D:response>\r\n"];
   [r appendContentString: @"    <D:href>"];
index 7cddf7e60da8d38f24e39bd4793510a79aa0ae90..a9fdac90963e5bee2674607a239d2a5b12110d88 100644 (file)
 #define SOGOCONTACTLDAPFOLDER_H
 
 #import "SOGoContactFolder.h"
-#import "NSObject+CardDAV.h"
+#import "SOGoFolder+CardDAV.h"
 
 @class NSMutableDictionary;
 
 @class LDAPSource;
 
-@interface SOGoContactLDAPFolder : SOGoObject <SOGoContactFolder>
+@interface SOGoContactLDAPFolder : SOGoFolder <SOGoContactFolder>
 {
   NSString *displayName;
   LDAPSource *ldapSource;
index bc684ca3971fe5333bec812a8898511888e82989..dd1bfd3c2d281a75d4042fd24b45540d3d999d5f 100644 (file)
 
 @implementation SOGoContactLDAPFolder
 
+#warning this should be unified within SOGoFolder
 - (void) appendObject: (NSDictionary *) object
           withBaseURL: (NSString *) baseURL
      toREPORTResponse: (WOResponse *) r
 {
   SOGoContactLDIFEntry *component;
-  Class componentClass;
   NSString *name, *etagLine, *contactString;
 
   name = [object objectForKey: @"c_name"];
-  componentClass = [SOGoContactLDIFEntry class];
-
-  component = [componentClass contactEntryWithName: name
-                             withLDIFEntry: object  inContainer: self];
+  component = [self lookupName: name inContext: context acquire: NO];
 
   [r appendContentString: @"  <D:response>\r\n"];
   [r appendContentString: @"    <D:href>"];
   if (!obj)
     {
       ldifEntry = [ldapSource lookupContactEntry: objectName];
-#if 0
       obj = ((ldifEntry)
             ? [SOGoContactLDIFEntry contactEntryWithName: objectName
                                     withLDIFEntry: ldifEntry
                                     inContainer: self]
             : [NSException exceptionWithHTTPStatus: 404]);
-#else
-      if (ldifEntry)
-       obj = [SOGoContactLDIFEntry contactEntryWithName: objectName
-                                   withLDIFEntry: ldifEntry
-                                   inContainer: self];
-      else
-       {
-         NSArray *davNamespaces;
-         NSDictionary *davInvocation;
-         NSString *objcMethod;
-         
-         davNamespaces = [self davNamespaces];
-         if ([davNamespaces count] > 0)
-           {
-             davInvocation = [objectName asDavInvocation];
-             if (davInvocation
-                 && [davNamespaces
-                      containsObject: [davInvocation objectForKey: @"ns"]])
-               {
-                 objcMethod = [[davInvocation objectForKey: @"method"]
-                            davMethodToObjC];
-                 obj = [[SoSelectorInvocation alloc]
-                         initWithSelectorNamed:
-                           [NSString stringWithFormat: @"%@:", objcMethod]
-                         addContextParameter: YES];
-                 [obj autorelease];
-               }
-           }
-       }
-#endif
     }
 
   return obj;
similarity index 92%
rename from SoObjects/Contacts/NSObject+CardDAV.h
rename to SoObjects/Contacts/SOGoFolder+CardDAV.h
index d87dff40fbabd19aad032ac6d7c94d3f06c1f19e..056f5c418f41ba08fb83134e213456aca501a97e 100644 (file)
@@ -23,7 +23,9 @@
 #ifndef __Contacts_NSObject_CardDAV_H__
 #define __Contacts_NSObject_CardDAV_H__
 
-@interface NSObject (CardDAV)
+#import "SOGoContactFolder.h"
+
+@interface SOGoFolder (CardDAV) <SOGoContactFolder>
 
 - (id) davAddressbookQuery: (id) queryContext;
 
similarity index 97%
rename from SoObjects/Contacts/NSObject+CardDAV.m
rename to SoObjects/Contacts/SOGoFolder+CardDAV.m
index 2fed99dcb5c55a7023ec282bb1c6b3d26646e294..18b739de2fb23312d13bc567d96694cc3301bbd8 100644 (file)
 #import "SOGoContactFolder.h"
 #import "SOGoContactGCSEntry.h"
 
-@implementation NSObject (CardDAV)
+@implementation SOGoFolder (CardDAV)
 
 - (void) _appendComponentsMatchingFilters: (NSArray *) filters
                                toResponse: (WOResponse *) response
-                                 context: (id) context
+                                 context: (id) localContext
 {
   unsigned int count, max;
   NSDictionary *currentFilter, *contact;
@@ -46,7 +46,7 @@
   SOGoObject <SOGoContactFolder> *o;
 
   o = (id<SOGoContactFolder>)self;
-  baseURL = [o baseURLInContext: context];
+  baseURL = [o baseURLInContext: localContext];
   
   max = [filters count];
   for (count = 0; count < max; count++)
index ee5de48e40784f50ebd670af4eab42d37421cada..1292b96e39e9df7e3f3bf087253bad2b022d0414 100644 (file)
@@ -35,6 +35,9 @@
 
 - (NSString *) folderType;
 
+/* sorting */
+- (NSComparisonResult) compare: (id) otherFolder;
+
 /* dav */
 - (NSArray *) davNamespaces;
 
index af83275ead92aa560a5b3dd0f4904b399c25e583..3f49d254fb38c42a57bdc7434ac7f30cb3c79c00 100644 (file)
   return [[self davURL] absoluteString];
 }
 
+/* sorting */
+- (NSComparisonResult) _compareByOrigin: (SOGoFolder *) otherFolder
+{
+  NSArray *thisElements, *otherElements;
+  unsigned thisCount, otherCount;
+  NSComparisonResult comparison;
+
+  thisElements = [nameInContainer componentsSeparatedByString: @"_"];
+  otherElements = [[otherFolder nameInContainer]
+                   componentsSeparatedByString: @"_"];
+  thisCount = [thisElements count];
+  otherCount = [otherElements count];
+  if (thisCount == otherCount)
+    {
+      if (thisCount == 1)
+       comparison = NSOrderedSame;
+      else
+       comparison = [[thisElements objectAtIndex: 0]
+                      compare: [otherElements objectAtIndex: 0]];
+    }
+  else
+    {
+      if (thisCount > otherCount)
+       comparison = NSOrderedDescending;
+      else
+       comparison = NSOrderedAscending;
+    }
+
+  return comparison;
+}
+
+- (NSComparisonResult) _compareByNameInContainer: (SOGoFolder *) otherFolder
+{
+  NSString *otherName;
+  NSComparisonResult comparison;
+
+  otherName = [otherFolder nameInContainer];
+  if ([nameInContainer hasSuffix: @"personal"])
+    {
+      if ([otherName hasSuffix: @"personal"])
+       comparison = [nameInContainer compare: otherName];
+      else
+       comparison = NSOrderedAscending;
+    }
+  else
+    {
+      if ([otherName hasSuffix: @"personal"])
+       comparison = NSOrderedDescending;
+      else
+       comparison = NSOrderedSame;
+    }
+
+  return comparison;
+}
+
+- (NSComparisonResult) compare: (id) otherFolder
+{
+  NSComparisonResult comparison;
+
+  comparison = [self _compareByOrigin: otherFolder];
+  if (comparison == NSOrderedSame)
+    {
+      comparison = [self _compareByNameInContainer: otherFolder];
+      if (comparison == NSOrderedSame)
+       comparison
+         = [[self displayName]
+             localizedCaseInsensitiveCompare: [otherFolder displayName]];
+    }
+
+  return comparison;
+}
+
 /* WebDAV */
 
 - (NSArray *) davNamespaces
index 9e331452e571db7d19e5e1058960f30a1e7e4ad5..21fb8934ab5878686355fbbbaaf3f07c1283d541 100644 (file)
@@ -71,9 +71,6 @@
 
 - (BOOL) folderIsMandatory;
 
-/* sorting */
-- (NSComparisonResult) compare: (SOGoGCSFolder *) otherFolder;
-
 - (BOOL) create;
 - (NSException *) delete;
 - (void) renameTo: (NSString *) newName;
index 2caaa6878e8e4ae0f832853f6db3bd577cfae02d..42c5974a73c5970947bb1fbcfdacef3496091e7b 100644 (file)
@@ -635,77 +635,6 @@ static NSString *defaultUserID = @"<default>";
   return defaultUserID;
 }
 
-- (NSComparisonResult) _compareByOrigin: (SOGoFolder *) otherFolder
-{
-  NSArray *thisElements, *otherElements;
-  unsigned thisCount, otherCount;
-  NSComparisonResult comparison;
-
-  thisElements = [nameInContainer componentsSeparatedByString: @"_"];
-  otherElements = [[otherFolder nameInContainer]
-                   componentsSeparatedByString: @"_"];
-  thisCount = [thisElements count];
-  otherCount = [otherElements count];
-  if (thisCount == otherCount)
-    {
-      if (thisCount == 1)
-       comparison = NSOrderedSame;
-      else
-       comparison = [[thisElements objectAtIndex: 0]
-                      compare: [otherElements objectAtIndex: 0]];
-    }
-  else
-    {
-      if (thisCount > otherCount)
-       comparison = NSOrderedDescending;
-      else
-       comparison = NSOrderedAscending;
-    }
-
-  return comparison;
-}
-
-- (NSComparisonResult) _compareByNameInContainer: (SOGoFolder *) otherFolder
-{
-  NSString *otherName;
-  NSComparisonResult comparison;
-
-  otherName = [otherFolder nameInContainer];
-  if ([nameInContainer hasSuffix: @"personal"])
-    {
-      if ([otherName hasSuffix: @"personal"])
-       comparison = [nameInContainer compare: otherName];
-      else
-       comparison = NSOrderedAscending;
-    }
-  else
-    {
-      if ([otherName hasSuffix: @"personal"])
-       comparison = NSOrderedDescending;
-      else
-       comparison = NSOrderedSame;
-    }
-
-  return comparison;
-}
-
-- (NSComparisonResult) compare: (SOGoGCSFolder *) otherFolder
-{
-  NSComparisonResult comparison;
-
-  comparison = [self _compareByOrigin: otherFolder];
-  if (comparison == NSOrderedSame)
-    {
-      comparison = [self _compareByNameInContainer: otherFolder];
-      if (comparison == NSOrderedSame)
-       comparison
-         = [[self displayName]
-             localizedCaseInsensitiveCompare: [otherFolder displayName]];
-    }
-
-  return comparison;
-}
-
 /* description */
 
 - (void) appendAttributesToDescription: (NSMutableString *) _ms