[Adium-devl] Meta-contact account selection
BJ Homer
bjhomer at gmail.com
Sat Jul 19 15:54:31 UTC 2008
I've been writing unit tests on Adium for my SoC project, and lately been
writing tests for AdiumPreferredAccounts.m. I've had a few questions about
it, though, and before I continue on the path I'm on I thought I'd throw out
a couple questions. Hopefully someone here is familiar with that code.
As I understand it, the purpose of that class (and specifically
-[AdiumPreferredAccounts preferredAccountForSendingContentType:toContact:])
is to determine which account will be used to send content to a contact. In
the case of non-meta-contacts, this seems trivial, as there is only one
account per contact, so I assume the code is used mostly for deciding among
the various accounts of a meta-contact.
Currently, the criteria (as I have been able to determine) are as follows:
1. Use the preferred account, which is essentially the account most recently
used to talk to that contact.
2. Use another account for this contact on the same service, if that account
has been added to the server's list of contacts (i.e., the account is not a
stranger).
3. Use the account associated with the contact, if the account is not a
stranger.
4. Use any other account on this service on which the contact is not a
stranger.
5. Use the most recent account on this service through which we have sent a
message, even if the contact is a stranger on that account.
6. Use the account associated with the contact, even if the contact is a
stranger on that account.
This certainly seems robust, but it also seems needlessly complex and
mysterious to users. My wife and I both have MSN accounts, but we both
prefer to use Google Talk. In the meta-contact representing my wife, I have
placed the google account first and the MSN account last, and she has done
the same. Nonetheless, sometimes when she double-clicks on my name, the MSN
account is selected. The list of accounts in the meta-contact is the only
user-visible method we know of to prioritize account selection, and yet it
seems to be ineffective.
What's more, from what I can see of the code, it is possible for a
non-preferred account to be stored as the preferred account. If my Google
Talk account is offline, it might be reasonable that when she double-clicks
on my name, the MSN account comes up. However, as soon as she sends a
message, [AdiumAccounts didSendContent:] is called (via the notification
system) and the msn account is now the preferred account. This wasn't the
intended action; she simply wanted to send a message, and had to do so via a
lower-priority mechanism. Simple use of a second option should not make
that the first option. And if it does, the user should have some way of
finding out about it.
My question is this: is there a reason why the account prioritization could
not simply be a reflection of the ordering in the meta-contact list? It
seems more logical to me that we'd simply try every account in order. If
none of those accounts are online, then return the first account which
supports offline messaging, and if none of the accounts support offline
messaging, just return the first account.
If I were implementing the code, that's how I'd do it. Perhaps, though,
there's a historical reason for the added complexity. If so, that's fine.
It's just that the test cases are proving quite complex and slow to write,
and I figured that if my suggestion would make it simpler and more
user-friendly, I wouldn't bother to write the test cases for the complex
code.
-BJ Homer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20080719/34acaed5/attachment-0001.html>
More information about the devel
mailing list