summaryrefslogtreecommitdiffstats
path: root/Classes/Fetcher.m
diff options
context:
space:
mode:
authormatt handler <matt.handler@gmail.com>2011-04-27 01:25:19 -0400
committermatt handler <matt.handler@gmail.com>2011-04-27 01:25:19 -0400
commite6eb634beac831e64becc03928a467701f9625cf (patch)
treebf6df33a2a77c6ee462438f9e0e38c1717414a4f /Classes/Fetcher.m
parent39478a90674f2b4238ba1cfaa49908deb0200e24 (diff)
downloadpiccast-app-e6eb634beac831e64becc03928a467701f9625cf.tar.gz
piccast-app-e6eb634beac831e64becc03928a467701f9625cf.zip
made fetcher take a payload, added favicon, turned off statement caching, may turn it back on who knows, added sourceid to topics, added category to topictableviewcell, did a little cleaning
Diffstat (limited to 'Classes/Fetcher.m')
-rw-r--r--Classes/Fetcher.m17
1 files changed, 14 insertions, 3 deletions
diff --git a/Classes/Fetcher.m b/Classes/Fetcher.m
index 3fe162f..6e3e7b3 100644
--- a/Classes/Fetcher.m
+++ b/Classes/Fetcher.m
@@ -11,11 +11,16 @@
@implementation Fetcher
-@synthesize delegate;
+@synthesize delegate, payload;
+ (Fetcher *) initWithString:(NSString *)string andDelegate:(id<FetcherDelegate>)d {
+ return [Fetcher initWithString:string payload:nil andDelegate:d];
+}
+
++ (Fetcher *) initWithString:(NSString *)string payload:(id)p andDelegate:(id <FetcherDelegate>)d {
Fetcher *fetcher = [[[Fetcher alloc] init] autorelease];
fetcher.delegate = d;
+ if (payload != nil) fetcher.payload = p;
[fetcher setUrlAndConnect:string];
return fetcher;
}
@@ -46,11 +51,17 @@
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
- [delegate connection:connection failedWithError:error];
+ if (payload != nil && [(NSObject *)delegate respondsToSelector:@selector(connection:failedWithError:andPayload:)])
+ [delegate connection:connection failedWithError:error andPayload:payload];
+ else
+ [delegate connection:connection failedWithError:error];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
- [delegate connection:connection finishedWithData:receivedData];
+ if (payload != nil && [(NSObject *)delegate respondsToSelector:@selector(connection:finishedWithData:andPayload:)])
+ [delegate connection:connection finishedWithData:receivedData andPayload:payload];
+ else
+ [delegate connection:connection finishedWithData:receivedData];
}
- (void) dealloc {