bugFix#2823
parent
b6be4e6e2f
commit
302e40a1c3
|
@ -1761,26 +1761,26 @@ static NSString *userAgent = nil;
|
||||||
{
|
{
|
||||||
SOGoUserDefaults *ud;
|
SOGoUserDefaults *ud;
|
||||||
ud = [[context activeUser] userDefaults];
|
ud = [[context activeUser] userDefaults];
|
||||||
|
|
||||||
if ([ud mailAddOutgoingAddresses])
|
if ([ud mailAddOutgoingAddresses])
|
||||||
{
|
{
|
||||||
|
Class contactGCSEntry;
|
||||||
SOGoContactFolders *contactFolders;
|
SOGoContactFolders *contactFolders;
|
||||||
NGMailAddressParser *parser;
|
|
||||||
id parsedRecipient;
|
|
||||||
SOGoContactFolder *folder;
|
SOGoContactFolder *folder;
|
||||||
SOGoContactGCSEntry *newContact;
|
SOGoContactGCSEntry *newContact;
|
||||||
NGVCard *card;
|
NGVCard *card;
|
||||||
Class contactGCSEntry;
|
NGMailAddressParser *parser;
|
||||||
|
NSArray *matchingContacts;
|
||||||
NSMutableArray *recipients;
|
NSMutableArray *recipients;
|
||||||
NSString *recipient, *emailAddress, *addressBook, *uid;
|
NSString *recipient, *emailAddress, *addressBook, *uid;
|
||||||
NSArray *matchingContacts;
|
id parsedRecipient;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Get all the addressbooks
|
// Get all the addressbooks
|
||||||
contactFolders = [[[context activeUser] homeFolderInContext: context]
|
contactFolders = [[[context activeUser] homeFolderInContext: context]
|
||||||
lookupName: @"Contacts"
|
lookupName: @"Contacts"
|
||||||
inContext: context
|
inContext: context
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
// Get all the recipients from the current email
|
// Get all the recipients from the current email
|
||||||
recipients = [self allRecipients];
|
recipients = [self allRecipients];
|
||||||
for (i = 0; i < [recipients count]; i++)
|
for (i = 0; i < [recipients count]; i++)
|
||||||
|
@ -1790,7 +1790,7 @@ static NSString *userAgent = nil;
|
||||||
parser = [NGMailAddressParser mailAddressParserWithString: recipient];
|
parser = [NGMailAddressParser mailAddressParserWithString: recipient];
|
||||||
parsedRecipient = [parser parse];
|
parsedRecipient = [parser parse];
|
||||||
emailAddress = [parsedRecipient address];
|
emailAddress = [parsedRecipient address];
|
||||||
|
|
||||||
matchingContacts = [contactFolders allContactsFromFilter: emailAddress
|
matchingContacts = [contactFolders allContactsFromFilter: emailAddress
|
||||||
excludeGroups: YES
|
excludeGroups: YES
|
||||||
excludeLists: YES];
|
excludeLists: YES];
|
||||||
|
|
|
@ -164,34 +164,45 @@ static SoSecurityManager *sm = nil;
|
||||||
NSString *folderName;
|
NSString *folderName;
|
||||||
SOGoGCSFolder *folder;
|
SOGoGCSFolder *folder;
|
||||||
SOGoUser *folderOwner;
|
SOGoUser *folderOwner;
|
||||||
|
SOGoUserDefaults *ud;
|
||||||
|
|
||||||
roles = [[context activeUser] rolesForObject: self inContext: context];
|
roles = [[context activeUser] rolesForObject: self inContext: context];
|
||||||
folderOwner = [SOGoUser userWithLogin: [self ownerInContext: context]];
|
folderOwner = [SOGoUser userWithLogin: [self ownerInContext: context]];
|
||||||
|
|
||||||
|
|
||||||
// We autocreate the calendars if the user is the owner, a superuser or
|
// 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
|
// if it's a resource as we won't necessarily want to login as a resource
|
||||||
// in order to create its database tables.
|
// 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] ||
|
if ([roles containsObject: SoRole_Owner] ||
|
||||||
(folderOwner && [folderOwner isResource]))
|
(folderOwner && [folderOwner isResource]))
|
||||||
|
{
|
||||||
|
if (folderType == SOGoPersonalFolder)
|
||||||
{
|
{
|
||||||
if (folderType == SOGoPersonalFolder)
|
folderName = @"personal";
|
||||||
{
|
folder = [subFolderClass objectWithName: folderName inContainer: self];
|
||||||
folderName = @"personal";
|
[folder setDisplayName: [self defaultFolderName]];
|
||||||
folder = [subFolderClass objectWithName: folderName inContainer: self];
|
|
||||||
[folder setDisplayName: [self defaultFolderName]];
|
|
||||||
}
|
|
||||||
else if (folderType == SOGoCollectedFolder)
|
|
||||||
{
|
|
||||||
folderName = @"collected";
|
|
||||||
folder = [subFolderClass objectWithName: folderName inContainer: self];
|
|
||||||
[folder setDisplayName: [self collectedFolderName]];
|
|
||||||
}
|
|
||||||
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
|
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
|
||||||
|
|
||||||
if ([folder create])
|
if ([folder create])
|
||||||
[subFolders setObject: folder forKey: folderName];
|
[subFolders setObject: folder forKey: folderName];
|
||||||
}
|
}
|
||||||
|
else if (folderType == SOGoCollectedFolder)
|
||||||
|
{
|
||||||
|
ud = [[context activeUser] userDefaults];
|
||||||
|
if ([ud mailAddOutgoingAddresses]) {
|
||||||
|
folderName = @"collected";
|
||||||
|
folder = [subFolderClass objectWithName: folderName inContainer: self];
|
||||||
|
[folder setDisplayName: [self collectedFolderName]];
|
||||||
|
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
|
||||||
|
|
||||||
|
if ([folder create])
|
||||||
|
[subFolders setObject: folder forKey: folderName];
|
||||||
|
|
||||||
|
[ud setSelectedAddressBook:folderName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSException *) fetchSpecialFolders: (NSString *) sql
|
- (NSException *) fetchSpecialFolders: (NSString *) sql
|
||||||
|
|
|
@ -699,47 +699,49 @@ static NSArray *reminderValues = nil;
|
||||||
/* We want all the SourceIDS */
|
/* We want all the SourceIDS */
|
||||||
NSMutableArray *folders, *availableAddressBooksID, *availableAddressBooksName;
|
NSMutableArray *folders, *availableAddressBooksID, *availableAddressBooksName;
|
||||||
SOGoParentFolder *contactFolders;
|
SOGoParentFolder *contactFolders;
|
||||||
|
|
||||||
int i, count;
|
int i, count;
|
||||||
BOOL collectedAlreadyExist;
|
BOOL collectedAlreadyExist;
|
||||||
|
|
||||||
contactFolders = [[[context activeUser] homeFolderInContext: context]
|
contactFolders = [[[context activeUser] homeFolderInContext: context]
|
||||||
lookupName: @"Contacts"
|
lookupName: @"Contacts"
|
||||||
inContext: context
|
inContext: context
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
folders = [NSMutableArray arrayWithArray: [contactFolders subFolders]];
|
folders = [NSMutableArray arrayWithArray: [contactFolders subFolders]];
|
||||||
count = [folders count]-1;
|
count = [folders count]-1;
|
||||||
|
|
||||||
// Inside this loop we remove all the public or shared addressbooks
|
// Inside this loop we remove all the public or shared addressbooks
|
||||||
for (; count >= 0; count--)
|
for (; count >= 0; count--)
|
||||||
{
|
{
|
||||||
if (![[folders objectAtIndex: count] isKindOfClass: [SOGoContactGCSFolder class]])
|
if (![[folders objectAtIndex: count] isKindOfClass: [SOGoContactGCSFolder class]])
|
||||||
[folders removeObjectAtIndex: count];
|
[folders removeObjectAtIndex: count];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the objects in order to have only the displayName of the addressbooks to be displayed on the preferences interface
|
// Parse the objects in order to have only the displayName of the addressbooks to be displayed on the preferences interface
|
||||||
availableAddressBooksID = [NSMutableArray arrayWithCapacity: [folders count]];
|
availableAddressBooksID = [NSMutableArray arrayWithCapacity: [folders count]];
|
||||||
availableAddressBooksName = [NSMutableArray arrayWithCapacity: [folders count]];
|
availableAddressBooksName = [NSMutableArray arrayWithCapacity: [folders count]];
|
||||||
count = [folders count]-1;
|
count = [folders count]-1;
|
||||||
collectedAlreadyExist = NO;
|
collectedAlreadyExist = NO;
|
||||||
|
|
||||||
for (i = 0; i <= count ; i++) {
|
for (i = 0; i <= count ; i++) {
|
||||||
[availableAddressBooksID addObject:[[folders objectAtIndex:i] realNameInContainer]];
|
[availableAddressBooksID addObject:[[folders objectAtIndex:i] realNameInContainer]];
|
||||||
[availableAddressBooksName addObject:[[folders objectAtIndex:i] displayName]];
|
[availableAddressBooksName addObject:[[folders objectAtIndex:i] displayName]];
|
||||||
|
|
||||||
if ([[availableAddressBooksID objectAtIndex:i] isEqualToString: @"collected"])
|
if ([[availableAddressBooksID objectAtIndex:i] isEqualToString: @"collected"])
|
||||||
collectedAlreadyExist = YES;
|
collectedAlreadyExist = YES;
|
||||||
}
|
}
|
||||||
// Create the dictionary for the next function : itemAddressBookText.
|
// Create the dictionary for the next function : itemAddressBookText.
|
||||||
if (!addressBooksIDWithDisplayName)
|
if (!addressBooksIDWithDisplayName)
|
||||||
|
{
|
||||||
addressBooksIDWithDisplayName = [[NSMutableDictionary alloc] initWithObjects:availableAddressBooksName
|
addressBooksIDWithDisplayName = [[NSMutableDictionary alloc] initWithObjects:availableAddressBooksName
|
||||||
forKeys:availableAddressBooksID];
|
forKeys:availableAddressBooksID];
|
||||||
if (!collectedAlreadyExist)
|
}
|
||||||
{
|
if (!collectedAlreadyExist)
|
||||||
[availableAddressBooksID addObject: @"collected"];
|
{
|
||||||
[addressBooksIDWithDisplayName setObject: [self labelForKey: @"Collected Address Book"] forKey: @"collected"];
|
[availableAddressBooksID addObject: @"collected"];
|
||||||
}
|
[addressBooksIDWithDisplayName setObject: [self labelForKey: @"Collected Address Book"] forKey: @"collected"];
|
||||||
|
}
|
||||||
|
|
||||||
return availableAddressBooksID;
|
return availableAddressBooksID;
|
||||||
}
|
}
|
||||||
- (NSString *) itemAddressBookText
|
- (NSString *) itemAddressBookText
|
||||||
|
|
|
@ -299,7 +299,8 @@
|
||||||
<dd><input type="checkbox"
|
<dd><input type="checkbox"
|
||||||
const:name="addOutgoingAddresses"
|
const:name="addOutgoingAddresses"
|
||||||
const:id="addOutgoingAddresses"
|
const:id="addOutgoingAddresses"
|
||||||
var:checked="addOutgoingAddresses" />
|
var:checked="addOutgoingAddresses"
|
||||||
|
onChange = "onAddOutgoingAddressesCheck(this);"/>
|
||||||
<var:string label:value="When sending mail, add unknown recipients to my"/><br/>
|
<var:string label:value="When sending mail, add unknown recipients to my"/><br/>
|
||||||
<var:popup list="addressBookList" item="item"
|
<var:popup list="addressBookList" item="item"
|
||||||
const:id="addressBookList"
|
const:id="addressBookList"
|
||||||
|
|
|
@ -291,6 +291,7 @@ function initPreferences() {
|
||||||
$("vacationEndDate_date").disable();
|
$("vacationEndDate_date").disable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onAddOutgoingAddressesCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSieveFilters() {
|
function initSieveFilters() {
|
||||||
|
@ -1172,8 +1173,15 @@ function serializeContactsCategories() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* / contact categories */
|
/* / contact categories */
|
||||||
|
|
||||||
|
function onAddOutgoingAddressesCheck(checkBox) {
|
||||||
|
if (!checkBox) {
|
||||||
|
checkBox = $("addOutgoingAddresses");
|
||||||
|
}
|
||||||
|
$("addressBookList").disabled = !checkBox.checked;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function onReplyPlacementListChange() {
|
function onReplyPlacementListChange() {
|
||||||
if ($("replyPlacementList").value == 0) {
|
if ($("replyPlacementList").value == 0) {
|
||||||
// Reply placement is above quote, signature can be place before of after quote
|
// Reply placement is above quote, signature can be place before of after quote
|
||||||
|
|
Loading…
Reference in New Issue