See ChangeLog

Monotone-Parent: 8d42e44b72c2c9e6431e77f6b5c590736449f7d7
Monotone-Revision: bafccbe12139895411068d388269aca400af46ec

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2009-04-01T13:49:24
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2009-04-01 13:49:24 +00:00
parent 4d8563ac99
commit 8f2318fe52
56 changed files with 164 additions and 1302 deletions
@@ -52,7 +52,7 @@
forRecurrenceId: (NSCalendarDate *) _recurrenceId;
- (void) takeAttendeeStatus: (iCalPerson *) attendee
from: (NSString *) originator
from: (SOGoUser *) originator
withRecurrenceId: (NSCalendarDate*) recurrenceId;
- (NSArray *) postCalDAVEventRequestTo: (NSArray *) recipients from: (NSString *) originator;
@@ -285,9 +285,9 @@
iCalEntityObject *currentOccurence;
iCalRepeatableEntityObject *event;
iCalCalendar *calendar;
NSMutableArray *occurences;
NSCalendarDate *currentId;
NSString *calendarContent;
NSArray *occurences;
int max, count;
// Invitations are always written to the personal folder; it's not necessay
@@ -835,7 +835,7 @@
{
// If no occurence found, create one.
recurrenceTime = [NSString stringWithFormat: @"%f", [recurrenceId timeIntervalSince1970]];
oldEvent = [oldEventObject newOccurenceWithID: recurrenceTime];
oldEvent = (iCalEvent *)[oldEventObject newOccurenceWithID: recurrenceTime];
}
// Add the event as a new occurrence, without the organizer.
@@ -958,13 +958,13 @@
// Mozilla Lightning. We assume the SENT-BY has
// already been added, if required.
//
// It is used to updated the status of an attendee.
// It is used to update the status of an attendee.
// The originator is the actualy owner of the calendar
// where the update took place. The status must then
// be propagated to the organizer and the other attendees.
//
- (void) takeAttendeeStatus: (iCalPerson *) attendee
from: (NSString *) ownerUser
from: (SOGoUser *) ownerUser
withRecurrenceId: (NSCalendarDate*) recurrenceId
{
iCalPerson *localAttendee;
@@ -1,6 +1,6 @@
/* SOGoAptMailICalReply - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
* Copyright (C) 2007-2009 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
@@ -35,6 +35,7 @@
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import "iCalPerson+SOGo.h"
#import "SOGoAptMailICalReply.h"
@interface SOGoAptMailICalReply (PrivateAPI)
@@ -1,15 +1,15 @@
/*
Copyright (C) 2000-2005 SKYRIX Software AG
Copyright (C) 2006-2008 Inverse inc.
Copyright (C) 2006-2009 Inverse inc.
This file is part of OpenGroupware.org.
This file is part of SOGo.
OGo is free software; you can redistribute it and/or modify it under
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
@@ -32,6 +32,7 @@
#import <SoObjects/SOGo/NSString+Utilities.h>
#import "iCalPerson+SOGo.h"
#import "SOGoAptMailNotification.h"
@interface SOGoAptMailNotification (PrivateAPI)
@@ -1,6 +1,6 @@
/* SOGoCalendarComponent.h - this file is part of SOGo
*
* Copyright (C) 2006-2008 Inverse inc.
* Copyright (C) 2006-2009 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
@@ -140,7 +140,7 @@
- (NSException *) prepareDelete;
{
NSMutableArray *occurences;
NSArray *occurences;
NSCalendarDate *recurrenceId, *currentId;
NSException *error;
NSString *newContent;
+10 -10
View File
@@ -1,6 +1,6 @@
/* NSObject+CardDAV.m - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
* Copyright (C) 2007-2009 Inverse inc.
*
* Author: Ludovic Marcotte <ludovic@inverse.ca>
*
@@ -52,15 +52,15 @@
for (count = 0; count < max; count++)
{
currentFilter = [filters objectAtIndex: count];
contacts = [[self lookupContactsWithFilter: [[currentFilter allValues] lastObject]
sortBy: @"c_givenname"
ordering: NSOrderedDescending]
contacts = [[(id<SOGoContactFolder>)self lookupContactsWithFilter: [[currentFilter allValues] lastObject]
sortBy: @"c_givenname"
ordering: NSOrderedDescending]
objectEnumerator];
while ((contact = [contacts nextObject]))
[self appendObject: contact
withBaseURL: baseURL
toREPORTResponse: response];
[(id<SOGoContactFolder>)self appendObject: contact
withBaseURL: baseURL
toREPORTResponse: response];
}
}
@@ -86,7 +86,7 @@
parentNode = [filterElement parentNode];
if ([[parentNode tagName] isEqualToString: @"filter"]
if ([[(id)parentNode tagName] isEqualToString: @"filter"]
&& [self _isValidFilter: [filterElement attribute: @"name"]])
{
ranges = [filterElement getElementsByTagName: @"text-match"];
@@ -113,8 +113,8 @@
filters = [NSMutableArray array];
children = [[parentNode getElementsByTagName: @"prop-filter"]
objectEnumerator];
children = [(NSArray *)[parentNode getElementsByTagName: @"prop-filter"]
objectEnumerator];
while ((node = [children nextObject]))
{
filter = [self _parseContactFilter: node];
+2 -2
View File
@@ -1,6 +1,6 @@
/* SOGoUserFolder+Contacts.m - this file is part of SOGo
*
* Copyright (C) 2008 Inverse inc.
* Copyright (C) 2008-2009 Inverse inc.
*
* Author: Francis Lachapelle <flachapelle@inverse.ca>
*
@@ -37,7 +37,7 @@
@interface SOGoUserFolder (private)
- (SOGoAppointmentFolders *) privateContacts: (NSString *) key
inContext: (WOContext *) localContext;
inContext: (WOContext *) localContext;
@end
+4 -3
View File
@@ -1,14 +1,15 @@
/*
Copyright (C) 2007-2009 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
This file is part of SOGo.
OGo is free software; you can redistribute it and/or modify it under
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
+2 -2
View File
@@ -112,7 +112,7 @@ static BOOL debugOn = NO;
id obj;
if (pathToPart != nil)
return [pathToPart isNotNull] ? pathToPart : nil;
return ([pathToPart isNotNull] ? (id)pathToPart : nil);
p = [[NSMutableArray alloc] initWithCapacity:8];
for (obj = self; [obj isKindOfClass:[SOGoMailBodyPart class]];
@@ -128,7 +128,7 @@ static BOOL debugOn = NO;
- (NSString *) bodyPartIdentifier
{
if (identifier != nil)
return [identifier isNotNull] ? identifier : nil;
return ([identifier isNotNull] ? (id)identifier : nil);
identifier =
[[[self bodyPartPath] componentsJoinedByString:@"."] copy];
+5
View File
@@ -104,6 +104,11 @@
- (NSException *) moveToFolderNamed: (NSString *) folderName
inContext: (id)_ctx;
- (void) addRequiredKeysOfStructure: (NSDictionary *) info
path: (NSString *) p
toArray: (NSMutableArray *) keys
acceptedTypes: (NSArray *) types;
@end
#endif /* __Mailer_SOGoMailObject_H__ */
+8 -7
View File
@@ -1,14 +1,15 @@
/*
Copyright (C) 2007-2009 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
This file is part of SOGo.
OGo is free software; you can redistribute it and/or modify it under
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
@@ -179,7 +180,7 @@ static BOOL debugSoParts = NO;
ma = [NSMutableArray arrayWithCapacity:count - i];
ext = [self keyExtensionForPart:part];
key = [[NSString alloc] initWithFormat: @"%d%@", i + 1, ext?ext: @""];
key = [[NSString alloc] initWithFormat: @"%d%@", i + 1, ((id)ext?(id)ext: (id)@"")];
[ma addObject:key];
[key release];
}
@@ -552,8 +553,8 @@ static BOOL debugSoParts = NO;
for (i = 0; i < count; i++)
{
sp = (([p length] > 0)
? [p stringByAppendingFormat: @".%d", i + 1]
: [NSString stringWithFormat: @"%d", i + 1]);
? (id)[p stringByAppendingFormat: @".%d", i + 1]
: (id)[NSString stringWithFormat: @"%d", i + 1]);
childInfo = [parts objectAtIndex: i];
@@ -570,7 +571,7 @@ static BOOL debugSoParts = NO;
if ([sp isEqualToString: @"multipart"])
sp = p;
else
sp = [p length] > 0 ? [p stringByAppendingString: @".1"] : @"1";
sp = [p length] > 0 ? (id)[p stringByAppendingString: @".1"] : (id)@"1";
[self addRequiredKeysOfStructure: body
path: sp toArray: keys
acceptedTypes: types];
+4 -1
View File
@@ -1,6 +1,6 @@
/* SOGoMailReply.h - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
* Copyright (C) 2007-2009 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
@@ -38,6 +38,9 @@
- (BOOL) outlookMode;
- (void) setReplyPlacement: (NSString *) newPlacement;
- (BOOL) replyPlacementOnTop;
- (void) setSignaturePlacement: (NSString *) newPlacement;
- (BOOL) signaturePlacementOnTop;
- (NSString *) messageBody;
@end
+1 -1
View File
@@ -1,6 +1,6 @@
/* SOGoMailReply.m - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
* Copyright (C) 2007-2009 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
-13
View File
@@ -9,12 +9,6 @@ FRAMEWORK_NAME = SOGo
SOGo_INSTALL_DIR = $(SOGO_LIBDIR)
TOOL_NAME = \
# sogo_email2uid \
# sogo_shares4uid \
# sogo_emails4uid \
# sogo_defaults
SOGo_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
# SOGoCustomGroupFolder.h \
@@ -125,13 +119,6 @@ SOGoNSUserDefaults_OBJC_FILES = \
endif
# tools
sogo_email2uid_OBJC_FILES += sogo_email2uid.m
sogo_shares4uid_OBJC_FILES += sogo_shares4uid.m
sogo_emails4uid_OBJC_FILES += sogo_emails4uid.m
sogo_defaults_OBJC_FILES += sogo_defaults.m
ADDITIONAL_TOOL_LIBS += -Lobj -lSOGo$(LIBRARY_NAME_SUFFIX)
ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/
ADDITIONAL_LIB_DIRS += -L../../SOPE/GDLContentStore/obj/
+1 -2
View File
@@ -19,7 +19,6 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSDistributedNotificationCenter.h>
@@ -430,7 +429,7 @@ static NSLock *lock = nil;
[d setObject: [newUser objectForKey: @"c_uid"]
forKey: @"uid"];
[[NSDistributedNotificationCenter defaultCenter]
[(NSDistributedNotificationCenter *)[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"SOGoUserAttributesHaveLoaded"
object: nil
userInfo: d
+1 -1
View File
@@ -374,7 +374,7 @@ static NSMutableCharacterSet *urlStartChars = nil;
match];
sq = [EOQualifier qualifierWithQualifierFormat: format];
return [sq evaluateWithObject: self];
return [(id<EOQualifierEvaluation>)sq evaluateWithObject: self];
}
#if LIB_FOUNDATION_LIBRARY
+1 -1
View File
@@ -88,7 +88,7 @@
- (NSString *) displayName
{
return ((displayName) ? displayName : nameInContainer);
return ((id)displayName ? (id)displayName : (id)nameInContainer);
}
- (void) setIsSubscription: (BOOL) newIsSubscription
+4 -2
View File
@@ -47,6 +47,8 @@
#import "SOGoUserDefaults.h"
#import "SOGoUserFolder.h"
#import "../../Main/SOGo.h"
#import "SOGoUser.h"
static NSTimeZone *serverTimeZone = nil;
@@ -490,7 +492,7 @@ _timeValue (NSString *key)
[[SOGoCache sharedCache] setDefaults: defaults
forLogin: login key: @"defaults"];
[[NSDistributedNotificationCenter defaultCenter]
[(NSDistributedNotificationCenter *)[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"SOGoUserDefaultsHaveLoaded"
object: nil
userInfo: d
@@ -535,7 +537,7 @@ _timeValue (NSString *key)
[[SOGoCache sharedCache] setDefaults: settings forLogin: login key: @"settings"];
[[NSDistributedNotificationCenter defaultCenter]
[(NSDistributedNotificationCenter *)[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"SOGoUserSettingsHaveLoaded"
object: nil
userInfo: d
+2
View File
@@ -83,6 +83,8 @@
- (NSString *) jsonRepresentation;
- (BOOL) fetchProfile;
/* saving changes */
- (BOOL) synchronize;
+1 -1
View File
@@ -304,7 +304,7 @@ static NSString *uidColumnName = @"c_uid";
forLogin: uid
key: ([fieldName isEqualToString: @"c_defaults"] ? @"defaults" : @"settings")];
[[NSDistributedNotificationCenter defaultCenter]
[(NSDistributedNotificationCenter *)[NSDistributedNotificationCenter defaultCenter]
postNotificationName: ([fieldName isEqualToString: @"c_defaults"]
? @"SOGoUserDefaultsHaveChanged"
: @"SOGoUserSettingsHaveChanged")
+2 -2
View File
@@ -125,11 +125,11 @@ static NSString *LDAPContactInfoAttribute = nil;
filter = [NSMutableDictionary dictionaryWithCapacity: 2];
children = [parentNode getElementsByTagName: @"prop-match"];
max = [children count];
max = [(NSArray *)children count];
for (count = 0; count < max; count++)
{
node = [children objectAtIndex: count];
componentName = [[node attribute: @"name"] lowercaseString];
componentName = [[(id<DOMElement>)node attribute: @"name"] lowercaseString];
[filter setObject: [node textValue] forKey: componentName];
}
-134
View File
@@ -1,134 +0,0 @@
/*
Copyright (C) 2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#include "LDAPUserManager.h"
#include "common.h"
static void usage(NSArray *args) {
fprintf(stderr, "usage: %s <uid> read|write|info [<key>] [<value>]\n",
[[args objectAtIndex:0] cString]);
}
static void doInfo(NSUserDefaults *defaults) {
printf("defaults for: '%s'\n", [[defaults valueForKey:@"uid"] cString]);
printf(" profile table: '%s'\n",
[[[defaults valueForKey:@"tableURL"] absoluteString] cString]);
}
static void doRead(NSUserDefaults *defaults, NSString *key) {
id value;
if (key == nil) {
NSArray *defNames;
unsigned i, count;
defNames = [defaults valueForKey:@"primaryDefaultNames"];
if ((count = [defNames count]) == 0) {
fprintf(stderr, "There are no keys in the SOGo profile!\n");
return;
}
for (i = 0; i < count; i++) {
printf("%s: %s\n",
[[defNames objectAtIndex:i] cString],
[[[defaults objectForKey:[defNames objectAtIndex:i]]
description] cString]);
}
}
else if ((value = [defaults objectForKey:key]) == nil) {
fprintf(stderr, "There is no key '%s' in the SOGo profile!\n",
[key cString]);
}
else
printf("%s\n", [[value description] cString]);
}
static void doWrite(NSUserDefaults *defaults, NSString *key, NSString *value) {
[defaults setObject:value forKey:key];
if (![defaults synchronize]) {
fprintf(stderr, "Failed to synchronize defaults with profile!\n");
return;
}
}
static void doIt(NSArray *args) {
LDAPUserManager *userManager;
NSUserDefaults *defaults;
NSString *uid, *op, *key, *value;
/* extract arguments */
if ([args count] < 3) {
usage(args);
return;
}
uid = [args objectAtIndex:1];
op = [args objectAtIndex:2];
key = nil;
value = nil;
if ([args count] > 3)
key = [args objectAtIndex:3];
if ([op isEqualToString:@"write"]) {
if ([args count] < 5) {
usage(args);
return;
}
value = [args objectAtIndex:4];
}
/* run */
userManager = [LDAPUserManager sharedUserManager];
defaults = [userManager getUserDefaultsForUID:uid];
if (![defaults isNotNull]) {
fprintf(stderr, "Error: found no userdefaults for UID: '%s'\n",
[uid cString]);
exit(1);
}
if ([op isEqualToString:@"read"])
doRead(defaults, key);
else if ([op isEqualToString:@"write"])
doWrite(defaults, key, value);
else if ([op isEqualToString:@"info"])
doInfo(defaults);
else
usage(args);
}
int main(int argc, char **argv, char **env) {
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
#if LIB_FOUNDATION_LIBRARY
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
doIt([[NSProcessInfo processInfo] argumentsWithoutDefaults]);
[pool release];
return 0;
}
-71
View File
@@ -1,71 +0,0 @@
/*
Copyright (C) 2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#include "LDAPUserManager.h"
#include "common.h"
static void usage(NSArray *args) {
fprintf(stderr, "usage: %s <email1> <email2> <email3>\n",
[[args objectAtIndex:0] cString]);
}
static void doIt(NSArray *args) {
LDAPUserManager *userManager;
NSEnumerator *e;
NSString *email;
if ([args count] < 2) {
usage(args);
return;
}
userManager = [LDAPUserManager sharedUserManager];
e = [args objectEnumerator];
[e nextObject]; /* consume the command name */
while ((email = [e nextObject]) != nil) {
NSString *uid;
uid = [userManager getUIDForEmail:email];
if ([uid isNotNull])
printf("%s: %s\n", [email cString], [uid cString]);
else {
fprintf(stderr, "ERROR: did not find uid for email: '%s'\n",
[email cString]);
}
}
}
int main(int argc, char **argv, char **env) {
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
#if LIB_FOUNDATION_LIBRARY
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
doIt([[NSProcessInfo processInfo] argumentsWithoutDefaults]);
[pool release];
return 0;
}
-85
View File
@@ -1,85 +0,0 @@
/*
Copyright (C) 2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#include "LDAPUserManager.h"
#include "common.h"
static void usage(NSArray *args) {
fprintf(stderr, "usage: %s <uid1> <uid2> <uid3>\n",
[[args objectAtIndex:0] cString]);
}
static void handleUID(NSString *uid, LDAPUserManager *userManager) {
NSArray *emails;
NSString *primary;
unsigned i, count;
primary = [userManager getEmailForUID:uid];
emails = [userManager getSharedMailboxEMailsForUID:uid];
printf("%s:", [uid cString]);
if ([primary length] > 0)
printf(" %s\n", [primary cString]);
else
printf(" <no primary email found>\n");
if ((count = [emails count]) == 0) {
printf(" <no shares with emitter access>\n");
return;
}
for (i = 0; i < count; i++)
printf(" %s\n", [[emails objectAtIndex:i] cString]);
}
static void doIt(NSArray *args) {
LDAPUserManager *userManager;
NSEnumerator *e;
NSString *uid;
if ([args count] < 2) {
usage(args);
return;
}
userManager = [LDAPUserManager sharedUserManager];
e = [args objectEnumerator];
[e nextObject]; /* consume the command name */
while ((uid = [e nextObject]) != nil)
handleUID(uid, userManager);
}
int main(int argc, char **argv, char **env) {
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
#if LIB_FOUNDATION_LIBRARY
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
doIt([[NSProcessInfo processInfo] argumentsWithoutDefaults]);
[pool release];
return 0;
}
-79
View File
@@ -1,79 +0,0 @@
/*
Copyright (C) 2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#include "LDAPUserManager.h"
#include "common.h"
static void usage(NSArray *args) {
fprintf(stderr, "usage: %s <uid1> <uid2> <uid3>\n",
[[args objectAtIndex:0] cString]);
}
static void handleUID(NSString *uid, LDAPUserManager *userManager) {
NSArray *shares;
unsigned i, count;
shares = [userManager getSharedMailboxAccountStringsForUID:uid];
printf("%s:", [uid cString]);
if ((count = [shares count]) == 0) {
printf(" <no shares>\n");
return;
}
puts("");
for (i = 0; i < count; i++)
printf(" %s\n", [[shares objectAtIndex:i] cString]);
}
static void doIt(NSArray *args) {
LDAPUserManager *userManager;
NSEnumerator *e;
NSString *uid;
if ([args count] < 2) {
usage(args);
return;
}
userManager = [LDAPUserManager sharedUserManager];
e = [args objectEnumerator];
[e nextObject]; /* consume the command name */
while ((uid = [e nextObject]) != nil)
handleUID(uid, userManager);
}
int main(int argc, char **argv, char **env) {
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
#if LIB_FOUNDATION_LIBRARY
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
doIt([[NSProcessInfo processInfo] argumentsWithoutDefaults]);
[pool release];
return 0;
}