Plugins/Purple Service/ESPurpleMSNAccountViewController.m
branchadium-1.5.11-merge
changeset 6013 f8d0dc659e3f
parent 5941 307f53385811
parent 6012 200a01709ba4
child 6014 fcb71cb71a3d
child 6015 2b01cc935b7c
equal deleted inserted replaced
5941:307f53385811 6013:f8d0dc659e3f
     1 /* 
       
     2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
       
     3  * with this source distribution.
       
     4  * 
       
     5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
       
     6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
       
     7  * or (at your option) any later version.
       
     8  * 
       
     9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
       
    10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
       
    11  * Public License for more details.
       
    12  * 
       
    13  * You should have received a copy of the GNU General Public License along with this program; if not,
       
    14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
       
    15  */
       
    16 
       
    17 #import "ESPurpleMSNAccountViewController.h"
       
    18 #import "ESPurpleMSNAccount.h"
       
    19 #import <Adium/AIAccount.h>
       
    20 #import <AIUtilities/AIAttributedStringAdditions.h>
       
    21 
       
    22 @implementation ESPurpleMSNAccountViewController
       
    23 
       
    24 - (NSString *)nibName{
       
    25     return @"ESPurpleMSNAccountView";
       
    26 }
       
    27 
       
    28 //Configure controls
       
    29 - (void)configureForAccount:(AIAccount *)inAccount
       
    30 {
       
    31     [super configureForAccount:inAccount];
       
    32 	
       
    33 	[checkBox_HTTPConnectMethod setState:[[account preferenceForKey:KEY_MSN_HTTP_CONNECT_METHOD 
       
    34 															  group:GROUP_ACCOUNT_STATUS] boolValue]];
       
    35 	
       
    36 	// negated preference, default => allowed
       
    37 	[checkbox_allowDirectConnections setState:![[account preferenceForKey:KEY_MSN_BLOCK_DIRECT_CONNECTIONS
       
    38 																   group:GROUP_ACCOUNT_STATUS] boolValue]];
       
    39 }
       
    40 
       
    41 //Save controls
       
    42 - (void)saveConfiguration
       
    43 {
       
    44 	[account setPreference:[NSNumber numberWithBool:[checkBox_HTTPConnectMethod state]] 
       
    45 					forKey:KEY_MSN_HTTP_CONNECT_METHOD group:GROUP_ACCOUNT_STATUS];
       
    46 	
       
    47 	[account setPreference:[NSNumber numberWithBool:![checkbox_allowDirectConnections state]]
       
    48 					forKey:KEY_MSN_BLOCK_DIRECT_CONNECTIONS group:GROUP_ACCOUNT_STATUS];
       
    49 	
       
    50 	//Alias
       
    51 	if (!account.online &&
       
    52 		![[textField_alias stringValue] isEqualToString:[[NSAttributedString stringWithData:[account preferenceForKey:KEY_ACCOUNT_DISPLAY_NAME
       
    53 																											   group:GROUP_ACCOUNT_STATUS]] string]]) {
       
    54 		[account setPreference:[NSNumber numberWithBool:YES]
       
    55 						forKey:KEY_DISPLAY_CUSTOM_EMOTICONS
       
    56 						 group:GROUP_ACCOUNT_STATUS];
       
    57 		
       
    58 	}
       
    59 
       
    60 	[super saveConfiguration];
       
    61 }
       
    62 
       
    63 @end