Ignore:
Timestamp:
Feb 6, 2011, 5:30:46 PM (11 years ago)
Author:
jordan
Message:

(trunk) #3675 "Not all .part files are removed" -- handle trashing files via RPC.

When libtransmission gets a "remove torrent" request from RPC, it tries to delegate the work. This is because the GTK+ and Mac clients don't want torrents disappearing in a different thread and causing possible thread issues. So the GTK+ and Mac clients get notification about this via libtransmission's RPC callback and remove the torrents themselves. Unfortunately, that notification doesn't include information about whether or not to delete local data.

This commit adds that information to the RPC callback so that the Mac and GTK+ clients will know whether or not to trash the local files when a third-party RPC client requests that at torrent and its files be deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpcimpl.c

    r11709 r11834  
    245245    int i;
    246246    int torrentCount;
     247    tr_rpc_callback_type type;
     248    tr_bool deleteFlag = FALSE;
    247249    tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
    248250
    249251    assert( idle_data == NULL );
    250252
     253    tr_bencDictFindBool( args_in, "delete-local-data", &deleteFlag );
     254    type = deleteFlag ? TR_RPC_TORRENT_TRASHING
     255                      : TR_RPC_TORRENT_REMOVING;
     256
    251257    for( i=0; i<torrentCount; ++i )
    252258    {
    253259        tr_torrent * tor = torrents[i];
    254         const tr_rpc_callback_status status = notify( session, TR_RPC_TORRENT_REMOVING, tor );
     260        const tr_rpc_callback_status status = notify( session, type, tor );
    255261        if( !( status & TR_RPC_NOREMOVE ) )
    256         {
    257             tr_bool deleteFlag = FALSE;
    258             tr_bencDictFindBool( args_in, "delete-local-data", &deleteFlag );
    259262            tr_torrentRemove( tor, deleteFlag, NULL );
    260         }
    261263    }
    262264
Note: See TracChangeset for help on using the changeset viewer.