[Adium-devl] [Adium-svn] rev 22094 - in trunk: Frameworks/Adium Framework/Source Resources

Matt Handley applmak at gmail.com
Wed Jan 2 16:16:47 UTC 2008


The reason that such a string returns one account if there are  
multiple possible accounts that match the UID is that the AS  
guidelines suggest trying to succeed at all costs, returning the  
first in such a case, rather than simply erroring.

 From http://developer.apple.com/technotes/tn2002/ 
tn2106.html#building-your-objects

> Non-unique key forms
> Typically, names and IDs are unique at least within in a container,  
> so there is only one object folder "Bob" could possibly return.  
> However, this is not always the case – for example, in some  
> applications, names are purely for the user’s reference, and the  
> application makes no attempt to keep them unique.
>
> For such applications, invoke the “be consistent about return  
> types” rule: named and indexed key forms normally return a single  
> object, so they should still do so even in the face of ambiguous  
> objects. If one object is a better match than the other, return  
> that one; if there is no best match, return the first one. However,  
> ensure that users can select all the matching objects using a  
> filter expression of some sort, such as every item whose name is ...
>


Matt

On Jan 2, 2008, at 1:26 AM, Peter Hosey wrote:

> On Jan 01, 2008, at 23:19:37, Evan Schoenberg wrote:
>> Two AIAccount objects with the same UID and service could exist …
>
> Is there a good reason to allow this in the first place?
>
>>> I do notice that in r22005, “account "foo at bar.com"” returns an  
>>> account rather than raising an error, which is certainly a bug.  
>>> But that's different: the service is missing from the reference,  
>>> which should be an error whenever the account specifier is ambiguous
>>
>> I don't understand what you're pointing out here.
>
> Create two accounts with the same UID, foo at bar.com. Then try this  
> script:
>
> 	tell app "Adium" to account "foo at bar.com"
>
> Surprise: It returns an account. Of course, it's not guaranteed to  
> be one account or the other, since you weren't specific enough.
>
> What it *should* do (and doesn't, as of this old rev) is raise an  
> error.
>
> The same could be said of “account "foo at bar.com" of service  
> "Jabber"” for multiple Jabber accounts with that UID, if we want to  
> continue allowing that sort of tomfoolery.
>
> _______________________________________________
> Adium-devl mailing list
> Adium-devl at adiumx.com
> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com





More information about the devel mailing list