first implementation of the blocklist
This commit is contained in:
parent
a09b43a4b4
commit
7fdb2f6f40
|
@ -162,6 +162,8 @@
|
|||
A2D22A130D65EEE700007D5F /* verify.c in Sources */ = {isa = PBXBuildFile; fileRef = A2D22A100D65EED100007D5F /* verify.c */; };
|
||||
A2D3078F0D9EC45F0051FD27 /* blocklist.c in Sources */ = {isa = PBXBuildFile; fileRef = A2D3078E0D9EC45F0051FD27 /* blocklist.c */; };
|
||||
A2D307910D9EC46B0051FD27 /* ggets.c in Sources */ = {isa = PBXBuildFile; fileRef = A2D307900D9EC46B0051FD27 /* ggets.c */; };
|
||||
A2D307A40D9EC6870051FD27 /* BlocklistDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D307A30D9EC6870051FD27 /* BlocklistDownloader.m */; };
|
||||
A2D307B10D9EC9F50051FD27 /* BlocklistStatusWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A2D307B00D9EC9F50051FD27 /* BlocklistStatusWindow.xib */; };
|
||||
A2DA362A0CBC674900C2ED41 /* InfoActivity.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36270CBC674900C2ED41 /* InfoActivity.png */; };
|
||||
A2DA362B0CBC674900C2ED41 /* InfoFiles.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36280CBC674900C2ED41 /* InfoFiles.png */; };
|
||||
A2DA362C0CBC674900C2ED41 /* InfoPeers.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DA36290CBC674900C2ED41 /* InfoPeers.png */; };
|
||||
|
@ -588,6 +590,9 @@
|
|||
A2D307920D9EC4800051FD27 /* ggets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ggets.h; path = libtransmission/ggets.h; sourceTree = "<group>"; };
|
||||
A2D307930D9EC4860051FD27 /* blocklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blocklist.h; path = libtransmission/blocklist.h; sourceTree = "<group>"; };
|
||||
A2D307950D9EC4C10051FD27 /* bsdtree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bsdtree.h; path = daemon/bsdtree.h; sourceTree = "<group>"; };
|
||||
A2D307A20D9EC6870051FD27 /* BlocklistDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlocklistDownloader.h; path = macosx/BlocklistDownloader.h; sourceTree = "<group>"; };
|
||||
A2D307A30D9EC6870051FD27 /* BlocklistDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BlocklistDownloader.m; path = macosx/BlocklistDownloader.m; sourceTree = "<group>"; };
|
||||
A2D307B00D9EC9F50051FD27 /* BlocklistStatusWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = BlocklistStatusWindow.xib; path = macosx/BlocklistStatusWindow.xib; sourceTree = "<group>"; };
|
||||
A2D688A70CB4986A009BEC3A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = macosx/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
A2D6891B0CB4990E009BEC3A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = macosx/English.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
A2DA36270CBC674900C2ED41 /* InfoActivity.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoActivity.png; path = macosx/Images/InfoActivity.png; sourceTree = "<group>"; };
|
||||
|
@ -868,6 +873,8 @@
|
|||
A22180970D148A71007D09ED /* GroupsWindowController.m */,
|
||||
A2FB701A0D95CAEA0001F331 /* GroupsController.h */,
|
||||
A2FB701B0D95CAEA0001F331 /* GroupsController.m */,
|
||||
A2D307A20D9EC6870051FD27 /* BlocklistDownloader.h */,
|
||||
A2D307A30D9EC6870051FD27 /* BlocklistDownloader.m */,
|
||||
);
|
||||
name = Sources;
|
||||
sourceTree = "<group>";
|
||||
|
@ -923,6 +930,7 @@
|
|||
A233BD680D8CF2C7007EE7B4 /* StatsWindow.xib */,
|
||||
A22180B50D148F0F007D09ED /* GroupsWindow.xib */,
|
||||
A231274B0D11D0B7003F9AFF /* AboutWindow.xib */,
|
||||
A2D307B00D9EC9F50051FD27 /* BlocklistStatusWindow.xib */,
|
||||
A20B6FA40C4D97840034AB1D /* PriorityNone.png */,
|
||||
A20B6F8B0C4D90980034AB1D /* PriorityMixed.png */,
|
||||
A20B6FAD0C4D9B040034AB1D /* PriorityNormal.png */,
|
||||
|
@ -1676,6 +1684,7 @@
|
|||
A2012AE20D77151D0056FD71 /* YingYangGroupTemplate.png in Resources */,
|
||||
A233BD330D8C6585007EE7B4 /* MessageWindow.xib in Resources */,
|
||||
A233BD690D8CF2C7007EE7B4 /* StatsWindow.xib in Resources */,
|
||||
A2D307B10D9EC9F50051FD27 /* BlocklistStatusWindow.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -1830,6 +1839,7 @@
|
|||
A2FB701C0D95CAEA0001F331 /* GroupsController.m in Sources */,
|
||||
A2D3078F0D9EC45F0051FD27 /* blocklist.c in Sources */,
|
||||
A2D307910D9EC46B0051FD27 /* ggets.c in Sources */,
|
||||
A2D307A40D9EC6870051FD27 /* BlocklistDownloader.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "net.h" /* tr_netResolve */
|
||||
#include "platform.h" /* tr_getPrefsDirectory() */
|
||||
#include "utils.h" /* tr_buildPath() */
|
||||
#include "internal.h"
|
||||
|
||||
struct tr_ip_range
|
||||
{
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2008 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <transmission.h>
|
||||
|
||||
@class PrefsController;
|
||||
|
||||
@interface BlocklistDownloader : NSObject
|
||||
{
|
||||
PrefsController * fPrefsController;
|
||||
tr_handle * fHandle;
|
||||
|
||||
IBOutlet NSWindow * fStatusWindow;
|
||||
IBOutlet NSProgressIndicator * fProgressBar;
|
||||
IBOutlet NSTextField * fTextField;
|
||||
IBOutlet NSButton * fButton;
|
||||
|
||||
NSURLDownload * fDownload;
|
||||
|
||||
NSUInteger fCurrentSize;
|
||||
long long fExpectedSize;
|
||||
}
|
||||
|
||||
+ (id) downloadWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle;
|
||||
|
||||
- (void) cancelDownload: (id) sender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,164 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2008 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import "BlocklistDownloader.h"
|
||||
#import "PrefsController.h"
|
||||
#import "NSStringAdditions.h"
|
||||
|
||||
#define LIST_URL @"http://download.m0k.org/transmission/files/level1.gz"
|
||||
#define DESTINATION [NSTemporaryDirectory() stringByAppendingPathComponent: @"level1.gz"]
|
||||
|
||||
@interface BlocklistDownloader (Private)
|
||||
|
||||
- (id) initWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle;
|
||||
- (void) startDownload;
|
||||
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info;
|
||||
|
||||
@end
|
||||
|
||||
@implementation BlocklistDownloader
|
||||
|
||||
+ (id) downloadWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle
|
||||
{
|
||||
BlocklistDownloader * downloader = [[BlocklistDownloader alloc] initWithPrefsController: prefsController withHandle: handle];
|
||||
[downloader startDownload];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[fDownload release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) cancelDownload: (id) sender
|
||||
{
|
||||
[fDownload release];
|
||||
fDownload = nil;
|
||||
|
||||
[NSApp endSheet: fStatusWindow];
|
||||
[fStatusWindow orderOut: self];
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void) download: (NSURLDownload *) download didReceiveResponse: (NSURLResponse *) response
|
||||
{
|
||||
fCurrentSize = 0;
|
||||
fExpectedSize = [response expectedContentLength];
|
||||
|
||||
//change from indeterminate to progress
|
||||
|
||||
[fProgressBar setIndeterminate: NO];
|
||||
[fTextField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"Downloading blocklist (%d%%)", "Blocklist -> message"),
|
||||
0]];
|
||||
[fProgressBar setDoubleValue: 0];
|
||||
}
|
||||
|
||||
- (void) download: (NSURLDownload *) download didReceiveDataOfLength: (NSUInteger) length
|
||||
{
|
||||
if (fExpectedSize != NSURLResponseUnknownLength)
|
||||
fCurrentSize += length;
|
||||
|
||||
#warning factor for unknown size, combine 2 strings - make a single private method
|
||||
[fTextField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"Downloading blocklist (%d%%)", "Blocklist -> message"),
|
||||
100 * (fCurrentSize / fExpectedSize)]];
|
||||
[fProgressBar setDoubleValue: fCurrentSize / fExpectedSize];
|
||||
}
|
||||
|
||||
- (void) download: (NSURLDownload *) download didFailWithError: (NSError *) error
|
||||
{
|
||||
[fDownload release];
|
||||
fDownload = nil;
|
||||
|
||||
[fProgressBar setHidden: YES];
|
||||
|
||||
[NSApp endSheet: fStatusWindow];
|
||||
[fStatusWindow orderOut: self];
|
||||
|
||||
NSAlert * alert = [[[NSAlert alloc] init] autorelease];
|
||||
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Blocklist -> button")];
|
||||
[alert setMessageText: NSLocalizedString(@"Download failed!", "Blocklist -> message")];
|
||||
[alert setAlertStyle: NSWarningAlertStyle];
|
||||
|
||||
[alert setInformativeText: [NSString stringWithFormat: @"%@ - %@ %@", NSLocalizedString(@"Error", "Blocklist -> message"),
|
||||
[error localizedDescription], [[error userInfo] objectForKey:NSErrorFailingURLStringKey]]];
|
||||
|
||||
[alert beginSheetModalForWindow: [fPrefsController window] modalDelegate: self
|
||||
didEndSelector: @selector(failureSheetClosed:returnCode:contextInfo:) contextInfo: nil];
|
||||
}
|
||||
|
||||
- (void) downloadDidFinish: (NSURLDownload *) download
|
||||
{
|
||||
[fDownload release];
|
||||
fDownload = nil;
|
||||
|
||||
//process data
|
||||
tr_blocklistSet(fHandle, [DESTINATION UTF8String]);
|
||||
|
||||
//delete downloaded file
|
||||
[[NSFileManager defaultManager] removeItemAtPath: DESTINATION error: NULL];
|
||||
|
||||
[fPrefsController updateBlocklistFields];
|
||||
|
||||
[NSApp endSheet: fStatusWindow];
|
||||
[fStatusWindow orderOut: self];
|
||||
[self release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation BlocklistDownloader (Private)
|
||||
|
||||
- (id) initWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
fPrefsController = prefsController;
|
||||
fHandle = handle;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) startDownload
|
||||
{
|
||||
NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL URLWithString: LIST_URL]];
|
||||
|
||||
fDownload = [[NSURLDownload alloc] initWithRequest: request delegate: self];
|
||||
[fDownload setDestination: DESTINATION allowOverwrite: YES];
|
||||
|
||||
[NSBundle loadNibNamed: @"BlocklistStatusWindow" owner: self];
|
||||
|
||||
[fButton setTitle: NSLocalizedString(@"Cancel", "Blocklist -> cancel button")];
|
||||
[fTextField setStringValue: [NSLocalizedString(@"Connecting to site", "Blocklist -> message") stringByAppendingEllipsis]];
|
||||
|
||||
[NSApp beginSheet: fStatusWindow modalForWindow: [fPrefsController window] modalDelegate: nil didEndSelector: nil contextInfo: nil];
|
||||
}
|
||||
|
||||
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info
|
||||
{
|
||||
[[alert window] orderOut: nil];
|
||||
[self release];
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,384 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<string key="IBDocument.SystemVersion">9C7010</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">648</string>
|
||||
<string key="IBDocument.AppKitVersion">949.26</string>
|
||||
<string key="IBDocument.HIToolboxVersion">352.00</string>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="1"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilderKit</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSCustomObject" id="1001">
|
||||
<string key="NSClassName">BlocklistDownloader</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1003">
|
||||
<string key="NSClassName">FirstResponder</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1004">
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
</object>
|
||||
<object class="NSWindowTemplate" id="1005">
|
||||
<int key="NSWindowStyleMask">7</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{196, 389}, {405, 121}}</string>
|
||||
<int key="NSWTFlags">536871936</int>
|
||||
<string key="NSWindowTitle">Window</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<object class="NSView" key="NSWindowView" id="1006">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSTextField" id="694289168">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{17, 84}, {371, 17}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="745253671">
|
||||
<int key="NSCellFlags">67239488</int>
|
||||
<int key="NSCellFlags2">272631808</int>
|
||||
<string key="NSContents">Label</string>
|
||||
<object class="NSFont" key="NSSupport" id="640917393">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">1.300000e+01</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
</object>
|
||||
<reference key="NSControlView" ref="694289168"/>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlTextColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSProgressIndicator" id="365018519">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">1292</int>
|
||||
<object class="NSPSMatrix" key="NSDrawMatrix"/>
|
||||
<string key="NSFrame">{{18, 56}, {369, 20}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<int key="NSpiFlags">16394</int>
|
||||
<double key="NSMaxValue">1.000000e+00</double>
|
||||
</object>
|
||||
<object class="NSButton" id="700889541">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{309, 12}, {82, 32}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="88133668">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Cancel</string>
|
||||
<reference key="NSSupport" ref="640917393"/>
|
||||
<reference key="NSControlView" ref="700889541"/>
|
||||
<int key="NSButtonFlags">-2038284033</int>
|
||||
<int key="NSButtonFlags2">129</int>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string key="NSKeyEquivalent"/>
|
||||
<int key="NSPeriodicDelay">200</int>
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{405, 121}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
|
||||
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">fTextField</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="694289168"/>
|
||||
</object>
|
||||
<int key="connectionID">9</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">fProgressBar</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="365018519"/>
|
||||
</object>
|
||||
<int key="connectionID">10</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">fButton</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="700889541"/>
|
||||
</object>
|
||||
<int key="connectionID">11</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">cancelDownload:</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="700889541"/>
|
||||
</object>
|
||||
<int key="connectionID">12</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">fStatusWindow</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="1005"/>
|
||||
</object>
|
||||
<int key="connectionID">13</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<object class="NSArray" key="object" id="1002">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="1001"/>
|
||||
<reference key="parent" ref="1002"/>
|
||||
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="1003"/>
|
||||
<reference key="parent" ref="1002"/>
|
||||
<string key="objectName">First Responder</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-3</int>
|
||||
<reference key="object" ref="1004"/>
|
||||
<reference key="parent" ref="1002"/>
|
||||
<string key="objectName">Application</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="1005"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="1006"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1002"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">2</int>
|
||||
<reference key="object" ref="1006"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="694289168"/>
|
||||
<reference ref="365018519"/>
|
||||
<reference ref="700889541"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="365018519"/>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">5</int>
|
||||
<reference key="object" ref="694289168"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="745253671"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="745253671"/>
|
||||
<reference key="parent" ref="694289168"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="700889541"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="88133668"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
<reference key="object" ref="88133668"/>
|
||||
<reference key="parent" ref="700889541"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMutableArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.IBPluginDependency</string>
|
||||
<string>-2.IBPluginDependency</string>
|
||||
<string>-3.IBPluginDependency</string>
|
||||
<string>1.IBEditorWindowLastContentRect</string>
|
||||
<string>1.IBPluginDependency</string>
|
||||
<string>1.IBWindowTemplateEditedContentRect</string>
|
||||
<string>1.NSWindowTemplate.visibleAtLaunch</string>
|
||||
<string>1.WindowOrigin</string>
|
||||
<string>1.editorWindowContentRectSynchronizationRect</string>
|
||||
<string>2.IBPluginDependency</string>
|
||||
<string>4.IBPluginDependency</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
<string>7.IBPluginDependency</string>
|
||||
<string>8.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilderKit</string>
|
||||
<string>com.apple.InterfaceBuilderKit</string>
|
||||
<string>{{249, 598}, {405, 121}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{249, 598}, {405, 121}}</string>
|
||||
<integer value="0"/>
|
||||
<string>{196, 240}</string>
|
||||
<string>{{202, 428}, {480, 270}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">13</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">BlocklistDownloader</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">cancelDownload:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMutableArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>fButton</string>
|
||||
<string>fProgressBar</string>
|
||||
<string>fStatusWindow</string>
|
||||
<string>fTextField</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSButton</string>
|
||||
<string>NSProgressIndicator</string>
|
||||
<string>NSWindow</string>
|
||||
<string>NSTextField</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/BlocklistDownloader.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSApplication</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/NSApplicationAdditions.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSMenu</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/NSMenuAdditions.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/IPCController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/UKKQueue/UKFileWatcher.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/UKKQueue/UKKQueue.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">macosx/UKKQueue/UKMainThreadProxy.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.LastKnownRelativeProjectPath">../Transmission.xcodeproj</string>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
</data>
|
||||
</archive>
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
#import <Sparkle/Sparkle.h>
|
||||
|
||||
|
||||
#define TOOLBAR_CREATE @"Toolbar Create"
|
||||
#define TOOLBAR_OPEN_FILE @"Toolbar Open"
|
||||
#define TOOLBAR_OPEN_WEB @"Toolbar Open Web"
|
||||
|
@ -178,16 +179,13 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
[[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]];
|
||||
|
||||
//set custom value transformers
|
||||
ExpandedPathToPathTransformer * pathTransformer =
|
||||
[[[ExpandedPathToPathTransformer alloc] init] autorelease];
|
||||
ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease];
|
||||
[NSValueTransformer setValueTransformer: pathTransformer forName: @"ExpandedPathToPathTransformer"];
|
||||
|
||||
ExpandedPathToIconTransformer * iconTransformer =
|
||||
[[[ExpandedPathToIconTransformer alloc] init] autorelease];
|
||||
ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease];
|
||||
[NSValueTransformer setValueTransformer: iconTransformer forName: @"ExpandedPathToIconTransformer"];
|
||||
|
||||
SpeedLimitToTurtleIconTransformer * speedLimitIconTransformer =
|
||||
[[[SpeedLimitToTurtleIconTransformer alloc] init] autorelease];
|
||||
SpeedLimitToTurtleIconTransformer * speedLimitIconTransformer = [[[SpeedLimitToTurtleIconTransformer alloc] init] autorelease];
|
||||
[NSValueTransformer setValueTransformer: speedLimitIconTransformer forName: @"SpeedLimitToTurtleIconTransformer"];
|
||||
}
|
||||
|
||||
|
@ -208,7 +206,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
-1, /* reset in prefs */
|
||||
[fDefaults integerForKey: @"PeersTotal"],
|
||||
[fDefaults integerForKey: @"MessageLevel"],
|
||||
YES);
|
||||
YES,
|
||||
[fDefaults boolForKey: @"Blocklist"]);
|
||||
|
||||
[NSApp setDelegate: self];
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
<true/>
|
||||
<key>BindPort</key>
|
||||
<integer>51413</integer>
|
||||
<key>Blocklist</key>
|
||||
<false/>
|
||||
<key>CheckDownload</key>
|
||||
<false/>
|
||||
<key>CheckForUpdates</key>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,30 +31,31 @@
|
|||
{
|
||||
tr_handle * fHandle;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
BOOL fHasLoaded;
|
||||
NSUserDefaults * fDefaults;
|
||||
BOOL fHasLoaded;
|
||||
|
||||
IBOutlet NSView * fGeneralView, * fTransfersView, * fBandwidthView, * fAdvancedView;
|
||||
IBOutlet NSView * fGeneralView, * fTransfersView, * fBandwidthView, * fAdvancedView;
|
||||
|
||||
NSString * fInitialString;
|
||||
|
||||
IBOutlet NSPopUpButton * fFolderPopUp, * fIncompleteFolderPopUp, * fImportFolderPopUp;
|
||||
IBOutlet NSTextField * fRatioStopField, * fQueueDownloadField, * fQueueSeedField, * fStalledField;
|
||||
IBOutlet NSPopUpButton * fFolderPopUp, * fIncompleteFolderPopUp, * fImportFolderPopUp;
|
||||
IBOutlet NSTextField * fRatioStopField, * fQueueDownloadField, * fQueueSeedField, * fStalledField;
|
||||
|
||||
SUUpdater * fUpdater;
|
||||
SUUpdater * fUpdater;
|
||||
|
||||
IBOutlet NSTextField * fUploadField, * fDownloadField,
|
||||
* fSpeedLimitUploadField, * fSpeedLimitDownloadField;
|
||||
IBOutlet NSTextField * fUploadField, * fDownloadField,
|
||||
* fSpeedLimitUploadField, * fSpeedLimitDownloadField;
|
||||
|
||||
IBOutlet NSTextField * fPeersGlobalField, * fPeersTorrentField;
|
||||
IBOutlet NSTextField * fPeersGlobalField, * fPeersTorrentField, * fBlocklistMessageField;
|
||||
IBOutlet NSButton * fBlocklistEnableCheck;
|
||||
|
||||
PortChecker * fPortChecker;
|
||||
IBOutlet NSTextField * fPortField, * fPortStatusField;
|
||||
IBOutlet NSButton * fNatCheck;
|
||||
IBOutlet NSImageView * fPortStatusImage;
|
||||
IBOutlet NSProgressIndicator * fPortStatusProgress;
|
||||
NSTimer * fPortStatusTimer;
|
||||
int fPublicPort, fNatStatus;
|
||||
PortChecker * fPortChecker;
|
||||
IBOutlet NSTextField * fPortField, * fPortStatusField;
|
||||
IBOutlet NSButton * fNatCheck;
|
||||
IBOutlet NSImageView * fPortStatusImage;
|
||||
IBOutlet NSProgressIndicator * fPortStatusProgress;
|
||||
NSTimer * fPortStatusTimer;
|
||||
int fPublicPort, fNatStatus;
|
||||
}
|
||||
|
||||
- (id) initWithHandle: (tr_handle *) handle;
|
||||
|
@ -76,6 +77,10 @@
|
|||
|
||||
- (void) setEncryptionMode: (id) sender;
|
||||
|
||||
- (void) setBlocklistEnabled: (id) sender;
|
||||
- (void) updateBlocklist: (id) sender;
|
||||
- (void) updateBlocklistFields;
|
||||
|
||||
- (void) setBadge: (id) sender;
|
||||
- (void) resetWarnings: (id) sender;
|
||||
- (void) setCheckForUpdate: (id) sender;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#import "PrefsController.h"
|
||||
#import "BlocklistDownloader.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
#import "NSStringAdditions.h"
|
||||
#import "UKKQueue.h"
|
||||
|
@ -153,6 +154,9 @@
|
|||
[fQueueDownloadField setIntValue: [fDefaults integerForKey: @"QueueDownloadNumber"]];
|
||||
[fQueueSeedField setIntValue: [fDefaults integerForKey: @"QueueSeedNumber"]];
|
||||
[fStalledField setIntValue: [fDefaults integerForKey: @"StalledMinutes"]];
|
||||
|
||||
//set blocklist
|
||||
[self updateBlocklistFields];
|
||||
}
|
||||
|
||||
- (void) setUpdater: (SUUpdater *) updater
|
||||
|
@ -354,6 +358,30 @@
|
|||
([fDefaults boolForKey: @"EncryptionRequire"] ? TR_ENCRYPTION_REQUIRED : TR_ENCRYPTION_PREFERRED) : TR_PLAINTEXT_PREFERRED);
|
||||
}
|
||||
|
||||
- (void) setBlocklistEnabled: (id) sender
|
||||
{
|
||||
BOOL enable = [sender state] == NSOnState;
|
||||
[fDefaults setBool: enable forKey: @"Blocklist"];
|
||||
tr_blocklistSetEnabled(fHandle, enable);
|
||||
}
|
||||
|
||||
- (void) updateBlocklist: (id) sender
|
||||
{
|
||||
[BlocklistDownloader downloadWithPrefsController: self withHandle: fHandle];
|
||||
}
|
||||
|
||||
- (void) updateBlocklistFields
|
||||
{
|
||||
BOOL exists = tr_blocklistExists(fHandle);
|
||||
|
||||
[fBlocklistMessageField setStringValue: exists
|
||||
? NSLocalizedString(@"Blocklist is loaded", "Prefs -> blocklist -> message")
|
||||
: NSLocalizedString(@"A blocklist must first be downloaded", "Prefs -> blocklist -> message")];
|
||||
|
||||
[fBlocklistEnableCheck setEnabled: exists];
|
||||
[fBlocklistEnableCheck setState: exists && [fDefaults boolForKey: @"Blocklist"]];
|
||||
}
|
||||
|
||||
- (void) applySpeedSettings: (id) sender
|
||||
{
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
|
@ -443,7 +471,7 @@
|
|||
}
|
||||
|
||||
- (void) setBadge: (id) sender
|
||||
{
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"DockBadgeChange" object: self];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue