adium 2473:62337e60e337: Make openChats return an immutable copy
commits at adium.im
commits at adium.im
Tue Jun 9 23:32:37 UTC 2009
details: http://hg.adium.im/adium/rev/62337e60e337
revision: 2473:62337e60e337
author: David Smith <catfish.man at gmail.com>
date: Tue Jun 09 16:31:16 2009 -0700
Make openChats return an immutable copy
Subject: adium 2474:c56975e58200: Fix the one callsite that was doing it manually
details: http://hg.adium.im/adium/rev/c56975e58200
revision: 2474:c56975e58200
author: David Smith <catfish.man at gmail.com>
date: Tue Jun 09 16:32:31 2009 -0700
Fix the one callsite that was doing it manually
diffs (77 lines):
diff -r 724bdc7a81eb -r c56975e58200 Plugins/Purple Service/adiumPurpleSignals.m
--- a/Plugins/Purple Service/adiumPurpleSignals.m Tue Jun 09 16:20:08 2009 -0700
+++ b/Plugins/Purple Service/adiumPurpleSignals.m Tue Jun 09 16:32:31 2009 -0700
@@ -279,7 +279,7 @@
CBPurpleAccount *account = accountLookup(purple_connection_get_account(gc));
NSDictionary *componentDict = dictionaryFromHashTable(components);
- for (AIChat *chat in [[adium.chatController.openChats copy] autorelease]) {
+ for (AIChat *chat in adium.chatController.openChats) {
if ((chat.account == account) &&
[account chatCreationDictionary:chat.chatCreationDictionary isEqualToDictionary:componentDict]) {
[account chatJoinDidFail:chat];
diff -r 724bdc7a81eb -r c56975e58200 Source/AIChatController.m
--- a/Source/AIChatController.m Tue Jun 09 16:20:08 2009 -0700
+++ b/Source/AIChatController.m Tue Jun 09 16:32:31 2009 -0700
@@ -197,10 +197,8 @@
* This lets an observer use its normal update mechanism to update every chat in some manner
*/
- (void)updateAllChatsForObserver:(id <AIChatObserver>)observer
-{
- AIChat *chat;
-
- for (chat in openChats) {
+{
+ for (AIChat *chat in openChats) {
[self chatStatusChanged:chat modifiedStatusKeys:nil silent:NO];
}
}
@@ -275,8 +273,8 @@
*/
- (AIChat *)chatWithContact:(AIListContact *)inContact
{
+ AIListContact *targetContact = inContact;
AIChat *chat = nil;
- AIListContact *targetContact = inContact;
/*
If we're dealing with a meta contact, open a chat with the preferred contact for this meta contact
@@ -700,7 +698,7 @@
*/
- (NSSet *)openChats
{
- return openChats;
+ return [[openChats copy] autorelease];
}
/*!
@@ -737,7 +735,7 @@
{
NSUInteger count = 0;
- for (AIChat *chat in self.openChats) {
+ for (AIChat *chat in openChats) {
if (chat.isGroupChat &&
[[adium.preferenceController preferenceForKey:KEY_STATUS_MENTION_COUNT
group:PREF_GROUP_STATUS_PREFERENCES] boolValue]) {
@@ -758,7 +756,7 @@
{
NSUInteger count = 0;
- for (AIChat *chat in self.openChats) {
+ for (AIChat *chat in openChats) {
if (chat.isGroupChat &&
[[adium.preferenceController preferenceForKey:KEY_STATUS_MENTION_COUNT
group:PREF_GROUP_STATUS_PREFERENCES] boolValue]) {
@@ -779,10 +777,9 @@
*/
- (BOOL)contactIsInGroupChat:(AIListContact *)listContact
{
- AIChat *chat;
BOOL contactIsInGroupChat = NO;
- for (chat in openChats) {
+ for (AIChat *chat in openChats) {
if (chat.isGroupChat &&
[chat containsObject:listContact]) {
More information about the commits
mailing list