mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-09 21:45:26 +00:00
Monotone-Parent: b3104cb2f524576b6a02514df135076db60274ea
Monotone-Revision: 1471bacc37d4bfc7718c85c0760024d89c4440ef Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-09T19:23:45 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -51,15 +51,13 @@
|
||||
andDisplayName: (NSString *) aDisplayName
|
||||
inContainer: (SOGoObject *) aContainer;
|
||||
|
||||
- (NSString *) nameInContainer;
|
||||
- (NSString *) displayName;
|
||||
|
||||
- (id <SOGoContactObject>) lookupContactWithId: (NSString *) recordId;
|
||||
- (NSArray *) lookupContactsWithFilter: (NSString *) filter
|
||||
sortBy: (NSString *) sortKey
|
||||
ordering: (NSComparisonResult) sortOrdering;
|
||||
|
||||
- (void) setDisplayName: (NSString *) aDisplayName;
|
||||
- (NSString *) displayName;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __Contacts_SOGoContactFolder_H__ */
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
|
||||
#import "SOGoObject.h"
|
||||
|
||||
@class NSString, NSArray, NSDictionary;
|
||||
@class NSArray;
|
||||
@class NSDictionary;
|
||||
@class NSMutableDictionary;
|
||||
@class NSString;
|
||||
|
||||
@class GCSFolder;
|
||||
|
||||
/*
|
||||
@@ -37,10 +41,6 @@
|
||||
cyclic references.
|
||||
*/
|
||||
|
||||
@class NSString;
|
||||
@class GCSFolder;
|
||||
@class NSMutableDictionary;
|
||||
|
||||
@interface SOGoFolder : SOGoObject
|
||||
{
|
||||
NSString *ocsPath;
|
||||
|
||||
@@ -34,10 +34,20 @@
|
||||
lookup.
|
||||
*/
|
||||
|
||||
@class NSString, NSArray, NSMutableString, NSException, NSTimeZone;
|
||||
@class GCSFolderManager, GCSFolder;
|
||||
@class SOGoUserFolder, SOGoGroupsFolder;
|
||||
#import <NGObjWeb/SoObject.h>
|
||||
|
||||
@class NSString;
|
||||
@class NSArray;
|
||||
@class NSMutableString;
|
||||
@class NSException;
|
||||
@class NSTimeZone;
|
||||
|
||||
@class WOContext;
|
||||
@class GCSFolderManager;
|
||||
@class GCSFolder;
|
||||
|
||||
@class SOGoUserFolder;
|
||||
@class SOGoGroupsFolder;
|
||||
@class SOGoDAVSet;
|
||||
|
||||
#define $(class) NSClassFromString(class)
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#import "SOGoUserFolder.h"
|
||||
|
||||
#import "SOGoDAVRendererTypes.h"
|
||||
#import "AgenorUserManager.h"
|
||||
|
||||
#import "SOGoObject.h"
|
||||
|
||||
|
||||
@@ -19,14 +19,18 @@
|
||||
02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/SoObject.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGExtensions/NSNull+misc.h>
|
||||
|
||||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/NSArray+NGCards.h>
|
||||
|
||||
#import <NGObjWeb/SoObject.h>
|
||||
|
||||
#import <Contacts/SOGoContactObject.h>
|
||||
#import <Contacts/SOGoContactFolder.h>
|
||||
#import "common.h"
|
||||
|
||||
#import "UIxContactEditor.h"
|
||||
|
||||
@@ -536,7 +540,8 @@
|
||||
|
||||
- (id) writeAction
|
||||
{
|
||||
NSString *email, *url;
|
||||
NSString *email, *cn, *url;
|
||||
NSMutableString *address;
|
||||
|
||||
card = [[self clientObject] vCard];
|
||||
[self initSnapshot];
|
||||
@@ -546,7 +551,16 @@
|
||||
email = [snapshot objectForKey: @"workMail"];
|
||||
|
||||
if (email)
|
||||
url = [NSString stringWithFormat: @"Mail/compose?mailto=%@", email];
|
||||
{
|
||||
address = [NSMutableString string];
|
||||
cn = [card fn];
|
||||
if ([cn length] > 0)
|
||||
[address appendFormat: @"%@ <%@>", cn, email];
|
||||
else
|
||||
[address appendString: email];
|
||||
|
||||
url = [NSString stringWithFormat: @"Mail/compose?mailto=%@", address];
|
||||
}
|
||||
else
|
||||
url = @"Mail/compose";
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#import <GDLContentStore/GCSFolder.h>
|
||||
#import <GDLContentStore/GCSFolderManager.h>
|
||||
|
||||
#import <SoObjects/SOGo/LDAPUserManager.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/NSString+Utilities.h>
|
||||
#import <SoObjects/Contacts/SOGoContactFolders.h>
|
||||
@@ -93,28 +94,45 @@
|
||||
return [self _selectActionForApplication: @"mailer-contacts"];
|
||||
}
|
||||
|
||||
- (NSArray *) _searchResults: (NSString *) contact
|
||||
ldapFoldersOnly: (BOOL) ldapFoldersOnly
|
||||
- (void) _fillResults: (NSMutableDictionary *) results
|
||||
inFolder: (id <SOGoContactFolder>) folder
|
||||
withSearchOn: (NSString *) contact
|
||||
{
|
||||
NSMutableArray *results;
|
||||
NSEnumerator *folderResults;
|
||||
NSDictionary *currentContact;
|
||||
NSString *uid;
|
||||
|
||||
folderResults = [[folder lookupContactsWithFilter: contact
|
||||
sortBy: @"cn"
|
||||
ordering: NSOrderedAscending] objectEnumerator];
|
||||
currentContact = [folderResults nextObject];
|
||||
while (currentContact)
|
||||
{
|
||||
uid = [currentContact objectForKey: @"c_uid"];
|
||||
if (uid && ![results objectForKey: uid])
|
||||
[results setObject: currentContact
|
||||
forKey: uid];
|
||||
currentContact = [folderResults nextObject];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSDictionary *) _searchResults: (NSString *) contact
|
||||
ldapFoldersOnly: (BOOL) ldapOnly
|
||||
{
|
||||
NSMutableDictionary *results;
|
||||
SOGoContactFolders *topFolder;
|
||||
NSEnumerator *sogoContactFolders;
|
||||
id <SOGoContactFolder> currentFolder;
|
||||
|
||||
results = [NSMutableArray new];
|
||||
[results autorelease];
|
||||
|
||||
results = [NSMutableDictionary dictionary];
|
||||
topFolder = [self clientObject];
|
||||
sogoContactFolders = [[topFolder contactFolders] objectEnumerator];
|
||||
currentFolder = [sogoContactFolders nextObject];
|
||||
while (currentFolder)
|
||||
{
|
||||
if (!ldapFoldersOnly
|
||||
|| [currentFolder isKindOfClass: [SOGoContactLDAPFolder class]])
|
||||
[results addObjectsFromArray: [currentFolder
|
||||
lookupContactsWithFilter: contact
|
||||
sortBy: @"cn"
|
||||
ordering: NSOrderedAscending]];
|
||||
if (!ldapOnly || [currentFolder isKindOfClass: [SOGoContactLDAPFolder class]])
|
||||
[self _fillResults: results inFolder: currentFolder
|
||||
withSearchOn: contact];
|
||||
currentFolder = [sogoContactFolders nextObject];
|
||||
}
|
||||
[topFolder release];
|
||||
@@ -140,44 +158,34 @@
|
||||
return email;
|
||||
}
|
||||
|
||||
- (NSDictionary *) _nextResultWithUid: (NSEnumerator *) results
|
||||
{
|
||||
NSDictionary *result, *possibleResult;
|
||||
|
||||
result = nil;
|
||||
possibleResult = [results nextObject];
|
||||
while (possibleResult && !result)
|
||||
if ([[possibleResult objectForKey: @"c_uid"] length])
|
||||
result = possibleResult;
|
||||
else
|
||||
possibleResult = [results nextObject];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (WOResponse *) _responseForResults: (NSArray *) results
|
||||
- (WOResponse *) _responseForResults: (NSDictionary *) results
|
||||
{
|
||||
WOResponse *response;
|
||||
NSString *email, *responseString, *uid;
|
||||
NSEnumerator *uids;
|
||||
NSString *responseString, *uid, *cn, *mail;
|
||||
NSDictionary *result;
|
||||
|
||||
response = [context response];
|
||||
|
||||
if ([results count])
|
||||
{
|
||||
result = [self _nextResultWithUid: [results objectEnumerator]];
|
||||
if (!result)
|
||||
result = [results objectAtIndex: 0];
|
||||
email = [self _emailForResult: result];
|
||||
uid = [result objectForKey: @"c_uid"];
|
||||
if ([uid length] == 0)
|
||||
uid = @"";
|
||||
responseString = [NSString stringWithFormat: @"%@:%@",
|
||||
uid, email];
|
||||
[response setStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=iso-8859-1"
|
||||
forKey: @"Content-Type"];
|
||||
[response appendContentString: responseString];
|
||||
uids = [[results allKeys] objectEnumerator];
|
||||
uid = [uids nextObject];
|
||||
while (uid)
|
||||
{
|
||||
result = [results objectForKey: uid];
|
||||
cn = [result objectForKey: @"displayName"];
|
||||
if (![cn length])
|
||||
cn = [result objectForKey: @"cn"];
|
||||
mail = [result objectForKey: @"mail"];
|
||||
responseString = [NSString stringWithFormat: @"%@:%@:%@",
|
||||
uid, cn, mail];
|
||||
[response setStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=iso-8859-1"
|
||||
forKey: @"Content-Type"];
|
||||
[response appendContentString: responseString];
|
||||
uid = [uids nextObject];
|
||||
}
|
||||
}
|
||||
else
|
||||
[response setStatus: 404];
|
||||
@@ -302,8 +310,8 @@
|
||||
WOResponse *response;
|
||||
NSString *uid, *foldersString;
|
||||
NSMutableString *responseString;
|
||||
NSDictionary *result;
|
||||
NSEnumerator *resultsEnum;
|
||||
NSDictionary *contact;
|
||||
NSEnumerator *contacts;
|
||||
NSArray *folders;
|
||||
|
||||
response = [context response];
|
||||
@@ -311,21 +319,26 @@
|
||||
if ([results count])
|
||||
{
|
||||
[response setStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=iso-8859-1"
|
||||
[response setHeader: @"text/plain; charset=utf-8"
|
||||
forKey: @"Content-Type"];
|
||||
|
||||
responseString = [NSMutableString new];
|
||||
resultsEnum = [results objectEnumerator];
|
||||
result = [resultsEnum nextObject];
|
||||
while (result)
|
||||
contacts = [results objectEnumerator];
|
||||
contact = [contacts nextObject];
|
||||
while (contact)
|
||||
{
|
||||
uid = [result objectForKey: @"c_uid"];
|
||||
folders = [self _foldersForUID: uid ofType: folderType];
|
||||
foldersString
|
||||
= [self _foldersStringForFolders: [folders objectEnumerator]];
|
||||
[responseString appendFormat: @"%@:%@%@\n",
|
||||
uid, [self _emailForResult: result], foldersString];
|
||||
result = [resultsEnum nextObject];
|
||||
uid = [contact objectForKey: @"c_uid"];
|
||||
if ([uid length] > 0)
|
||||
{
|
||||
folders = [self _foldersForUID: uid ofType: folderType];
|
||||
foldersString
|
||||
= [self _foldersStringForFolders: [folders objectEnumerator]];
|
||||
[responseString appendFormat: @"%@:%@:%@%@\n", uid,
|
||||
[contact objectForKey: @"cn"],
|
||||
[contact objectForKey: @"c_email"],
|
||||
foldersString];
|
||||
}
|
||||
contact = [contacts nextObject];
|
||||
}
|
||||
[response appendContentString: responseString];
|
||||
[responseString release];
|
||||
@@ -340,17 +353,16 @@
|
||||
{
|
||||
NSString *contact, *folderType;
|
||||
id <WOActionResults> result;
|
||||
BOOL ldapOnly;
|
||||
LDAPUserManager *um;
|
||||
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
contact = [self queryParameterForKey: @"search"];
|
||||
if ([contact length] > 0)
|
||||
{
|
||||
ldapOnly = [[self queryParameterForKey: @"ldap-only"] boolValue];
|
||||
folderType = [self queryParameterForKey: @"type"];
|
||||
result = [self _foldersResponseForResults:
|
||||
[self _searchResults: contact
|
||||
ldapFoldersOnly: ldapOnly]
|
||||
withType: folderType];
|
||||
result
|
||||
= [self _foldersResponseForResults: [um fetchContactsMatching: contact]
|
||||
withType: folderType];
|
||||
}
|
||||
else
|
||||
result = [NSException exceptionWithHTTPStatus: 400
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#import <NGObjWeb/SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Values.h>
|
||||
|
||||
#import <SoObjects/SOGo/AgenorUserManager.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/Contacts/SOGoContactFolder.h>
|
||||
|
||||
@@ -128,20 +127,16 @@
|
||||
|
||||
- (NSString *) currentContactFolderName
|
||||
{
|
||||
return [self labelForKey: [currentFolder displayName]];
|
||||
return [currentFolder displayName];
|
||||
}
|
||||
|
||||
- (NSArray *) additionalFolders
|
||||
{
|
||||
AgenorUserManager *um;
|
||||
NSUserDefaults *ud;
|
||||
NSString *login;
|
||||
|
||||
if (!additionalFolders)
|
||||
{
|
||||
um = [AgenorUserManager sharedUserManager];
|
||||
login = [[context activeUser] login];
|
||||
ud = [um getUserSettingsForUID: login];
|
||||
ud = [[context activeUser] userSettings];
|
||||
additionalFolders
|
||||
= [[ud objectForKey: @"Contacts"] objectForKey: @"SubscribedFolders"];
|
||||
[additionalFolders retain];
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#import <SOGoUI/SOGoDateFormatter.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
|
||||
#import <SoObjects/Mailer/SOGoMailObject.h>
|
||||
@@ -189,8 +189,15 @@
|
||||
|
||||
- (id)calendarFolder {
|
||||
/* return scheduling calendar of currently logged-in user */
|
||||
return [[[self context] activeUser] schedulingCalendarInContext:
|
||||
[self context]];
|
||||
SOGoUser *user;
|
||||
id folder;
|
||||
|
||||
user = [context activeUser];
|
||||
folder = [[user homeFolderInContext: context] lookupName: @"Calendar"
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
- (id)storedEventObject {
|
||||
@@ -238,7 +245,7 @@
|
||||
/* organizer tracking */
|
||||
|
||||
- (NSString *)loggedInUserEMail {
|
||||
return [[[self context] activeUser] email];
|
||||
return [[[self context] activeUser] primaryEmail];
|
||||
}
|
||||
|
||||
- (iCalEvent *)authorativeEvent {
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <SOGo/AgenorUserManager.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGoUI/SOGoDateFormatter.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
|
||||
@@ -48,7 +47,7 @@
|
||||
#import <SoObjects/Appointments/SOGoTaskObject.h>
|
||||
#import <SoObjects/SOGo/NSString+Utilities.h>
|
||||
|
||||
#import "UIxComponent+Agenor.h"
|
||||
#import "UIxComponent+Scheduler.h"
|
||||
|
||||
#import "UIxComponentEditor.h"
|
||||
|
||||
@@ -653,8 +652,7 @@
|
||||
|
||||
- (BOOL) isMyComponent
|
||||
{
|
||||
// TODO: this should check a set of emails against the SoUser
|
||||
return ([[organizer rfc822Email] isEqualToString: [self emailForUser]]);
|
||||
return ([[context activeUser] hasEmail: [organizer rfc822Email]]);
|
||||
}
|
||||
|
||||
- (BOOL) canEditComponent
|
||||
@@ -794,6 +792,7 @@
|
||||
- (void) _handleOrganizer
|
||||
{
|
||||
NSString *organizerEmail;
|
||||
SOGoUser *activeUser;
|
||||
|
||||
organizerEmail = [[component organizer] email];
|
||||
if ([organizerEmail length] == 0)
|
||||
@@ -801,8 +800,9 @@
|
||||
if ([[component attendees] count] > 0)
|
||||
{
|
||||
ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]);
|
||||
[organizer setCn: [self cnForUser]];
|
||||
[organizer setEmail: [self emailForUser]];
|
||||
activeUser = [context activeUser];
|
||||
[organizer setCn: [activeUser cn]];
|
||||
[organizer setEmail: [activeUser primaryEmail]];
|
||||
[component setOrganizer: organizer];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user