+ Support BitTorrent Enhancement Proposal #21 "Extension for Partial Seeds"
- Mac
+ Groups (moved to preferences) can have a default location when adding transfers
+ + Bonjour support for web interface
- GTK+
+ Minor display improvements and HIG compliance
--- /dev/null
+/******************************************************************************
+ * $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>
+
+@interface BonjourController : NSObject
+{
+ NSNetService * fService;
+}
+
++ (BonjourController *) defaultController;
+
+- (void) startWithPort: (NSInteger) port;
+- (void) stop;
+
+@end
--- /dev/null
+/******************************************************************************
+ * $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 "BonjourController.h"
+
+@implementation BonjourController
+
+BonjourController * fDefaultController = nil;
++ (BonjourController *) defaultController
+{
+ if (!fDefaultController)
+ fDefaultController = [[BonjourController alloc] init];
+ return fDefaultController;
+}
+
+- (void) dealloc
+{
+ [fService release];
+ [super dealloc];
+}
+
+- (void) startWithPort: (NSInteger) port
+{
+ [self stop];
+
+ CFStringRef machineName = CSCopyMachineName();
+ NSString * serviceName = [NSString stringWithFormat: @"%@: Transmission Web Interface", (NSString *)machineName];
+ CFRelease(machineName);
+
+ fService = [[NSNetService alloc] initWithDomain: @"local." type: @"_http._tcp." name: serviceName port: port];
+ [fService setDelegate: self];
+
+ [fService publish];
+}
+
+- (void) stop;
+{
+ [fService stop];
+ [fService release];
+ fService = nil;
+}
+
+- (void) netServiceWillPublish: (NSNetService *) sender
+{
+ NSLog(@"Will publish the Web UI service on port: %d", [sender port]);
+}
+
+- (void) netService: (NSNetService *) sender didNotPublish: (NSDictionary *) errorDict
+{
+ NSLog(@"Failed to publish the Web UI service on port: %d, with error: %@", [sender port], errorDict);
+}
+
+- (void) netServiceDidPublish: (NSNetService *) sender
+{
+ NSLog(@"Did publish the Web UI service on port: %d", [sender port]);
+}
+
+- (void) netServiceWillResolve: (NSNetService *) sender
+{
+ NSLog(@"Will resolve the Web UI service on port: %d", [sender port]);
+}
+
+- (void) netService: (NSNetService *) sender didNotResolve: (NSDictionary *) errorDict
+{
+ NSLog(@"Failed to resolve the Web UI service on port: %d, with error: %@", [sender port], errorDict);
+}
+
+- (void) netServiceDidResolveAddress: (NSNetService *) sender
+{
+ NSLog(@"Did resolve the Web UI service on port: %d", [sender port]);
+}
+
+@end
#import "BlocklistDownloader.h"
#import "StatusBarView.h"
#import "FilterButton.h"
+#import "BonjourController.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#import "NSMenuAdditions.h"
//auto importing
[self checkAutoImportDirectory];
+
+ //registering the Web UI to Bonjour
+ if ([fDefaults boolForKey: @"RPC"])
+ [[BonjourController defaultController] startWithPort: [fDefaults integerForKey: @"RPCPort"]];
}
- (BOOL) applicationShouldHandleReopen: (NSApplication *) app hasVisibleWindows: (BOOL) visibleWindows
- (void) applicationWillTerminate: (NSNotification *) notification
{
+ //stop the Bonjour service
+ [[BonjourController defaultController] stop];
+
//stop blocklist download
if ([BlocklistDownloader isRunning])
[[BlocklistDownloader downloader] cancelDownload];
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 5];
CGFloat progress = [[peer objectForKey: @"Progress"] floatValue];
-
- NSString * seedStatus;
+ NSString * progressString = [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
+ "Inspector -> Peers tab -> table row tooltip"), progress * 100.0];
if (progress < 1.0 && [[peer objectForKey: @"Seed"] boolValue])
- seedStatus = [NSString stringWithFormat: @" (%@)", NSLocalizedString(@"Partial Seed",
- "Inspector -> Peers tab -> table row tooltip")];
- else
- seedStatus = @"";
-
- [components addObject: [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%%@",
- "Inspector -> Peers tab -> table row tooltip"), progress * 100.0, seedStatus]];
+ progressString = [progressString stringByAppendingFormat: @" (%@)", NSLocalizedString(@"Partial Seed",
+ "Inspector -> Peers tab -> table row tooltip")];
+ [components addObject: progressString];
if ([[peer objectForKey: @"Encryption"] boolValue])
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
BlocklistDownloaderViewController.m \
BlocklistScheduler.h \
BlocklistScheduler.m \
+ BonjourController.h \
+ BonjourController.m \
ButtonToolbarItem.h \
ButtonToolbarItem.m \
ColorTextField.h \
#import "BlocklistDownloaderViewController.h"
#import "BlocklistScheduler.h"
#import "PortChecker.h"
+#import "BonjourController.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#import "UKKQueue.h"
- (void) setRPCEnabled: (id) sender
{
- tr_sessionSetRPCEnabled(fHandle, [fDefaults boolForKey: @"RPC"]);
+ BOOL enable = [fDefaults boolForKey: @"RPC"];
+ tr_sessionSetRPCEnabled(fHandle, enable);
+
+ //Registering the Web UI to Bonjour
+ if (enable)
+ [[BonjourController defaultController] startWithPort: [fDefaults integerForKey: @"RPCPort"]];
+ else
+ [[BonjourController defaultController] stop];
}
- (void) linkWebUI: (id) sender
int port = [sender intValue];
[fDefaults setInteger: port forKey: @"RPCPort"];
tr_sessionSetRPCPort(fHandle, port);
+
+ //Registering the Web UI to Bonjour
+ if ([fDefaults boolForKey:@"RPC"])
+ [[BonjourController defaultController] startWithPort: port];
}
- (void) setRPCUseWhitelist: (id) sender