diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 203d390c5..eb590adb6 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -1731,18 +1731,20 @@ static NSString *userAgent = nil; matchingContacts = [contactFolders allContactsFromFilter: emailAddress excludeGroups: YES excludeLists: YES]; + } + // If we don't get any results from the autocompletion code, we add it.. + if ([matchingContacts count] == 0) + { + /* Get the selected addressbook from the user preferences where the new address will be added */ + addressBook = [ud selectedAddressBook]; + folder = [contactFolders lookupName: addressBook inContext: context acquire: NO]; + uid = [folder globallyUniqueObjectId]; - // If we don't get any results from the autocompletion code, we add it.. - if ([matchingContacts count] == 0) + if (!(folder == nil || uid == nil)) { - /* Get the selected addressbook from the user preferences where the new address will be added */ - addressBook = [ud selectedAddressBook]; - folder = [contactFolders lookupName: addressBook inContext: context acquire: NO]; - uid = [folder globallyUniqueObjectId]; - card = [NGVCard cardWithUid: uid]; [card addEmail: emailAddress types: nil]; - + contactGCSEntry = NSClassFromString(@"SOGoContactGCSEntry"); newContact = [contactGCSEntry objectWithName: uid inContainer: folder]; diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index 8d55adbb0..4c7c7c31a 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -171,7 +171,7 @@ static SoSecurityManager *sm = nil; // We autocreate the calendars if the user is the owner, a superuser or // if it's a resource as we won't necessarily want to login as a resource // in order to create its database tables. - // FolderType is an Enum where 0 = Personal and 1 = collected + // FolderType is an enum where 0 = Personal and 1 = collected if ([roles containsObject: SoRole_Owner] || (folderOwner && [folderOwner isResource])) { diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 02adf2ff6..9328084c3 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -717,7 +717,7 @@ static NSArray *reminderValues = nil; count = [folders count]-1; collectedAlreadyExist = false; - for (i=0; i <= count ; i++) { + for (i = 0; i <= count ; i++) { [availableAddressBooksID addObject:[[folders objectAtIndex:i] realNameInContainer]]; [availableAddressBooksName addObject:[[folders objectAtIndex:i] displayName]];