1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

make libtransmission's pex accessor public, and eliminate a redundant variable in Torrent.[mh]

This commit is contained in:
Mitchell Livingston 2007-10-14 22:01:55 +00:00
parent 57eaa27970
commit cc2db392f5
4 changed files with 12 additions and 16 deletions

View file

@ -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 * );

View file

@ -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 * );

View file

@ -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;

View file

@ -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;