diff options
author | Brian Cully <bjc@kublai.com> | 2008-04-14 21:45:08 -0400 |
---|---|---|
committer | Brian Cully <github.20.shmit@spamgourmet.com> | 2008-04-14 21:45:08 -0400 |
commit | 17349a5e426dc7acf1216a3767a22f69974cbca0 (patch) | |
tree | 20029d02f07ab6257cccec36d34fb312f796e1d1 /Liaison/DownloadManager.m | |
download | liaison-17349a5e426dc7acf1216a3767a22f69974cbca0.tar.gz liaison-17349a5e426dc7acf1216a3767a22f69974cbca0.zip |
Initial commit.
Diffstat (limited to 'Liaison/DownloadManager.m')
-rw-r--r-- | Liaison/DownloadManager.m | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Liaison/DownloadManager.m b/Liaison/DownloadManager.m new file mode 100644 index 0000000..5fb1085 --- /dev/null +++ b/Liaison/DownloadManager.m @@ -0,0 +1,69 @@ +// +// DownloadManager.m +// Liaison +// +// Created by Brian Cully on Wed Jun 04 2003. +// Copyright (c) 2003 Brian Cully. All rights reserved. +// + +#import "DownloadManager.h" +#import "Downloader.h" + +@implementation DownloadManager +DownloadManager *defaultManager = nil; + ++ (DownloadManager *)defaultManager +{ + if (defaultManager == nil) + defaultManager = [[DownloadManager alloc] init]; + return defaultManager; +} + +- (id)init +{ + self = [super init]; + + [self setDownloads: [NSMutableDictionary dictionary]]; + + return self; +} + +- (void)dealloc +{ + [self setDownloads: nil]; + + [super dealloc]; +} + +- (void)downloadFileHandle: (LiFileHandle *)aFileHandle + fromSocket: (NSFileHandle *)aSocket + target: (id)anObject + didFinishSelector: (SEL)aSelector + withContext: (void *)someContext +{ + Downloader *downloader; + + downloader = [[Downloader alloc] initWithSocket: aSocket + target: anObject + selector: aSelector + context: someContext]; + [[self downloads] setObject: downloader forKey: aFileHandle]; + [downloader downloadFileHandle: aFileHandle]; + [downloader release]; +} +@synthesize theDownloads; +@end + +@implementation DownloadManager (Accessors) +- (NSMutableDictionary *)downloads +{ + return theDownloads; +} + +- (void)setDownloads: (NSMutableDictionary *)someDownloads +{ + [someDownloads retain]; + [theDownloads release]; + theDownloads = someDownloads; +} +@end
\ No newline at end of file |