Changeset 1377

Show
Ignore:
Timestamp:
07/27/04 20:28:26 (4 years ago)
Author:
morris
Message:

add topic privilege in account editor

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/WCAccount.h

    r1267 r1377  
    1 /* $Id: WCAccount.h,v 1.3 2004/05/19 21:34:28 morris Exp $ */ 
     1/* $Id: WCAccount.h,v 1.4 2004/07/27 18:28:26 morris Exp $ */ 
    22 
    33/* 
     
    3434 
    3535 
    36 #define                                         WCAccountTypeUser                       0 
    37 #define                                         WCAccountTypeGroup                      1 
     36enum WCAccountType { 
     37        WCAccountTypeUser               = 0, 
     38        WCAccountTypeGroup 
     39}; 
    3840 
    3941 
     
    5759- (BOOL)                                        uploadAnywhere; 
    5860- (BOOL)                                        createFolders; 
    59 - (BOOL)                                        changeFiles; 
     61- (BOOL)                                        alterFiles; 
    6062- (BOOL)                                        deleteFiles; 
    6163- (BOOL)                                        viewDropBoxes; 
     
    6769- (BOOL)                                        banUsers; 
    6870- (BOOL)                                        cannotBeKicked; 
     71- (BOOL)                                        setTopic; 
    6972 
    7073- (NSComparisonResult)          nameSort:(WCAccount *)other; 
  • WiredClient/trunk/WCAccount.m

    r1269 r1377  
    1 /* $Id: WCAccount.m,v 1.3 2004/05/19 21:57:29 morris Exp $ */ 
     1/* $Id: WCAccount.m,v 1.4 2004/07/27 18:28:26 morris Exp $ */ 
    22 
    33/* 
     
    174174 
    175175 
    176 - (BOOL)changeFiles { 
     176- (BOOL)alterFiles { 
    177177        return [[_privileges objectAtIndex:8] isEqualToString:@"1"]; 
    178178} 
     
    230230- (BOOL)cannotBeKicked { 
    231231        return [[_privileges objectAtIndex:17] isEqualToString:@"1"]; 
     232} 
     233 
     234 
     235 
     236- (BOOL)setTopic { 
     237        return [[_privileges objectAtIndex:20] isEqualToString:@"1"]; 
    232238} 
    233239 
  • WiredClient/trunk/WCAccountEditor.h

    r944 r1377  
    1 /* $Id: WCAccountEditor.h,v 1.1 2004/03/08 19:23:42 morris Exp $ */ 
     1/* $Id: WCAccountEditor.h,v 1.2 2004/07/27 18:28:26 morris Exp $ */ 
    22 
    33/* 
     
    4242        IBOutlet NSMenuItem                     *_noneMenuItem; 
    4343         
     44    IBOutlet NSButton                   *_getUserInfoButton; 
     45        IBOutlet NSButton                       *_broadcastButton; 
     46        IBOutlet NSButton                       *_setTopicButton; 
    4447    IBOutlet NSButton                   *_postNewsButton; 
    4548    IBOutlet NSButton                   *_clearNewsButton; 
    46     IBOutlet NSButton                   *_getUserInfoButton; 
    47         IBOutlet NSButton                       *_broadcastButton; 
    4849 
    4950    IBOutlet NSButton                   *_downloadButton; 
  • WiredClient/trunk/WCAccountEditor.m

    r1371 r1377  
    1 /* $Id: WCAccountEditor.m,v 1.11 2004/07/23 11:29:12 morris Exp $ */ 
     1/* $Id: WCAccountEditor.m,v 1.12 2004/07/27 18:28:26 morris Exp $ */ 
    22 
    33/* 
     
    159159 
    160160- (void)windowDidLoad { 
     161        NSRect          rect; 
     162        NSSize          size; 
     163         
     164        // --- we're only interested in the window position, so save size 
     165        size = [[self window] frame].size; 
     166         
    161167        // --- window position 
    162168        [self setShouldCascadeWindows:NO]; 
    163169        [self setWindowFrameAutosaveName:@"AccountEditor"]; 
     170         
     171        // --- reset size 
     172        rect = [[self window] frame]; 
     173        rect.size = size; 
     174        [[self window] setFrame:rect display:NO]; 
    164175         
    165176        // --- window title 
     
    239250        [_postNewsButton setState:[[fields objectAtIndex:5] intValue]]; 
    240251        [_clearNewsButton setState:[[fields objectAtIndex:6] intValue]]; 
     252         
     253        if([_connection protocol] >= 1.1) 
     254                [_setTopicButton setState:[[fields objectAtIndex:23] intValue]]; 
    241255         
    242256        [_downloadButton setState:[[fields objectAtIndex:7] intValue]]; 
     
    315329        [_clearNewsButton setState:[[fields objectAtIndex:4] intValue]]; 
    316330 
     331        if([_connection protocol] >= 1.1) 
     332                [_setTopicButton setState:[[fields objectAtIndex:21] intValue]]; 
     333 
    317334        [_downloadButton setState:[[fields objectAtIndex:5] intValue]]; 
    318335        [_uploadButton setState:[[fields objectAtIndex:6] intValue]]; 
     
    420437                [_connection sendCommand:WCCreateUserCommand 
    421438                                        withArgument:[NSString stringWithFormat: 
    422                                 @"%@%@%@%@%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
     439                                @"%@%@%@%@%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    423440                        [_nameTextField stringValue], 
    424441                        WCFieldSeparator, 
     
    465482                        [_downloadSpeedTextField intValue] * 1024, 
    466483                        WCFieldSeparator, 
    467                         [_uploadSpeedTextField intValue] * 1024] 
     484                        [_uploadSpeedTextField intValue] * 1024, 
     485                        WCFieldSeparator, 
     486                        [_setTopicButton intValue]] 
    468487                                          withSender:self]; 
    469488        } 
     
    471490                [_connection sendCommand:WCCreateGroupCommand 
    472491                                        withArgument:[NSString stringWithFormat: 
    473                         @"%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
     492                        @"%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    474493                        [_nameTextField stringValue], 
    475494                        WCFieldSeparator, 
     
    512531                        [_downloadSpeedTextField intValue] * 1024, 
    513532                        WCFieldSeparator, 
    514                         [_uploadSpeedTextField intValue] * 1024] 
     533                        [_uploadSpeedTextField intValue] * 1024, 
     534                        WCFieldSeparator, 
     535                        [_setTopicButton intValue]] 
    515536                                          withSender:self]; 
    516537        } 
     
    557578                [_connection sendCommand:WCEditUserCommand 
    558579                                        withArgument:[NSString stringWithFormat: 
    559                         @"%@%@%@%@%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
     580                        @"%@%@%@%@%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    560581                        [_nameTextField stringValue], 
    561582                        WCFieldSeparator, 
     
    602623                        [_downloadSpeedTextField intValue] * 1024, 
    603624                        WCFieldSeparator, 
    604                         [_uploadSpeedTextField intValue] * 1024] 
     625                        [_uploadSpeedTextField intValue] * 1024, 
     626                        WCFieldSeparator, 
     627                        [_setTopicButton intValue]] 
    605628                                          withSender:self]; 
    606629        } else { 
    607630                [_connection sendCommand:WCEditGroupCommand 
    608631                                        withArgument:[NSString stringWithFormat: 
    609                         @"%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
     632                        @"%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    610633                        [_nameTextField stringValue], 
    611634                        WCFieldSeparator, 
     
    648671                        [_downloadSpeedTextField intValue] * 1024, 
    649672                        WCFieldSeparator, 
    650                         [_uploadSpeedTextField intValue] * 1024] 
     673                        [_uploadSpeedTextField intValue] * 1024, 
     674                        WCFieldSeparator, 
     675                        [_setTopicButton intValue]] 
    651676                                          withSender:self]; 
    652677        } 
     
    660685- (IBAction)selectAll:(id)sender { 
    661686        // --- check all the buttons we can access 
     687        if([_getUserInfoButton isEnabled]) 
     688                [_getUserInfoButton setState:NSOnState]; 
     689         
     690        if([_broadcastButton isEnabled]) 
     691                [_broadcastButton setState:NSOnState]; 
     692         
     693        if([_setTopicButton isEnabled]) 
     694                [_setTopicButton setState:NSOnState]; 
     695         
    662696        if([_postNewsButton isEnabled]) 
    663697                [_postNewsButton setState:NSOnState]; 
     
    665699        if([_clearNewsButton isEnabled]) 
    666700                [_clearNewsButton setState:NSOnState]; 
    667          
    668         if([_getUserInfoButton isEnabled]) 
    669                 [_getUserInfoButton setState:NSOnState]; 
    670          
    671         if([_broadcastButton isEnabled]) 
    672                         [_broadcastButton setState:NSOnState]; 
    673701         
    674702        if([_downloadButton isEnabled]) 
     
    742770                if([[_connection account] elevatePrivileges]) { 
    743771                        // --- enable all buttons 
     772                        [_getUserInfoButton setEnabled:YES]; 
     773                        [_broadcastButton setEnabled:YES]; 
     774                        [_setTopicButton setEnabled:YES]; 
    744775                        [_postNewsButton setEnabled:YES]; 
    745776                        [_clearNewsButton setEnabled:YES]; 
    746                         [_getUserInfoButton setEnabled:YES]; 
    747                         [_broadcastButton setEnabled:YES]; 
    748777                         
    749778                        [_downloadButton setEnabled:YES]; 
     
    769798                        [_getUserInfoButton setEnabled:[[_connection account] getUserInfo]]; 
    770799                        [_broadcastButton setEnabled:[[_connection account] broadcast]]; 
     800                        [_setTopicButton setEnabled:[[_connection account] setTopic]]; 
    771801                        [_postNewsButton setEnabled:[[_connection account] postNews]]; 
    772802                        [_clearNewsButton setEnabled:[[_connection account] clearNews]]; 
     
    776806                        [_uploadAnywhereButton setEnabled:[[_connection account] uploadAnywhere]]; 
    777807                        [_createFoldersButton setEnabled:[[_connection account] createFolders]]; 
    778                         [_moveButton setEnabled:[[_connection account] changeFiles]]; 
     808                        [_moveButton setEnabled:[[_connection account] alterFiles]]; 
    779809                        [_deleteButton setEnabled:[[_connection account] deleteFiles]]; 
    780810                        [_viewDropBoxButton setEnabled:[[_connection account] viewDropBoxes]]; 
     
    797827                 
    798828                // --- disable buttons 
     829                [_getUserInfoButton setEnabled:NO]; 
     830                [_broadcastButton setEnabled:NO]; 
     831                [_setTopicButton setEnabled:YES]; 
    799832                [_postNewsButton setEnabled:NO]; 
    800833                [_clearNewsButton setEnabled:NO]; 
    801                 [_getUserInfoButton setEnabled:NO]; 
    802                 [_broadcastButton setEnabled:NO]; 
    803834                 
    804835                [_downloadButton setEnabled:NO]; 
  • WiredClient/trunk/WCFileInfo.m

    r1361 r1377  
    1 /* $Id: WCFileInfo.m,v 1.15 2004/06/10 13:21:21 morris Exp $ */ 
     1/* $Id: WCFileInfo.m,v 1.16 2004/07/27 18:28:26 morris Exp $ */ 
    22 
    33/* 
     
    108108        // --- compare the existing file name with the one in the text field 
    109109        if([[self window] isVisible] && 
    110            [[_connection account] changeFiles] && 
     110           [[_connection account] alterFiles] && 
    111111           ![[[_file path] lastPathComponent] isEqualToString:[_fileTextField stringValue]]) { 
    112112                // --- send the move command 
     
    121121        // --- compare the existing comment with the one in the text field 
    122122        if([[self window] isVisible] && 
    123            [[_connection account] changeFiles] && 
     123           [[_connection account] alterFiles] && 
    124124           [_connection protocol] >= 1.1 && 
    125125           ![[_file comment] isEqualToString:[_commentTextField stringValue]]) { 
     
    133133        // --- compare the existing type with the one in the menu 
    134134        if([[self window] isVisible] && 
    135            [[_connection account] changeFiles] && 
     135           [[_connection account] alterFiles] && 
    136136           [_connection protocol] >= 1.1 && 
    137137           [_file type] != WCFileTypeFile && 
     
    302302 
    303303                [_kindPopUpButton selectItemWithTag:[_file type]]; 
    304                 [_kindPopUpButton setEnabled:[[_connection account] changeFiles]]; 
     304                [_kindPopUpButton setEnabled:[[_connection account] alterFiles]]; 
    305305        } 
    306306                 
     
    319319         
    320320        // --- set editable 
    321         [_fileTextField setEditable:[[_connection account] changeFiles]]; 
     321        [_fileTextField setEditable:[[_connection account] alterFiles]]; 
    322322        [_commentTextField setEditable: 
    323                 [_connection protocol] >= 1.1 && [[_connection account] changeFiles]]; 
     323                [_connection protocol] >= 1.1 && [[_connection account] alterFiles]]; 
    324324 
    325325        // --- resize and show window 
  • WiredClient/trunk/WCPublicChat.m

    r1376 r1377  
    1 /* $Id: WCPublicChat.m,v 1.31 2004/07/27 17:37:44 morris Exp $ */ 
     1/* $Id: WCPublicChat.m,v 1.32 2004/07/27 18:28:26 morris Exp $ */ 
    22 
    33/* 
     
    350350 
    351351 
    352  
    353352- (void)banSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 
    354353        WCUser          *user = (WCUser *) contextInfo;