1
0
Fork 0

removed old WRTRequest files

master
Spike Grobstein 14 years ago
parent 2645c4d66f
commit e3b50a4b37

@ -13,7 +13,6 @@
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
96DEDE2A139486BB00EF8526 /* WRTStatusClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 96DEDE29139486BB00EF8526 /* WRTStatusClient.m */; }; 96DEDE2A139486BB00EF8526 /* WRTStatusClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 96DEDE29139486BB00EF8526 /* WRTStatusClient.m */; };
F215851013930D1700853C55 /* WRTRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = F215850F13930D1700853C55 /* WRTRequest.m */; };
F215851213931CF000853C55 /* MenuIconDisabled.png in Resources */ = {isa = PBXBuildFile; fileRef = F215851113931CF000853C55 /* MenuIconDisabled.png */; }; F215851213931CF000853C55 /* MenuIconDisabled.png in Resources */ = {isa = PBXBuildFile; fileRef = F215851113931CF000853C55 /* MenuIconDisabled.png */; };
F2511F5C13914A120053990C /* MenuIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = F2511F5B13914A120053990C /* MenuIcon.png */; }; F2511F5C13914A120053990C /* MenuIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = F2511F5B13914A120053990C /* MenuIcon.png */; };
F2511FFB1391543E0053990C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2511FFA1391543E0053990C /* WebKit.framework */; }; F2511FFB1391543E0053990C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2511FFA1391543E0053990C /* WebKit.framework */; };
@ -35,8 +34,6 @@
8D1107320486CEB800E47090 /* DDWRT-Monitor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DDWRT-Monitor.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 8D1107320486CEB800E47090 /* DDWRT-Monitor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DDWRT-Monitor.app"; sourceTree = BUILT_PRODUCTS_DIR; };
96DEDE28139486BB00EF8526 /* WRTStatusClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WRTStatusClient.h; sourceTree = "<group>"; }; 96DEDE28139486BB00EF8526 /* WRTStatusClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WRTStatusClient.h; sourceTree = "<group>"; };
96DEDE29139486BB00EF8526 /* WRTStatusClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WRTStatusClient.m; sourceTree = "<group>"; }; 96DEDE29139486BB00EF8526 /* WRTStatusClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WRTStatusClient.m; sourceTree = "<group>"; };
F215850E13930D1700853C55 /* WRTRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WRTRequest.h; sourceTree = "<group>"; };
F215850F13930D1700853C55 /* WRTRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WRTRequest.m; sourceTree = "<group>"; };
F215851113931CF000853C55 /* MenuIconDisabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MenuIconDisabled.png; sourceTree = "<group>"; }; F215851113931CF000853C55 /* MenuIconDisabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MenuIconDisabled.png; sourceTree = "<group>"; };
F2511F5B13914A120053990C /* MenuIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MenuIcon.png; sourceTree = "<group>"; }; F2511F5B13914A120053990C /* MenuIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MenuIcon.png; sourceTree = "<group>"; };
F2511FFA1391543E0053990C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; F2511FFA1391543E0053990C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
@ -63,8 +60,6 @@
256AC3D90F4B6AC300CF3369 /* DDWRT_MonitorAppDelegate.m */, 256AC3D90F4B6AC300CF3369 /* DDWRT_MonitorAppDelegate.m */,
96DEDE28139486BB00EF8526 /* WRTStatusClient.h */, 96DEDE28139486BB00EF8526 /* WRTStatusClient.h */,
96DEDE29139486BB00EF8526 /* WRTStatusClient.m */, 96DEDE29139486BB00EF8526 /* WRTStatusClient.m */,
F215850E13930D1700853C55 /* WRTRequest.h */,
F215850F13930D1700853C55 /* WRTRequest.m */,
); );
name = Classes; name = Classes;
sourceTree = "<group>"; sourceTree = "<group>";
@ -207,7 +202,6 @@
files = ( files = (
8D11072D0486CEB800E47090 /* main.m in Sources */, 8D11072D0486CEB800E47090 /* main.m in Sources */,
256AC3DA0F4B6AC300CF3369 /* DDWRT_MonitorAppDelegate.m in Sources */, 256AC3DA0F4B6AC300CF3369 /* DDWRT_MonitorAppDelegate.m in Sources */,
F215851013930D1700853C55 /* WRTRequest.m in Sources */,
96DEDE2A139486BB00EF8526 /* WRTStatusClient.m in Sources */, 96DEDE2A139486BB00EF8526 /* WRTStatusClient.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

@ -1,35 +0,0 @@
//
// WRTRequest.h
// DDWRT-Monitor
//
// Created by Matthieu Lalonde on 11-05-29.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WRTRequest : NSObject {
BOOL wrtReachable;
@private
NSString *username;
NSString *password;
NSMutableData *receivedData;
NSURLRequest *theRequest;
NSURLConnection *theConnection;
id delegate;
SEL callback;
SEL errorCallback;
}
@property(nonatomic, retain) NSString *username;
@property(nonatomic, retain) NSString *password;
@property(nonatomic, retain) NSMutableData *receivedData;
@property(nonatomic, retain) id delegate;
@property(nonatomic) SEL callback;
@property(nonatomic) SEL errorCallback;
-(void)doRequest:(id)requestDelegate requestSelector:(SEL)requestSelector uri:(NSString *)uri;
-(void)request:(NSURL *) url;
@end

@ -1,127 +0,0 @@
//
// WRTRequest.m
// DDWRT-Monitor
//
// Created by Matthieu Lalonde on 11-05-29.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "WRTRequest.h"
@implementation WRTRequest
@synthesize username;
@synthesize password;
@synthesize receivedData;
@synthesize delegate;
@synthesize callback;
@synthesize errorCallback;
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
wrtReachable = false;
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
-(void)doRequest:(id)requestDelegate requestSelector:(SEL)requestSelector uri:(NSString *)uri
{
self.delegate = requestDelegate;
self.callback = requestSelector;
NSString *urlAddress = [NSString stringWithFormat:@"https://%@:%d/%@",
[[NSUserDefaults standardUserDefaults] stringForKey:@"hostname"],
[[NSUserDefaults standardUserDefaults] integerForKey:@"port"],
uri];
NSURL *url = [NSURL URLWithString:urlAddress];
[self request:url];
}
-(void)request:(NSURL *) url
{
theRequest = [[NSMutableURLRequest alloc] initWithURL:url];
theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
receivedData = [[NSMutableData data] retain];
} else {
// TODO return error
}
}
-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
NSLog(@"1");
if ([challenge previousFailureCount] == 0) {
NSLog(@"1.1.1");
NSURLCredential *newCredential;
newCredential = [NSURLCredential credentialWithUser:@"user" password:@"password" persistence:NSURLCredentialPersistenceForSession];
NSLog(@"1.1.2");
[[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
} else {
NSLog(@"1.2");
[[challenge sender] cancelAuthenticationChallenge:challenge];
// TODO Pop up authentication error
NSLog(@"Invalid Username or Password");
}
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSLog(@"2");
[receivedData setLength:0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSLog(@"3");
[receivedData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"4");
[connection release];
[receivedData release];
[theRequest release];
//TODO Return alert
NSLog(@"Connection failed! Error - %@ %@", [error localizedDescription], [[error userInfo] objectForKey:NSErrorFailingURLStringKey]);
if (errorCallback) {
[delegate performSelector:errorCallback withObject:error];
}
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"5");
// TODO: Return the data
if (delegate && callback) {
if ([delegate respondsToSelector:self.callback]) {
[delegate performSelector:self.callback withObject:receivedData];
} else {
// TODO: Return no data
NSLog(@"No response data from delegate");
}
}
[theConnection release];
[receivedData release];
[theRequest release];
}
@end
Loading…
Cancel
Save