2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
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
28 int main(int argc, char **argv, char **env) {
29 NSAutoreleasePool *pool;
31 #if LIB_FOUNDATION_LIBRARY
32 [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
35 pool = [[NSAutoreleasePool alloc] init];
38 NSString *login, *pwd, *host;
40 NGImap4Client *client;
42 ud = [NSUserDefaults standardUserDefaults];
44 if (!(login = [ud stringForKey:@"login"])) {
47 if (!(pwd = [ud stringForKey:@"pwd"])) {
50 if (!(host = [ud stringForKey:@"host"])) {
54 client = [NGImap4Client clientWithHost:host];
56 [client login:login password:pwd];
57 NSLog(@"client %@", client);
67 action = [ud stringForKey:
68 [NSString stringWithFormat:@"action_%d", cnt]];
69 arg = [ud stringForKey:
70 [NSString stringWithFormat:@"arg_%d", cnt]];
75 if ([action isEqualToString:@"select"]) {
76 result = [client select:arg];
78 else if ([action isEqualToString:@"thread"]) {
79 result = [client threadBySubject:[arg boolValue] charset:nil];
81 else if ([action isEqualToString:@"list"]) {
82 result = [client list:arg pattern:@"*"];
84 else if ([action isEqualToString:@"fetch"]) {
87 args = [arg componentsSeparatedByString:@":"];
88 result = [client fetchFrom:[[args objectAtIndex:0] intValue]
89 to:[[args objectAtIndex:1] intValue]
90 parts:[args subarrayWithRange:
91 NSMakeRange(2,[args count] - 2)]];
93 NSLog(@"action %d: %@:%@ : %@", cnt, action, arg,