Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding again the clickable urls

  • Loading branch information...
commit c16878c9360f5c3412ca9ce2baa49c22dbae4d6b 1 parent 64e7b4e
Jérôme Lebel authored
View
199 Resources/MainViewController.xib
@@ -12,6 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="31"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -37,10 +38,39 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="968621707">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUILabel" id="608282906">
+ <reference key="NSNextResponder" ref="968621707"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{21, 172}, {269, 21}}</string>
+ <reference key="NSSuperview" ref="968621707"/>
+ <object class="NSColor" key="IBUIBackgroundColor" id="896195690">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">http://000.000.000.000:8080/http.pac</string>
+ <object class="NSFont" key="IBUIFont" id="274457517">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="IBUITextColor" id="601914288">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDEAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">0</int>
+ <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
+ <float key="IBUIMinimumFontSize">10</float>
+ <int key="IBUILineBreakMode">3</int>
+ </object>
<object class="IBUITextView" id="196376934">
<reference key="NSNextResponder" ref="968621707"/>
<int key="NSvFlags">292</int>
@@ -74,43 +104,14 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{21, 295}, {269, 22}}</string>
<reference key="NSSuperview" ref="968621707"/>
- <object class="NSColor" key="IBUIBackgroundColor" id="896195690">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MCAwAA</bytes>
- </object>
- <bool key="IBUIOpaque">NO</bool>
- <bool key="IBUIClipsSubviews">YES</bool>
- <bool key="IBUIUserInteractionEnabled">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <string key="IBUIText">http://000.000.000.000:8080/socks.pac</string>
- <object class="NSFont" key="IBUIFont" id="274457517">
- <string key="NSName">Helvetica</string>
- <double key="NSSize">15</double>
- <int key="NSfFlags">16</int>
- </object>
- <object class="NSColor" key="IBUITextColor" id="1053088554">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MCAwIDAAA</bytes>
- </object>
- <nil key="IBUIHighlightedColor"/>
- <int key="IBUIBaselineAdjustment">0</int>
- <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
- <float key="IBUIMinimumFontSize">10</float>
- <int key="IBUILineBreakMode">3</int>
- </object>
- <object class="IBUILabel" id="608282906">
- <reference key="NSNextResponder" ref="968621707"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrame">{{21, 172}, {269, 21}}</string>
- <reference key="NSSuperview" ref="968621707"/>
<reference key="IBUIBackgroundColor" ref="896195690"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <string key="IBUIText">http://000.000.000.000:8080/http.pac</string>
+ <string key="IBUIText">http://000.000.000.000:8080/socks.pac</string>
<reference key="IBUIFont" ref="274457517"/>
- <reference key="IBUITextColor" ref="1053088554"/>
+ <reference key="IBUITextColor" ref="601914288"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
@@ -129,7 +130,10 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">192.168.1.10:8888</string>
<reference key="IBUIFont" ref="274457517"/>
- <reference key="IBUITextColor" ref="1053088554"/>
+ <object class="NSColor" key="IBUITextColor" id="1053088554">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAAA</bytes>
+ </object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
@@ -207,8 +211,53 @@
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
<float key="IBUIMinimumFontSize">10</float>
</object>
+ <object class="IBUIButton" id="529301683">
+ <reference key="NSNextResponder" ref="968621707"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{21, 295}, {279, 22}}</string>
+ <reference key="NSSuperview" ref="968621707"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <object class="NSFont" key="IBUIFont" id="624676805">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="IBUIHighlightedTitleColor" id="763196868">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor" id="488757955">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ <object class="IBUIButton" id="939138619">
+ <reference key="NSNextResponder" ref="968621707"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{21, 172}, {279, 21}}</string>
+ <reference key="NSSuperview" ref="968621707"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <reference key="IBUIFont" ref="624676805"/>
+ <reference key="IBUIHighlightedTitleColor" ref="763196868"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="488757955"/>
+ </object>
</object>
<string key="NSFrameSize">{320, 360}</string>
+ <reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
@@ -284,10 +333,7 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<bool key="IBUIBouncesZoom">NO</bool>
<bool key="IBUIEditable">NO</bool>
<string key="IBUIText">No tethering but still better than getting ripped off.</string>
- <object class="NSColor" key="IBUITextColor" id="763196868">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
+ <reference key="IBUITextColor" ref="763196868"/>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">12</double>
@@ -308,11 +354,7 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
- <object class="NSFont" key="IBUIFont">
- <string key="NSName">Helvetica-Bold</string>
- <double key="NSSize">15</double>
- <int key="NSfFlags">16</int>
- </object>
+ <reference key="IBUIFont" ref="624676805"/>
<int key="IBUIButtonType">4</int>
<bool key="IBUIShowsTouchWhenHighlighted">YES</bool>
<reference key="IBUIHighlightedTitleColor" ref="763196868"/>
@@ -320,10 +362,7 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA</bytes>
</object>
- <object class="NSColor" key="IBUINormalTitleShadowColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41AA</bytes>
- </object>
+ <reference key="IBUINormalTitleShadowColor" ref="488757955"/>
</object>
<object class="IBUIImageView" id="492181255">
<reference key="NSNextResponder" ref="774585933"/>
@@ -451,6 +490,24 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
</object>
<int key="connectionID">63</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">httpURLAction:</string>
+ <reference key="source" ref="939138619"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">66</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">socksURLAction:</string>
+ <reference key="source" ref="529301683"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">67</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -528,6 +585,8 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<reference ref="196376934"/>
<reference ref="286753545"/>
<reference ref="608282906"/>
+ <reference ref="529301683"/>
+ <reference ref="939138619"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">RunningView</string>
@@ -577,6 +636,16 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<reference key="object" ref="725642033"/>
<reference key="parent" ref="968621707"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">64</int>
+ <reference key="object" ref="529301683"/>
+ <reference key="parent" ref="968621707"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">65</int>
+ <reference key="object" ref="939138619"/>
+ <reference key="parent" ref="968621707"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -619,6 +688,10 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<string>54.IBViewBoundsToFrameTransform</string>
<string>6.IBEditorWindowLastContentRect</string>
<string>6.IBPluginDependency</string>
+ <string>64.IBPluginDependency</string>
+ <string>64.IBViewBoundsToFrameTransform</string>
+ <string>65.IBPluginDependency</string>
+ <string>65.IBViewBoundsToFrameTransform</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -686,6 +759,14 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
</object>
<string>{{767, 146}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <object class="NSAffineTransform">
+ <bytes key="NSTransformStruct">AUGoAABDk4AAA</bytes>
+ </object>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <object class="NSAffineTransform">
+ <bytes key="NSTransformStruct">P4AAAL+AAABBqAAAw52AAA</bytes>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -704,7 +785,7 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">63</int>
+ <int key="maxID">67</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -716,7 +797,9 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>httpURLAction:</string>
<string>showInfo</string>
+ <string>socksURLAction:</string>
<string>switchedHttp:</string>
<string>switchedSocks:</string>
</object>
@@ -725,23 +808,35 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>httpURLAction:</string>
<string>showInfo</string>
+ <string>socksURLAction:</string>
<string>switchedHttp:</string>
<string>switchedSocks:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
+ <string key="name">httpURLAction:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">showInfo</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
+ <string key="name">socksURLAction:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">switchedHttp:</string>
<string key="candidateClassName">id</string>
</object>
@@ -826,6 +921,14 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Sources/MainViewController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">MainViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
@@ -834,7 +937,7 @@ ayBvciBjcmVhdGUgYW4gYWQtaG9jIG5ldHdvcmsgZm9yIHRoZW0uA</string>
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Sources/UIViewExtensions.h</string>
+ <string key="minorKey">Sources/UIViewAdditions.h</string>
</object>
</object>
</object>
View
3  Sources/HTTPServer.h
@@ -42,8 +42,7 @@ typedef enum
@property (nonatomic, readonly, retain) NSError *lastError;
@property (readonly, assign) HTTPServerState state;
-@property (readonly) UInt32 httpPort;
-@property (readonly) UInt32 proxyPort;
+@property (readonly) UInt32 httpServerPort;
+ (HTTPServer *)sharedHTTPServer;
View
13 Sources/HTTPServer.m
@@ -67,11 +67,11 @@ - (id)init
-(void)startBonjourServices
{
socks5NetService = [[NSNetService alloc] initWithDomain:@"" type:@"_socks5._tcp."
- name:@"" port:self.proxyPort];
+ name:@"" port:SOCKS_PROXY_PORT];
socks5NetService.delegate = self;
[socks5NetService publish];
pacFileServerNetService = [[NSNetService alloc] initWithDomain:@"" type:@"_pacfileserver._tcp."
- name:@"" port:self.httpPort];
+ name:@"" port:self.httpServerPort];
pacFileServerNetService.delegate = self;
[pacFileServerNetService publish];
}
@@ -188,7 +188,7 @@ - (void)start
address.sin_len = sizeof(address);
address.sin_family = AF_INET;
address.sin_addr.s_addr = htonl(INADDR_ANY);
- address.sin_port = htons(HTTP_SERVER_PORT);
+ address.sin_port = htons(self.httpServerPort);
CFDataRef addressData =
CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address));
[(id)addressData autorelease];
@@ -384,14 +384,9 @@ - (void)closeHandler:(HTTPResponseHandler *)aHandler
[responseHandlers removeObject:aHandler];
}
-- (UInt32)httpPort
+- (UInt32)httpServerPort
{
return HTTP_SERVER_PORT;
}
-- (UInt32)proxyPort
-{
- return PROXY_PORT_HTTP;
-}
-
@end
View
8 Sources/MainViewController.h
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#import <MessageUI/MFMailComposeViewController.h>
-@interface MainViewController : UIViewController {
+@interface MainViewController : UIViewController <UIActionSheetDelegate, MFMailComposeViewControllerDelegate> {
IBOutlet UISwitch *httpSwitch;
IBOutlet UILabel *httpAddressLabel;
@@ -30,6 +31,9 @@
BOOL proxyHttpRunning;
BOOL proxySocksRunning;
BOOL httpRunning;
+
+ NSString *emailBody;
+ NSString *emailURL;
NSString *ip;
}
@@ -45,6 +49,8 @@
- (IBAction) switchedHttp:(id)sender;
- (IBAction) switchedSocks:(id)sender;
+- (IBAction) httpURLAction:(id)sender;
+- (IBAction) socksURLAction:(id)sender;
- (IBAction) showInfo;
@property (nonatomic, retain) UISwitch *httpSwitch;
View
74 Sources/MainViewController.m
@@ -18,6 +18,7 @@
#import "InfoViewController.h"
#import "HTTPServer.h"
#import "PacFileResponse.h"
+#import <MobileCoreServices/MobileCoreServices.h>
int polipo_main(int argc, char **argv);
void polipo_exit();
@@ -87,11 +88,11 @@ - (void) ping
if (self.ip != nil) {
- httpAddressLabel.text = [NSString stringWithFormat:@"%@:%d", self.ip, PROXY_PORT_HTTP];
- httpPacLabel.text = [NSString stringWithFormat:@"http://%@:%d/http.pac", self.ip, HTTP_SERVER_PORT];
+ httpAddressLabel.text = [NSString stringWithFormat:@"%@:%d", self.ip, HTTP_PROXY_PORT];
+ httpPacLabel.text = [NSString stringWithFormat:@"http://%@:%d/http.pac", self.ip, [HTTPServer sharedHTTPServer].httpServerPort];
- socksAddressLabel.text = [NSString stringWithFormat:@"%@:%d", self.ip, PROXY_PORT_SOCKS];
- socksPacLabel.text = [NSString stringWithFormat:@"http://%@:%d/socks.pac", self.ip, HTTP_SERVER_PORT];
+ socksAddressLabel.text = [NSString stringWithFormat:@"%@:%d", self.ip, SOCKS_PROXY_PORT];
+ socksPacLabel.text = [NSString stringWithFormat:@"http://%@:%d/socks.pac", self.ip, [HTTPServer sharedHTTPServer].httpServerPort];
if (httpSwitch.on) {
[self proxyHttpStart];
@@ -221,7 +222,7 @@ - (void) proxyHttpRun
"-c",
(char*)[configuration UTF8String],
(char*)[[NSString stringWithFormat:@"proxyAddress=%@", ip] UTF8String],
- (char*)[[NSString stringWithFormat:@"proxyPort=%d", PROXY_PORT_HTTP] UTF8String],
+ (char*)[[NSString stringWithFormat:@"proxyPort=%d", HTTP_PROXY_PORT] UTF8String],
};
polipo_main(5, args);
@@ -261,7 +262,7 @@ - (void) proxySocksRun
NSLog(@"socks proxy start");
- NSString *connect = [NSString stringWithFormat:@"%@:%d", self.ip, PROXY_PORT_SOCKS];
+ NSString *connect = [NSString stringWithFormat:@"%@:%d", self.ip, SOCKS_PROXY_PORT];
char *args[4] = {
"srelay",
@@ -279,4 +280,65 @@ - (void) proxySocksRun
self.proxySocksRunning = NO;
}
+- (void) httpURLAction:(id)sender
+{
+ UIActionSheet *test;
+
+ test = [[UIActionSheet alloc] initWithTitle:@"HTTP Pac URL Action" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Send by Email", @"Copy URL", nil];
+ [emailBody release];
+ emailBody = [[NSString alloc] initWithFormat:@"http pac URL : %@\n", httpPacLabel.text];
+ [emailURL release];
+ emailURL = [httpPacLabel.text retain];
+ [test showInView:self.view];
+ [test release];
+}
+
+- (void) socksURLAction:(id)sender
+{
+ UIActionSheet *test;
+
+ test = [[UIActionSheet alloc] initWithTitle:@"SOCKS Pac URL Action" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Send by Email", @"Copy URL", nil];
+ [emailBody release];
+ emailBody = [[NSString alloc] initWithFormat:@"socks pac URL : %@\n", socksPacLabel.text];
+ [emailURL release];
+ emailURL = [socksPacLabel.text retain];
+ [test showInView:self.view];
+ [test release];
+}
+
+- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+ switch (buttonIndex) {
+ case 0:
+ {
+ MFMailComposeViewController* messageController = [[MFMailComposeViewController alloc] init];
+
+ if ([messageController respondsToSelector:@selector(setModalPresentationStyle:)]) // XXX not available in 3.1.3
+ messageController.modalPresentationStyle = UIModalPresentationFormSheet;
+
+ messageController.mailComposeDelegate = self;
+ [messageController setMessageBody:emailBody isHTML:NO];
+ [self presentModalViewController:messageController animated:YES];
+ [messageController release];
+ }
+ break;
+ case 1:
+ {
+ NSDictionary *items;
+
+ items = [NSDictionary dictionaryWithObjectsAndKeys:emailURL, kUTTypePlainText, emailURL, kUTTypeText, emailURL, kUTTypeUTF8PlainText, [NSURL URLWithString:emailURL], kUTTypeURL, nil];
+ [UIPasteboard generalPasteboard].items = [NSArray arrayWithObjects:items, nil];
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
+{
+ [self dismissModalViewControllerAnimated:YES];
+}
+
@end
View
4 Sources/PacFileResponse.m
@@ -66,13 +66,13 @@ - (void)startResponse
if ([@"/http.pac" isEqualToString:requestPath]) {
fileData = [[NSString stringWithFormat:
@"function FindProxyForURL(url, host) { return \"PROXY %@:%d\"; }",
- [self serverIPForRequest], PROXY_PORT_HTTP] dataUsingEncoding:NSUTF8StringEncoding];
+ [self serverIPForRequest], HTTP_PROXY_PORT] dataUsingEncoding:NSUTF8StringEncoding];
}
if ([@"/socks.pac" isEqualToString:requestPath]) {
fileData = [[NSString stringWithFormat:
@"function FindProxyForURL(url, host) { return \"SOCKS %@:%d\"; }",
- [self serverIPForRequest], PROXY_PORT_SOCKS] dataUsingEncoding:NSUTF8StringEncoding];
+ [self serverIPForRequest], SOCKS_PROXY_PORT] dataUsingEncoding:NSUTF8StringEncoding];
}
if (fileData) {
View
4 Sources/Prefix.pch
@@ -29,8 +29,8 @@
#define KEY_HTTP_ON @"http.on"
// ports
-#define PROXY_PORT_HTTP 8888
-#define PROXY_PORT_SOCKS 1080
+#define HTTP_PROXY_PORT 8888
+#define SOCKS_PROXY_PORT 1080
#define HTTP_SERVER_PORT 8000
// urls
Please sign in to comment.
Something went wrong with that request. Please try again.