Adium

Ticket #344: KGBlockedContacts3.diff

File KGBlockedContacts3.diff, 46.3 kB (added by Kiel Gillard, 3 years ago)

Untamed version of cbarrett's patch.

  • Frameworks/Adium

    old new  
    4444- (void)setOnline:(BOOL)online notify:(NotifyTiming)notify silently:(BOOL)silent; 
    4545- (void)setSignonDate:(NSDate *)signonDate notify:(NotifyTiming)notify; 
    4646- (NSDate *)signonDate; 
     47- (void)setIsBlocked:(BOOL)yesOrNo; 
    4748 
    4849- (void)setIdle:(BOOL)isIdle sinceDate:(NSDate *)idleSinceDate notify:(NotifyTiming)notify; 
    4950- (void)setServersideIconData:(NSData *)iconData notify:(NotifyTiming)notify; 
  • Frameworks/Adium

    old new  
    2828#import <AIUtilities/AIMutableOwnerArray.h> 
    2929#import <AIUtilities/AIMutableStringAdditions.h> 
    3030 
     31#define IS_BLOCKED_KEY @"isBlocked" 
     32 
    3133@implementation AIListContact 
    3234 
    3335//Init with an account 
     
    456458                                   notify:notify]; 
    457459} 
    458460 
     461/*! 
     462 * @brief Is this contact blocked? 
     463 */ 
     464- (BOOL)isBlocked 
     465{ 
     466        return [self integerStatusObjectForKey:IS_BLOCKED_KEY]; 
     467} 
     468 
     469/*! 
     470 * @brief Set if this contact is blocked 
     471 */ 
     472- (void)setIsBlocked:(BOOL)yesOrNo 
     473{ 
     474        [self setStatusObject:(yesOrNo ? [NSNumber numberWithBool:YES] : nil) 
     475                                   forKey:IS_BLOCKED_KEY  
     476                                   notify:NotifyNow]; 
     477} 
     478 
    459479#pragma mark Status 
    460480 
    461481/*! 
  • Frameworks/Adium

    old new  
    3131#define KEY_LIST_LAYOUT_SHOW_EXT_STATUS                 @"Show Extended Status" 
    3232#define KEY_LIST_LAYOUT_SHOW_STATUS_ICONS               @"Show Status Icons" 
    3333#define KEY_LIST_LAYOUT_SHOW_SERVICE_ICONS              @"Show Service Icons" 
     34#define KEY_LIST_LAYOUT_SHOW_BLOCKED_ICONS              @"Show Blocked Icons" 
    3435#define KEY_LIST_LAYOUT_WINDOW_STYLE                    @"Window Style" 
    3536 
    3637#define KEY_LIST_LAYOUT_EXTENDED_STATUS_STYLE   @"Extended Status Style" 
     
    3839#define KEY_LIST_LAYOUT_USER_ICON_POSITION              @"User Icon Position" 
    3940#define KEY_LIST_LAYOUT_STATUS_ICON_POSITION    @"Status Icon Position" 
    4041#define KEY_LIST_LAYOUT_SERVICE_ICON_POSITION   @"Service Icon Position" 
     42#define KEY_LIST_LAYOUT_BLOCKED_ICON_POSITION   @"Blocked Icon Position" 
    4143 
    4244#define KEY_LIST_LAYOUT_CONTACT_SPACING                 @"Contact Spacing" 
    4345#define KEY_LIST_LAYOUT_GROUP_TOP_SPACING               @"Group Top Spacing" 
  • Frameworks/Adium

    old new  
    249249                [contentCell setExtendedStatusVisible:[[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_EXT_STATUS] boolValue]]; 
    250250                [contentCell setStatusIconsVisible:[[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_STATUS_ICONS] boolValue]]; 
    251251                [contentCell setServiceIconsVisible:[[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_SERVICE_ICONS] boolValue]]; 
     252                [contentCell setBlockedIconVisible:[[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_BLOCKED_ICONS] boolValue]]; 
    252253 
    253254                [contentCell setUserIconPosition:[[prefDict objectForKey:KEY_LIST_LAYOUT_USER_ICON_POSITION] intValue]]; 
    254255                [contentCell setStatusIconPosition:[[prefDict objectForKey:KEY_LIST_LAYOUT_STATUS_ICON_POSITION] intValue]]; 
    255256                [contentCell setServiceIconPosition:[[prefDict objectForKey:KEY_LIST_LAYOUT_SERVICE_ICON_POSITION] intValue]]; 
     257                [contentCell setBlockedIconPosition:[[prefDict objectForKey:KEY_LIST_LAYOUT_BLOCKED_ICON_POSITION] intValue]]; 
    256258                [contentCell setExtendedStatusIsBelowName:[[prefDict objectForKey:KEY_LIST_LAYOUT_EXTENDED_STATUS_POSITION] boolValue]];                 
    257259        } else { 
    258260                //Fitted pillows + centered text = no icons 
     
    261263                [contentCell setUserIconVisible:(allowIcons ? [[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_ICON] boolValue] : NO)]; 
    262264                [contentCell setStatusIconsVisible:(allowIcons ? [[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_STATUS_ICONS] boolValue] : NO)]; 
    263265                [contentCell setServiceIconsVisible:(allowIcons ? [[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_SERVICE_ICONS] boolValue] : NO)]; 
     266                [contentCell setBlockedIconVisible:(allowIcons ? [[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_BLOCKED_ICONS] boolValue] : NO)]; 
    264267 
    265268                [contentCell setExtendedStatusVisible:NO /*(allowIcons ? [[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_EXT_STATUS] boolValue] : NO)*/]; 
    266269 
     
    282285                                                                                                         contentCellAlignment:contentCellAlignment]; 
    283286                        [contentCell setServiceIconPosition:iconPosition]; 
    284287                         
     288                        iconPosition = [[prefDict objectForKey:KEY_LIST_LAYOUT_BLOCKED_ICON_POSITION] intValue]; 
     289                        iconPosition = [self pillowsFittedIconPositionForIconPosition:iconPosition 
     290                                                                                                         contentCellAlignment:contentCellAlignment]; 
     291                        [contentCell setBlockedIconPosition:iconPosition]; 
     292                         
    285293                        //Force extended status below the name (?) 
    286294                        [contentCell setExtendedStatusIsBelowName:YES]; 
    287295                } 
  • Frameworks/Adium

    old new  
    3131#define SERVICE_ICON_LEFT_PAD           2 
    3232#define SERVICE_ICON_RIGHT_PAD          2 
    3333 
     34//Blocked icon 
     35#define BLOCKED_ICON_LEFT_PAD           2 
     36#define BLOCKED_ICON_RIGHT_PAD          2 
     37 
    3438@interface AIListContactCell : AIListCell { 
    3539        BOOL                            userIconVisible; 
    3640        BOOL                            extendedStatusVisible; 
    3741        BOOL                            statusIconsVisible; 
    3842        BOOL                            serviceIconsVisible; 
     43        BOOL                            blockedIconVisible; 
    3944        NSSize                          userIconSize; 
    4045        int                                     statusFontHeight;        
    4146         
     
    4651        LIST_POSITION           userIconPosition; 
    4752        LIST_POSITION           statusIconPosition; 
    4853        LIST_POSITION           serviceIconPosition; 
     54        LIST_POSITION           blockedIconPosition; 
    4955        BOOL                            extendedStatusIsBelowName; 
    5056         
    5157        float                           backgroundOpacity; 
     
    7783- (BOOL)statusIconsVisible; 
    7884- (void)setServiceIconsVisible:(BOOL)inShowService; 
    7985- (BOOL)serviceIconsVisible; 
     86- (void)setBlockedIconVisible:(BOOL)yesOrNo; 
     87- (BOOL)blockedIconVisible; 
    8088- (void)setExtendedStatusIsBelowName:(BOOL)inBelowName; 
    8189- (void)setUserIconPosition:(LIST_POSITION)inPosition; 
    8290- (void)setStatusIconPosition:(LIST_POSITION)inPosition; 
    8391- (void)setServiceIconPosition:(LIST_POSITION)inPosition; 
     92- (void)setBlockedIconPosition:(LIST_POSITION)inPosition; 
    8493- (void)setBackgroundOpacity:(float)inOpacity; 
    8594- (float)backgroundOpacity; 
    8695- (void)setBackgroundColorIsStatus:(BOOL)isStatus; 
     
    93102- (NSRect)drawUserIconInRect:(NSRect)inRect position:(IMAGE_POSITION)position; 
    94103- (NSRect)drawStatusIconInRect:(NSRect)rect position:(IMAGE_POSITION)position; 
    95104- (NSRect)drawServiceIconInRect:(NSRect)rect position:(IMAGE_POSITION)position; 
     105- (NSRect)drawBlockedIconInRect:(NSRect)rect position:(IMAGE_POSITION)position; 
    96106- (NSRect)drawUserExtendedStatusInRect:(NSRect)rect drawUnder:(BOOL)drawUnder; 
    97107- (NSColor *)labelColor; 
    98108- (NSColor *)textColor; 
    99109- (NSImage *)userIconImage; 
    100110- (NSImage *)statusImage; 
    101111- (NSImage *)serviceImage; 
     112- (NSImage *)blockedImage; 
    102113//- (BOOL)drawStatusBelowLabelInRect:(NSRect)rect; 
    103114- (BOOL)drawGridBehindCell; 
    104115- (float)imageOpacityForDrawing; 
  • Frameworks/Adium

    old new  
    1717#import "AIListContactCell.h" 
    1818#import "AIListLayoutWindowController.h" 
    1919#import "AIListObject.h" 
     20#import "AIListContact.h" 
    2021#import <AIUtilities/AIAttributedStringAdditions.h> 
    2122#import <AIUtilities/AIParagraphStyleAdditions.h> 
     23#import <Adium/AIStatusIcons.h> 
    2224#import <Adium/AIServiceIcons.h> 
    2325#import <Adium/AIUserIcons.h> 
    2426 
     
    135137                width += SERVICE_ICON_LEFT_PAD + SERVICE_ICON_RIGHT_PAD; 
    136138        } 
    137139         
     140        //Blocked icon 
     141        if (blockedIconVisible && 
     142                (blockedIconPosition != LIST_POSITION_BADGE_LEFT && blockedIconPosition != LIST_POSITION_BADGE_RIGHT)) { 
     143                width += [[self blockedImage] size].width; 
     144                width += BLOCKED_ICON_LEFT_PAD + BLOCKED_ICON_RIGHT_PAD; 
     145        } 
     146         
    138147        return width + 1; 
    139148} 
    140149 
     
    270279        return serviceIconsVisible; 
    271280} 
    272281 
     282/*! 
     283 * @brief Set if a blocked icon be shown for a blocked contact 
     284 */ 
     285- (void)setBlockedIconVisible:(BOOL)yesOrNo 
     286{ 
     287        blockedIconVisible = yesOrNo; 
     288} 
     289 
     290/*! 
     291 * @brief Should a block icon for a blocked contact be shown? 
     292 */ 
     293- (BOOL)blockedIconVisible 
     294{ 
     295        return blockedIconVisible; 
     296} 
     297 
    273298//Element Positioning 
    274299- (void)setExtendedStatusIsBelowName:(BOOL)inBelowName{ 
    275300        extendedStatusIsBelowName = inBelowName; 
     
    284309        serviceIconPosition = inPosition; 
    285310} 
    286311 
     312/*! 
     313 * @brief Remember where a blocked icon should be drawn.  
     314 */ 
     315- (void)setBlockedIconPosition:(LIST_POSITION)inPosition 
     316{ 
     317        blockedIconPosition = inPosition; 
     318} 
     319 
    287320//Opacity 
    288321- (void)setBackgroundOpacity:(float)inOpacity 
    289322{ 
     
    320353        //Far Left 
    321354        if (statusIconPosition == LIST_POSITION_FAR_LEFT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_LEFT]; 
    322355        if (serviceIconPosition == LIST_POSITION_FAR_LEFT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     356        if (blockedIconPosition == LIST_POSITION_FAR_LEFT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_LEFT]; 
    323357         
    324358        //User Icon [Left] 
    325359        if (userIconPosition == LIST_POSITION_LEFT) rect = [self drawUserIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     
    327361        //Left 
    328362        if (statusIconPosition == LIST_POSITION_LEFT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_LEFT]; 
    329363        if (serviceIconPosition == LIST_POSITION_LEFT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     364        if (blockedIconPosition == LIST_POSITION_LEFT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     365 
    330366         
    331367        //Far Right 
    332368        if (statusIconPosition == LIST_POSITION_FAR_RIGHT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    333369        if (serviceIconPosition == LIST_POSITION_FAR_RIGHT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
     370        if (blockedIconPosition == LIST_POSITION_FAR_RIGHT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    334371         
    335372        //User Icon [Right] 
    336373        if (userIconPosition == LIST_POSITION_RIGHT) rect = [self drawUserIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
     
    338375        //Right 
    339376        if (statusIconPosition == LIST_POSITION_RIGHT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    340377        if (serviceIconPosition == LIST_POSITION_RIGHT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
     378        if (blockedIconPosition == LIST_POSITION_RIGHT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    341379         
    342380        //Extended Status 
    343381        if (extendedStatusIsBelowName) rect = [self drawUserExtendedStatusInRect:rect drawUnder:YES]; 
     
    392430                        [self drawServiceIconInRect:drawRect position:IMAGE_POSITION_LOWER_RIGHT]; 
    393431                } 
    394432                 
     433                //badge the user icon with the status pack's blocked icon 
     434                if (blockedIconPosition == LIST_POSITION_BADGE_LEFT) { 
     435                        [self drawBlockedIconInRect:drawRect position:IMAGE_POSITION_LOWER_LEFT]; 
     436                } else if (blockedIconPosition == LIST_POSITION_BADGE_RIGHT) { 
     437                        [self drawBlockedIconInRect:drawRect position:IMAGE_POSITION_LOWER_RIGHT]; 
     438                } 
     439                 
    395440                //If we're using space on the right, shrink the width so we won't be overlapped 
    396441//              if (position == IMAGE_POSITION_RIGHT) rect.size.width -= USER_ICON_RIGHT_PAD; 
    397442                if (position == IMAGE_POSITION_LEFT) rect.origin.x += USER_ICON_RIGHT_PAD; 
     
    459504        return rect; 
    460505} 
    461506 
     507/*! 
     508 * @brief Draw the Blocked icon in the contact's rect 
     509 */ 
     510- (NSRect)drawBlockedIconInRect:(NSRect)rect position:(IMAGE_POSITION)position 
     511{ 
     512         
     513        if ([self blockedIconVisible] && [(AIListContact *)listObject isBlocked]) { 
     514                BOOL    isBadge = (position == IMAGE_POSITION_LOWER_LEFT || position == IMAGE_POSITION_LOWER_RIGHT); 
     515 
     516                if (!isBadge) { 
     517                        if (position == IMAGE_POSITION_LEFT) rect.origin.x += BLOCKED_ICON_LEFT_PAD; 
     518                        rect.size.width -= BLOCKED_ICON_LEFT_PAD; 
     519                } 
     520                 
     521                /* 
     522                 Draw the blocked icon if (it is not a badge), or if (it is a badge and there is a userIconImage) 
     523                 (We have already drawn the blocked icon if there is no userIconImage, in drawUserIconInRect:position:) 
     524                 */ 
     525                if (!isBadge || ([self userIconImage] != nil)) { 
     526                        NSImage *image = [self blockedImage]; 
     527                        [image setFlipped:![image isFlipped]]; 
     528                        rect = [image drawInRect:rect 
     529                                                          atSize:NSMakeSize(0, 0) 
     530                                                        position:position 
     531                                                        fraction:1.0]; 
     532                        [image setFlipped:![image isFlipped]]; 
     533                } 
     534                 
     535                if (!isBadge) { 
     536                        if (position == IMAGE_POSITION_LEFT) rect.origin.x += BLOCKED_ICON_RIGHT_PAD; 
     537                        rect.size.width -= BLOCKED_ICON_RIGHT_PAD; 
     538                } 
     539        } 
     540        return rect; 
     541} 
     542 
    462543//User Extended Status 
    463544- (NSRect)drawUserExtendedStatusInRect:(NSRect)rect drawUnder:(BOOL)drawUnder 
    464545{ 
     
    582663        return [AIServiceIcons serviceIconForObject:listObject type:AIServiceIconList direction:AIIconFlipped]; 
    583664} 
    584665 
     666/*! 
     667 * @brief Return blocked icon image from current status pack 
     668 */ 
     669- (NSImage *)blockedImage 
     670{ 
     671        return [AIStatusIcons statusIconForStatusName:@"Blocked"  
     672                                                                           statusType:AIAwayStatus  
     673                                                                                 iconType:AIStatusIconList 
     674                                                                                direction:AIIconNormal]; 
     675} 
     676 
    585677//No need to the grid if we have a status color to draw 
    586678- (BOOL)drawGridBehindCell 
    587679{ 
  • Frameworks/Adium

    old new  
    119119 
    120120- (BOOL)isStranger; 
    121121- (BOOL)isMobile; 
     122- (BOOL)isBlocked; 
    122123 
    123124- (NSString *)displayName; 
    124125- (void)setDisplayName:(NSString *)alias; 
  • Frameworks/Adium

    old new  
    590590} 
    591591 
    592592/*! 
     593 * @brief Is this contact blocked? 
     594 */ 
     595- (BOOL)isBlocked 
     596{ 
     597        return NO; 
     598} 
     599 
     600/*! 
    593601 * @brief Set the current status message 
    594602 * 
    595603 * @param statusMessage Status message. May be nil. 
  • Frameworks/Adium

    old new  
    183183        return NO; 
    184184} 
    185185 
     186/*! 
     187 * @brief Are all the contacts in this meta blocked? 
     188 */ 
     189- (BOOL)isBlocked 
     190{ 
     191        BOOL                    allContactsBlocked = YES; 
     192        NSEnumerator    *enumerator = [self listContactsEnumerator]; 
     193        AIListContact   *currentContact = nil; 
     194         
     195        while ((currentContact = [enumerator nextObject])) { 
     196                if (![currentContact isBlocked]) { 
     197                        allContactsBlocked = NO; 
     198                        break; 
     199                } 
     200        } 
     201         
     202        return allContactsBlocked; 
     203} 
     204 
    186205//Object Storage ------------------------------------------------------------------------------------------------------- 
    187206#pragma mark Object Storage 
    188207/*! 
  • Plugins/Contact

    old new  
    2626        IBOutlet                NSPopUpButton           *popUp_userIconPosition; 
    2727        IBOutlet                NSPopUpButton           *popUp_statusIconPosition; 
    2828        IBOutlet                NSPopUpButton           *popUp_serviceIconPosition; 
     29        IBOutlet                NSPopUpButton           *popUp_blockedIconPosition; 
    2930 
    3031        IBOutlet                NSButton                        *checkBox_userIconVisible; 
    3132        IBOutlet                NSButton                        *checkBox_extendedStatusVisible; 
    3233        IBOutlet                NSButton                        *checkBox_statusIconsVisible; 
    3334        IBOutlet                NSButton                        *checkBox_serviceIconsVisible; 
     35        IBOutlet                NSButton                        *checkBox_blockedIconsVisible; 
    3436 
    3537        IBOutlet                NSSlider                        *slider_userIconSize; 
    3638        IBOutlet                NSTextField                     *textField_userIconSize; 
  • Plugins/Contact

    old new  
    3535- (void)configureControlDimming; 
    3636- (void)updateSliderValues; 
    3737- (void)updateDisplayedTabsFromPrefDict:(NSDictionary *)prefDict; 
    38 - (void)updateStatusAndServiceIconMenusFromPrefDict:(NSDictionary *)prefDict; 
     38- (void)updateMenusOfBadgeableIconsFromPrefDict:(NSDictionary *)prefDict; 
    3939- (void)updateUserIconMenuFromPrefDict:(NSDictionary *)prefDict; 
     40- (void)updateBlockedIconMenuFromPrefDict:(NSDictionary *)prefDict; 
    4041- (NSMenu *)alignmentMenuWithChoices:(int [])alignmentChoices; 
    4142- (NSMenu *)positionMenuWithChoices:(int [])positionChoices; 
    4243- (NSMenu *)extendedStatusStyleMenu; 
     
    144145        textAlignmentChoices[3] = -1; 
    145146         
    146147        [self updateDisplayedTabsFromPrefDict:prefDict]; 
    147          
    148         [self updateStatusAndServiceIconMenusFromPrefDict:prefDict]; 
    149          
     148        [self updateMenusOfBadgeableIconsFromPrefDict:prefDict]; 
    150149        [self updateUserIconMenuFromPrefDict:prefDict]; 
    151150         
    152151        //Context text alignment 
     
    189188                NSDictionary    *prefDict; 
    190189                prefDict = [[adium preferenceController] preferencesForGroup:PREF_GROUP_LIST_LAYOUT]; 
    191190                 
    192                 [self updateStatusAndServiceIconMenusFromPrefDict:prefDict]; 
     191                [self updateMenusOfBadgeableIconsFromPrefDict:prefDict]; 
    193192                [self updateUserIconMenuFromPrefDict:prefDict]; 
    194193                 
    195194                [self configureControlDimming]; 
     
    219218                                                                                         forKey:KEY_LIST_LAYOUT_SERVICE_ICON_POSITION 
    220219                                                                                          group:PREF_GROUP_LIST_LAYOUT]; 
    221220                 
     221        } else if (sender == popUp_blockedIconPosition) { 
     222                [[adium preferenceController] setPreference:[NSNumber numberWithInt:[[sender selectedItem] tag]] 
     223                                                                                         forKey:KEY_LIST_LAYOUT_BLOCKED_ICON_POSITION 
     224                                                                                          group:PREF_GROUP_LIST_LAYOUT]; 
     225 
    222226        } else if (sender == popUp_extendedStatusStyle) { 
    223227                [[adium preferenceController] setPreference:[NSNumber numberWithInt:[[sender selectedItem] tag]] 
    224228                                                                                         forKey:KEY_LIST_LAYOUT_EXTENDED_STATUS_STYLE 
     
    250254                                                                                          group:PREF_GROUP_LIST_LAYOUT]; 
    251255                 
    252256                prefDict  = [[adium preferenceController] preferencesForGroup:PREF_GROUP_LIST_LAYOUT]; 
    253                 //Update the status and service icon menus to show/hide the badge options 
    254                 [self updateStatusAndServiceIconMenusFromPrefDict:prefDict]; 
     257                //Update the status, blocked and service icon menus to show/hide the badge options 
     258                [self updateMenusOfBadgeableIconsFromPrefDict:prefDict]; 
    255259                [self configureControlDimming]; 
    256260                 
    257261        } else if (sender == checkBox_extendedStatusVisible) { 
     
    272276                                                                                          group:PREF_GROUP_LIST_LAYOUT]; 
    273277                [self configureControlDimming]; 
    274278                 
     279    } else if (sender == checkBox_blockedIconsVisible) { 
     280                [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]] 
     281                                                                                         forKey:KEY_LIST_LAYOUT_SHOW_BLOCKED_ICONS 
     282                                                                                          group:PREF_GROUP_LIST_LAYOUT]; 
     283                [self configureControlDimming]; 
     284                 
    275285    } else if (sender == checkBox_outlineBubbles) { 
    276286        [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]] 
    277287                                             forKey:KEY_LIST_LAYOUT_OUTLINE_BUBBLE 
     
    383393                [checkBox_serviceIconsVisible setEnabled:YES]; 
    384394                [checkBox_serviceIconsVisible setState:[[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_SERVICE_ICONS] boolValue]];  
    385395                 
     396                [checkBox_blockedIconsVisible setEnabled:YES]; 
     397                [checkBox_blockedIconsVisible setState:[[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_BLOCKED_ICONS] boolValue]];  
     398                 
    386399        } else { 
    387400                //For fitted and centered, disable and set to NO 
    388401                [checkBox_userIconVisible setEnabled:NO]; 
     
    393406                 
    394407                [checkBox_serviceIconsVisible setEnabled:NO]; 
    395408                [checkBox_serviceIconsVisible setState:NO]; 
     409                 
     410                [checkBox_blockedIconsVisible setEnabled:NO]; 
     411                [checkBox_blockedIconsVisible setState:NO]; 
    396412        } 
    397413         
    398414         
     
    415431        [popUp_serviceIconPosition setEnabled:([checkBox_serviceIconsVisible state] && 
    416432                                                                                   [checkBox_serviceIconsVisible isEnabled] && 
    417433                                                                                   ([popUp_serviceIconPosition numberOfItems] > 0))]; 
     434        [popUp_blockedIconPosition setEnabled:([checkBox_blockedIconsVisible state] && 
     435                                                                                   [checkBox_blockedIconsVisible isEnabled] && 
     436                                                                                   ([popUp_blockedIconPosition numberOfItems] > 0))]; 
    418437        [popUp_userIconPosition setEnabled:([checkBox_userIconVisible state] && 
    419438                                                                                [checkBox_userIconVisible isEnabled] && 
    420439                                                                                ([popUp_userIconPosition numberOfItems] > 0))]; 
     
    429448        [slider_outlineWidth setEnabled:[checkBox_outlineBubbles state]]; 
    430449} 
    431450 
    432 - (void)updateStatusAndServiceIconMenusFromPrefDict:(NSDictionary *)prefDict 
     451/*! 
     452 * @brief Update menus of icons that are badgeable 
     453 */ 
     454- (void)updateMenusOfBadgeableIconsFromPrefDict:(NSDictionary *)prefDict 
    433455{ 
    434         int                             statusAndServicePositionChoices[7]; 
     456        int                             choices[7]; 
    435457        BOOL                    showUserIcon = [[prefDict objectForKey:KEY_LIST_LAYOUT_SHOW_ICON] boolValue]; 
    436458        int                             indexForFinishingChoices = 0; 
    437459         
    438460        if ([[[adium preferenceController] preferenceForKey:KEY_LIST_LAYOUT_WINDOW_STYLE group:PREF_GROUP_APPEARANCE] intValue] != WINDOW_STYLE_PILLOWS_FITTED) { 
    439                 statusAndServicePositionChoices[0] = LIST_POSITION_FAR_LEFT; 
    440                 statusAndServicePositionChoices[1] = LIST_POSITION_LEFT; 
    441                 statusAndServicePositionChoices[2] = LIST_POSITION_RIGHT; 
    442                 statusAndServicePositionChoices[3] = LIST_POSITION_FAR_RIGHT; 
     461                choices[0] = LIST_POSITION_FAR_LEFT; 
     462                choices[1] = LIST_POSITION_LEFT; 
     463                choices[2] = LIST_POSITION_RIGHT; 
     464                choices[3] = LIST_POSITION_FAR_RIGHT; 
    443465                 
    444466                indexForFinishingChoices = 4; 
    445467                 
     
    447469                //For fitted pillows, only show the options which correspond to the text alignment 
    448470                switch ([[prefDict objectForKey:KEY_LIST_LAYOUT_ALIGNMENT] intValue]) { 
    449471                        case NSLeftTextAlignment: 
    450                                 statusAndServicePositionChoices[0] = LIST_POSITION_FAR_LEFT; 
    451                                 statusAndServicePositionChoices[1] = LIST_POSITION_LEFT; 
     472                                choices[0] = LIST_POSITION_FAR_LEFT; 
     473                                choices[1] = LIST_POSITION_LEFT; 
    452474                                indexForFinishingChoices = 2; 
    453475                                break; 
    454476                                 
    455477                        case NSRightTextAlignment: 
    456                                 statusAndServicePositionChoices[0] = LIST_POSITION_RIGHT; 
    457                                 statusAndServicePositionChoices[1] = LIST_POSITION_FAR_RIGHT; 
     478                                choices[0] = LIST_POSITION_RIGHT; 
     479                                choices[1] = LIST_POSITION_FAR_RIGHT; 
    458480                                indexForFinishingChoices = 2; 
    459481                                 
    460482                                break; 
     
    466488         
    467489        //Only show the badge choices if we are showing the user icon 
    468490        if (showUserIcon && (indexForFinishingChoices != 0)) { 
    469                 statusAndServicePositionChoices[indexForFinishingChoices] = LIST_POSITION_BADGE_LEFT; 
    470                 statusAndServicePositionChoices[indexForFinishingChoices + 1] = LIST_POSITION_BADGE_RIGHT; 
    471                 statusAndServicePositionChoices[indexForFinishingChoices + 2] = -1; 
     491                choices[indexForFinishingChoices] = LIST_POSITION_BADGE_LEFT; 
     492                choices[indexForFinishingChoices + 1] = LIST_POSITION_BADGE_RIGHT; 
     493                choices[indexForFinishingChoices + 2] = -1; 
    472494                 
    473495        } else { 
    474                 statusAndServicePositionChoices[indexForFinishingChoices] = -1; 
     496                choices[indexForFinishingChoices] = -1; 
    475497                 
    476498        } 
    477499         
    478         [popUp_statusIconPosition setMenu:[self positionMenuWithChoices:statusAndServicePositionChoices]]; 
     500        //update status icon positions in menu 
     501        [popUp_statusIconPosition setMenu:[self positionMenuWithChoices:choices]]; 
    479502        [popUp_statusIconPosition compatibleSelectItemWithTag:[[prefDict objectForKey:KEY_LIST_LAYOUT_STATUS_ICON_POSITION] intValue]]; 
    480503         
    481         [popUp_serviceIconPosition setMenu:[self positionMenuWithChoices:statusAndServicePositionChoices]]; 
    482         [popUp_serviceIconPosition compatibleSelectItemWithTag:[[prefDict objectForKey:KEY_LIST_LAYOUT_SERVICE_ICON_POSITION] intValue]];        
     504        //update service icon positions in menu 
     505        [popUp_serviceIconPosition setMenu:[self positionMenuWithChoices:choices]]; 
     506        [popUp_serviceIconPosition compatibleSelectItemWithTag:[[prefDict objectForKey:KEY_LIST_LAYOUT_SERVICE_ICON_POSITION] intValue]]; 
     507         
     508        //update blocked icon positions in menu 
     509        [popUp_blockedIconPosition setMenu:[self positionMenuWithChoices:choices]]; 
     510        [popUp_blockedIconPosition compatibleSelectItemWithTag:[[prefDict objectForKey:KEY_LIST_LAYOUT_BLOCKED_ICON_POSITION] intValue]]; 
    483511} 
    484512 
    485513- (void)updateUserIconMenuFromPrefDict:(NSDictionary *)prefDict 
  • Plugins/Gaim

    old new  
    10431043                AIListContact   *contact = [self contactWithUID:sourceUID]; 
    10441044                 
    10451045                [(type == PRIVACY_PERMIT ? permittedContactsArray : deniedContactsArray) addObject:contact]; 
     1046                [contact setIsBlocked:(type == PRIVACY_DENY)]; 
    10461047        } 
    10471048} 
    10481049 
  • KGContactUIDPlugin.h

    old new  
     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//  KGContactUIDPlugin.h 
     18//  Adium 
     19// 
     20//  Created by Kiel Gillard on 8/09/05. 
     21// 
     22 
     23#import <Adium/AIPlugin.h> 
     24 
     25@protocol AIContactListTooltipEntry; 
     26 
     27@interface KGContactUIDPlugin : AIPlugin <AIContactListTooltipEntry> { 
     28} 
     29 
     30@end 
  • KGContactUIDPlugin.m

    old new  
     1// 
     2//  KGContactUIDPlugin.m 
     3//  Adium 
     4// 
     5//  Created by Kiel Gillard on 8/09/05. 
     6// 
     7 
     8#import "KGContactUIDPlugin.h" 
     9#import "AIInterfaceController.h" 
     10#import <Adium/AIListObject.h> 
     11#import <Adium/AIListContact.h> 
     12#import <Adium/AIMetaContact.h> 
     13#import <AIUtilities/AIAttributedStringAdditions.h> 
     14#import <AIUtilities/AIStringAdditions.h> 
     15 
     16@interface KGContactUIDPlugin (PRIVATE) 
     17- (NSAttributedString *)entryForListContact:(AIListObject *)contact; 
     18@end 
     19 
     20@implementation KGContactUIDPlugin 
     21/*! 
     22 * @class KGContactUIDPlugin 
     23 * @brief Adds a "User ID: <contact formattedUID>" to List contact tooltips. 
     24 */ 
     25- (void)installPlugin 
     26{ 
     27    //Install our tooltip entry 
     28    [[adium interfaceController] registerContactListTooltipEntry:self secondaryEntry:NO]; 
     29} 
     30 
     31/*! 
     32 * @brief Tooltip entry 
     33 * 
     34 * @result An entry for the User ID label, or nil if no tooltip label and entry should be shown 
     35 */ 
     36- (NSAttributedString *)entryForObject:(AIListObject *)inObject 
     37{ 
     38        NSAttributedString *entry = nil; 
     39         
     40        //do this for ListContacts only 
     41        if (![inObject isKindOfClass:[AIMetaContact class]] && [inObject isKindOfClass:[AIListContact class]]) { 
     42                entry = [self entryForListContact:inObject]; 
     43        } else if ([inObject isKindOfClass:[AIMetaContact class]]) { 
     44                 
     45                if ([(AIMetaContact *)inObject containsOnlyOneUniqueContact]) { 
     46                        entry = [self entryForListContact:[[(AIMetaContact *)inObject listContacts] lastObject]]; 
     47                } 
     48        } 
     49         
     50        return entry; 
     51} 
     52 
     53/*! 
     54 * @brief Tooltip entry 
     55 * 
     56 * @result The tooltip "User ID" label 
     57 */ 
     58- (NSString *)labelForObject:(AIListObject *)inObject 
     59{ 
     60        NSString *label = nil; 
     61         
     62        if ([inObject isKindOfClass:[AIListContact class]] && (![inObject isKindOfClass:[AIMetaContact class]])) { 
     63                label = AILocalizedString(@"User ID", @"Tooltip entry label to show a contact's formatted user ID"); 
     64        } else if ([inObject isKindOfClass:[AIMetaContact class]]) { 
     65                if ([(AIMetaContact *)inObject containsOnlyOneUniqueContact]) { 
     66                        label = AILocalizedString(@"User ID", @"Tooltip entry label to show a contact's formatted user ID"); 
     67                } 
     68        } 
     69         
     70        return label; 
     71} 
     72 
     73/*! 
     74 * @brief Provides a Tooltip entry for the contact argument 
     75 * 
     76 * @result The formattedUID of the contact if it's different from the displayName 
     77 */ 
     78- (NSAttributedString *)entryForListContact:(AIListObject *)contact 
     79{ 
     80        NSAttributedString      *entry = nil; 
     81        NSString                        *formattedUID = [(AIListObject *)contact formattedUID]; 
     82        NSString                        *displayName = [(AIListObject *)contact displayName]; 
     83         
     84        if (formattedUID && (!([[displayName compactedString] isEqualToString:[formattedUID compactedString]]))) { 
     85                entry = [NSAttributedString stringWithString:formattedUID]; 
     86        } 
     87         
     88        return entry; 
     89} 
     90 
     91@end 
  • Adium.xcodeproj/project.pbxproj

    old new  
    11331133                9E6A9BF80732CB500032C9F6 /* adiumOffline.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E6A9BF60732CB500032C9F6 /* adiumOffline.png */; }; 
    11341134                9EA125E9055B630900ECF349 /* CBGaimOscarAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EA125E8055B630900ECF349 /* CBGaimOscarAccount.m */; }; 
    11351135                9EA125EF055B633000ECF349 /* CBGaimOscarAccount.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EA125EE055B633000ECF349 /* CBGaimOscarAccount.h */; }; 
     1136                9EF7CC2A093340010044EFB6 /* KGContactServicePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EF7CC26093340000044EFB6 /* KGContactServicePlugin.h */; }; 
     1137                9EF7CC2B093340010044EFB6 /* KGContactServicePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EF7CC27093340000044EFB6 /* KGContactServicePlugin.m */; }; 
     1138                9EF7CC2C093340010044EFB6 /* KGContactUIDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EF7CC28093340000044EFB6 /* KGContactUIDPlugin.h */; }; 
     1139                9EF7CC2D093340010044EFB6 /* KGContactUIDPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EF7CC29093340010044EFB6 /* KGContactUIDPlugin.m */; }; 
    11361140                A3C042D208D7483100B48CE1 /* GaimDefaultsGTalk.plist in Resources */ = {isa = PBXBuildFile; fileRef = A3C042D108D7483100B48CE1 /* GaimDefaultsGTalk.plist */; }; 
    11371141                A3C0432108D74D3100B48CE1 /* AIGaimGTalkAccount.h in Headers */ = {isa = PBXBuildFile; fileRef = A3C0431B08D74D3100B48CE1 /* AIGaimGTalkAccount.h */; }; 
    11381142                A3C0432208D74D3100B48CE1 /* AIGaimGTalkAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C0431C08D74D3100B48CE1 /* AIGaimGTalkAccount.m */; }; 
     
    29942998                9EB3C52E04F94F24001D1F74 /* MainMenu.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = MainMenu.nib; sourceTree = "<group>"; }; 
    29952999                9EB3C53304F94FAE001D1F74 /* CBOldPrefsImporterAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBOldPrefsImporterAppController.h; sourceTree = "<group>"; }; 
    29963000                9EB3C53404F94FAE001D1F74 /* CBOldPrefsImporterAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBOldPrefsImporterAppController.m; sourceTree = "<group>"; }; 
     3001                9EF7CC26093340000044EFB6 /* KGContactServicePlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGContactServicePlugin.h; sourceTree = "<group>"; }; 
     3002                9EF7CC27093340000044EFB6 /* KGContactServicePlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGContactServicePlugin.m; sourceTree = "<group>"; }; 
     3003                9EF7CC28093340000044EFB6 /* KGContactUIDPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGContactUIDPlugin.h; sourceTree = "<group>"; }; 
     3004                9EF7CC29093340010044EFB6 /* KGContactUIDPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGContactUIDPlugin.m; sourceTree = "<group>"; }; 
    29973005                A3C042D108D7483100B48CE1 /* GaimDefaultsGTalk.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; name = GaimDefaultsGTalk.plist; path = "Plugins/Gaim Service/GaimDefaultsGTalk.plist"; sourceTree = "<group>"; }; 
    29983006                A3C0431B08D74D3100B48CE1 /* AIGaimGTalkAccount.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIGaimGTalkAccount.h; path = "Plugins/Gaim Service/AIGaimGTalkAccount.h"; sourceTree = "<group>"; }; 
    29993007                A3C0431C08D74D3100B48CE1 /* AIGaimGTalkAccount.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIGaimGTalkAccount.m; path = "Plugins/Gaim Service/AIGaimGTalkAccount.m"; sourceTree = "<group>"; }; 
     
    37883796                3479A83B05DC9F2400998B3D /* Tooltips */ = { 
    37893797                        isa = PBXGroup; 
    37903798                        children = ( 
     3799                                9EF7CC26093340000044EFB6 /* KGContactServicePlugin.h */, 
     3800                                9EF7CC27093340000044EFB6 /* KGContactServicePlugin.m */, 
     3801                                9EF7CC28093340000044EFB6 /* KGContactUIDPlugin.h */, 
     3802                                9EF7CC29093340010044EFB6 /* KGContactUIDPlugin.m */, 
    37913803                                347E7A8D07CAF88200350507 /* AIContactAwayPlugin.h */, 
    37923804                                347E7A8E07CAF88200350507 /* AIContactAwayPlugin.m */, 
    37933805                                347E7A9807CAF8AF00350507 /* AIContactIdlePlugin.h */, 
     
    63266338                                9E44248808E11F380015D4DD /* AdiumURLHandling.h in Headers */, 
    63276339                                633F175A08F905A700C76383 /* AIXtraInfo.h in Headers */, 
    63286340                                633F175C08F905A700C76383 /* AIXtrasManager.h in Headers */, 
     6341                                9EF7CC2A093340010044EFB6 /* KGContactServicePlugin.h in Headers */, 
     6342                                9EF7CC2C093340010044EFB6 /* KGContactUIDPlugin.h in Headers */, 
    63296343                        ); 
    63306344                        runOnlyForDeploymentPostprocessing = 0; 
    63316345                }; 
     
    79397953                                9E44248908E11F380015D4DD /* AdiumURLHandling.m in Sources */, 
    79407954                                633F175B08F905A700C76383 /* AIXtraInfo.m in Sources */, 
    79417955                                633F175D08F905A800C76383 /* AIXtrasManager.m in Sources */, 
     7956                                9EF7CC2B093340010044EFB6 /* KGContactServicePlugin.m in Sources */, 
     7957                                9EF7CC2D093340010044EFB6 /* KGContactUIDPlugin.m in Sources */, 
    79427958                        ); 
    79437959                        runOnlyForDeploymentPostprocessing = 0; 
    79447960                }; 
  • Source/ESBlockingPlugin.m

    old new  
    5656        [blockContactContextualMenuItem release]; 
    5757} 
    5858 
    59  
    6059- (IBAction)blockContact:(id)sender 
    6160{ 
    6261        AIListObject    *object; 
     
    7877 
    7978                if (NSRunAlertPanel([NSString stringWithFormat:format, [contact displayName]], 
    8079                                                   @"", 
    81                                                    AILocalizedString(@"OK", nil)
     80                                                   [sender title]
    8281                                                   AILocalizedString(@"Cancel", nil), 
    8382                                                   nil) == NSAlertDefaultReturn) { 
    8483                         
     
    198197                        AIAccount <AIAccount_Privacy> *privacyAccount = (AIAccount <AIAccount_Privacy> *)account; 
    199198                        if (unblock) { 
    200199                                if ([[privacyAccount listObjectIDsOnPrivacyList:PRIVACY_DENY] containsObject:[contact UID]]) { 
    201                                         [privacyAccount removeListObject:contact fromPrivacyList:PRIVACY_DENY]; 
     200                                        if ([privacyAccount removeListObject:contact fromPrivacyList:PRIVACY_DENY]) { 
     201                                                [contact setIsBlocked:NO]; 
     202                                        } 
    202203                                } 
    203204                        } else { 
    204205                                if (![[privacyAccount listObjectIDsOnPrivacyList:PRIVACY_DENY] containsObject:[contact UID]]) { 
    205                                         [privacyAccount addListObject:contact toPrivacyList:PRIVACY_DENY]; 
     206                                        if ([privacyAccount addListObject:contact toPrivacyList:PRIVACY_DENY]) { 
     207                                                [contact setIsBlocked:YES]; 
     208                                        } 
    206209                                } 
    207210                        } 
    208211                } 
  • Source/ESMetaContactContentsPlugin.m

    old new  
    1717#import "AIInterfaceController.h" 
    1818#import "ESMetaContactContentsPlugin.h" 
    1919#import <AIUtilities/AIImageAdditions.h> 
     20#import <AIUtilities/AIAttributedStringAdditions.h> 
    2021#import <Adium/AIListContact.h> 
    2122#import <Adium/AIListObject.h> 
    2223#import <Adium/AIMetaContact.h>