From: helge Date: Thu, 7 Jul 2005 09:25:26 +0000 (+0000) Subject: added a small test tool to get an email for a uid X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83d58905943e55460423d536a948cdd1a33a0637;p=scalable-opengroupware.org added a small test tool to get an email for a uid git-svn-id: http://svn.opengroupware.org/SOGo/trunk@680 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/SOGo/AgenorUserManager.m b/SOGo/SoObjects/SOGo/AgenorUserManager.m index c73b6935..a71cf177 100644 --- a/SOGo/SoObjects/SOGo/AgenorUserManager.m +++ b/SOGo/SoObjects/SOGo/AgenorUserManager.m @@ -579,4 +579,14 @@ static NSString *defaultMailDomain = @"equipement.gouv.fr"; return debugOn; } +/* description */ + +- (NSString *)description { + NSMutableString *ms; + + ms = [NSMutableString stringWithCapacity:16]; + [ms appendFormat:@"<0x%08X[%@]>", self, NSStringFromClass([self class])]; + return ms; +} + @end /* AgenorUserManager */ diff --git a/SOGo/SoObjects/SOGo/ChangeLog b/SOGo/SoObjects/SOGo/ChangeLog index c89cf327..82084cda 100644 --- a/SOGo/SoObjects/SOGo/ChangeLog +++ b/SOGo/SoObjects/SOGo/ChangeLog @@ -1,3 +1,10 @@ +2005-07-07 Helge Hess + + * AgenorUserManager.m: added a simple -description method (v0.9.38) + + * added agenor_email2uid.m tool to check whether the email=>uid mapping + in AgenorUserManager works + 2005-07-06 Marcus Mueller * v0.9.37 diff --git a/SOGo/SoObjects/SOGo/GNUmakefile b/SOGo/SoObjects/SOGo/GNUmakefile index d68deca6..1a00ae02 100644 --- a/SOGo/SoObjects/SOGo/GNUmakefile +++ b/SOGo/SoObjects/SOGo/GNUmakefile @@ -6,6 +6,7 @@ include $(GNUSTEP_MAKEFILES)/common.make -include ./Version LIBRARY_NAME = libSOGo +TOOL_NAME = agenor_email2uid libSOGo_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION) @@ -42,6 +43,14 @@ libSOGo_OBJC_FILES = \ AgenorUserManager.m \ NSObject+AptComparison.m \ +# tools + +agenor_email2uid_OBJC_FILES += \ + agenor_email2uid.m \ + AgenorUserManager.m \ + SOGoLRUCache.m \ + -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/library.make +include $(GNUSTEP_MAKEFILES)/tool.make -include GNUmakefile.postamble diff --git a/SOGo/SoObjects/SOGo/GNUmakefile.preamble b/SOGo/SoObjects/SOGo/GNUmakefile.preamble index 98a8e981..a5b52736 100644 --- a/SOGo/SoObjects/SOGo/GNUmakefile.preamble +++ b/SOGo/SoObjects/SOGo/GNUmakefile.preamble @@ -1,4 +1,4 @@ -# $Id$ +# compilation settings libSOGo_INCLUDE_DIRS += -I.. -I../../.. @@ -22,4 +22,7 @@ libSOGo_LIBRARIES_DEPEND_UPON += \ -lNGMime \ -lNGStreams -lNGExtensions -lEOControl \ -lXmlRpc -lDOM -lSaxObjC \ - -lNGLdap + -lNGLdap + +agenor_email2uid_TOOL_LIBS += \ + -lNGLdap diff --git a/SOGo/SoObjects/SOGo/Version b/SOGo/SoObjects/SOGo/Version index e46a17bd..4797ab0b 100644 --- a/SOGo/SoObjects/SOGo/Version +++ b/SOGo/SoObjects/SOGo/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=37 +SUBMINOR_VERSION:=38 # v0.9.34 requires libGDLContentStore v4.5.26 # v0.9.26 requires libOGoContentStore v0.9.13 diff --git a/SOGo/SoObjects/SOGo/agenor_email2uid.m b/SOGo/SoObjects/SOGo/agenor_email2uid.m new file mode 100644 index 00000000..09c36c3e --- /dev/null +++ b/SOGo/SoObjects/SOGo/agenor_email2uid.m @@ -0,0 +1,72 @@ +/* + 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 "AgenorUserManager.h" +#include "common.h" + +static void usage(NSArray *args) { + fprintf(stderr, "usage: %s \n", + [[args objectAtIndex:0] cString]); +} + +static void doIt(NSArray *args) { + AgenorUserManager *userManager; + NSEnumerator *e; + NSString *email; + + if ([args count] < 2) { + usage(args); + return; + } + + userManager = [AgenorUserManager sharedUserManager]; + NSLog(@"We are using user manager: %@", userManager); + + 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; +}