Changeset 6033


Ignore:
Timestamp:
Jun 4, 2008, 5:25:51 PM (14 years ago)
Author:
livings124
Message:

accurately test the rpc acl's ip address

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r6032 r6033  
    22832283    }
    22842284   
    2285    
     2285    //tiger doesn't have built-in image scaling in buttons
    22862286    if (![NSApp isOnLeopardOrBetter])
    22872287    {
  • trunk/macosx/PrefsController.m

    r6030 r6033  
    759759       
    760760        NSString * newIP = [newComponents componentsJoinedByString: @"."];
     761       
    761762        //revert if ip is not valid
    762         #warning fix
    763         if ([newComponents count] != 4)
     763        if (!tr_sessionTestRPCACL(fHandle, [[@"+" stringByAppendingString: newIP] UTF8String], NULL))
     764        {
     765            NSDictionary * newDict = [NSDictionary dictionaryWithObjectsAndKeys: newIP, @"IP",
     766                                        [oldDict objectForKey: @"Allow"], @"Allow", nil];
     767            [fRPCAccessArray replaceObjectAtIndex: row withObject: newDict];
     768           
     769            NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"IP" ascending: YES selector: @selector(compareIP:)]
     770                                                autorelease];
     771            [fRPCAccessArray sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
     772        }
     773        else
    764774        {
    765775            NSBeep();
    766776           
    767777            if ([[oldDict objectForKey: @"IP"] isEqualToString: @""])
    768             {
    769778                [fRPCAccessArray removeObjectAtIndex: row];
    770                 [fRPCAccessTable deselectAll: self];
    771                 [fRPCAccessTable reloadData];
    772             }
    773            
    774             return;
    775779        }
    776780       
    777         NSDictionary * newDict = [NSDictionary dictionaryWithObjectsAndKeys: newIP, @"IP",
    778                                     [oldDict objectForKey: @"Allow"], @"Allow", nil];
    779         [fRPCAccessArray replaceObjectAtIndex: row withObject: newDict];
    780        
    781         NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"IP" ascending: YES selector: @selector(compareIP:)]
    782                                             autorelease];
    783         [fRPCAccessArray sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
    784781        [fRPCAccessTable deselectAll: self];
    785782        [fRPCAccessTable reloadData];
Note: See TracChangeset for help on using the changeset viewer.