Adium

Ticket #344: KGContactBlockedPlugin2.diff

File KGContactBlockedPlugin2.diff, 48.3 kB (added by Kiel Gillard, 3 years ago)

Potential patch to close ticket. Please extensively review!

  • 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  
    2626 
    2727#import <AIUtilities/AIMutableOwnerArray.h> 
    2828 
     29#define IS_BLOCKED_KEY @"isBlocked" 
     30 
    2931@implementation AIListContact 
    3032 
    3133//Init with an account 
     
    446448                                   notify:notify]; 
    447449} 
    448450 
     451/*! 
     452 * @brief Is this contact blocked? 
     453 */ 
     454- (BOOL)isBlocked 
     455{ 
     456        return [self integerStatusObjectForKey:IS_BLOCKED_KEY]; 
     457} 
     458 
     459/*! 
     460 * @brief Set if this contact is blocked 
     461 */ 
     462- (void)setIsBlocked:(BOOL)yesOrNo 
     463{ 
     464        [self setStatusObject:(yesOrNo ? [NSNumber numberWithBool:YES] : nil) 
     465                                   forKey:IS_BLOCKED_KEY  
     466                                   notify:NotifyNever]; 
     467} 
     468 
    449469#pragma mark Status 
    450470 
    451471/*! 
  • 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 += 16;//[[NSImage imageNamed:@"remove.png"] 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; 
     
    283308- (void)setServiceIconPosition:(LIST_POSITION)inPosition{ 
    284309        serviceIconPosition = inPosition; 
    285310} 
     311- (void)setBlockedIconPosition:(LIST_POSITION)inPosition{ 
     312        blockedIconPosition = inPosition; 
     313} 
    286314 
    287315//Opacity 
    288316- (void)setBackgroundOpacity:(float)inOpacity 
     
    320348        //Far Left 
    321349        if (statusIconPosition == LIST_POSITION_FAR_LEFT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_LEFT]; 
    322350        if (serviceIconPosition == LIST_POSITION_FAR_LEFT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     351        if (blockedIconPosition == LIST_POSITION_FAR_LEFT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_LEFT]; 
    323352         
    324353        //User Icon [Left] 
    325354        if (userIconPosition == LIST_POSITION_LEFT) rect = [self drawUserIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     
    327356        //Left 
    328357        if (statusIconPosition == LIST_POSITION_LEFT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_LEFT]; 
    329358        if (serviceIconPosition == LIST_POSITION_LEFT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     359        if (blockedIconPosition == LIST_POSITION_LEFT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_LEFT]; 
     360 
    330361         
    331362        //Far Right 
    332363        if (statusIconPosition == LIST_POSITION_FAR_RIGHT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    333364        if (serviceIconPosition == LIST_POSITION_FAR_RIGHT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
     365        if (blockedIconPosition == LIST_POSITION_FAR_RIGHT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    334366         
    335367        //User Icon [Right] 
    336368        if (userIconPosition == LIST_POSITION_RIGHT) rect = [self drawUserIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
     
    338370        //Right 
    339371        if (statusIconPosition == LIST_POSITION_RIGHT) rect = [self drawStatusIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    340372        if (serviceIconPosition == LIST_POSITION_RIGHT) rect = [self drawServiceIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
     373        if (blockedIconPosition == LIST_POSITION_RIGHT) rect = [self drawBlockedIconInRect:rect position:IMAGE_POSITION_RIGHT]; 
    341374         
    342375        //Extended Status 
    343376        if (extendedStatusIsBelowName) rect = [self drawUserExtendedStatusInRect:rect drawUnder:YES]; 
     
    392425                        [self drawServiceIconInRect:drawRect position:IMAGE_POSITION_LOWER_RIGHT]; 
    393426                } 
    394427                 
     428                //badge the user icon with the status pack's blocked icon 
     429                if (blockedIconPosition == LIST_POSITION_BADGE_LEFT) { 
     430                        [self drawBlockedIconInRect:drawRect position:IMAGE_POSITION_LOWER_LEFT]; 
     431                } else if (blockedIconPosition == LIST_POSITION_BADGE_RIGHT) { 
     432                        [self drawBlockedIconInRect:drawRect position:IMAGE_POSITION_LOWER_RIGHT]; 
     433                } 
     434                 
    395435                //If we're using space on the right, shrink the width so we won't be overlapped 
    396436//              if (position == IMAGE_POSITION_RIGHT) rect.size.width -= USER_ICON_RIGHT_PAD; 
    397437                if (position == IMAGE_POSITION_LEFT) rect.origin.x += USER_ICON_RIGHT_PAD; 
     
    459499        return rect; 
    460500} 
    461501 
     502/*! 
     503 * @brief Draw the Blocked icon in the contact's rect 
     504 */ 
     505- (NSRect)drawBlockedIconInRect:(NSRect)rect position:(IMAGE_POSITION)position 
     506{ 
     507         
     508        if ([self blockedIconVisible] && [(AIListContact *)listObject isBlocked]) { 
     509                BOOL    isBadge = (position == IMAGE_POSITION_LOWER_LEFT || position == IMAGE_POSITION_LOWER_RIGHT); 
     510 
     511                if (!isBadge) { 
     512                        if (position == IMAGE_POSITION_LEFT) rect.origin.x += BLOCKED_ICON_LEFT_PAD; 
     513                        rect.size.width -= BLOCKED_ICON_LEFT_PAD; 
     514                } 
     515                 
     516                /* 
     517                 Draw the blocked icon if (it is not a badge), or if (it is a badge and there is a userIconImage) 
     518                 (We have already drawn the blocked icon if there is no userIconImage, in drawUserIconInRect:position:) 
     519                 */ 
     520                if (!isBadge || ([self userIconImage] != nil)) { 
     521                        NSImage *image = [self blockedImage]; 
     522                        [image setFlipped:![image isFlipped]]; 
     523                        rect = [image drawInRect:rect 
     524                                                          atSize:NSMakeSize(0, 0) 
     525                                                        position:position 
     526                                                        fraction:1.0]; 
     527                        [image setFlipped:![image isFlipped]]; 
     528                } 
     529                 
     530                if (!isBadge) { 
     531                        if (position == IMAGE_POSITION_LEFT) rect.origin.x += BLOCKED_ICON_RIGHT_PAD; 
     532                        rect.size.width -= BLOCKED_ICON_RIGHT_PAD; 
     533                } 
     534        } 
     535        return rect; 
     536} 
     537 
    462538//User Extended Status 
    463539- (NSRect)drawUserExtendedStatusInRect:(NSRect)rect drawUnder:(BOOL)drawUnder 
    464540{ 
     
    582658        return [AIServiceIcons serviceIconForObject:listObject type:AIServiceIconList direction:AIIconFlipped]; 
    583659} 
    584660 
     661//Return blocked icon image from current status pack 
     662- (NSImage *)blockedImage 
     663{ 
     664        return [AIStatusIcons statusIconForStatusName:@"Blocked"  
     665                                                                           statusType:AIAwayStatus  
     666                                                                                 iconType:AIAwayStatusType 
     667                                                                                direction:AIIconNormal]; 
     668} 
     669 
    585670//No need to the grid if we have a status color to draw 
    586671- (BOOL)drawGridBehindCell 
    587672{ 
  • 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  
    182182        return NO; 
    183183} 
    184184 
     185/*! 
     186 * @brief Are all the contacts in this meta blocked? 
     187 */ 
     188- (BOOL)isBlocked 
     189{ 
     190        BOOL                    allContactsBlocked = YES; 
     191        NSEnumerator    *enumerator = [self listContactsEnumerator]; 
     192        AIListContact   *currentContact = nil; 
     193         
     194        while ((currentContact = [enumerator nextObject])) { 
     195                if (![currentContact isBlocked]) { 
     196                        allContactsBlocked = NO; 
     197                        break; 
     198                } 
     199        } 
     200         
     201        return allContactsBlocked; 
     202} 
     203 
    185204//Object Storage ------------------------------------------------------------------------------------------------------- 
    186205#pragma mark Object Storage 
    187206/*! 
  • 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  
    3636{ 
    3737        [super awakeFromNib]; 
    3838         
    39         NSScrollView  *scrollView = [textView_textProfile enclosingScrollView]; 
     39        /*NSScrollView        *scrollView = [textView_textProfile enclosingScrollView]; 
    4040        if (scrollView && [scrollView isKindOfClass:[AIAutoScrollView class]]) { 
    4141                [(AIAutoScrollView *)scrollView setAlwaysDrawFocusRingIfFocused:YES]; 
    4242        } 
    4343         
    4444        if ([textView_textProfile isKindOfClass:[AIMessageEntryTextView class]]) { 
    45                 /* We use the AIMessageEntryTextView to get nifty features for our text view, but we don't want to attempt 
    46                  * to 'send' to a target on Enter or Return. 
    47                  *
     45                // We use the AIMessageEntryTextView to get nifty features for our text view, but we don't want to attempt 
     46                // to 'send' to a target on Enter or Return. 
     47                /
    4848                [(AIMessageEntryTextView *)textView_textProfile setSendingEnabled:NO]; 
    49         } 
     49        }*/ 
    5050} 
    5151 
    5252/*! 
  • Plugins/Gaim

    old new  
    972972#pragma mark Privacy 
    973973- (BOOL)addListObject:(AIListObject *)inObject toPrivacyList:(PRIVACY_TYPE)type 
    974974{ 
    975     if (type == PRIVACY_PERMIT) 
    976         return (gaim_privacy_permit_add(account,[[inObject UID] UTF8String],FALSE)); 
    977     else 
    978         return (gaim_privacy_deny_add(account,[[inObject UID] UTF8String],FALSE)); 
     975        BOOL result; 
     976         
     977    if (type == PRIVACY_PERMIT) { 
     978                result = (gaim_privacy_permit_add(account,[[inObject UID] UTF8String],FALSE)); 
     979        } else { 
     980                result = (gaim_privacy_deny_add(account,[[inObject UID] UTF8String],FALSE)); 
     981        } 
     982         
     983        return result; 
    979984} 
    980985 
    981986- (BOOL)removeListObject:(AIListObject *)inObject fromPrivacyList:(PRIVACY_TYPE)type 
    982987{ 
    983     if (type == PRIVACY_PERMIT) 
    984         return (gaim_privacy_permit_remove(account,[[inObject UID] UTF8String],FALSE)); 
    985     else 
    986         return (gaim_privacy_deny_remove(account,[[inObject UID] UTF8String],FALSE)); 
     988        BOOL result; 
     989         
     990    if (type == PRIVACY_PERMIT) { 
     991                result = (gaim_privacy_permit_remove(account,[[inObject UID] UTF8String],FALSE)); 
     992        } else { 
     993                result = (gaim_privacy_deny_remove(account,[[inObject UID] UTF8String],FALSE)); 
     994        } 
     995         
     996        return result; 
    987997} 
    988998 
    989999- (NSArray *)listObjectsOnPrivacyList:(PRIVACY_TYPE)type 
     
    10211031        if ([sourceUID length]) { 
    10221032                //Get our contact 
    10231033                AIListContact   *contact = [self contactWithUID:sourceUID]; 
    1024                  
    10251034                [(type == PRIVACY_PERMIT ? permittedContactsArray : deniedContactsArray) addObject:contact]; 
     1035                //contacts remember for themselves if they're blocked 
     1036                [contact setIsBlocked:(type == PRIVACY_DENY)]; 
    10261037        } 
    10271038} 
    10281039 
     
    10511062                 
    10521063                if (contact) { 
    10531064                        [(type == PRIVACY_PERMIT ? permittedContactsArray : deniedContactsArray) removeObject:contact]; 
     1065                        //contacts should remember if they're blocked 
     1066                        [contact setIsBlocked:(type == PRIVACY_PERMIT)]; 
    10541067                } 
    10551068        } 
    10561069} 
  • Adium.xcodeproj/project.pbxproj

    old new  
    11311131                9E6A9BF80732CB500032C9F6 /* adiumOffline.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E6A9BF60732CB500032C9F6 /* adiumOffline.png */; }; 
    11321132                9EA125E9055B630900ECF349 /* CBGaimOscarAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EA125E8055B630900ECF349 /* CBGaimOscarAccount.m */; }; 
    11331133                9EA125EF055B633000ECF349 /* CBGaimOscarAccount.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EA125EE055B633000ECF349 /* CBGaimOscarAccount.h */; }; 
     1134                9EFF7CEB0922E32A00B9AC0C /* KGContactServicePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EFF7CE70922E32900B9AC0C /* KGContactServicePlugin.h */; }; 
     1135                9EFF7CEC0922E32A00B9AC0C /* KGContactServicePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EFF7CE80922E32900B9AC0C /* KGContactServicePlugin.m */; }; 
     1136                9EFF7CED0922E32A00B9AC0C /* KGContactUIDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EFF7CE90922E32900B9AC0C /* KGContactUIDPlugin.h */; }; 
     1137                9EFF7CEE0922E32A00B9AC0C /* KGContactUIDPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EFF7CEA0922E32A00B9AC0C /* KGContactUIDPlugin.m */; }; 
    11341138                A3C042D208D7483100B48CE1 /* GaimDefaultsGTalk.plist in Resources */ = {isa = PBXBuildFile; fileRef = A3C042D108D7483100B48CE1 /* GaimDefaultsGTalk.plist */; }; 
    11351139                A3C0432108D74D3100B48CE1 /* AIGaimGTalkAccount.h in Headers */ = {isa = PBXBuildFile; fileRef = A3C0431B08D74D3100B48CE1 /* AIGaimGTalkAccount.h */; }; 
    11361140                A3C0432208D74D3100B48CE1 /* AIGaimGTalkAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C0431C08D74D3100B48CE1 /* AIGaimGTalkAccount.m */; }; 
     
    30043008                9EB3C52E04F94F24001D1F74 /* MainMenu.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = MainMenu.nib; sourceTree = "<group>"; }; 
    30053009                9EB3C53304F94FAE001D1F74 /* CBOldPrefsImporterAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBOldPrefsImporterAppController.h; sourceTree = "<group>"; }; 
    30063010                9EB3C53404F94FAE001D1F74 /* CBOldPrefsImporterAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBOldPrefsImporterAppController.m; sourceTree = "<group>"; }; 
     3011                9EFF7CE70922E32900B9AC0C /* KGContactServicePlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGContactServicePlugin.h; sourceTree = "<group>"; }; 
     3012                9EFF7CE80922E32900B9AC0C /* KGContactServicePlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGContactServicePlugin.m; sourceTree = "<group>"; }; 
     3013                9EFF7CE90922E32900B9AC0C /* KGContactUIDPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KGContactUIDPlugin.h; sourceTree = "<group>"; }; 
     3014                9EFF7CEA0922E32A00B9AC0C /* KGContactUIDPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KGContactUIDPlugin.m; sourceTree = "<group>"; }; 
    30073015                A3C042D108D7483100B48CE1 /* GaimDefaultsGTalk.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; name = GaimDefaultsGTalk.plist; path = "Plugins/Gaim Service/GaimDefaultsGTalk.plist"; sourceTree = "<group>"; }; 
    30083016                A3C0431B08D74D3100B48CE1 /* AIGaimGTalkAccount.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIGaimGTalkAccount.h; path = "Plugins/Gaim Service/AIGaimGTalkAccount.h"; sourceTree = "<group>"; }; 
    30093017                A3C0431C08D74D3100B48CE1 /* AIGaimGTalkAccount.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIGaimGTalkAccount.m; path = "Plugins/Gaim Service/AIGaimGTalkAccount.m"; sourceTree = "<group>"; }; 
     
    38173825                                347E7ACD07CAF98400350507 /* ESMetaContactContentsPlugin.m */, 
    38183826                                347E7AA907CAF8EE00350507 /* SAContactOnlineForPlugin.h */, 
    38193827                                347E7AA807CAF8EE00350507 /* SAContactOnlineForPlugin.m */, 
     3828                                9EFF7CE70922E32900B9AC0C /* KGContactServicePlugin.h */, 
     3829                                9EFF7CE80922E32900B9AC0C /* KGContactServicePlugin.m */, 
     3830                                9EFF7CE90922E32900B9AC0C /* KGContactUIDPlugin.h */, 
     3831                                9EFF7CEA0922E32A00B9AC0C /* KGContactUIDPlugin.m */, 
    38203832                        ); 
    38213833                        name = Tooltips; 
    38223834                        sourceTree = "<group>"; 
     
    63346346                                9E44248808E11F380015D4DD /* AdiumURLHandling.h in Headers */, 
    63356347                                633F175A08F905A700C76383 /* AIXtraInfo.h in Headers */, 
    63366348                                633F175C08F905A700C76383 /* AIXtrasManager.h in Headers */, 
     6349                                9EFF7CEB0922E32A00B9AC0C /* KGContactServicePlugin.h in Headers */, 
     6350                                9EFF7CED0922E32A00B9AC0C /* KGContactUIDPlugin.h in Headers */, 
    63376351                        ); 
    63386352                        runOnlyForDeploymentPostprocessing = 0; 
    63396353                }; 
     
    79457959                                9E44248908E11F380015D4DD /* AdiumURLHandling.m in Sources */, 
    79467960                                633F175B08F905A700C76383 /* AIXtraInfo.m in Sources */, 
    79477961                                633F175D08F905A800C76383 /* AIXtrasManager.m in Sources */, 
     7962                                9EFF7CEC0922E32A00B9AC0C /* KGContactServicePlugin.m in Sources */, 
     7963                                9EFF7CEE0922E32A00B9AC0C /* KGContactUIDPlugin.m in Sources */, 
    79487964                        ); 
    79497965                        runOnlyForDeploymentPostprocessing = 0; 
    79507966                }; 
  • Source/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 
  • Source/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