use libtransmission's "can announce" functionality instead of custom mac code

This commit is contained in:
Mitchell Livingston 2007-07-30 22:19:52 +00:00
parent e677cb8017
commit e406ece219
3 changed files with 6 additions and 19 deletions

View File

@ -1324,8 +1324,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
NSDate * date; NSDate * date;
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
{ {
//time interval returned will be negative if ([torrent canAnnounce])
if (!(date = [torrent announceDate]) || [date timeIntervalSinceNow] <= ANNOUNCE_WAIT_INTERVAL_SECONDS)
[torrent announce]; [torrent announce];
} }
} }
@ -2896,8 +2895,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
{ {
//time interval returned will be negative //time interval returned will be negative
if ([torrent isActive] && if ([torrent canAnnounce])
(!(date = [torrent announceDate]) || [date timeIntervalSinceNow] <= ANNOUNCE_WAIT_INTERVAL_SECONDS))
return YES; return YES;
} }
return NO; return NO;

View File

@ -37,8 +37,7 @@
int fID; int fID;
BOOL fResumeOnWake; BOOL fResumeOnWake;
NSDate * fDateAdded, * fDateCompleted, * fAnnounceDate, NSDate * fDateAdded, * fDateCompleted, * fDateActivity;
* fDateActivity;
BOOL fUseIncompleteFolder; BOOL fUseIncompleteFolder;
NSString * fDownloadFolder, * fIncompleteFolder; NSString * fDownloadFolder, * fIncompleteFolder;
@ -92,7 +91,7 @@
- (void) wakeUp; - (void) wakeUp;
- (void) announce; - (void) announce;
- (NSDate *) announceDate; - (BOOL) canAnnounce;
- (void) resetCache; - (void) resetCache;

View File

@ -171,8 +171,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[fDateCompleted release]; [fDateCompleted release];
[fDateActivity release]; [fDateActivity release];
[fAnnounceDate release];
[fIcon release]; [fIcon release];
[fIconFlipped release]; [fIconFlipped release];
[fIconSmall release]; [fIconSmall release];
@ -559,20 +557,12 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (void) announce - (void) announce
{ {
if (![self isActive])
return;
#warning doesn't work!
tr_manualUpdate(fHandle); tr_manualUpdate(fHandle);
if (fAnnounceDate)
[fAnnounceDate release];
fAnnounceDate = [[NSDate date] retain];
} }
- (NSDate *) announceDate - (BOOL) canAnnounce
{ {
return fAnnounceDate; return tr_torrentCanManualUpdate(fHandle);
} }
- (void) resetCache - (void) resetCache