mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
Check for private flag in main dict too.
This commit is contained in:
@@ -1007,7 +1007,7 @@ actionclick(GtkWidget *widget, gpointer gdata) {
|
||||
/* tor will be unref'd in the politely_stopped signal handler */
|
||||
g_object_ref(tor);
|
||||
tr_torrent_stop_politely(tor);
|
||||
if(TR_FSAVEPRIVATE & tr_torrent_info(tor)->flags)
|
||||
if(TR_FLAG_SAVE & tr_torrent_info(tor)->flags)
|
||||
tr_torrentRemoveSaved(tr_torrent_handle(tor));
|
||||
gtk_list_store_remove(GTK_LIST_STORE(data->model), &iter);
|
||||
changed = TRUE;
|
||||
|
||||
@@ -272,7 +272,7 @@ tr_torrent_new(GObject *backend, const char *torrent, const char *dir,
|
||||
back = tr_backend_handle(TR_BACKEND(backend));
|
||||
trflags = 0;
|
||||
if((TR_TORNEW_SAVE_COPY|TR_TORNEW_SAVE_MOVE) & flags)
|
||||
trflags |= TR_FSAVEPRIVATE;
|
||||
trflags |= TR_FLAG_SAVE;
|
||||
errcode = -1;
|
||||
|
||||
if(TR_TORNEW_LOAD_SAVED & flags)
|
||||
@@ -380,7 +380,7 @@ tr_torrent_get_state(TrTorrent *tor, benc_val_t *state) {
|
||||
state->val.l.vals = g_new0(benc_val_t, 6);
|
||||
state->val.l.alloc = state->val.l.count = 6;
|
||||
|
||||
if(TR_FSAVEPRIVATE & in->flags) {
|
||||
if(TR_FLAG_SAVE & in->flags) {
|
||||
SETSTRVAL(state->val.l.vals + 0, "hash");
|
||||
SETSTRVAL(state->val.l.vals + 1, in->hashString);
|
||||
} else {
|
||||
|
||||
@@ -171,9 +171,12 @@ int tr_metainfoParse( tr_info_t * inf, const char * path,
|
||||
}
|
||||
|
||||
/* Private torrent */
|
||||
if( ( val = tr_bencDictFind( beInfo, "private" ) ) && TYPE_INT == val->type )
|
||||
if( ( NULL != ( val = tr_bencDictFind( beInfo, "private" ) ) &&
|
||||
TYPE_INT == val->type && val->val.i ) ||
|
||||
( NULL != ( val = tr_bencDictFind( &meta, "private" ) ) &&
|
||||
TYPE_INT == val->type && val->val.i ) )
|
||||
{
|
||||
inf->privateTorrent = val->val.i;
|
||||
inf->flags |= TR_FLAG_PRIVATE;
|
||||
}
|
||||
|
||||
/* Piece length */
|
||||
|
||||
@@ -52,7 +52,7 @@ tr_torrent_t * tr_torrentInit( tr_handle_t * h, const char * path,
|
||||
int flags, int * error )
|
||||
{
|
||||
tr_torrent_t * tor = calloc( sizeof( tr_torrent_t ), 1 );
|
||||
int saveCopy = ( TR_FSAVEPRIVATE & flags );
|
||||
int saveCopy = ( TR_FLAG_SAVE & flags );
|
||||
|
||||
/* Parse torrent file */
|
||||
if( tr_metainfoParse( &tor->info, path, NULL, saveCopy ) )
|
||||
@@ -78,7 +78,7 @@ tr_torrent_t * tr_torrentInitSaved( tr_handle_t * h, const char * hashStr,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return torrentRealInit( h, tor, ( TR_FSAVEPRIVATE | flags ), error );
|
||||
return torrentRealInit( h, tor, ( TR_FLAG_SAVE | flags ), error );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
@@ -199,8 +199,8 @@ void tr_close( tr_handle_t * );
|
||||
* Opens and parses torrent file at 'path'. If the file exists and is a
|
||||
* valid torrent file, returns an handle and adds it to the list of
|
||||
* torrents (but doesn't start it). Returns NULL and sets *error
|
||||
* otherwise. If the TR_FSAVEPRIVATE flag is passed then a private copy
|
||||
* of the torrent file will be saved.
|
||||
* otherwise. If the TR_FLAG_SAVE flag is passed then a copy of the
|
||||
* torrent file will be saved.
|
||||
**********************************************************************/
|
||||
#define TR_EINVALID 1
|
||||
#define TR_EUNSUPPORTED 2
|
||||
@@ -306,8 +306,8 @@ void tr_torrentAmountFinished( tr_torrent_t * tor, float * tab, int size );
|
||||
/***********************************************************************
|
||||
* tr_torrentRemoveSaved
|
||||
***********************************************************************
|
||||
* Removes the private saved copy of a torrent file for torrents which
|
||||
* the TR_FSAVEPRIVATE flag is set.
|
||||
* Removes the saved copy of a torrent file for torrents which the
|
||||
* TR_FLAG_SAVE flag is set.
|
||||
**********************************************************************/
|
||||
void tr_torrentRemoveSaved( tr_torrent_t * );
|
||||
|
||||
@@ -339,7 +339,8 @@ struct tr_info_s
|
||||
char name[MAX_PATH_LENGTH];
|
||||
|
||||
/* Flags */
|
||||
#define TR_FSAVEPRIVATE 0x01 /* save a private copy of the torrent */
|
||||
#define TR_FLAG_SAVE 0x01 /* save a copy of the torrent file */
|
||||
#define TR_FLAG_PRIVATE 0x02 /* do not share information for this torrent */
|
||||
int flags;
|
||||
|
||||
/* Tracker info */
|
||||
@@ -354,7 +355,6 @@ struct tr_info_s
|
||||
char comment[MAX_PATH_LENGTH];
|
||||
char creator[MAX_PATH_LENGTH];
|
||||
int dateCreated;
|
||||
int privateTorrent;
|
||||
|
||||
/* Pieces info */
|
||||
int pieceSize;
|
||||
|
||||
@@ -845,7 +845,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
|
||||
- (BOOL) privateTorrent
|
||||
{
|
||||
return fInfo->privateTorrent;
|
||||
return TR_FLAG_PRIVATE & fInfo->flags;
|
||||
}
|
||||
|
||||
- (NSString *) torrentLocation
|
||||
@@ -1143,10 +1143,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
|
||||
int error;
|
||||
if (hashString)
|
||||
fHandle = tr_torrentInitSaved(fLib, [hashString UTF8String], TR_FSAVEPRIVATE, & error);
|
||||
fHandle = tr_torrentInitSaved(fLib, [hashString UTF8String], TR_FLAG_SAVE, & error);
|
||||
|
||||
if (!fHandle && path)
|
||||
fHandle = tr_torrentInit(fLib, [path UTF8String], TR_FSAVEPRIVATE, & error);
|
||||
fHandle = tr_torrentInit(fLib, [path UTF8String], TR_FLAG_SAVE, & error);
|
||||
|
||||
if (!fHandle)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user