Changeset 9561 for trunk/macosx/Controller.m
- Timestamp:
- Nov 25, 2009, 4:11:52 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r9453 r9561 934 934 } 935 935 936 - (void) openMagnet: (NSString *) address 937 { 938 Torrent * torrent; 939 if (!(torrent = [[Torrent alloc] initWithMagnetAddress: address location: nil lib: fLib])) 940 { 941 #warning should we do something here? 942 return; 943 } 944 945 #warning should we do this? 946 [torrent setWaitToStart: [fDefaults boolForKey: @"AutoStartDownload"]]; 947 948 [torrent update]; 949 [fTorrents addObject: torrent]; 950 [torrent release]; 951 952 [self updateTorrentsInQueue]; 953 } 954 936 955 - (void) askOpenConfirmed: (AddWindowController *) addController add: (BOOL) add 937 956 { … … 1111 1130 1112 1131 NSString * urlString = [fURLSheetTextField stringValue]; 1113 if ([urlString rangeOfString: @"://"].location == NSNotFound) 1114 { 1115 if ([urlString rangeOfString: @"."].location == NSNotFound) 1116 { 1117 NSInteger beforeCom; 1118 if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound) 1119 urlString = [NSString stringWithFormat: @"http://www.%@.com/%@", 1120 [urlString substringToIndex: beforeCom], 1121 [urlString substringFromIndex: beforeCom + 1]]; 1132 1133 if ([urlString compare: @"magnet:" options: (NSAnchoredSearch | NSCaseInsensitiveSearch)]) 1134 [self openMagnet: urlString]; 1135 else 1136 { 1137 if ([urlString rangeOfString: @"://"].location == NSNotFound) 1138 { 1139 if ([urlString rangeOfString: @"."].location == NSNotFound) 1140 { 1141 NSInteger beforeCom; 1142 if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound) 1143 urlString = [NSString stringWithFormat: @"http://www.%@.com/%@", 1144 [urlString substringToIndex: beforeCom], 1145 [urlString substringFromIndex: beforeCom + 1]]; 1146 else 1147 urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString]; 1148 } 1122 1149 else 1123 urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString]; 1124 } 1150 urlString = [@"http://" stringByAppendingString: urlString]; 1151 } 1152 1153 1125 1154 else 1126 urlString = [@"http://" stringByAppendingString: urlString];1127 }1128 1129 NSURL * url = [NSURL URLWithString: urlString];1130 [self performSelectorOnMainThread: @selector(openURL:) withObject: url waitUntilDone: NO];1155 { 1156 NSURL * url = [NSURL URLWithString: urlString]; 1157 [self performSelectorOnMainThread: @selector(openURL:) withObject: url waitUntilDone: NO]; 1158 } 1159 } 1131 1160 } 1132 1161
Note: See TracChangeset
for help on using the changeset viewer.