Changeset 6027
- Timestamp:
- Jun 4, 2008, 6:40:50 AM (14 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r6023 r6027 220 220 [fDefaults boolForKey: @"RPC"], 221 221 [fDefaults integerForKey: @"RPCPort"], 222 /*TR_DEFAULT_RPC_ACL*/"");222 NULL); /*reset in prefs*/ 223 223 224 224 [NSApp setDelegate: self]; -
trunk/macosx/English.lproj/PrefsWindow.xib
r6024 r6027 2980 2980 <reference key="NSNextResponder" ref="206862330"/> 2981 2981 <int key="NSvFlags">256</int> 2982 <string key="NSFrameSize">{327, 11 6}</string>2982 <string key="NSFrameSize">{327, 117}</string> 2983 2983 <reference key="NSSuperview" ref="206862330"/> 2984 2984 <bool key="NSEnabled">YES</bool> … … 2993 2993 <reference key="NSNextResponder" ref="122119447"/> 2994 2994 <int key="NSvFlags">256</int> 2995 <string key="NSFrame">{{328, 1}, {16, 17}}</string>2995 <string key="NSFrame">{{328, 0}, {16, 17}}</string> 2996 2996 <reference key="NSSuperview" ref="122119447"/> 2997 2997 </object> … … 3077 3077 <object class="NSMenuItem" id="790371608"> 3078 3078 <reference key="NSMenu" ref="23202450"/> 3079 <string key="NSTitle"> Block</string>3079 <string key="NSTitle">Deny</string> 3080 3080 <string key="NSKeyEquiv"/> 3081 3081 <int key="NSMnemonicLoc">2147483647</int> … … 3118 3118 </object> 3119 3119 </object> 3120 <string key="NSFrame">{{1, 1 8}, {327, 116}}</string>3120 <string key="NSFrame">{{1, 17}, {327, 117}}</string> 3121 3121 <reference key="NSSuperview" ref="122119447"/> 3122 3122 <reference key="NSNextKeyView" ref="173651346"/> … … 3128 3128 <reference key="NSNextResponder" ref="122119447"/> 3129 3129 <int key="NSvFlags">256</int> 3130 <string key="NSFrame">{{328, 1 8}, {15, 116}}</string>3130 <string key="NSFrame">{{328, 17}, {15, 117}}</string> 3131 3131 <reference key="NSSuperview" ref="122119447"/> 3132 3132 <reference key="NSTarget" ref="122119447"/> … … 3151 3151 <reference ref="520862816"/> 3152 3152 </object> 3153 <string key="NSFrame">{{1, 1}, {327, 17}}</string>3153 <string key="NSFrame">{{1, 0}, {327, 17}}</string> 3154 3154 <reference key="NSSuperview" ref="122119447"/> 3155 3155 <reference key="NSNextKeyView" ref="520862816"/> … … 7441 7441 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 7442 7442 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 7443 <string>{{499, 476}, {327, 37}}</string>7443 <string>{{499, 504}, {327, 37}}</string> 7444 7444 <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 7445 7445 <string>{{289, 658}, {535, 226}}</string> -
trunk/macosx/PrefsController.m
r6024 r6027 33 33 34 34 #define RPC_ACCESS_ALLOW 0 35 #define RPC_ACCESS_ BLOCK135 #define RPC_ACCESS_DENY 1 36 36 37 37 #define RPC_IP_ADD_TAG 0 … … 670 670 [dict objectForKey: @"IP"]]]; 671 671 672 NSString * string = [components componentsJoinedByString: @","]; NSLog(string);672 NSString * string = [components componentsJoinedByString: @","]; 673 673 674 674 #warning check for an error! … … 715 715 if ([ident isEqualToString: @"Permission"]) 716 716 { 717 int allow = [[dict objectForKey: @"Allow"] boolValue] ? RPC_ACCESS_ALLOW : RPC_ACCESS_ BLOCK;717 int allow = [[dict objectForKey: @"Allow"] boolValue] ? RPC_ACCESS_ALLOW : RPC_ACCESS_DENY; 718 718 return [NSNumber numberWithInt: allow]; 719 719 } … … 725 725 row: (NSInteger) row 726 726 { 727 NSDictionary * oldDict = [fRPCAccessArray objectAtIndex: row] , * newDict;727 NSDictionary * oldDict = [fRPCAccessArray objectAtIndex: row]; 728 728 729 729 NSString * ident = [tableColumn identifier]; … … 731 731 { 732 732 NSNumber * allow = [NSNumber numberWithBool: [object intValue] == RPC_ACCESS_ALLOW]; 733 newDict = [NSDictionary dictionaryWithObjectsAndKeys: [oldDict objectForKey: @"IP"], @"IP", allow, @"Allow", nil]; 733 NSDictionary * newDict = [NSDictionary dictionaryWithObjectsAndKeys: [oldDict objectForKey: @"IP"], @"IP", allow, @"Allow", nil]; 734 [fRPCAccessArray replaceObjectAtIndex: row withObject: newDict]; 734 735 } 735 736 else 736 737 { 738 NSArray * components = [object componentsSeparatedByString: @"."]; 739 NSMutableArray * newComponents = [NSMutableArray arrayWithCapacity: 4]; 740 737 741 //verify ip 738 NSArray * components = [object componentsSeparatedByString: @"."]; 739 BOOL valid = [components count] == 4; 740 741 NSMutableArray * newComponents; 742 if (valid) 742 if ([components count] == 4) 743 743 { 744 newComponents = [NSMutableArray arrayWithCapacity: 4];745 746 744 NSEnumerator * enumerator = [components objectEnumerator]; 747 745 NSString * component; … … 751 749 [newComponents addObject: component]; 752 750 else 753 { 754 int value = [component intValue]; 755 if (value >= 0 && value < 256) 756 [newComponents addObject: [[NSNumber numberWithInt: value] stringValue]]; 757 else 758 { 759 valid = NO; 760 break; 761 } 762 } 751 [newComponents addObject: [[NSNumber numberWithInt: [component intValue]] stringValue]]; 763 752 } 764 753 } 765 754 766 if (!valid) 755 NSString * newIP = [newComponents componentsJoinedByString: @"."]; 756 //revert if ip is not valid 757 #warning fix 758 if ([newComponents count] != 4) 767 759 { 768 760 NSBeep(); … … 778 770 } 779 771 780 newDict = [NSDictionary dictionaryWithObjectsAndKeys: [newComponents componentsJoinedByString: @"."], @"IP", 781 [oldDict objectForKey: @"Allow"], @"Allow", nil]; 782 } 783 784 [fRPCAccessArray replaceObjectAtIndex: row withObject: newDict]; 772 NSDictionary * newDict = [NSDictionary dictionaryWithObjectsAndKeys: newIP, @"IP", 773 [oldDict objectForKey: @"Allow"], @"Allow", nil]; 774 [fRPCAccessArray replaceObjectAtIndex: row withObject: newDict]; 775 776 NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"IP" ascending: YES selector: @selector(compareIP:)] 777 autorelease]; 778 [fRPCAccessArray sortUsingDescriptors: [NSArray arrayWithObject: descriptor]]; 779 [fRPCAccessTable deselectAll: self]; 780 [fRPCAccessTable reloadData]; 781 } 785 782 786 783 [fDefaults setObject: fRPCAccessArray forKey: @"RPCAccessList"];
Note: See TracChangeset
for help on using the changeset viewer.