2 Copyright (C) 2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "AgenorUserManager.h"
25 static void usage(NSArray *args) {
26 fprintf(stderr, "usage: %s <uid1> <uid2> <uid3>\n",
27 [[args objectAtIndex:0] cString]);
30 static void handleUID(NSString *uid, AgenorUserManager *userManager) {
35 primary = [userManager getEmailForUID:uid];
36 emails = [userManager getSharedMailboxEMailsForUID:uid];
38 printf("%s:", [uid cString]);
40 if ([primary length] > 0)
41 printf(" %s\n", [primary cString]);
43 printf(" <no primary email found>\n");
45 if ((count = [emails count]) == 0) {
46 printf(" <no shares with emitter access>\n");
50 for (i = 0; i < count; i++)
51 printf(" %s\n", [[emails objectAtIndex:i] cString]);
54 static void doIt(NSArray *args) {
55 AgenorUserManager *userManager;
59 if ([args count] < 2) {
64 userManager = [AgenorUserManager sharedUserManager];
66 e = [args objectEnumerator];
67 [e nextObject]; /* consume the command name */
69 while ((uid = [e nextObject]) != nil)
70 handleUID(uid, userManager);
73 int main(int argc, char **argv, char **env) {
74 NSAutoreleasePool *pool;
76 pool = [[NSAutoreleasePool alloc] init];
77 #if LIB_FOUNDATION_LIBRARY
78 [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
81 doIt([[NSProcessInfo processInfo] argumentsWithoutDefaults]);