diff --git a/libtransmission/internal.h b/libtransmission/internal.h index de811fcdb..c41cd3dc0 100644 --- a/libtransmission/internal.h +++ b/libtransmission/internal.h @@ -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 * ); diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index d7b607548..94a24ea26 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -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 * ); diff --git a/macosx/Torrent.h b/macosx/Torrent.h index e95ea3cb6..da471677e 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -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; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index f347bc3d0..fbc9b4989 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -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;