(trunk libT) change the new public API a little bit -- clearer, but a little wordier
This commit is contained in:
parent
7b5dcdf6d1
commit
0df58b9ab4
|
@ -107,7 +107,7 @@ readOrWriteBytes( const tr_torrent * tor,
|
|||
{
|
||||
base = tor->currentDir;
|
||||
|
||||
if( tr_sessionIsPartialFilenamesEnabled( tor->session ) )
|
||||
if( tr_sessionIsIncompleteFileNamingEnabled( tor->session ) )
|
||||
subpath = tr_torrentBuildPartial( tor, fileIndex );
|
||||
else
|
||||
subpath = tr_strdup( file->name );
|
||||
|
|
|
@ -446,7 +446,7 @@ tr_sessionGetSettings( tr_session * s, struct tr_benc * d )
|
|||
tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY_USERNAME, s->proxyUsername );
|
||||
tr_bencDictAddReal( d, TR_PREFS_KEY_RATIO, s->desiredRatio );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RATIO_ENABLED, s->isRatioLimited );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RENAME_PARTIAL_FILES, tr_sessionIsPartialFilenamesEnabled( s ) );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RENAME_PARTIAL_FILES, tr_sessionIsIncompleteFileNamingEnabled( s ) );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RPC_AUTH_REQUIRED, tr_sessionIsRPCPasswordEnabled( s ) );
|
||||
tr_bencDictAddStr ( d, TR_PREFS_KEY_RPC_BIND_ADDRESS, tr_sessionGetRPCBindAddress( s ) );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RPC_ENABLED, tr_sessionIsRPCEnabled( s ) );
|
||||
|
@ -704,7 +704,7 @@ tr_sessionInitImpl( void * vdata )
|
|||
|
||||
found = tr_bencDictFindBool( &settings, TR_PREFS_KEY_RENAME_PARTIAL_FILES, &boolVal );
|
||||
assert( found );
|
||||
tr_sessionSetPartialFilenamesEnabled( session, boolVal );
|
||||
tr_sessionSetIncompleteFileNamingEnabled( session, boolVal );
|
||||
|
||||
found = tr_bencDictFindBool( &settings, TR_PREFS_KEY_PROXY_ENABLED, &boolVal );
|
||||
assert( found );
|
||||
|
@ -937,20 +937,20 @@ tr_sessionGetDownloadDir( const tr_session * session )
|
|||
***/
|
||||
|
||||
void
|
||||
tr_sessionSetPartialFilenamesEnabled( tr_session * session, tr_bool b )
|
||||
tr_sessionSetIncompleteFileNamingEnabled( tr_session * session, tr_bool b )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
assert( tr_isBool( b ) );
|
||||
|
||||
session->isPartialNamesEnabled = b;
|
||||
session->isIncompleteFileNamingEnabled = b;
|
||||
}
|
||||
|
||||
tr_bool
|
||||
tr_sessionIsPartialFilenamesEnabled( const tr_session * session )
|
||||
tr_sessionIsIncompleteFileNamingEnabled( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->isPartialNamesEnabled;
|
||||
return session->isIncompleteFileNamingEnabled;
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
@ -51,7 +51,7 @@ struct tr_session
|
|||
tr_bool isClosed;
|
||||
tr_bool isWaiting;
|
||||
tr_bool useLazyBitfield;
|
||||
tr_bool isPartialNamesEnabled;
|
||||
tr_bool isIncompleteFileNamingEnabled;
|
||||
tr_bool isRatioLimited;
|
||||
tr_bool isIncompleteDirEnabled;
|
||||
|
||||
|
|
|
@ -360,20 +360,28 @@ static TR_INLINE const char * tr_torrentName( const tr_torrent * tor )
|
|||
void tr_torrentFileCompleted( tr_torrent * tor, tr_file_index_t fileNo );
|
||||
|
||||
|
||||
/* Like tr_torrentFindFile(), but splits the filename into base
|
||||
* (tr_torrent.incompleteDir or tr_torrent.downloadDir) and subpath */
|
||||
/**
|
||||
* @brief Like tr_torrentFindFile(), but splits the filename into base and subpath;
|
||||
*
|
||||
* If the file is found, "tr_buildPath( base, subpath, NULL )"
|
||||
* will generate the complete filename.
|
||||
*
|
||||
* @return true if the file is found, false otherwise.
|
||||
*
|
||||
* @param base if the torrent is found, this will be either
|
||||
* tor->downloadDir or tor->incompleteDir
|
||||
* @param subpath on success, this pointer is assigned a newly-allocated
|
||||
* string holding the second half of the filename.
|
||||
*/
|
||||
tr_bool tr_torrentFindFile2( const tr_torrent *, tr_file_index_t fileNo,
|
||||
const char ** base, char ** subpath );
|
||||
|
||||
|
||||
/* Returns a newly-allocated string that's been munged to the form
|
||||
* that denotes to humans that it's a partial file.
|
||||
* This is like the filenames in tr_torrent.info.files --
|
||||
* it's not a complete filename by itself, but a fragment that
|
||||
* can be passed to tr_buildPath() */
|
||||
/* Returns a newly-allocated version of the tr_file.name string
|
||||
* that's been modified to denote that it's not a complete file yet.
|
||||
* In the current implementation this is done by appending ".part"
|
||||
* a la Firefox. */
|
||||
char* tr_torrentBuildPartial( const tr_torrent *, tr_file_index_t fileNo );
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -361,18 +361,17 @@ tr_bool tr_sessionIsIncompleteDirEnabled( const tr_session * session );
|
|||
|
||||
|
||||
/**
|
||||
* @brief When enabled, unfinished torrent content files created after
|
||||
* this call will have ".part" appended to their filename
|
||||
* @brief When enabled, newly-created files will have ".part" appended
|
||||
* to their filename until the file is fully downloaded
|
||||
*
|
||||
* This is not retroactive -- toggling this will not rename existing files.
|
||||
* It only applies to new files created by Transmission after this API call.
|
||||
*
|
||||
* @param session
|
||||
* @param enable
|
||||
* @see tr_sessionIsIncompleteFileNamingEnabled()
|
||||
*/
|
||||
void tr_sessionSetPartialFilenamesEnabled( tr_session * session, tr_bool );
|
||||
void tr_sessionSetIncompleteFileNamingEnabled( tr_session * session, tr_bool );
|
||||
|
||||
tr_bool tr_sessionIsPartialFilenamesEnabled( const tr_session * session );
|
||||
tr_bool tr_sessionIsIncompleteFileNamingEnabled( const tr_session * session );
|
||||
|
||||
/**
|
||||
* @brief Set whether or not RPC calls are allowed in this session.
|
||||
|
@ -1129,10 +1128,10 @@ int tr_torrentGetFileDL( const tr_torrent * torrent,
|
|||
tr_file_index_t file );
|
||||
|
||||
/** @brief Set a batch of files to be downloaded or not. */
|
||||
void tr_torrentSetFileDLs( tr_torrent * torrent,
|
||||
tr_file_index_t * files,
|
||||
tr_file_index_t fileCount,
|
||||
tr_bool do_download );
|
||||
void tr_torrentSetFileDLs( tr_torrent * torrent,
|
||||
tr_file_index_t * files,
|
||||
tr_file_index_t fileCount,
|
||||
tr_bool do_download );
|
||||
|
||||
|
||||
const tr_info * tr_torrentInfo( const tr_torrent * torrent );
|
||||
|
|
Loading…
Reference in New Issue