Changeset 4783
- Timestamp:
- 05/20/07 14:29:26 (2 years ago)
- Files:
-
- WiredClient/trunk/WCTransfers.m (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCTransfers.m
r4775 r4783 61 61 62 62 - (WCTransfer *)_selectedTransfer; 63 - (WCTransfer *)_ transferWithPath:(NSString *)path;63 - (WCTransfer *)_unfinishedTransferWithPath:(NSString *)path; 64 64 - (WCTransfer *)_transferWithState:(WCTransferState)state; 65 65 - (WCTransfer *)_transferWithState:(WCTransferState)state type:(WCTransferType)type; … … 228 228 229 229 230 - (WCTransfer *)_ transferWithPath:(NSString *)path {230 - (WCTransfer *)_unfinishedTransferWithPath:(NSString *)path { 231 231 NSEnumerator *enumerator; 232 WCTransfer * eachTransfer, *transfer = NULL;232 WCTransfer *transfer; 233 233 234 234 enumerator = [_transfers objectEnumerator]; 235 235 236 while((eachTransfer = [enumerator nextObject])) { 237 if([eachTransfer isFolder]) { 238 if([[eachTransfer virtualPath] isEqualToString:path] || 239 [path hasPrefix:[[eachTransfer virtualPath] stringByAppendingString:@"/"]]) 240 transfer = eachTransfer; 241 } else { 242 if([eachTransfer containsFile:[WCFile fileWithPath:path]]) 243 transfer = eachTransfer; 244 } 245 246 if(transfer) 247 break; 248 } 249 250 return transfer; 236 while((transfer = [enumerator nextObject])) { 237 if([transfer state] != WCTransferFinished) { 238 if([transfer isFolder]) { 239 if([[transfer virtualPath] isEqualToString:path] || 240 [path hasPrefix:[[transfer virtualPath] stringByAppendingString:@"/"]]) 241 return transfer; 242 } else { 243 if([transfer containsFile:[WCFile fileWithPath:path]]) 244 return transfer; 245 } 246 } 247 } 248 249 return NULL; 251 250 } 252 251 … … 255 254 - (WCTransfer *)_transferWithState:(WCTransferState)state { 256 255 NSEnumerator *enumerator; 257 WCTransfer * eachTransfer, *transfer = NULL;256 WCTransfer *transfer; 258 257 259 258 enumerator = [_transfers objectEnumerator]; 260 259 261 while((eachTransfer = [enumerator nextObject])) { 262 if([eachTransfer state] == state) { 263 transfer = eachTransfer; 264 265 break; 266 } 267 } 268 269 return transfer; 260 while((transfer = [enumerator nextObject])) { 261 if([transfer state] == state) 262 return transfer; 263 } 264 265 return NULL; 270 266 } 271 267 … … 274 270 - (WCTransfer *)_transferWithState:(WCTransferState)state type:(WCTransferType)type { 275 271 NSEnumerator *enumerator; 276 WCTransfer * eachTransfer, *transfer = NULL;272 WCTransfer *transfer; 277 273 278 274 enumerator = [_transfers objectEnumerator]; 279 275 280 while((eachTransfer = [enumerator nextObject])) { 281 if([eachTransfer state] == state && [eachTransfer type] == type) { 282 transfer = eachTransfer; 283 284 break; 285 } 286 } 287 288 return transfer; 276 while((transfer = [enumerator nextObject])) { 277 if([transfer state] == state && [transfer type] == type) 278 return transfer; 279 } 280 281 return NULL; 289 282 } 290 283 … … 557 550 unsigned int count; 558 551 559 if([self _ transferWithPath:[file path]]) {552 if([self _unfinishedTransferWithPath:[file path]]) { 560 553 error = [WCError errorWithDomain:WCWiredClientErrorDomain code:WCWiredClientTransferExists argument:[file path]]; 561 554 [self _presentError:error]; … … 639 632 remotePath = [[destination path] stringByAppendingPathComponent:[path lastPathComponent]]; 640 633 641 if([self _ transferWithPath:remotePath]) {634 if([self _unfinishedTransferWithPath:remotePath]) { 642 635 error = [WCError errorWithDomain:WCWiredClientErrorDomain code:WCWiredClientTransferExists argument:remotePath]; 643 636 [self _presentError:error]; … … 1206 1199 hash = [fields safeObjectAtIndex:2]; 1207 1200 1208 transfer = [self _ transferWithPath:path];1201 transfer = [self _unfinishedTransferWithPath:path]; 1209 1202 1210 1203 if(!transfer) … … 1234 1227 queue = [fields safeObjectAtIndex:1]; 1235 1228 1236 transfer = [self _ transferWithPath:path];1229 transfer = [self _unfinishedTransferWithPath:path]; 1237 1230 1238 1231 if(!transfer) … … 1254 1247 1255 1248 file = [WCFile fileWithInfoArguments:[[notification userInfo] objectForKey:WCArgumentsKey]]; 1256 transfer = [self _ transferWithPath:[file path]];1249 transfer = [self _unfinishedTransferWithPath:[file path]]; 1257 1250 1258 1251 if(!transfer) … … 1289 1282 1290 1283 file = [WCFile fileWithListArguments:[[notification userInfo] objectForKey:WCArgumentsKey]]; 1291 transfer = [self _ transferWithPath:[file path]];1284 transfer = [self _unfinishedTransferWithPath:[file path]]; 1292 1285 1293 1286 if(!transfer) … … 1329 1322 free = [fields safeObjectAtIndex:1]; 1330 1323 1331 transfer = [self _ transferWithPath:path];1324 transfer = [self _unfinishedTransferWithPath:path]; 1332 1325 1333 1326 if(!transfer) … … 1364 1357 1365 1358 file = [WCFile fileWithListArguments:[[notification userInfo] objectForKey:WCArgumentsKey]]; 1366 transfer = [self _ transferWithPath:[file path]];1359 transfer = [self _unfinishedTransferWithPath:[file path]]; 1367 1360 1368 1361 if(!transfer) … … 1388 1381 path = [fields safeObjectAtIndex:0]; 1389 1382 free = [fields safeObjectAtIndex:1]; 1390 transfer = [self _ transferWithPath:path];1383 transfer = [self _unfinishedTransferWithPath:path]; 1391 1384 1392 1385 if(!transfer)
