adium 2172:e3ebfad3071f: Avoid creating a bad account on the wro...
commits at adium.im
commits at adium.im
Wed May 13 04:30:19 UTC 2009
details: http://hg.adium.im/adium/rev/e3ebfad3071f
revision: 2172:e3ebfad3071f
author: Zachary West <zacw at adium.im>
date: Wed May 13 00:29:42 2009 -0400
Avoid creating a bad account on the wrong service for "preferred account" guesses.
The preferred account for a meta contact was attempting to create contacts on its preferred account, even if the requested contact was on a different service. This know makes sure we're returning the correct account type, and adds an assert to make diagnosing this issue easier in the future. Fixes #11866.
diffstat:
Source/AIAccountController.m | 6 +++++-
Source/AdiumPreferredAccounts.m | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r 812c0749b152 -r e3ebfad3071f Source/AIAccountController.m
--- a/Source/AIAccountController.m Tue May 12 17:50:30 2009 -0700
+++ b/Source/AIAccountController.m Wed May 13 00:29:42 2009 -0400
@@ -180,7 +180,11 @@
//Preferred Accounts
#pragma mark Preferred Accounts
- (AIAccount *)preferredAccountForSendingContentType:(NSString *)inType toContact:(AIListContact *)inContact {
- return [adiumPreferredAccounts preferredAccountForSendingContentType:inType toContact:inContact];
+ AIAccount *account = [adiumPreferredAccounts preferredAccountForSendingContentType:inType toContact:inContact];
+
+ NSAssert([account.service.serviceClass isEqualToString:inContact.service.serviceClass], @"Wrong account for the contact; differing services.");
+
+ return account;
}
- (void)disconnectAllAccounts
diff -r 812c0749b152 -r e3ebfad3071f Source/AdiumPreferredAccounts.m
--- a/Source/AdiumPreferredAccounts.m Tue May 12 17:50:30 2009 -0700
+++ b/Source/AdiumPreferredAccounts.m Wed May 13 00:29:42 2009 -0400
@@ -105,7 +105,8 @@
if ((account = [adium.accountController accountWithInternalObjectID:accountID])) {
- if ([account availableForSendingContentType:inType toContact:inContact] || !strictChecking) {
+ if ([account.service.serviceClass isEqualToString:inContact.service.serviceClass] &&
+ ([account availableForSendingContentType:inType toContact:inContact] || !strictChecking)) {
return account;
}
}
More information about the commits
mailing list