diff --git a/ChangeLog b/ChangeLog index 4fcdd571f..5121bf2f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,52 @@ add CardDAV stuff. Currently only implements the addressbook-home-set report from the principal URL. +2009-02-06 Wolfgang Sourdeau + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([SOGoAppointmentFolder + -fetchFields:_fieldsfrom:_startDateto:_endDatetitle:titlecomponent:_componentadditionalFilters:filtersincludeProtectedInformation:_includeProtectedInformation]): + added the "c_cycleinfo" and "c_cycleenddate" fields to the list of + fields that should not be stripped when removing protected informations. + + * UI/Scheduler/UIxTaskEditor.m ([UIxTaskEditor -dealloc]) + ([UIxTaskEditor -todo]): same as below (apts). + + * UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor + -event]): retain the event parent calendar object instead of the + event itself. + ([UIxAppointmentEditor -dealloc]): release the above calendar. + + * UI/MailPartViewers/UIxMailPartICalViewer.m + ([UIxMailPartICalViewer -dealloc]): no longer release "inEvent" + since it does not need to be retained. + + * Main/SOGo.m ([SOGo +initialize]): added handling of the + "SOGoDebugLeaks" configuration variable. + ([SOGo -dispatchRequest:_request]): log the classes of instances + that were leaked between the handling of the request, if + SOGoDebugLeaks is set. + + * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder + -aclsForUser:uidforObjectAtPath:objectPathArray]): cache an empty + array if not acl have been returned for the specified user. + + * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder + -lookupContactsWithFilter:filtersortBy:sortKeyordering:sortOrdering]): + same as below. + ([SOGoContactGCSFolder -fixupContactRecord:contactRecord]): new + method that initializes c_mail, c_screenname, c_o, + c_telephonenumber to empty strings if not found. + + * SoObjects/Contacts/SOGoContactLDAPFolder.m + ([SOGoContactLDAPFolder + -lookupContactsWithFilter:filtersortBy:sortKeyordering:sortOrdering]): + no longer make use of the displayName, mail, screenName, phone and + org intermediary keys. + + * UI/Contacts/UIxContactsListView.m ([-currentCName]): removed + useless method. + 2009-02-05 Francis Lachapelle * UI/SOGoUI/UIxComponent.m ([UIxComponent -responseWithStatus:): diff --git a/Main/SOGo.m b/Main/SOGo.m index 06e5c0942..11a4bad6b 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -19,6 +19,7 @@ 02111-1307, USA. */ +#import #import #import #import @@ -64,6 +65,7 @@ static unsigned int vMemSizeLimit = 0; static BOOL doCrashOnSessionCreate = NO; static BOOL hasCheckedTables = NO; static BOOL debugRequests = NO; +static BOOL debugLeaks = NO; #ifdef GNUSTEP_BASE_LIBRARY static BOOL debugObjectAllocation = NO; @@ -91,6 +93,7 @@ static BOOL debugObjectAllocation = NO; } #endif debugRequests = [ud boolForKey: @"SOGoDebugRequests"]; + debugLeaks = [ud boolForKey: @"SOGoDebugLeaks"]; /* vMem size check - default is 200MB */ tmp = [ud objectForKey: @"SxVMemLimit"]; @@ -394,6 +397,7 @@ static BOOL debugObjectAllocation = NO; static NSArray *runLoopModes = nil; WOResponse *resp; NSDate *startDate, *endDate; + NSAutoreleasePool *pool; if (debugRequests) { @@ -403,6 +407,13 @@ static BOOL debugObjectAllocation = NO; } cache = [SOGoCache sharedCache]; + if (debugLeaks) + { + GSDebugAllocationActive (YES); + GSDebugAllocationList (NO); + pool = [NSAutoreleasePool new]; + } + resp = [super dispatchRequest: _request]; [SOGoCache killCache]; @@ -413,6 +424,15 @@ static BOOL debugObjectAllocation = NO; [endDate timeIntervalSinceDate: startDate]]; } + if (debugLeaks) + { + [resp retain]; + [pool release]; + [resp autorelease]; + NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES)); + GSDebugAllocationActive (NO); + } + if (![self isTerminating]) { if (!runLoopModes) diff --git a/SOPE/NGCards/CardElement.m b/SOPE/NGCards/CardElement.m index 56d04798c..079221f37 100644 --- a/SOPE/NGCards/CardElement.m +++ b/SOPE/NGCards/CardElement.m @@ -105,7 +105,6 @@ - (void) dealloc { - [parent release]; [tag release]; [group release]; [attributes release]; @@ -115,8 +114,7 @@ - (void) setParent: (CardGroup *) aParent { -#warning THIS CAUSES A LEAK. We need this for the moment because of a design error. - ASSIGN (parent, aParent); + parent = aParent; } - (id) parent diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index 4191fcce8..ed8f6fcdc 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,4 +1,4 @@ -2008-12-15 Wolfgang Sourdeau +2009-02-06 Wolfgang Sourdeau * CardElement.m ([CardElement -setParent:aParent]): no longer retain the parent passed as parameter. diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 61c08a612..f46ed34b5 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -880,6 +880,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir @"c_uid", @"c_startdate", @"c_enddate", @"c_isallday", @"c_iscycle", @"c_isopaque", + @"c_cycleinfo", + @"c_cycleenddate", @"c_classification", @"c_component", nil]]; } diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.h b/SoObjects/Contacts/SOGoContactGCSFolder.h index 06690a022..377cc5700 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.h +++ b/SoObjects/Contacts/SOGoContactGCSFolder.h @@ -32,6 +32,8 @@ @interface SOGoContactGCSFolder : SOGoGCSFolder +- (void) fixupContactRecord: (NSMutableDictionary *) contactRecord; + @end #endif /* __Contacts_SOGoContactGCSFolder_H__ */ diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index 927a4adaa..e4689cb65 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -232,13 +232,33 @@ return qualifier; } +- (void) fixupContactRecord: (NSMutableDictionary *) contactRecord +{ + NSString *data; + + data = [contactRecord objectForKey: @"c_cn"]; + if (![data length]) + { + data = [contactRecord keysWithFormat: @"%{c_givenname} %{c_sn}"]; + [contactRecord setObject: data forKey: @"c_cn"]; + } + + if (![contactRecord objectForKey: @"c_mail"]) + [contactRecord setObject: @"" forKey: @"c_mail"]; + if (![contactRecord objectForKey: @"c_screenname"]) + [contactRecord setObject: @"" forKey: @"c_screenname"]; + if (![contactRecord objectForKey: @"c_o"]) + [contactRecord setObject: @"" forKey: @"c_o"]; + if (![contactRecord objectForKey: @"c_telephonenumber"]) + [contactRecord setObject: @"" forKey: @"c_telephonenumber"]; +} + - (NSArray *) _flattenedRecords: (NSArray *) records { NSMutableArray *newRecords; NSEnumerator *oldRecords; NSDictionary *oldRecord; NSMutableDictionary *newRecord; - NSString *data; newRecords = [NSMutableArray arrayWithCapacity: [records count]]; @@ -246,40 +266,8 @@ oldRecord = [oldRecords nextObject]; while (oldRecord) { - newRecord = [NSMutableDictionary new]; - [newRecord autorelease]; - - [newRecord setObject: [oldRecord objectForKey: @"c_name"] - forKey: @"c_uid"]; - [newRecord setObject: [oldRecord objectForKey: @"c_name"] - forKey: @"c_name"]; - - data = [oldRecord objectForKey: @"c_cn"]; - if (![data length]) - data = [oldRecord keysWithFormat: @"%{c_givenname} %{c_sn}"]; - [newRecord setObject: data - forKey: @"displayName"]; - - data = [oldRecord objectForKey: @"c_mail"]; - if (!data) - data = @""; - [newRecord setObject: data forKey: @"mail"]; - - data = [oldRecord objectForKey: @"c_screenname"]; - if (!data) - data = @""; - [newRecord setObject: data forKey: @"screenName"]; - - data = [oldRecord objectForKey: @"c_o"]; - if (!data) - data = @""; - [newRecord setObject: data forKey: @"org"]; - - data = [oldRecord objectForKey: @"c_telephonenumber"]; - if (![data length]) - data = @""; - [newRecord setObject: data forKey: @"phone"]; - + newRecord = [NSMutableDictionary dictionaryWithDictionary: oldRecord]; + [self fixupContactRecord: newRecord]; [newRecords addObject: newRecord]; oldRecord = [oldRecords nextObject]; } diff --git a/SoObjects/Contacts/SOGoContactLDAPFolder.m b/SoObjects/Contacts/SOGoContactLDAPFolder.m index 0f726b732..21a69bc4a 100644 --- a/SoObjects/Contacts/SOGoContactLDAPFolder.m +++ b/SoObjects/Contacts/SOGoContactLDAPFolder.m @@ -167,11 +167,12 @@ if (!obj) { ldifEntry = [ldapSource lookupContactEntryWithUIDorEmail: objectName]; - obj = ((ldifEntry) - ? [SOGoContactLDIFEntry contactEntryWithName: objectName - withLDIFEntry: ldifEntry - inContainer: self] - : [NSException exceptionWithHTTPStatus: 404]); + if (ldifEntry) + obj = [SOGoContactLDIFEntry contactEntryWithName: objectName + withLDIFEntry: ldifEntry + inContainer: self]; + else + obj = [NSException exceptionWithHTTPStatus: 404]; } return obj; @@ -212,24 +213,24 @@ data = [oldRecord objectForKey: @"c_cn"]; if (!data) data = @""; - [newRecord setObject: data forKey: @"displayName"]; + [newRecord setObject: data forKey: @"c_cn"]; data = [oldRecord objectForKey: @"mail"]; if (!data) data = @""; - [newRecord setObject: data forKey: @"mail"]; + [newRecord setObject: data forKey: @"c_mail"]; data = [oldRecord objectForKey: @"nsAIMid"]; if (![data length]) data = [oldRecord objectForKey: @"nscpaimscreenname"]; if (![data length]) data = @""; - [newRecord setObject: data forKey: @"screenName"]; + [newRecord setObject: data forKey: @"c_screenname"]; data = [oldRecord objectForKey: @"o"]; if (!data) data = @""; - [newRecord setObject: data forKey: @"org"]; + [newRecord setObject: data forKey: @"c_o"]; data = [oldRecord objectForKey: @"telephoneNumber"]; if (![data length]) @@ -238,7 +239,7 @@ data = [oldRecord objectForKey: @"homePhone"]; if (![data length]) data = @""; - [newRecord setObject: data forKey: @"phone"]; + [newRecord setObject: data forKey: @"c_telephonenumber"]; contactInfo = [ud stringForKey: @"SOGoLDAPContactInfoAttribute"]; if ([contactInfo length] > 0) { diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index d36eead45..8ae3a117b 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -817,6 +817,8 @@ static NSArray *childRecordFields = nil; if (!acls) { acls = [self _fetchAclsForUser: uid forObjectAtPath: objectPath]; + if (!acls) + acls = [NSArray array]; [self _cacheRoles: acls forUser: uid forObjectAtPath: objectPath]; } diff --git a/UI/Contacts/UIxContactsListView.m b/UI/Contacts/UIxContactsListView.m index e6b2e2ad1..eeed561c3 100644 --- a/UI/Contacts/UIxContactsListView.m +++ b/UI/Contacts/UIxContactsListView.m @@ -60,15 +60,6 @@ return currentContact; } -- (NSString *) currentCName -{ - NSString *cName; - - cName = [currentContact objectForKey: @"c_name"]; - - return [cName stringByEscapingURL]; -} - - (id ) mailerContactsAction { selectorComponentClass = @"UIxContactsMailerSelection"; diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index 5ee210d4c..4a18f0284 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -57,7 +57,6 @@ [attendee release]; [item release]; [inCalendar release]; - [inEvent release]; [dateFormatter release]; [super dealloc]; } @@ -67,7 +66,7 @@ - (void) resetPathCaches { [super resetPathCaches]; - [inEvent release]; inEvent = nil; + inEvent = nil; [inCalendar release]; inCalendar = nil; [storedEventObject release]; storedEventObject = nil; [storedEvent release]; storedEvent = nil; @@ -104,7 +103,7 @@ { events = [[self inCalendar] events]; if ([events count] > 0) - inEvent = [[events objectAtIndex: 0] retain]; + inEvent = [events objectAtIndex: 0]; } return inEvent; diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index ab719ab06..a28b0828f 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -74,7 +74,7 @@ - (void) dealloc { [item release]; - [event release]; + [[event parent] release]; [aptStartDate release]; [aptEndDate release]; [componentCalendar release]; @@ -87,7 +87,7 @@ if (!event) { event = (iCalEvent *) [[self clientObject] occurence]; - [event retain]; + [[event parent] retain]; } return event; diff --git a/UI/Scheduler/UIxTaskEditor.m b/UI/Scheduler/UIxTaskEditor.m index 090fde75f..8d1af4a29 100644 --- a/UI/Scheduler/UIxTaskEditor.m +++ b/UI/Scheduler/UIxTaskEditor.m @@ -67,7 +67,7 @@ [statusDate release]; [status release]; [statusPercent release]; - [todo release]; + [[todo parent] release]; [super dealloc]; } @@ -77,7 +77,7 @@ if (!todo) { todo = (iCalToDo *) [[self clientObject] component: YES secure: YES]; - [todo retain]; + [[todo parent] retain]; } return todo; diff --git a/UI/Templates/ContactsUI/UIxContactsListView.wox b/UI/Templates/ContactsUI/UIxContactsListView.wox index 8520f889c..5dba56529 100644 --- a/UI/Templates/ContactsUI/UIxContactsListView.wox +++ b/UI/Templates/ContactsUI/UIxContactsListView.wox @@ -29,14 +29,13 @@ - - - - - + var:id="currentContact.c_name" + var:contactname="currentContact.c_cn"> + + + + + diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index d97fef2e0..429e94f71 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -351,10 +351,10 @@ function moveTo(uri) { /* contact menu entries */ function onContactRowDblClick(event) { - var contactId = this.getAttribute('contactid'); + var cname = this.getAttribute('id'); openContactWindow(URLForFolderID(Contact.currentAddressBook) - + "/" + contactId + "/edit", contactId); + + "/" + cname + "/edit", cname); return false; } @@ -364,7 +364,7 @@ function onContactSelectionChange(event) { if (rows.length == 1) { var node = $(rows[0]); - loadContact(node.getAttribute('contactid')); + loadContact(node.getAttribute('id')); } else if (rows.length > 1) { $('contactView').update(); @@ -551,7 +551,7 @@ function onConfirmContactSelection(event) { var contactsList = $("contactsList"); var rows = contactsList.getSelectedRows(); for (i = 0; i < rows.length; i++) { - var cid = rows[i].getAttribute("contactid"); + var cid = rows[i].getAttribute("id"); var cname = '' + rows[i].getAttribute("contactname"); var email = '' + rows[i].cells[1].innerHTML; @@ -562,10 +562,10 @@ function onConfirmContactSelection(event) { preventDefault(event); } -function refreshContacts(contactId) { - openContactsFolder(Contact.currentAddressBook, true, contactId); - delete cachedContacts[Contact.currentAddressBook + "/" + contactId]; - loadContact(contactId); +function refreshContacts(cname) { + openContactsFolder(Contact.currentAddressBook, true, cname); + delete cachedContacts[Contact.currentAddressBook + "/" + cname]; + loadContact(cname); return false; } diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index 51aaf5524..8627cd334 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -207,7 +207,7 @@ function openUserFolderSelector(callback, type) { } function openContactWindow(url, wId) { - if (typeof wId == "undefined") + if (!wId) wId = "_blank"; else { wId = sanitizeWindowName(wId); @@ -223,7 +223,7 @@ function openContactWindow(url, wId) { function openMailComposeWindow(url, wId) { var parentWindow = this; - if (typeof wId == "undefined") + if (!wId) wId = "_blank"; else { wId = sanitizeWindowName(wId);