| 1 |
// |
| 2 |
// PrototypePOPController.m |
| 3 |
// |
| 4 |
// Created by Hori,Masaki on Sun Nov 17 2002. |
| 5 |
// |
| 6 |
|
| 7 |
#import "PrototypePOPController.h" |
| 8 |
#import "POPRequest.h" |
| 9 |
|
| 10 |
#import <UnnamedMail/AccountInfoProtocol.h> |
| 11 |
|
| 12 |
#import "MainController.h" |
| 13 |
#import "MailboxManager.h" |
| 14 |
|
| 15 |
|
| 16 |
@implementation PrototypePOPController |
| 17 |
|
| 18 |
-(id)init |
| 19 |
{ |
| 20 |
self = [super init]; |
| 21 |
if( self ) { |
| 22 |
channel = [[CommunicationChannel alloc] initWithWorkersNum:1 queueSize:1024]; |
| 23 |
popEngineClass = [[NSObject sharedMainController] popEngineClass]; |
| 24 |
} |
| 25 |
|
| 26 |
return self; |
| 27 |
} |
| 28 |
|
| 29 |
#pragma mark - |
| 30 |
#pragma mark POPController Protocol Method |
| 31 |
|
| 32 |
-(oneway void)fetchmailWithAccountInfo:(id <AccountInfo>)account |
| 33 |
{ |
| 34 |
if( [account status] == accountInfoNone ) { |
| 35 |
POPRequest* request = [[[POPRequest alloc] init] autorelease]; |
| 36 |
|
| 37 |
[account setStatus:accountInfoWating]; |
| 38 |
[request setAccountInfo:account]; |
| 39 |
[request setPOPEngineClass:popEngineClass]; |
| 40 |
[request setDelegate:self]; |
| 41 |
|
| 42 |
[channel putResuest:request]; |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
-(void)fetchmailWithAccountInfos:(NSArray*)infos |
| 47 |
{ |
| 48 |
NSEnumerator* infoEnum = [infos objectEnumerator]; |
| 49 |
id account; |
| 50 |
|
| 51 |
while( (account = [infoEnum nextObject]) ) { |
| 52 |
[self fetchmailWithAccountInfo:account]; |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
-(oneway void)stop |
| 57 |
{ |
| 58 |
[channel terminateAll]; |
| 59 |
} |
| 60 |
|
| 61 |
#pragma mark - |
| 62 |
-(BOOL)addMailAndIsDelete:(NSData*)mail |
| 63 |
{ |
| 64 |
/******************/ |
| 65 |
/* NSString* hoge = [[NSString alloc] initWithData:mail encoding:NSISO2022JPStringEncoding]; |
| 66 |
NSLog(@"PrototypePOPController addMailAndIsDelete:"); |
| 67 |
printf("%s\n", [hoge cString] ); |
| 68 |
[hoge release]; |
| 69 |
*/ |
| 70 |
[[[NSObject sharedMainController] mailboxManager] addMail:mail]; |
| 71 |
return NO; |
| 72 |
} |
| 73 |
|
| 74 |
-(BOOL)isFetchMailHasHeader:(NSData*)header |
| 75 |
{ |
| 76 |
/****************/ |
| 77 |
NSLog(@"PrototypePOPController isFetchMailHasHeader:"); |
| 78 |
return YES; |
| 79 |
} |
| 80 |
|
| 81 |
-(NSArray*)makeMustFetchHeader:(NSArray*)messageIDs |
| 82 |
{ |
| 83 |
NSMutableArray* result = [NSMutableArray array]; |
| 84 |
NSEnumerator* messageIDEnum = [messageIDs objectEnumerator]; |
| 85 |
NSNumber* number; |
| 86 |
unsigned i = 0; |
| 87 |
|
| 88 |
NSLog(@"PrototypePOPController makeMustFetchHeader:"); |
| 89 |
|
| 90 |
while([messageIDEnum nextObject]) { |
| 91 |
number = [NSNumber numberWithUnsignedInt:i++]; |
| 92 |
[result addObject:number]; |
| 93 |
} |
| 94 |
|
| 95 |
return result; |
| 96 |
} |
| 97 |
|
| 98 |
-(BOOL)isRetryAuthentication |
| 99 |
{ |
| 100 |
/*****************/ |
| 101 |
NSLog(@"PrototypePOPController isRetryAuthentication"); |
| 102 |
return NO; |
| 103 |
} |
| 104 |
|
| 105 |
-(BOOL)isRetryConnect |
| 106 |
{ |
| 107 |
/****************/ |
| 108 |
NSLog(@"PrototypePOPController isRetryConnect"); |
| 109 |
return NO; |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
@end |
| 114 |
|
| 115 |
|