Changeset 868


Ignore:
Timestamp:
Sep 18, 2006, 2:11:03 PM (15 years ago)
Author:
livings124
Message:

attempt at getting nat traversal support in the os x gui

Location:
branches/nat-traversal
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/nat-traversal/Transmission.xcodeproj/project.pbxproj

    r865 r868  
    281281                4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = "<group>"; };
    282282                4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = "<group>"; };
    283                 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
     283                4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
    284284                4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = "<group>"; };
    285285                4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = "<group>"; };
  • branches/nat-traversal/macosx/Controller.m

    r855 r868  
    426426    [fTorrents makeObjectsPerformSelector: @selector(stopTransferForQuit)];
    427427   
     428    //disable NAT traversal
     429    tr_natTraversalDisable(fLib);
     430   
    428431    //remember window states and close all windows
    429432    [fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
     
    439442        return;
    440443
    441     //wait for running transfers to stop (5 second timeout)
     444    //wait for running transfers to stop (5 second timeout) and for NAT to be disabled
    442445    NSDate * start = [NSDate date];
    443446    BOOL timeUp = NO;
     
    445448    NSEnumerator * enumerator = [fTorrents objectEnumerator];
    446449    Torrent * torrent;
    447     while (!timeUp && (torrent = [enumerator nextObject]))
     450    while (!timeUp && ((torrent = [enumerator nextObject]) || tr_natTraversalStatus(fLib) != TR_NAT_TRAVERSAL_DISABLED))
    448451        while (![torrent isPaused] && !(timeUp = [start timeIntervalSinceNow] < -5.0))
    449452        {
  • branches/nat-traversal/macosx/Defaults.plist

    r807 r868  
    5353        <key>MoveFolder</key>
    5454        <string>~/Desktop</string>
     55        <key>NatTraversal</key>
     56        <true/>
    5557        <key>PlayDownloadSound</key>
    5658        <true/>
  • branches/nat-traversal/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r752 r868  
    1818                setLimitCheck = id;
    1919                setMoveTorrent = id;
     20                setNat = id;
    2021                setPlaySound = id;
    2122                setPort = id;
     
    4546                fGeneralView = NSView;
    4647                fImportFolderPopUp = NSPopUpButton;
     48                fNatCheck = NSButton;
    4749                fNetworkView = NSView;
    4850                fPlayDownloadSoundCheck = NSButton;
  • branches/nat-traversal/macosx/English.lproj/PrefsWindow.nib/info.nib

    r753 r868  
    1010                <string>285 423 582 311 0 0 1152 842 </string>
    1111                <key>28</key>
    12                 <string>58 372 582 290 0 0 1152 842 </string>
     12                <string>285 434 582 290 0 0 1152 842 </string>
    1313                <key>41</key>
    1414                <string>285 427 582 304 0 0 1152 842 </string>
    1515                <key>66</key>
    16                 <string>164 527 582 104 0 0 1152 842 </string>
     16                <string>285 517 582 124 0 0 1152 842 </string>
    1717        </dict>
    1818        <key>IBFramework Version</key>
     
    2424        <key>IBOpenObjects</key>
    2525        <array>
    26                 <integer>153</integer>
     26                <integer>66</integer>
    2727        </array>
    2828        <key>IBSystem Version</key>
  • branches/nat-traversal/macosx/PrefsController.h

    r752 r868  
    5252
    5353    IBOutlet NSTextField    * fPortField;
     54    IBOutlet NSButton       * fNatCheck;
    5455   
    5556    IBOutlet NSButton       * fRatioCheck;
     
    8182- (void) folderSheetShow:       (id) sender;
    8283
    83 - (void) setPort:       (id) sender;
     84- (void) setPort:   (id) sender;
     85- (void) setNat:    (id) sender;
     86
    8487- (void) setSpeedLimit: (id) sender;
    8588
  • branches/nat-traversal/macosx/PrefsController.m

    r850 r868  
    127127    tr_setBindPort(fHandle, bindPort);
    128128   
     129    //set NAT
     130    BOOL natShouldEnable = [fDefaults boolForKey: @"NatTraversal"];
     131    if (natShouldEnable)
     132        tr_natTraversalEnable(fHandle);
     133    [fNatCheck setState: natShouldEnable];
     134   
    129135    //checks for old version upload speed of -1
    130136    if ([fDefaults integerForKey: @"UploadLimit"] < 0)
     
    356362        [fDefaults setInteger: bindPort forKey: @"BindPort"];
    357363    }
     364}
     365
     366- (void) setNat: (id) sender
     367{
     368    BOOL enable = [sender state] == NSOnState;
     369    enable ? tr_natTraversalEnable(fHandle) : tr_natTraversalDisable(fHandle);
     370    [fDefaults setBool: enable forKey: @"NatTraversal"];
    358371}
    359372
Note: See TracChangeset for help on using the changeset viewer.