From 5032fe48ba03055a736e06d08b46197ce55fbdfc Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 13 Jul 2005 16:52:23 +0000 Subject: [PATCH] added -description to connection object added tool git-svn-id: http://svn.opengroupware.org/SOPE/trunk@898 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-mime/ChangeLog | 4 ++ sope-mime/NGImap4/ChangeLog | 4 ++ sope-mime/NGImap4/NGImap4Connection.m | 24 ++++++++++ sope-mime/Version | 2 +- sope-mime/samples/ChangeLog | 4 ++ sope-mime/samples/GNUmakefile | 4 +- sope-mime/samples/imapcontest.m | 66 +++++++++++++++++++++++++++ 7 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 sope-mime/samples/imapcontest.m diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index 957c701c..ad9e33a7 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,3 +1,7 @@ +2005-07-13 Helge Hess + + * NGImap4: added -description to imap4-connection (v4.5.226) + 2005-07-12 Helge Hess * NGMime: headers hashmap is now properly made immutable (v4.5.225) diff --git a/sope-mime/NGImap4/ChangeLog b/sope-mime/NGImap4/ChangeLog index 9322da2d..154ddd11 100644 --- a/sope-mime/NGImap4/ChangeLog +++ b/sope-mime/NGImap4/ChangeLog @@ -1,3 +1,7 @@ +2005-07-13 Helge Hess + + * NGImap4Connection.m: added a -description + 2005-07-13 Marcus Mueller * NGImap4.xcodeproj: synced with GNUmakefile diff --git a/sope-mime/NGImap4/NGImap4Connection.m b/sope-mime/NGImap4/NGImap4Connection.m index 7a1d779d..3b77e65c 100644 --- a/sope-mime/NGImap4/NGImap4Connection.m +++ b/sope-mime/NGImap4/NGImap4Connection.m @@ -872,4 +872,28 @@ NSArray *SOGoMailExtractSubfolders(NSURL *_url, NSDictionary *_result) { return result; } +/* description */ + +- (NSString *)description { + NSMutableString *ms; + + ms = [NSMutableString stringWithCapacity:128]; + [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])]; + + [ms appendFormat:@" client=0x%08X", self->client]; + if ([self->password length] > 0) + [ms appendString:@" pwd"]; + + [ms appendFormat:@" created=%@", self->creationTime]; + + if (self->subfolders != nil) + [ms appendFormat:@" #cached-folders=%d", [self->subfolders count]]; + + if (self->cachedUIDs != nil) + [ms appendFormat:@" #cached-uids=%d", [self->cachedUIDs count]]; + + [ms appendString:@">"]; + return ms; +} + @end /* NGImap4Connection */ diff --git a/sope-mime/Version b/sope-mime/Version index 3be919ee..6a95f499 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=225 +SUBMINOR_VERSION:=226 # v4.5.214 requires libNGExtensions v4.5.146 # v4.2.149 requires libNGStreams v4.2.34 diff --git a/sope-mime/samples/ChangeLog b/sope-mime/samples/ChangeLog index 51a889d0..b8ac3c70 100644 --- a/sope-mime/samples/ChangeLog +++ b/sope-mime/samples/ChangeLog @@ -1,3 +1,7 @@ +2005-07-13 Helge Hess + + * added imapcontest.m tool to test the new NGImap4Connection object + 2005-07-05 Helge Hess * added imapacl tool to test ACL related IMAP4 commands diff --git a/sope-mime/samples/GNUmakefile b/sope-mime/samples/GNUmakefile index c6c22365..0e69a115 100644 --- a/sope-mime/samples/GNUmakefile +++ b/sope-mime/samples/GNUmakefile @@ -10,7 +10,8 @@ TOOL_NAME = \ imapquota \ imapacl \ imap_tool \ - sievetool + sievetool \ + imapcontest \ imapquota_OBJC_FILES = ImapQuotaTool.m ImapTool.m imapquota.m imapacl_OBJC_FILES = ImapQuotaTool.m ImapTool.m imapacl.m @@ -20,6 +21,7 @@ mime2xml_OBJC_FILES = Mime2XmlTool.m mime2xml.m imapls_OBJC_FILES = ImapTool.m ImapListTool.m imapls.m test_qpdecode_OBJC_FILES = test_qpdecode.m sievetool_OBJC_FILES = sievetool.m +imapcontest_OBJC_FILES = imapcontest.m -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/tool.make diff --git a/sope-mime/samples/imapcontest.m b/sope-mime/samples/imapcontest.m new file mode 100644 index 00000000..7bdd10a8 --- /dev/null +++ b/sope-mime/samples/imapcontest.m @@ -0,0 +1,66 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of SOPE. + + SOPE 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. + + SOPE 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 SOPE; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include +#include +#include "common.h" + +static int runIt(NSArray *args) { + NGImap4ConnectionManager *cm; + NGImap4Connection *c; + NSUserDefaults *ud; + id url; + + ud = [NSUserDefaults standardUserDefaults]; + url = [ud stringForKey:@"url"]; + url = url ? [NSURL URLWithString:url] : nil; + if (url == nil) { + NSLog(@"ERROR: found no proper URL for connection ('url' default)!"); + return 1; + } + + printf("connect to: '%s'\n", [[url absoluteString] cString]); + + cm = [NGImap4ConnectionManager defaultConnectionManager]; + c = [cm connectionForURL:url password:[ud stringForKey:@"pwd"]]; + + NSLog(@"con: %@", c); + + NSLog(@"all: %@", [c allFoldersForURL:url]); + NSLog(@"sub: %@", [c allFoldersForURL:url]); + + return 0; +} + +int main(int argc, char **argv, char **env) { + NSAutoreleasePool *pool; + int res; + + pool = [NSAutoreleasePool new]; +#if LIB_FOUNDATION_LIBRARY + [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; +#endif + + res = runIt([[NSProcessInfo processInfo] argumentsWithoutDefaults]); + + [pool release]; + return res; +} -- 2.39.5