Ignore:
Timestamp:
Jul 16, 2010, 3:12:57 AM (12 years ago)
Author:
livings124
Message:

First go at #2560 "inactive seeding time limit". libtransmission and Mac support are currently implemented.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r11001 r11013  
    4646- (void) completenessChange: (NSDictionary *) statusInfo;
    4747- (void) ratioLimitHit;
     48- (void) inactiveLimitHit;
    4849- (void) metadataRetrieved;
    4950
     
    6465{
    6566    [(Torrent *)torrentData performSelectorOnMainThread: @selector(ratioLimitHit) withObject: nil waitUntilDone: NO];
     67}
     68
     69void inactiveLimitHitCallback(tr_torrent * torrent, void * torrentData)
     70{
     71    [(Torrent *)torrentData performSelectorOnMainThread: @selector(inactiveLimitHit) withObject: nil waitUntilDone: NO];
    6672}
    6773
     
    293299        [self update];
    294300       
    295         //capture, specifically, ratio setting changing to unlimited
     301        //capture, specifically, stop-seeding settings changing to unlimited
    296302        [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptions" object: nil];
    297303    }
     
    386392{
    387393    return fStat->seedRatioPercentDone;
     394}
     395
     396- (tr_inactvelimit) inactiveSetting
     397{
     398    return tr_torrentGetInactiveMode(fHandle);
     399}
     400
     401- (void) setInactiveSetting: (tr_inactvelimit) setting
     402{
     403    tr_torrentSetInactiveMode(fHandle, setting);
     404}
     405
     406- (NSUInteger) inactiveLimitMinutes
     407{
     408    return tr_torrentGetInactiveLimit(fHandle);
     409}
     410
     411- (void) setInactiveLimitMinutes: (NSUInteger) limit
     412{
     413    NSAssert(limit > 0, @"Inactive limit must be greater than zero");
     414    tr_torrentSetInactiveLimit(fHandle, limit);
     415}
     416
     417- (BOOL) seedInactiveLimitSet
     418{
     419    return tr_torrentGetSeedInactive(fHandle, NULL);
    388420}
    389421
     
    9811013    }
    9821014   
    983     //add time when downloading
     1015    //add time when downloading or seed limit set
    9841016    if (fStat->activity == TR_STATUS_DOWNLOAD || ([self isSeeding] && [self seedRatioSet]))
    9851017        string = [string stringByAppendingFormat: @" - %@", [self etaString]];
     
    11301162- (NSString *) remainingTimeString
    11311163{
     1164    #warning update?
    11321165    if (fStat->activity == TR_STATUS_DOWNLOAD || ([self isSeeding] && [self seedRatioSet]))
    11331166        return [self etaString];
     
    16141647    tr_torrentSetCompletenessCallback(fHandle, completenessChangeCallback, self);
    16151648    tr_torrentSetRatioLimitHitCallback(fHandle, ratioLimitHitCallback, self);
     1649    tr_torrentSetInactiveLimitHitCallback(fHandle, inactiveLimitHitCallback, self);
    16161650    tr_torrentSetMetadataCallback(fHandle, metadataCallback, self);
    16171651   
     
    17691803}
    17701804
     1805- (void) inactiveLimitHit
     1806{
     1807    fStat = tr_torrentStat(fHandle);
     1808   
     1809    #warning fix
     1810    [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentStoppedForRatio" object: self];
     1811}
     1812
    17711813- (void) metadataRetrieved
    17721814{
Note: See TracChangeset for help on using the changeset viewer.