mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
make libtransmission's pex accessor public, and eliminate a redundant variable in Torrent.[mh]
This commit is contained in:
parent
57eaa27970
commit
cc2db392f5
4 changed files with 12 additions and 16 deletions
|
@ -61,8 +61,6 @@ void tr_torrentSetHasPiece( tr_torrent * tor, int pieceIndex, int has );
|
|||
void tr_torrentLock ( const tr_torrent * );
|
||||
void tr_torrentUnlock ( const tr_torrent * );
|
||||
|
||||
int tr_torrentIsPexEnabled( const tr_torrent * );
|
||||
|
||||
void tr_torrentChangeMyPort ( tr_torrent * );
|
||||
|
||||
int tr_torrentExists( tr_handle *, const uint8_t * );
|
||||
|
|
|
@ -403,6 +403,7 @@ tr_torrent * tr_torrentInitSaved( tr_handle *,
|
|||
* disabled and cannot be enabled.
|
||||
**********************************************************************/
|
||||
void tr_torrentDisablePex( tr_torrent *, int disable );
|
||||
int tr_torrentIsPexEnabled( const tr_torrent * );
|
||||
|
||||
const tr_info * tr_torrentInfo( const tr_torrent * );
|
||||
|
||||
|
|
|
@ -52,8 +52,6 @@ typedef enum
|
|||
BOOL fPublicTorrent;
|
||||
NSString * fPublicTorrentLocation;
|
||||
|
||||
BOOL fPex;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
|
||||
NSImage * fIcon;
|
||||
|
@ -200,7 +198,7 @@ typedef enum
|
|||
- (float) swarmSpeed;
|
||||
|
||||
- (BOOL) pex;
|
||||
- (void) setPex: (BOOL) setting;
|
||||
- (void) setPex: (BOOL) enabled;
|
||||
|
||||
- (NSNumber *) orderValue;
|
||||
- (void) setOrderValue: (int) orderValue;
|
||||
|
|
|
@ -135,8 +135,9 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
if (fPublicTorrent)
|
||||
[history setObject: [self publicTorrentLocation] forKey: @"TorrentPath"];
|
||||
|
||||
#warning need?
|
||||
if (![self privateTorrent])
|
||||
[history setObject: [NSNumber numberWithBool: fPex] forKey: @"Pex"];
|
||||
[history setObject: [NSNumber numberWithBool: [self pex]] forKey: @"Pex"];
|
||||
|
||||
if (fDateCompleted)
|
||||
[history setObject: fDateCompleted forKey: @"DateCompleted"];
|
||||
|
@ -1130,16 +1131,12 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
|
||||
- (BOOL) pex
|
||||
{
|
||||
return fPex;
|
||||
return tr_torrentIsPexEnabled(fHandle);
|
||||
}
|
||||
|
||||
- (void) setPex: (BOOL) setting
|
||||
- (void) setPex: (BOOL) enabled
|
||||
{
|
||||
if (![self privateTorrent])
|
||||
{
|
||||
fPex = setting;
|
||||
tr_torrentDisablePex(fHandle, !setting);
|
||||
}
|
||||
tr_torrentDisablePex(fHandle, !enabled);
|
||||
}
|
||||
|
||||
- (NSNumber *) orderValue
|
||||
|
@ -1464,11 +1461,13 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
fRatioLimit = ratioLimit ? [ratioLimit floatValue] : [fDefaults floatForKey: @"RatioLimit"];
|
||||
fFinishedSeeding = NO;
|
||||
|
||||
#warning need?
|
||||
BOOL pexEnable;
|
||||
if ([self privateTorrent])
|
||||
fPex = NO;
|
||||
pexEnable = NO;
|
||||
else
|
||||
fPex = pex ? [pex boolValue] : YES;
|
||||
tr_torrentDisablePex(fHandle, !fPex);
|
||||
pexEnable = pex ? [pex boolValue] : YES;
|
||||
[self setPex: pexEnable];
|
||||
|
||||
fWaitToStart = waitToStart ? [waitToStart boolValue] : [fDefaults boolForKey: @"AutoStartDownload"];
|
||||
fOrderValue = orderValue ? [orderValue intValue] : tr_torrentCount(fLib) - 1;
|
||||
|
|
Loading…
Reference in a new issue