Adium

Ticket #344: KGContactBlockedPlugin.diff

File KGContactBlockedPlugin.diff, 8.7 kB (added by Kiel Gillard, 3 years ago)

The proposed plugin, version 1.0

  • Adium.xcodeproj/project.pbxproj

    old new  
    11391139                9E28FDE806ADB30D0041553E /* adiumRedHighlight.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E28FDE606ADB30D0041553E /* adiumRedHighlight.png */; }; 
    11401140                9E6417070613C55D006AF387 /* CBURLHandlingPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E6417050613C55C006AF387 /* CBURLHandlingPlugin.h */; }; 
    11411141                9E6417080613C55D006AF387 /* CBURLHandlingPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E6417060613C55C006AF387 /* CBURLHandlingPlugin.m */; }; 
     1142                9E6586AD08CD633A00FD51A9 /* KGContactBlockedPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E6586AB08CD633A00FD51A9 /* KGContactBlockedPlugin.h */; }; 
     1143                9E6586AE08CD633A00FD51A9 /* KGContactBlockedPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E6586AC08CD633A00FD51A9 /* KGContactBlockedPlugin.m */; }; 
    11421144                9E6A9BF70732CB500032C9F6 /* adiumOfflineHighlight.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E6A9BF50732CB500032C9F6 /* adiumOfflineHighlight.png */; }; 
    11431145                9E6A9BF80732CB500032C9F6 /* adiumOffline.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E6A9BF60732CB500032C9F6 /* adiumOffline.png */; }; 
    11441146                9EA125E9055B630900ECF349 /* CBGaimOscarAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EA125E8055B630900ECF349 /* CBGaimOscarAccount.m */; }; 
     
    30093011                9E28FDE606ADB30D0041553E /* adiumRedHighlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = adiumRedHighlight.png; path = "Plugins/Status Menu Item/adiumRedHighlight.png"; sourceTree = "<group>"; }; 
    30103012                9E6417050613C55C006AF387 /* CBURLHandlingPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CBURLHandlingPlugin.h; path = "Plugins/URL Handling/CBURLHandlingPlugin.h"; sourceTree = "<group>"; }; 
    30113013                9E6417060613C55C006AF387 /* CBURLHandlingPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = CBURLHandlingPlugin.m; path = "Plugins/URL Handling/CBURLHandlingPlugin.m"; sourceTree = "<group>"; }; 
     3014                9E6586AB08CD633A00FD51A9 /* KGContactBlockedPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = KGContactBlockedPlugin.h; path = Source/KGContactBlockedPlugin.h; sourceTree = "<group>"; }; 
     3015                9E6586AC08CD633A00FD51A9 /* KGContactBlockedPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = KGContactBlockedPlugin.m; path = Source/KGContactBlockedPlugin.m; sourceTree = "<group>"; }; 
    30123016                9E6A9BF50732CB500032C9F6 /* adiumOfflineHighlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = adiumOfflineHighlight.png; path = "Plugins/Status Menu Item/adiumOfflineHighlight.png"; sourceTree = "<group>"; }; 
    30133017                9E6A9BF60732CB500032C9F6 /* adiumOffline.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = adiumOffline.png; path = "Plugins/Status Menu Item/adiumOffline.png"; sourceTree = "<group>"; }; 
    30143018                9E791D9405768B7A00547562 /* CBStatusMenuItemPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CBStatusMenuItemPlugin.h; path = "Plugins/Status Menu Item/CBStatusMenuItemPlugin.h"; sourceTree = "<group>"; }; 
     
    38373841                                347E7ACD07CAF98400350507 /* ESMetaContactContentsPlugin.m */, 
    38383842                                347E7AA907CAF8EE00350507 /* SAContactOnlineForPlugin.h */, 
    38393843                                347E7AA807CAF8EE00350507 /* SAContactOnlineForPlugin.m */, 
     3844                                9E6586AB08CD633A00FD51A9 /* KGContactBlockedPlugin.h */, 
     3845                                9E6586AC08CD633A00FD51A9 /* KGContactBlockedPlugin.m */, 
    38403846                        ); 
    38413847                        name = Tooltips; 
    38423848                        sourceTree = "<group>"; 
     
    64286434                                B02355A508CBE854008CDDDA /* sqliteInt.h in Headers */, 
    64296435                                B02355AF08CBE854008CDDDA /* vdbe.h in Headers */, 
    64306436                                B02355B308CBE854008CDDDA /* vdbeInt.h in Headers */, 
     6437                                9E6586AD08CD633A00FD51A9 /* KGContactBlockedPlugin.h in Headers */, 
    64316438                        ); 
    64326439                        runOnlyForDeploymentPostprocessing = 0; 
    64336440                }; 
     
    80788085                                B02355B208CBE854008CDDDA /* vdbefifo.c in Sources */, 
    80798086                                B02355B408CBE854008CDDDA /* vdbemem.c in Sources */, 
    80808087                                B02355B508CBE854008CDDDA /* where.c in Sources */, 
     8088                                9E6586AE08CD633A00FD51A9 /* KGContactBlockedPlugin.m in Sources */, 
    80818089                        ); 
    80828090                        runOnlyForDeploymentPostprocessing = 0; 
    80838091                }; 
  • Source/KGContactBlockedPlugin.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// 
     18//  KGContactBlockedPlugin.h 
     19//  Adium 
     20// 
     21//  Created by Kiel Gillard on 6/09/05. 
     22// 
     23 
     24#import <Adium/AIPlugin.h> 
     25#import "AIListObject.h" 
     26 
     27@protocol AIContactListTooltipEntry; 
     28 
     29@interface KGContactBlockedPlugin : AIPlugin <AIContactListTooltipEntry> { 
     30} 
     31 
     32@end 
  • Source/KGContactBlockedPlugin.m

    old new  
     1// 
     2//  KGContactBlockedPlugin.m 
     3//  Adium 
     4// 
     5//  Created by Kiel Gillard on 6/09/05. 
     6// 
     7 
     8#import "KGContactBlockedPlugin.h" 
     9#import "AIAccountController.h" 
     10#import "AIInterfaceController.h" 
     11#import <Adium/AIAccount.h> 
     12#import <AIUtilities/AIAttributedStringAdditions.h> 
     13 
     14@protocol AIContactListTooltipEntry; 
     15 
     16@implementation KGContactBlockedPlugin 
     17/*! 
     18 * @class KGContactBlockedPlugin 
     19 * @brief Adds a "Blocked: Yes" to the tooltip bodies of blocked contacts. 
     20 */ 
     21- (void)installPlugin 
     22{ 
     23    //Install our tooltip entry 
     24    [[adium interfaceController] registerContactListTooltipEntry:self secondaryEntry:YES]; 
     25} 
     26 
     27/*! 
     28 * @brief Tooltip entry 
     29 * 
     30 * @result An entry for the blocked label, or nil if no tooltip label and entry should be shown 
     31 */ 
     32- (NSAttributedString *)entryForObject:(AIListObject *)inObject 
     33{ 
     34        /* 
     35         * 1. Determine if contact is on privacy list 
     36         * 2. If it is, create a blocked tooltip entry (that is, return localised @"Yes") 
     37         * 3. If not, return nil 
     38         */ 
     39         
     40    NSAttributedString                          *entry = nil; 
     41        BOOL                                                    blocked = NO; 
     42        NSArray                                                 *privacyList = nil; 
     43        AIAccount <AIAccount_Privacy>   *account; 
     44        NSEnumerator                                    *enumerator = [[[adium accountController] accounts] objectEnumerator]; 
     45         
     46        //loop thru all the accounts 
     47        while ((account = [enumerator nextObject])) { 
     48 
     49                //if the current account is online and responds to the privacy protocol 
     50                if ([[account statusObjectForKey:@"Online"] boolValue] &&  
     51                   [account conformsToProtocol:@protocol(AIAccount_Privacy)]) { 
     52                        //get the list 
     53                        privacyList = [account listObjectsOnPrivacyList:PRIVACY_DENY]; 
     54                        //check for the buddy on the privacy list 
     55                        blocked = [privacyList containsObject:inObject]; 
     56                        //no point looping on 
     57                        if (blocked) break; 
     58                } 
     59        } 
     60         
     61        if (blocked) { 
     62                entry = [NSAttributedString stringWithString:AILocalizedString(@"Yes", nil)]; 
     63        } 
     64         
     65        return entry; 
     66} 
     67 
     68/*! 
     69 * @brief Tooltip entry 
     70 * 
     71 * @result The tooltip "Blocked" label 
     72 */ 
     73- (NSString *)labelForObject:(AIListObject *)inObject 
     74{ 
     75        return AILocalizedString(@"Blocked", @"Tooltip entry label to show a contact as blocked"); 
     76} 
     77 
     78@end 
  • Resources/CoreComponents.plist

    old new  
    7979        <string>SMContactListShowBehaviorPlugin</string> 
    8080        <string>ESiTunesPlugin</string> 
    8181        <string>AIDockBadger</string> 
     82        <string>KGContactBlockedPlugin</string> 
    8283        <string>SMSQLiteLoggerPlugin</string> 
    8384</array> 
    8485</plist>