~ubuntu-branches/ubuntu/jaunty/transmission/jaunty-updates

« back to all changes in this revision

Viewing changes to macosx/Controller.m

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2008-11-28 15:33:48 UTC
  • mfrom: (1.1.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20081128153348-it70trfnxiroblmc
Tags: 1.40-0ubuntu1
* New upstream release (LP: #302672)
  - Tracker communication uses fewer resources
  - More accurate bandwidth limits
  - Reduce disk fragmentation by preallocating files (LP: #287726)
  - Stability, security and performance improvements to the RPC /
    Web UI server (closes LP: #290423)
  - Support compression when serving Web UI and RPC responses
  - Simplify the RPC whitelist
  - Fix bug that prevented handshakes with encrypted BitComet peers
  - Fix 1.3x bug that could re-download some data unnecessarily
    (LP: #295040)
  - Option to automatically update the blocklist weekly
  - Added off-hour bandwidth scheduling
  - Simplify file/priority selection in the details dialog
  - Fix a couple of crashes
  - New / updated translations
  - Don't inhibit hibernation by default (LP: #292929)
  - Use "close" animation when sending to notification area (LP: #130811)
  - Fix resize problems (LP: #269872)
  - Support "--version" option when launching from command line
    (LP: #292011)
  - Correctly parse announce URLs that have leading or trailing
    spaces (LP: #262411)
  - Display an error when "Open Torrent" fails (LP: #281463)
* Dropped 10_fix_crasher_from_upstream.dpatch: Fix is in this
  upstream release.
* debian/control: Don't just build-depend on libcurl-dev, which is
  a virtual package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: Controller.m 6330 2008-07-15 01:25:21Z livings124 $
 
2
 * $Id: Controller.m 7084 2008-11-09 14:25:52Z livings124 $
3
3
 * 
4
4
 * Copyright (c) 2005-2008 Transmission authors and contributors
5
5
 *
23
23
 *****************************************************************************/
24
24
 
25
25
#import <IOKit/IOMessage.h>
 
26
#import <IOKit/pwr_mgt/IOPMLib.h>
26
27
 
27
28
#import "Controller.h"
28
29
#import "Torrent.h"
38
39
#import "ButtonToolbarItem.h"
39
40
#import "GroupToolbarItem.h"
40
41
#import "ToolbarSegmentedCell.h"
 
42
#import "BlocklistDownloader.h"
 
43
#import "StatusBarView.h"
 
44
#import "FilterButton.h"
 
45
#import "MenuLabel.h"
41
46
#import "NSApplicationAdditions.h"
42
47
#import "NSStringAdditions.h"
43
48
#import "NSMenuAdditions.h"
44
49
#import "ExpandedPathToPathTransformer.h"
45
50
#import "ExpandedPathToIconTransformer.h"
46
51
#import "SpeedLimitToTurtleIconTransformer.h"
47
 
#include "utils.h" //tr_getRatio()
 
52
#import "metainfo.h"
 
53
#import "utils.h"
48
54
 
49
55
#import "UKKQueue.h"
50
56
#import <Sparkle/Sparkle.h>
138
144
 
139
145
#define WEBSITE_URL @"http://www.transmissionbt.com/"
140
146
#define FORUM_URL   @"http://forum.transmissionbt.com/"
 
147
#define TRAC_URL   @"http://trac.transmissionbt.com/"
141
148
#define DONATE_URL  @"http://www.transmissionbt.com/donate.php"
142
149
 
143
 
static void rpcCallback(tr_handle * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct, void * controller)
 
150
static tr_rpc_callback_status rpcCallback(tr_handle * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct, void * controller)
144
151
{
145
152
    [(Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct];
 
153
    return TR_RPC_NOREMOVE; //we'll do the remove manually
146
154
}
147
155
 
148
156
static void sleepCallback(void * controller, io_service_t y, natural_t messageType, void * messageArgument)
203
211
        
204
212
        fLib = tr_sessionInitFull(NULL, /* use default config directory (Application Support) */
205
213
                                "macosx",
206
 
                                NULL, /* download directory set when adding transfers */
 
214
#warning update when changing in prefs 
 
215
                                [[[fDefaults stringForKey: @"DownloadFolder"] stringByExpandingTildeInPath] UTF8String],
207
216
                                [fDefaults boolForKey: @"PEXGlobal"],
208
217
                                [fDefaults boolForKey: @"NatTraversal"],
209
218
                                [fDefaults integerForKey: @"BindPort"],
210
 
                                TR_ENCRYPTION_PREFERRED, /* reset in prefs */
 
219
                                TR_DEFAULT_ENCRYPTION, /* reset in prefs */
 
220
                                TR_DEFAULT_LAZY_BITFIELD_ENABLED,
211
221
                                NO, /* reset in prefs */
212
222
                                -1, /* reset in prefs */
213
223
                                NO, /* reset in prefs */
219
229
                                [fDefaults integerForKey: @"PeerSocketTOS"], /* hidden pref - default is TR_DEFAULT_PEER_SOCKET_TOS */
220
230
                                [fDefaults boolForKey: @"RPC"],
221
231
                                [fDefaults integerForKey: @"RPCPort"],
 
232
                                [fDefaults boolForKey: @"RPCUseWhitelist"],
222
233
                                NULL, /* reset in prefs */
223
234
                                [fDefaults boolForKey: @"RPCAuthorize"],
224
235
                                [[fDefaults stringForKey: @"RPCUsername"] UTF8String],
238
249
        
239
250
        fMessageController = [[MessageWindowController alloc] init];
240
251
        fInfoController = [[InfoWindowController alloc] init];
241
 
        fPrefsController = [[PrefsController alloc] initWithHandle: fLib];
242
 
        
243
 
        fBadger = [[Badger alloc] initWithLib: fLib];
 
252
        
 
253
        [PrefsController setHandle: fLib];
 
254
        fPrefsController = [[PrefsController alloc] init];
 
255
        
244
256
        [QuickLookController quickLookControllerInitializeWithController: self infoController: fInfoController];
245
257
        
246
258
        fSoundPlaying = NO;
248
260
        tr_sessionSetRPCCallback(fLib, rpcCallback, self);
249
261
        
250
262
        [GrowlApplicationBridge setGrowlDelegate: self];
 
263
        
251
264
        [[UKKQueue sharedFileWatcher] setDelegate: self];
 
265
        
 
266
        SUUpdater * updater = [SUUpdater sharedUpdater];
 
267
        [updater setDelegate: self];
 
268
        fUpdateInProgress = NO;
 
269
        
 
270
        //reset old Sparkle settings from previous versions
 
271
        [fDefaults removeObjectForKey: @"SUScheduledCheckInterval"];
 
272
        if ([fDefaults objectForKey: @"CheckForUpdates"])
 
273
        {
 
274
            [updater setAutomaticallyChecksForUpdates: [fDefaults boolForKey: @"CheckForUpdates"]];
 
275
            [fDefaults removeObjectForKey: @"CheckForUpdates"];
 
276
        }
252
277
    }
253
278
    return self;
254
279
}
342
367
    [fSpeedLimitButton setToolTip: NSLocalizedString(@"Speed Limit overrides the total bandwidth limits with its own limits.",
343
368
                                "Main window -> 2nd bottom left button (turtle) tooltip")];
344
369
    
345
 
    [fPrefsController setUpdater: fUpdater];
346
 
    
347
370
    [fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
348
371
    [fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]];
349
372
 
418
441
    }
419
442
    [[fSearchFilterField cell] setPlaceholderString: filterSearchTypeTitle];
420
443
    
 
444
    fBadger = [[Badger alloc] initWithLib: fLib];
 
445
    
421
446
    //observe notifications
422
447
    NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
423
448
    
434
459
    [nc addObserver: self selector: @selector(torrentTableViewSelectionDidChange:)
435
460
                    name: NSOutlineViewSelectionDidChangeNotification object: fTableView];
436
461
    
437
 
    [nc addObserver: self selector: @selector(prepareForUpdate:)
438
 
                    name: SUUpdaterWillRestartNotification object: nil];
439
 
    fUpdateInProgress = NO;
440
 
    
441
462
    [nc addObserver: self selector: @selector(autoSpeedLimitChange:)
442
463
                    name: @"AutoSpeedLimitChange" object: nil];
443
464
    
513
534
{
514
535
    if (!fUpdateInProgress && [fDefaults boolForKey: @"CheckQuit"])
515
536
    {
516
 
        int active = 0, downloading = 0;
 
537
        NSInteger active = 0, downloading = 0;
517
538
        Torrent * torrent;
518
539
        NSEnumerator * enumerator = [fTorrents objectEnumerator];
519
540
        while ((torrent = [enumerator nextObject]))
543
564
    return NSTerminateNow;
544
565
}
545
566
 
546
 
- (void) quitSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo
 
567
- (void) quitSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
547
568
{
548
569
    [NSApp replyToApplicationShouldTerminate: returnCode == NSAlertDefaultReturn];
549
570
}
550
571
 
551
572
- (void) applicationWillTerminate: (NSNotification *) notification
552
573
{
 
574
    //stop blocklist download
 
575
    if ([BlocklistDownloader isRunning])
 
576
        [[BlocklistDownloader downloader] cancelDownload];
 
577
    
553
578
    //stop timers and notification checking
554
579
    [[NSNotificationCenter defaultCenter] removeObserver: self];
555
580
    
615
640
    NSAppleEventDescriptor * directObject = [event paramDescriptorForKeyword: keyDirectObject];
616
641
    if ([directObject descriptorType] == typeAEList)
617
642
    {
618
 
        unsigned i;
619
 
        for (i = 1; i <= [directObject numberOfItems]; i++)
 
643
        for (NSUInteger i = 1; i <= [directObject numberOfItems]; i++)
620
644
            if ((urlString = [[directObject descriptorAtIndex: i] stringValue]))
621
645
                break;
622
646
    }
867
891
    [dict release];
868
892
}
869
893
 
870
 
- (void) incompleteChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (NSDictionary *) dictionary
 
894
- (void) incompleteChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (NSDictionary *) dictionary
871
895
{
872
896
    if (code == NSOKButton)
873
897
        [fDefaults setObject: [[openPanel filenames] objectAtIndex: 0] forKey: @"IncompleteDownloadFolder"];
877
901
    [self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dictionary waitUntilDone: NO];
878
902
}
879
903
 
880
 
- (void) downloadChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (NSDictionary *) dictionary
 
904
- (void) downloadChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (NSDictionary *) dictionary
881
905
{
882
906
    if (code == NSOKButton)
883
907
    {
916
940
        contextInfo: [NSNumber numberWithBool: sender == fOpenIgnoreDownloadFolder]];
917
941
}
918
942
 
919
 
- (void) openSheetClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSNumber *) useOptions
 
943
- (void) openSheetClosed: (NSOpenPanel *) panel returnCode: (NSInteger) code contextInfo: (NSNumber *) useOptions
920
944
{
921
945
    if (code == NSOKButton)
922
946
    {
1020
1044
    [fURLSheetOpenButton setEnabled: enable];
1021
1045
}
1022
1046
 
1023
 
- (void) urlSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo
 
1047
- (void) urlSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
1024
1048
{
1025
1049
    [fURLSheetTextField selectText: self];
1026
1050
    if (returnCode != 1)
1031
1055
    {
1032
1056
        if ([urlString rangeOfString: @"."].location == NSNotFound)
1033
1057
        {
1034
 
            int beforeCom;
 
1058
            NSInteger beforeCom;
1035
1059
            if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound)
1036
1060
                urlString = [NSString stringWithFormat: @"http://www.%@.com/%@",
1037
1061
                                [urlString substringToIndex: beforeCom],
1131
1155
- (void) removeTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent
1132
1156
{
1133
1157
    [torrents retain];
1134
 
    int active = 0, downloading = 0;
 
1158
    NSInteger active = 0, downloading = 0;
1135
1159
 
1136
1160
    if ([fDefaults boolForKey: @"CheckRemove"])
1137
1161
    {
1154
1178
            
1155
1179
            NSString * title, * message;
1156
1180
            
1157
 
            int selected = [torrents count];
 
1181
            NSInteger selected = [torrents count];
1158
1182
            if (selected == 1)
1159
1183
            {
1160
1184
                NSString * torrentName = [[torrents objectAtIndex: 0] name];
1217
1241
        }
1218
1242
    }
1219
1243
    
1220
 
    [self confirmRemoveTorrents: torrents deleteData: deleteData deleteTorrent: deleteTorrent fromRPC: NO];
 
1244
    [self confirmRemoveTorrents: torrents deleteData: deleteData deleteTorrent: deleteTorrent];
1221
1245
}
1222
1246
 
1223
 
- (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (NSDictionary *) dict
 
1247
- (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (NSDictionary *) dict
1224
1248
{
1225
1249
    NSArray * torrents = [dict objectForKey: @"Torrents"];
1226
1250
    if (returnCode == NSAlertDefaultReturn)
1227
1251
        [self confirmRemoveTorrents: torrents deleteData: [[dict objectForKey: @"DeleteData"] boolValue]
1228
 
                deleteTorrent: [[dict objectForKey: @"DeleteTorrent"] boolValue] fromRPC: NO];
 
1252
                deleteTorrent: [[dict objectForKey: @"DeleteTorrent"] boolValue]];
1229
1253
    else
1230
1254
        [torrents release];
1231
1255
    
1233
1257
}
1234
1258
 
1235
1259
- (void) confirmRemoveTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent
1236
 
        fromRPC: (BOOL) rpc
1237
1260
{
1238
1261
    //don't want any of these starting then stopping
1239
1262
    NSEnumerator * enumerator = [torrents objectEnumerator];
1243
1266
    
1244
1267
    [fTorrents removeObjectsInArray: torrents];
1245
1268
    
1246
 
    int lowestOrderValue = INT_MAX;
 
1269
    NSInteger lowestOrderValue = NSIntegerMax;
1247
1270
    enumerator = [torrents objectEnumerator];
1248
1271
    while ((torrent = [enumerator nextObject]))
1249
1272
    {
1257
1280
        
1258
1281
        lowestOrderValue = MIN(lowestOrderValue, [torrent orderValue]);
1259
1282
        
1260
 
        if (rpc)
1261
 
            [torrent closeRemoveTorrentInterface];
1262
 
        else
1263
 
            [torrent closeRemoveTorrent];
 
1283
        [torrent closeRemoveTorrent];
1264
1284
    }
1265
1285
    
1266
1286
    [torrents release];
1268
1288
    //reset the order values if necessary
1269
1289
    if (lowestOrderValue < [fTorrents count])
1270
1290
    {
1271
 
        int i;
1272
 
        for (i = lowestOrderValue; i < [fTorrents count]; i++)
 
1291
        for (NSInteger i = lowestOrderValue; i < [fTorrents count]; i++)
1273
1292
            [[fTorrents objectAtIndex: i] setOrderValue: i];
1274
1293
    }
1275
1294
    
1313
1332
    [panel setCanCreateDirectories: YES];
1314
1333
    
1315
1334
    torrents = [torrents retain];
1316
 
    int count = [torrents count];
 
1335
    NSInteger count = [torrents count];
1317
1336
    if (count == 1)
1318
1337
        [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for \"%@\".",
1319
1338
                            "Move torrent -> select destination folder"), [[torrents objectAtIndex: 0] name]]];
1325
1344
        didEndSelector: @selector(moveDataFileChoiceClosed:returnCode:contextInfo:) contextInfo: torrents];
1326
1345
}
1327
1346
 
1328
 
- (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSArray *) torrents
 
1347
- (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (NSInteger) code contextInfo: (NSArray *) torrents
1329
1348
{
1330
1349
    if (code == NSOKButton)
1331
1350
    {
1382
1401
    }
1383
1402
}
1384
1403
 
1385
 
- (void) saveTorrentCopySheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (NSMutableArray *) torrents
 
1404
- (void) saveTorrentCopySheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (NSMutableArray *) torrents
1386
1405
{
1387
1406
    //copy torrent to new location with name of data file
1388
1407
    if (code == NSOKButton)
1489
1508
            if (![fStatusBar isHidden])
1490
1509
            {
1491
1510
                //set rates
1492
 
                float downloadRate, uploadRate;
1493
 
                tr_sessionGetSpeed(fLib, &downloadRate, &uploadRate);
1494
 
                
1495
 
                [fTotalDLField setStringValue: [NSString stringForSpeed: downloadRate]];
1496
 
                [fTotalULField setStringValue: [NSString stringForSpeed: uploadRate]];
 
1511
                [fTotalDLField setStringValue: [NSString stringForSpeed: tr_sessionGetPieceSpeed(fLib, TR_DOWN)]];
 
1512
                [fTotalULField setStringValue: [NSString stringForSpeed: tr_sessionGetPieceSpeed(fLib, TR_UP)]];
1497
1513
                
1498
1514
                //set status button text
1499
1515
                NSString * statusLabel = [fDefaults stringForKey: @"StatusLabel"], * statusString;
1551
1567
    NSRect statusFrame = [fStatusButton frame];
1552
1568
    statusFrame.size.width -= 25.0;
1553
1569
    
1554
 
    float difference = NSMaxX(statusFrame) + 5.0 - [fTotalDLImageView frame].origin.x;
 
1570
    CGFloat difference = NSMaxX(statusFrame) + 5.0 - [fTotalDLImageView frame].origin.x;
1555
1571
    if (difference > 0)
1556
1572
        statusFrame.size.width -= difference;
1557
1573
    
1561
1577
- (void) setBottomCountText: (BOOL) filtering
1562
1578
{
1563
1579
    NSString * totalTorrentsString;
1564
 
    int totalCount = [fTorrents count];
 
1580
    NSInteger totalCount = [fTorrents count];
1565
1581
    if (totalCount != 1)
1566
1582
        totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%d transfers", "Status bar transfer count"), totalCount];
1567
1583
    else
1569
1585
    
1570
1586
    if (filtering)
1571
1587
    {
1572
 
        int count = [fTableView numberOfRows]; //have to factor in collapsed rows
 
1588
        NSInteger count = [fTableView numberOfRows]; //have to factor in collapsed rows
1573
1589
        if (count > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
1574
1590
            count -= [fDisplayedTorrents count];
1575
1591
        
1585
1601
    BOOL download = [fDefaults boolForKey: @"Queue"],
1586
1602
        seed = [fDefaults boolForKey: @"QueueSeed"];
1587
1603
    
1588
 
    int desiredDownloadActive = [self numToStartFromQueue: YES],
 
1604
    NSInteger desiredDownloadActive = [self numToStartFromQueue: YES],
1589
1605
        desiredSeedActive = [self numToStartFromQueue: NO];
1590
1606
    
1591
1607
    Torrent * torrent;
1622
1638
    [self updateTorrentHistory];
1623
1639
}
1624
1640
 
1625
 
- (int) numToStartFromQueue: (BOOL) downloadQueue
 
1641
- (NSInteger) numToStartFromQueue: (BOOL) downloadQueue
1626
1642
{
1627
1643
    if (![fDefaults boolForKey: downloadQueue ? @"Queue" : @"QueueSeed"])
1628
1644
        return 0;
1629
1645
    
1630
 
    int desired = [fDefaults integerForKey: downloadQueue ? @"QueueDownloadNumber" : @"QueueSeedNumber"];
 
1646
    NSInteger desired = [fDefaults integerForKey: downloadQueue ? @"QueueDownloadNumber" : @"QueueSeedNumber"];
1631
1647
        
1632
1648
    Torrent * torrent;
1633
1649
    NSEnumerator * enumerator = [fTorrents objectEnumerator];
1920
1936
    
1921
1937
    NSArray * selectedValues = [fTableView selectedValues];
1922
1938
    
1923
 
    int active = 0, downloading = 0, seeding = 0, paused = 0;
 
1939
    NSInteger active = 0, downloading = 0, seeding = 0, paused = 0;
1924
1940
    NSString * filterType = [fDefaults stringForKey: @"Filter"];
1925
1941
    BOOL filterActive = NO, filterDownload = NO, filterSeed = NO, filterPause = NO, filterStatus = YES;
1926
1942
    if ([filterType isEqualToString: FILTER_ACTIVE])
1934
1950
    else
1935
1951
        filterStatus = NO;
1936
1952
    
1937
 
    int groupFilterValue = [fDefaults integerForKey: @"FilterGroup"];
 
1953
    NSInteger groupFilterValue = [fDefaults integerForKey: @"FilterGroup"];
1938
1954
    BOOL filterGroup = groupFilterValue != GROUP_FILTER_ALL_TAG;
1939
1955
    
1940
1956
    NSString * searchString = [fSearchFilterField stringValue];
1946
1962
    //get count of each type
1947
1963
    NSEnumerator * enumerator = [fTorrents objectEnumerator];
1948
1964
    Torrent * torrent;
1949
 
    int i = -1;
 
1965
    NSInteger index = -1;
1950
1966
    while ((torrent = [enumerator nextObject]))
1951
1967
    {
1952
 
        i++;
 
1968
        index++;
1953
1969
        
1954
1970
        //check status
1955
1971
        if ([torrent isActive] && ![torrent isCheckingWaiting])
1961
1977
                if (isActive)
1962
1978
                    active++;
1963
1979
                
1964
 
                if (filterStatus && (!(filterActive && isActive) && !filterSeed))
 
1980
                if (filterStatus && !((filterActive && isActive) || filterSeed))
1965
1981
                    continue;
1966
1982
            }
1967
1983
            else
1971
1987
                if (isActive)
1972
1988
                    active++;
1973
1989
                
1974
 
                if (filterStatus && (!(filterActive && isActive) && !filterDownload))
 
1990
                if (filterStatus && !((filterActive && isActive) || filterDownload))
1975
1991
                    continue;
1976
1992
            }
1977
1993
        }
2014
2030
            }
2015
2031
        }
2016
2032
        
2017
 
        [indexes addIndex: i];
 
2033
        [indexes addIndex: index];
2018
2034
    }
2019
2035
    
2020
2036
    NSArray * allTorrents = [fTorrents objectsAtIndexes: indexes];
2042
2058
        allTorrents = [allTorrents sortedArrayUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
2043
2059
        
2044
2060
        NSMutableArray * groupTorrents;
2045
 
        int oldGroupValue = -2;
2046
 
        for (i = 0; i < [allTorrents count]; i++)
 
2061
        for (NSInteger i = 0, oldGroupValue = -2; i < [allTorrents count]; i++)
2047
2062
        {
2048
2063
            torrent = [allTorrents objectAtIndex: i];
2049
 
            int groupValue = [torrent groupValue];
 
2064
            NSInteger groupValue = [torrent groupValue];
2050
2065
            if (groupValue != oldGroupValue)
2051
2066
            {
2052
2067
                TorrentGroup * group = [[TorrentGroup alloc] initWithGroup: groupValue];
2137
2152
{
2138
2153
    NSString * oldFilterType = [fDefaults stringForKey: @"FilterSearchType"];
2139
2154
    
2140
 
    int prevTag, currentTag = [sender tag];
 
2155
    NSInteger prevTag, currentTag = [sender tag];
2141
2156
    if ([oldFilterType isEqualToString: FILTER_TYPE_TRACKER])
2142
2157
        prevTag = FILTER_TYPE_TAG_TRACKER;
2143
2158
    else
2214
2229
{
2215
2230
    if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu)
2216
2231
    {
2217
 
        int i;
2218
 
        for (i = [menu numberOfItems]-1 - 2; i >= 0; i--)
 
2232
        for (NSInteger i = [menu numberOfItems]-1 - 2; i >= 0; i--)
2219
2233
            [menu removeItemAtIndex: i];
2220
2234
        
2221
2235
        NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO];
2224
2238
    }
2225
2239
    else if (menu == fGroupFilterMenu)
2226
2240
    {
2227
 
        int i;
2228
 
        for (i = [menu numberOfItems]-1; i >= 3; i--)
 
2241
        for (NSInteger i = [menu numberOfItems]-1; i >= 3; i--)
2229
2242
            [menu removeItemAtIndex: i];
2230
2243
        
2231
2244
        NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroupFilter:)
2238
2251
        if ([menu numberOfItems] > 3)
2239
2252
            return;
2240
2253
        
2241
 
        const int speedLimitActionValue[] = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
 
2254
        const NSInteger speedLimitActionValue[] = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
2242
2255
        
2243
2256
        NSMenuItem * item;
2244
 
        int i;
2245
 
        for (i = 0; speedLimitActionValue[i] != -1; i++)
 
2257
        for (NSInteger i = 0; speedLimitActionValue[i] != -1; i++)
2246
2258
        {
2247
2259
            item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s",
2248
2260
                    "Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimitGlobal:)
2261
2273
        const float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1 };
2262
2274
        
2263
2275
        NSMenuItem * item;
2264
 
        int i;
2265
 
        for (i = 0; ratioLimitActionValue[i] != -1; i++)
 
2276
        for (NSInteger i = 0; ratioLimitActionValue[i] != -1; i++)
2266
2277
        {
2267
2278
            item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
2268
2279
                    action: @selector(setQuickRatioGlobal:) keyEquivalent: @""];
2300
2311
 
2301
2312
- (void) updateGroupsFilterButton
2302
2313
{
2303
 
    int groupIndex = [fDefaults integerForKey: @"FilterGroup"];
 
2314
    NSInteger groupIndex = [fDefaults integerForKey: @"FilterGroup"];
2304
2315
    
2305
2316
    NSImage * icon;
2306
2317
    NSString * toolTip;
2343
2354
 
2344
2355
- (void) autoSpeedLimitChange: (NSNotification *) notification
2345
2356
{
2346
 
    //clear timer here in case its not being reset
 
2357
    //clear timer here in case it's not being reset
2347
2358
    [fSpeedLimitTimer invalidate];
2348
2359
    fSpeedLimitTimer = nil;
2349
2360
    
2358
2369
                                        fromDate: [fDefaults objectForKey: @"SpeedLimitAutoOffDate"]];
2359
2370
    
2360
2371
    //check if should be on if within range
2361
 
    int onTime = [onComponents hour] * 60 + [onComponents minute],
 
2372
    NSInteger onTime = [onComponents hour] * 60 + [onComponents minute],
2362
2373
        offTime = [offComponents hour] * 60 + [offComponents minute],
2363
2374
        nowTime = [nowComponents hour] * 60 + [nowComponents minute];
2364
2375
    
2409
2420
                    * timerComponents = [calendar components: NSHourCalendarUnit | NSMinuteCalendarUnit fromDate: timerDate];
2410
2421
    
2411
2422
    //check if should be the next day
2412
 
    int nowTime = [nowComponents hour] * 60 + [nowComponents minute],
 
2423
    NSInteger nowTime = [nowComponents hour] * 60 + [nowComponents minute],
2413
2424
        timerTime = [timerComponents hour] * 60 + [timerComponents minute];
2414
2425
    if (timerTime < nowTime)
2415
2426
        [nowComponents setDay: [nowComponents day] + 1]; //properly goes to next month when appropriate
2423
2434
    fSpeedLimitTimer = [[NSTimer alloc] initWithFireDate: dateToUse interval: 0 target: self selector: @selector(autoSpeedLimit:)
2424
2435
                        userInfo: [NSNumber numberWithBool: nextIsLimit] repeats: NO];
2425
2436
    
2426
 
    [[NSRunLoop currentRunLoop] addTimer: fSpeedLimitTimer forMode: NSDefaultRunLoopMode];
2427
 
    [[NSRunLoop currentRunLoop] addTimer: fSpeedLimitTimer forMode: NSModalPanelRunLoopMode];
2428
 
    [[NSRunLoop currentRunLoop] addTimer: fSpeedLimitTimer forMode: NSEventTrackingRunLoopMode];
 
2437
    NSRunLoop * loop = [NSApp isOnLeopardOrBetter] ? [NSRunLoop mainRunLoop] : [NSRunLoop currentRunLoop];
 
2438
    [loop addTimer: fSpeedLimitTimer forMode: NSDefaultRunLoopMode];
 
2439
    [loop addTimer: fSpeedLimitTimer forMode: NSModalPanelRunLoopMode];
 
2440
    [loop addTimer: fSpeedLimitTimer forMode: NSEventTrackingRunLoopMode];
2429
2441
    [fSpeedLimitTimer release];
2430
2442
}
2431
2443
 
2529
2541
    [fAutoImportedNames setArray: importedNames];
2530
2542
    
2531
2543
    NSString * file;
2532
 
    int i;
2533
 
    for (i = [newNames count] - 1; i >= 0; i--)
 
2544
    for (NSInteger i = [newNames count] - 1; i >= 0; i--)
2534
2545
    {
2535
2546
        file = [newNames objectAtIndex: i];
2536
2547
        if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] != NSOrderedSame)
2609
2620
        NSString * ident = [tableColumn identifier];
2610
2621
        if ([ident isEqualToString: @"Group"])
2611
2622
        {
2612
 
            int group = [item groupIndex];
 
2623
            NSInteger group = [item groupIndex];
2613
2624
            return group != -1 ? [[GroupsController groups] nameForIndex: group]
2614
2625
                                : NSLocalizedString(@"No Group", "Group table row");
2615
2626
        }
2616
2627
        else if ([ident isEqualToString: @"Color"])
2617
2628
        {
2618
 
            int group = [item groupIndex];
 
2629
            NSInteger group = [item groupIndex];
2619
2630
            return [[GroupsController groups] imageForIndex: group];
2620
2631
        }
2621
2632
        else if ([ident isEqualToString: @"DL Image"])
2625
2636
                                        ? @"YingYangGroupTemplate.png" : @"UpArrowGroupTemplate.png"];
2626
2637
        else
2627
2638
        {
 
2639
            TorrentGroup * group = (TorrentGroup *)item;
 
2640
            
2628
2641
            if ([fDefaults boolForKey: @"DisplayGroupRowRatio"])
2629
 
            {
2630
 
                uint64_t uploaded = 0, downloaded = 0;
2631
 
                NSEnumerator * enumerator = [[item torrents] objectEnumerator];
2632
 
                Torrent * torrent;
2633
 
                while ((torrent = [enumerator nextObject]))
2634
 
                {
2635
 
                    uploaded += [torrent uploadedTotal];
2636
 
                    downloaded += [torrent downloadedTotal];
2637
 
                }
2638
 
                
2639
 
                return [NSString stringForRatio: tr_getRatio(uploaded, downloaded)];
2640
 
            }
 
2642
                return [NSString stringForRatio: [group ratio]];
2641
2643
            else
2642
2644
            {
2643
 
                BOOL upload = [ident isEqualToString: @"UL"];
2644
 
                
2645
 
                float rate = 0.0;
2646
 
                NSEnumerator * enumerator = [[item torrents] objectEnumerator];
2647
 
                Torrent * torrent;
2648
 
                while ((torrent = [enumerator nextObject]))
2649
 
                    rate += upload ? [torrent uploadRate] : [torrent downloadRate];
2650
 
                
 
2645
                CGFloat rate = [ident isEqualToString: @"UL"] ? [group uploadRate] : [group downloadRate];
2651
2646
                return [NSString stringForSpeed: rate];
2652
2647
            }
2653
2648
        }
2734
2729
        
2735
2730
        //get the torrents to move
2736
2731
        NSMutableArray * movingTorrents = [NSMutableArray arrayWithCapacity: [indexes count]];
2737
 
        int i;
2738
 
        for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
 
2732
        for (NSUInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
2739
2733
            [movingTorrents addObject: [fTableView itemAtRow: i]];
2740
2734
        
2741
2735
        //reset groups
2742
2736
        if (item)
2743
2737
        {
2744
2738
            //change groups
2745
 
            int groupValue = [item groupIndex];
 
2739
            NSInteger groupValue = [item groupIndex];
2746
2740
            NSEnumerator * enumerator = [movingTorrents objectEnumerator];
2747
2741
            Torrent * torrent;
2748
2742
            while ((torrent = [enumerator nextObject]))
2763
2757
            //find torrent to place under
2764
2758
            NSArray * groupTorrents = item ? [item torrents] : fDisplayedTorrents;
2765
2759
            Torrent * topTorrent = nil;
2766
 
            for (i = newRow-1; i >= 0; i--)
 
2760
            for (NSInteger i = newRow-1; i >= 0; i--)
2767
2761
            {
2768
2762
                Torrent * tempTorrent = [groupTorrents objectAtIndex: i];
2769
2763
                if (![movingTorrents containsObject: tempTorrent])
2782
2776
            [fTorrents insertObjects: movingTorrents atIndexes: insertIndexes];
2783
2777
            
2784
2778
            //redo order values
2785
 
            for (i = 0; i < [fTorrents count]; i++)
 
2779
            for (NSInteger i = 0; i < [fTorrents count]; i++)
2786
2780
                [[fTorrents objectAtIndex: i] setOrderValue: i];
2787
2781
        }
2788
2782
        
2945
2939
        if (!makeSmall && contentSize.height < contentMinSize.height)
2946
2940
        {
2947
2941
            NSRect frame = [fWindow frame];
2948
 
            float heightChange = contentMinSize.height - contentSize.height;
 
2942
            CGFloat heightChange = contentMinSize.height - contentSize.height;
2949
2943
            frame.size.height += heightChange;
2950
2944
            frame.origin.y -= heightChange;
2951
2945
            
2978
2972
    [fTableView reloadData];
2979
2973
}
2980
2974
 
2981
 
- (NSRect) windowFrameByAddingHeight: (float) height checkLimits: (BOOL) check
 
2975
- (NSRect) windowFrameByAddingHeight: (CGFloat) height checkLimits: (BOOL) check
2982
2976
{
2983
2977
    NSScrollView * scrollView = [fTableView enclosingScrollView];
2984
2978
    
3029
3023
        [fStatusBar setHidden: NO];
3030
3024
 
3031
3025
    NSRect frame;
3032
 
    float heightChange = [fStatusBar frame].size.height;
 
3026
    CGFloat heightChange = [fStatusBar frame].size.height;
3033
3027
    if (!show)
3034
3028
        heightChange *= -1;
3035
3029
    
3037
3031
    if (show && ![fDefaults boolForKey: @"AutoSize"])
3038
3032
    {
3039
3033
        frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
3040
 
        float change = [[fWindow screen] visibleFrame].size.height - frame.size.height;
 
3034
        CGFloat change = [[fWindow screen] visibleFrame].size.height - frame.size.height;
3041
3035
        if (change < 0.0)
3042
3036
        {
3043
3037
            frame = [fWindow frame];
3052
3046
    NSScrollView * scrollView = [fTableView enclosingScrollView];
3053
3047
    
3054
3048
    //set views to not autoresize
3055
 
    unsigned int statsMask = [fStatusBar autoresizingMask];
3056
 
    unsigned int filterMask = [fFilterBar autoresizingMask];
3057
 
    unsigned int scrollMask = [scrollView autoresizingMask];
 
3049
    NSUInteger statsMask = [fStatusBar autoresizingMask];
 
3050
    NSUInteger filterMask = [fFilterBar autoresizingMask];
 
3051
    NSUInteger scrollMask = [scrollView autoresizingMask];
3058
3052
    [fStatusBar setAutoresizingMask: NSViewNotSizable];
3059
3053
    [fFilterBar setAutoresizingMask: NSViewNotSizable];
3060
3054
    [scrollView setAutoresizingMask: NSViewNotSizable];
3100
3094
        [fFilterBar setHidden: NO];
3101
3095
 
3102
3096
    NSRect frame;
3103
 
    float heightChange = [fFilterBar frame].size.height;
 
3097
    CGFloat heightChange = [fFilterBar frame].size.height;
3104
3098
    if (!show)
3105
3099
        heightChange *= -1;
3106
3100
    
3108
3102
    if (show && ![fDefaults boolForKey: @"AutoSize"])
3109
3103
    {
3110
3104
        frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
3111
 
        float change = [[fWindow screen] visibleFrame].size.height - frame.size.height;
 
3105
        CGFloat change = [[fWindow screen] visibleFrame].size.height - frame.size.height;
3112
3106
        if (change < 0.0)
3113
3107
        {
3114
3108
            frame = [fWindow frame];
3121
3115
    NSScrollView * scrollView = [fTableView enclosingScrollView];
3122
3116
 
3123
3117
    //set views to not autoresize
3124
 
    unsigned int filterMask = [fFilterBar autoresizingMask];
3125
 
    unsigned int scrollMask = [scrollView autoresizingMask];
 
3118
    NSUInteger filterMask = [fFilterBar autoresizingMask];
 
3119
    NSUInteger scrollMask = [scrollView autoresizingMask];
3126
3120
    [fFilterBar setAutoresizingMask: NSViewNotSizable];
3127
3121
    [scrollView setAutoresizingMask: NSViewNotSizable];
3128
3122
    
3350
3344
 
3351
3345
- (void) allToolbarClicked: (id) sender
3352
3346
{
3353
 
    int tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
 
3347
    NSInteger tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
3354
3348
                    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [sender tag];
3355
3349
    switch (tagValue)
3356
3350
    {
3365
3359
 
3366
3360
- (void) selectedToolbarClicked: (id) sender
3367
3361
{
3368
 
    int tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
 
3362
    NSInteger tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
3369
3363
                    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [sender tag];
3370
3364
    switch (tagValue)
3371
3365
    {
3398
3392
 
3399
3393
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
3400
3394
{
3401
 
    return [NSArray arrayWithObjects:
3402
 
            TOOLBAR_CREATE, TOOLBAR_OPEN_FILE, TOOLBAR_REMOVE,
3403
 
            NSToolbarSeparatorItemIdentifier,
3404
 
            TOOLBAR_PAUSE_RESUME_ALL,
3405
 
            NSToolbarFlexibleSpaceItemIdentifier,
3406
 
            TOOLBAR_FILTER, TOOLBAR_INFO, nil];
 
3395
    NSMutableArray * idents =  [NSMutableArray arrayWithObjects:
 
3396
                                TOOLBAR_CREATE, TOOLBAR_OPEN_FILE, TOOLBAR_REMOVE,
 
3397
                                NSToolbarSeparatorItemIdentifier,
 
3398
                                TOOLBAR_PAUSE_RESUME_ALL,
 
3399
                                NSToolbarFlexibleSpaceItemIdentifier,
 
3400
                                TOOLBAR_FILTER, TOOLBAR_INFO, nil];
 
3401
    
 
3402
    //allow quicklook on leopard
 
3403
    if ([NSApp isOnLeopardOrBetter])
 
3404
        [idents insertObject: TOOLBAR_QUICKLOOK atIndex: [idents count]-2];
 
3405
    
 
3406
    return idents;
3407
3407
}
3408
3408
 
3409
3409
- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem
3556
3556
    {
3557
3557
        BOOL checked = NO;
3558
3558
        
3559
 
        int index = [menuItem tag];
 
3559
        NSInteger index = [menuItem tag];
3560
3560
        NSEnumerator * enumerator = [[fTableView selectedTorrents] objectEnumerator];
3561
3561
        Torrent * torrent;
3562
3562
        while ((torrent = [enumerator nextObject]))
3906
3906
 
3907
3907
- (NSMenu *) applicationDockMenu: (NSApplication *) sender
3908
3908
{
3909
 
    int seeding = 0, downloading = 0;
 
3909
    NSInteger seeding = 0, downloading = 0;
3910
3910
    NSEnumerator * enumerator = [fTorrents objectEnumerator];
3911
3911
    Torrent * torrent;
3912
3912
    while ((torrent = [enumerator nextObject]))
3991
3991
        [scrollView setHasVerticalScroller: NO];
3992
3992
        [fWindow setFrame: [self sizedWindowFrame] display: YES animate: YES];
3993
3993
        [scrollView setHasVerticalScroller: YES];
 
3994
        
 
3995
        //hack to ensure scrollbars don't disappear after resizing
 
3996
        [scrollView setAutohidesScrollers: NO];
 
3997
        [scrollView setAutohidesScrollers: YES];
3994
3998
    }
3995
3999
}
3996
4000
 
3997
4001
- (NSRect) sizedWindowFrame
3998
4002
{
3999
 
    int groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
 
4003
    NSInteger groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
4000
4004
                    ? [fDisplayedTorrents count] : 0;
4001
4005
    
4002
 
    float heightChange = (GROUP_SEPARATOR_HEIGHT + [fTableView intercellSpacing].height) * groups
 
4006
    CGFloat heightChange = (GROUP_SEPARATOR_HEIGHT + [fTableView intercellSpacing].height) * groups
4003
4007
                        + ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
4004
4008
                        - [[fTableView enclosingScrollView] frame].size.height;
4005
4009
    
4073
4077
        searchFrame.size.width = SEARCH_FILTER_MIN_WIDTH;
4074
4078
        
4075
4079
        //resize the buttons so they don't overlay
4076
 
        int difference = (NSMaxX(pauseRect) + 5.0) - searchFrame.origin.x - 1; //subtract 1, since 0 will be counted
 
4080
        NSInteger difference = (NSMaxX(pauseRect) + 5.0) - searchFrame.origin.x - 1; //subtract 1, since 0 will be counted
4077
4081
        
4078
4082
        //decrease downloading by 8, seeding by 1, paused by 1, active by 1, repeat
4079
 
        int download = (difference / 11 * 8) + MIN(difference % 11 + 1, 8); //8 for every 11
4080
 
        int seed = (difference / 11) + (difference % 11 >= 8 ? 1 : 0);
4081
 
        int paused = (difference / 11) + (difference % 11 >= 9 ? 1 : 0);
4082
 
        int active = (difference / 11) + (difference % 11 >= 10 ? 1 : 0);
 
4083
        NSInteger download = (difference / 11 * 8) + MIN(difference % 11 + 1, 8); //8 for every 11
 
4084
        NSInteger seed = (difference / 11) + (difference % 11 >= 8 ? 1 : 0);
 
4085
        NSInteger paused = (difference / 11) + (difference % 11 >= 9 ? 1 : 0);
 
4086
        NSInteger active = (difference / 11) + (difference % 11 >= 10 ? 1 : 0);
4083
4087
        
4084
4088
        activeRect.size.width -= active;
4085
4089
        
4149
4153
        NSString * fullPath = [url path];
4150
4154
        NSRange visibleRows = [fTableView rowsInRect: [fTableView bounds]];
4151
4155
        
4152
 
        int row;
4153
 
        for (row = 0; row < NSMaxRange(visibleRows); row++)
 
4156
        for (NSInteger row = 0; row < NSMaxRange(visibleRows); row++)
4154
4157
        {
4155
4158
            id item = [fTableView itemAtRow: row];
4156
4159
            if ([item isKindOfClass: [Torrent class]] && [[(Torrent *)item dataLocation] isEqualToString: fullPath])
4182
4185
    [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: FORUM_URL]];
4183
4186
}
4184
4187
 
 
4188
- (void) linkTrac: (id) sender
 
4189
{
 
4190
    [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: TRAC_URL]];
 
4191
}
 
4192
 
4185
4193
- (void) linkDonate: (id) sender
4186
4194
{
4187
4195
    [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: DONATE_URL]];
4188
4196
}
4189
4197
 
4190
 
- (void) prepareForUpdate: (NSNotification *) notification
 
4198
- (void) updaterWillRelaunchApplication: (SUUpdater *) updater
4191
4199
{
4192
4200
    fUpdateInProgress = YES;
4193
4201
}
4222
4230
        NSEnumerator * enumerator = [fTorrents objectEnumerator];
4223
4231
        while ((torrent = [enumerator nextObject]))
4224
4232
            if (torrentStruct == [torrent torrentStruct])
 
4233
            {
 
4234
                [torrent retain];
4225
4235
                break;
 
4236
            }
4226
4237
        
4227
4238
        if (!torrent)
4228
4239
        {
 
4240
            [pool release];
 
4241
            
4229
4242
            NSLog(@"No torrent found matching the given torrent struct from the RPC callback!");
4230
4243
            return;
4231
4244
        }
4232
 
        
4233
 
        [torrent retain];
4234
4245
    }
4235
4246
    
4236
4247
    switch (type)
4276
4287
    
4277
4288
    Torrent * torrent = [[Torrent alloc] initWithTorrentStruct: torrentStruct location: location lib: fLib];
4278
4289
    
4279
 
    [torrent setWaitToStart: [fDefaults boolForKey: @"AutoStartDownload"]];
4280
 
    
4281
4290
    [torrent update];
4282
4291
    [fTorrents addObject: torrent];
4283
4292
    [torrent release];
4287
4296
 
4288
4297
- (void) rpcRemoveTorrent: (Torrent *) torrent
4289
4298
{
4290
 
    [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO deleteTorrent: NO fromRPC: YES];
 
4299
    [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO deleteTorrent: NO];
4291
4300
    [torrent release];
4292
4301
}
4293
4302