Ignore:
Timestamp:
Apr 4, 2009, 5:29:08 AM (13 years ago)
Author:
charles
Message:

(trunk)

  1. add to the "recently-changed" torrent a list of recently-removed torrent ids.
  2. make the day-of-week alt speed a bitfield of days or'ed together, so that you can have (say) speed limits on monday and wednesday
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpcimpl.c

    r8130 r8132  
    2929#include "utils.h"
    3030#include "web.h"
     31
     32#define RECENTLY_ACTIVE_SECONDS 60
    3133
    3234#define TR_N_ELEMENTS( ary ) ( sizeof( ary ) / sizeof( *ary ) )
     
    149151            tr_torrent * tor = NULL;
    150152            const time_t now = time( NULL );
    151             const time_t window = 60;
     153            const time_t window = RECENTLY_ACTIVE_SECONDS;
    152154            const int n = tr_sessionCountTorrents( session );
    153155            torrents = tr_new0( tr_torrent *, n );
     
    591593    tr_benc *     fields;
    592594    const char *  msg = NULL;
     595    const char *  strVal;
    593596
    594597    assert( idle_data == NULL );
     598
     599    if( tr_bencDictFindStr( args_in, "ids", &strVal ) && !strcmp( strVal, "recently-active" ) ) {
     600        int n = 0;
     601        tr_benc * d;
     602        const time_t now = time( NULL );
     603        const int interval = RECENTLY_ACTIVE_SECONDS;
     604        tr_benc * removed_out = tr_bencDictAddList( args_out, "removed", 0 );
     605        while(( d = tr_bencListChild( &session->removedTorrents, n++ ))) {
     606            int64_t intVal;
     607            if( tr_bencDictFindInt( d, "date", &intVal ) && ( intVal >= now - interval ) ) {
     608                tr_bencDictFindInt( d, "id", &intVal );
     609                tr_bencListAddInt( removed_out, intVal );
     610            }
     611        }
     612    }
    595613
    596614    if( !tr_bencDictFindList( args_in, "fields", &fields ) )
Note: See TracChangeset for help on using the changeset viewer.