use the new status values in the inspector tooltips

This commit is contained in:
Mitchell Livingston 2008-01-10 00:45:52 +00:00
parent f0f958d755
commit b4d3c64e8e
2 changed files with 16 additions and 29 deletions

View File

@ -759,34 +759,18 @@ typedef enum
break;
}
/*int status = [[peer objectForKey: @"Status"] intValue];
if (status & TR_PEER_STATUS_HANDSHAKE)
[components addObject: NSLocalizedString(@"Handshaking", "Inspector -> peer -> status")];
else
{
NSMutableArray * peerStatusArray = [NSMutableArray arrayWithCapacity: 2];
if (status & TR_PEER_STATUS_CLIENT_IS_SENDING)
[peerStatusArray addObject: NSLocalizedString(@"Uploading to peer", "Inspector -> peer -> status")];
else if (status & TR_PEER_STATUS_PEER_IS_INTERESTED)
[peerStatusArray addObject: NSLocalizedString(@"Peer wants our data", "Inspector -> peer -> status")];
else if (status & TR_PEER_STATUS_PEER_IS_CHOKED)
[peerStatusArray addObject: NSLocalizedString(@"Refusing to send data to peer", "Inspector -> peer -> status")];
else;
if (status & TR_PEER_STATUS_PEER_IS_SENDING)
[peerStatusArray addObject: NSLocalizedString(@"Downloading from peer", "Inspector -> peer -> status")];
else if (status & TR_PEER_STATUS_CLIENT_SENT_REQUEST)
[peerStatusArray addObject: NSLocalizedString(@"Requesting data from peer", "Inspector -> peer -> status")];
else if (status & TR_PEER_STATUS_CLIENT_IS_INTERESTED)
[peerStatusArray addObject: NSLocalizedString(@"Waiting to request data from peer", "Inspector -> peer -> status")];
else if (status & TR_PEER_STATUS_CLIENT_IS_CHOKED)
[peerStatusArray addObject: NSLocalizedString(@"Peer will not send us data", "Inspector -> peer -> status")];
else;
if ([peerStatusArray count] > 0)
[components addObject: [peerStatusArray componentsJoinedByString: @" - "]];
}*/
NSMutableArray * peerStatusArray = [NSMutableArray arrayWithCapacity: 2];
if ([[peer objectForKey: @"PeerChoked"] boolValue])
[peerStatusArray addObject: NSLocalizedString(@"Refusing to send data to peer", "Inspector -> peer -> status")];
if ([[peer objectForKey: @"PeerInterested"] boolValue])
[peerStatusArray addObject: NSLocalizedString(@"Peer wants our data", "Inspector -> peer -> status")];
if ([[peer objectForKey: @"ClientChoked"] boolValue])
[peerStatusArray addObject: NSLocalizedString(@"Peer will not send us data", "Inspector -> peer -> status")];
if ([[peer objectForKey: @"ClientInterested"] boolValue])
[peerStatusArray addObject: NSLocalizedString(@"Waiting to request data from peer", "Inspector -> peer -> status")];
if ([peerStatusArray count] > 0)
[components addObject: [@"\n" stringByAppendingString: [peerStatusArray componentsJoinedByString: @"\n"]]];
return [components componentsJoinedByString: @"\n"];
}

View File

@ -874,7 +874,10 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
[NSNumber numberWithFloat: peer->progress], @"Progress",
[NSNumber numberWithBool: peer->isEncrypted], @"Encryption",
[NSString stringWithCString: (char *)peer->client encoding: NSUTF8StringEncoding], @"Client",
/*[NSNumber numberWithInt: peer->status], @"Status",*/ nil];
[NSNumber numberWithBool: peer->peerIsChoked], @"PeerChoked",
[NSNumber numberWithBool: peer->peerIsInterested], @"PeerInterested",
[NSNumber numberWithBool: peer->clientIsChoked], @"ClientChoked",
[NSNumber numberWithBool: peer->clientIsInterested], @"ClientInterested", nil];
if (peer->isDownloading)
[dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"];