Ticket #344: blockedContactsAlpha.diff
| File blockedContactsAlpha.diff, 12.9 kB (added by Kiel Gillard, 3 years ago) |
|---|
-
Frameworks/Adium
old new 43 43 - (void)setOnline:(BOOL)online notify:(NotifyTiming)notify silently:(BOOL)silent; 44 44 - (void)setSignonDate:(NSDate *)signonDate notify:(NotifyTiming)notify; 45 45 - (NSDate *)signonDate; 46 - (void)setIsBlocked:(BOOL)yesOrNo; 47 - (BOOL)isBlocked; 46 48 47 49 - (void)setIdle:(BOOL)isIdle sinceDate:(NSDate *)idleSinceDate notify:(NotifyTiming)notify; 48 50 - (void)setServersideIconData:(NSData *)iconData notify:(NotifyTiming)notify; -
Frameworks/Adium
old new 26 26 27 27 #import <AIUtilities/AIMutableOwnerArray.h> 28 28 29 #define IS_BLOCKED_KEY @"isBlocked" 30 29 31 @implementation AIListContact 30 32 31 33 //Init with an account … … 431 433 notify:notify]; 432 434 } 433 435 436 /*! 437 * @brief Is this contact blocked? 438 */ 439 - (BOOL)isBlocked 440 { 441 return [self integerStatusObjectForKey:IS_BLOCKED_KEY]; 442 } 443 444 /*! 445 * @brief Set if this contact is blocked 446 */ 447 - (void)setIsBlocked:(BOOL)yesOrNo 448 { 449 [self setStatusObject:(yesOrNo ? [NSNumber numberWithBool:YES] : nil) 450 forKey:IS_BLOCKED_KEY 451 notify:NotifyNever]; 452 } 453 434 454 #pragma mark Status 435 455 436 456 /*! -
Plugins/Gaim
old new 1013 1013 AIListContact *contact = [self contactWithUID:sourceUID]; 1014 1014 1015 1015 [(type == PRIVACY_PERMIT ? permittedContactsArray : deniedContactsArray) addObject:contact]; 1016 //contacts remember for themselves if they're blocked 1017 [contact setIsBlocked:(type == PRIVACY_DENY)]; 1016 1018 } 1017 1019 } 1018 1020 … … 1041 1043 1042 1044 if (contact) { 1043 1045 [(type == PRIVACY_PERMIT ? permittedContactsArray : deniedContactsArray) removeObject:contact]; 1046 //contacts should remember if they're blocked 1047 [contact setIsBlocked:(type == PRIVACY_PERMIT)]; 1044 1048 } 1045 1049 } 1046 1050 } -
Adium.xcodeproj/project.pbxproj
old new 1139 1139 9E28FDE806ADB30D0041553E /* adiumRedHighlight.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E28FDE606ADB30D0041553E /* adiumRedHighlight.png */; }; 1140 1140 9E6417070613C55D006AF387 /* CBURLHandlingPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E6417050613C55C006AF387 /* CBURLHandlingPlugin.h */; }; 1141 1141 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 */; }; 1142 1144 9E6A9BF70732CB500032C9F6 /* adiumOfflineHighlight.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E6A9BF50732CB500032C9F6 /* adiumOfflineHighlight.png */; }; 1143 1145 9E6A9BF80732CB500032C9F6 /* adiumOffline.png in Resources */ = {isa = PBXBuildFile; fileRef = 9E6A9BF60732CB500032C9F6 /* adiumOffline.png */; }; 1144 1146 9EA125E9055B630900ECF349 /* CBGaimOscarAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EA125E8055B630900ECF349 /* CBGaimOscarAccount.m */; }; … … 3009 3011 9E28FDE606ADB30D0041553E /* adiumRedHighlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = adiumRedHighlight.png; path = "Plugins/Status Menu Item/adiumRedHighlight.png"; sourceTree = "<group>"; }; 3010 3012 9E6417050613C55C006AF387 /* CBURLHandlingPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CBURLHandlingPlugin.h; path = "Plugins/URL Handling/CBURLHandlingPlugin.h"; sourceTree = "<group>"; }; 3011 3013 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>"; }; 3012 3016 9E6A9BF50732CB500032C9F6 /* adiumOfflineHighlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = adiumOfflineHighlight.png; path = "Plugins/Status Menu Item/adiumOfflineHighlight.png"; sourceTree = "<group>"; }; 3013 3017 9E6A9BF60732CB500032C9F6 /* adiumOffline.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = adiumOffline.png; path = "Plugins/Status Menu Item/adiumOffline.png"; sourceTree = "<group>"; }; 3014 3018 9E791D9405768B7A00547562 /* CBStatusMenuItemPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CBStatusMenuItemPlugin.h; path = "Plugins/Status Menu Item/CBStatusMenuItemPlugin.h"; sourceTree = "<group>"; }; … … 3837 3841 347E7ACD07CAF98400350507 /* ESMetaContactContentsPlugin.m */, 3838 3842 347E7AA907CAF8EE00350507 /* SAContactOnlineForPlugin.h */, 3839 3843 347E7AA807CAF8EE00350507 /* SAContactOnlineForPlugin.m */, 3844 9E6586AB08CD633A00FD51A9 /* KGContactBlockedPlugin.h */, 3845 9E6586AC08CD633A00FD51A9 /* KGContactBlockedPlugin.m */, 3840 3846 ); 3841 3847 name = Tooltips; 3842 3848 sourceTree = "<group>"; … … 6428 6434 B02355A508CBE854008CDDDA /* sqliteInt.h in Headers */, 6429 6435 B02355AF08CBE854008CDDDA /* vdbe.h in Headers */, 6430 6436 B02355B308CBE854008CDDDA /* vdbeInt.h in Headers */, 6437 9E6586AD08CD633A00FD51A9 /* KGContactBlockedPlugin.h in Headers */, 6431 6438 ); 6432 6439 runOnlyForDeploymentPostprocessing = 0; 6433 6440 }; … … 8078 8085 B02355B208CBE854008CDDDA /* vdbefifo.c in Sources */, 8079 8086 B02355B408CBE854008CDDDA /* vdbemem.c in Sources */, 8080 8087 B02355B508CBE854008CDDDA /* where.c in Sources */, 8088 9E6586AE08CD633A00FD51A9 /* KGContactBlockedPlugin.m in Sources */, 8081 8089 ); 8082 8090 runOnlyForDeploymentPostprocessing = 0; 8083 8091 }; -
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 26 @protocol AIContactListTooltipEntry; 27 28 @interface KGContactBlockedPlugin : AIPlugin <AIContactListTooltipEntry> { 29 } 30 31 @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/AIListContact.h> 12 #import <Adium/AIMetaContact.h> 13 #import <AIUtilities/AIAttributedStringAdditions.h> 14 15 @implementation KGContactBlockedPlugin 16 /*! 17 * @class KGContactBlockedPlugin 18 * @brief Adds a "Blocked: Yes" to the tooltip bodies of blocked List/Meta contacts. 19 * Meta contacts have to be completely blocked. ESMetaContentsPlugin covers semi-blocked metas. 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:(AIListContact *)inObject 33 { 34 NSAttributedString *entry = nil; 35 36 //do this part for ListContacts only 37 if (![inObject isKindOfClass:[AIMetaContact class]] && [inObject isKindOfClass:[AIListContact class]]) { 38 39 if ([inObject isBlocked]) { 40 entry = [NSAttributedString stringWithString:AILocalizedString(@"Yes", nil)]; 41 } 42 43 } else if ([inObject isKindOfClass:[AIMetaContact class]]) { 44 // We're only interested in metas whose list contacts are all blocked 45 46 //do we have enough contacts in this meta? 47 unsigned contactCount = [[(AIMetaContact *)inObject listContacts] count]; 48 49 if (contactCount > 1) { 50 AIListContact *currentContact = nil; 51 NSEnumerator *contactEnumerator = [(AIMetaContact *)inObject listContactsEnumerator]; 52 unsigned blockedContactCount = 0; 53 54 //determine if all the contacts are blocked 55 while ((currentContact = [contactEnumerator nextObject])) { 56 if ([currentContact isBlocked]) { 57 ++blockedContactCount; 58 } 59 } 60 61 //is the entire meta blocked? 62 if (blockedContactCount == contactCount) { 63 entry = [NSAttributedString stringWithString:AILocalizedString(@"Yes", nil)]; 64 } 65 } else { 66 //there's only one contact in the meta, so see if it's blocked 67 if ([[[(AIMetaContact *)inObject listContacts] lastObject] isBlocked]) { 68 //it is blocked, therefore the entire meta is considered blocked 69 entry = [NSAttributedString stringWithString:AILocalizedString(@"Yes", nil)]; 70 } 71 } 72 } 73 74 return entry; 75 } 76 77 /*! 78 * @brief Tooltip entry 79 * 80 * @result The tooltip "Blocked" label 81 */ 82 - (NSString *)labelForObject:(AIListContact *)inObject 83 { 84 NSString *label = nil; 85 if ([inObject isKindOfClass:[AIListContact class]] || [inObject isKindOfClass:[AIMetaContact class]]) { 86 label = AILocalizedString(@"Blocked", @"Tooltip entry label to show a contact as blocked"); 87 } 88 89 return label; 90 } 91 92 @end -
Source/ESMetaContactContentsPlugin.m
old new 71 71 AIListContact *contact; 72 72 NSEnumerator *enumerator; 73 73 BOOL shouldAppendString = NO; 74 BOOL appendsBlockedString = YES; 74 75 76 //see if all the contacts in the meta are blocked 77 unsigned blockedContactCount = 0; 78 enumerator = [listContacts objectEnumerator]; 79 while ((contact = [enumerator nextObject])) { 80 if ([contact isBlocked]) { 81 ++blockedContactCount; 82 } 83 } 84 85 //is the entire meta blocked? 86 if (blockedContactCount == [listContacts count]) { 87 appendsBlockedString = NO; 88 } 89 75 90 entry = [[NSMutableAttributedString alloc] init]; 76 91 entryString = [entry mutableString]; 77 92 … … 101 116 } 102 117 103 118 [entryString appendString:[contact formattedUID]]; 119 if (appendsBlockedString && [contact isBlocked]) { 120 [entryString appendFormat:@" (%@)", AILocalizedString(@"Blocked", @"Tooltip entry label to show a contact as blocked")]; 121 } 104 122 105 123 serviceIcon = [[AIServiceIcons serviceIconForObject:contact type:AIServiceIconSmall direction:AIIconNormal] 106 124 imageByScalingToSize:META_TOOLTIP_ICON_SIZE]; -
Resources/CoreComponents.plist
old new 79 79 <string>SMContactListShowBehaviorPlugin</string> 80 80 <string>ESiTunesPlugin</string> 81 81 <string>AIDockBadger</string> 82 <string>KGContactBlockedPlugin</string> 82 83 <string>SMSQLiteLoggerPlugin</string> 83 84 </array> 84 85 </plist>