1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

Saves in history the date at which the torrent was loaded

This commit is contained in:
Eric Petit 2006-04-25 16:31:19 +00:00
parent cf56d58f06
commit 734845196a
3 changed files with 130 additions and 107 deletions

View file

@ -109,6 +109,7 @@ static void sleepCallBack( void * controller, io_service_t y,
NSLog( @"Could not IORegisterForSystemPower" );
NSString * torrentPath, * downloadFolder, * paused;
NSDate * date;
NSDictionary * dic;
Torrent * torrent;
@ -122,7 +123,11 @@ static void sleepCallBack( void * controller, io_service_t y,
if (!torrentPath || !downloadFolder || !paused)
continue;
if ((date = [dic objectForKey: @"Date"]))
torrent = [[Torrent alloc] initWithPath: torrentPath lib: fLib date: date];
else
torrent = [[Torrent alloc] initWithPath: torrentPath lib: fLib];
if( !torrent )
continue;
@ -679,6 +684,7 @@ static void sleepCallBack( void * controller, io_service_t y,
[torrent path], @"TorrentPath",
[torrent getFolder], @"DownloadFolder",
[torrent isActive] ? @"NO" : @"YES", @"Paused",
[torrent date], @"Date",
nil]];
}

View file

@ -30,6 +30,7 @@
tr_info_t * fInfo;
tr_stat_t * fStat;
BOOL fResumeOnWake;
NSDate * fDate;
NSImage * fIcon;
NSImage * fIconNonFlipped;
@ -40,6 +41,8 @@
}
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib;
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
date: (NSDate *) date;
- (void) setFolder: (NSString *) path;
- (NSString *) getFolder;
- (void) getAvailability: (int8_t *) tab size: (int) size;
@ -78,5 +81,6 @@
- (int) leechers;
- (uint64_t) downloaded;
- (uint64_t) uploaded;
- (NSDate *) date;
@end

View file

@ -33,7 +33,7 @@
@implementation Torrent
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib date: (NSDate *) date
{
fLib = lib;
@ -45,6 +45,7 @@
return nil;
}
fDate = [date retain];
fInfo = tr_torrentInfo( fHandle );
NSString * fileType = ( fInfo->fileCount > 1 ) ?
@ -64,12 +65,19 @@
return self;
}
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
{
return [self initWithPath: path lib: lib date: [NSDate date]];
}
- (void) dealloc
{
if( fHandle )
{
tr_torrentClose( fLib, fHandle );
[fDate release];
[fIcon release];
[fIconNonFlipped release];
[fStatusString release];
[fInfoString release];
[fDownloadString release];
@ -351,6 +359,11 @@
return fStat->uploaded;
}
- (NSDate *) date
{
return fDate;
}
@end