[interfacekit] Re: BRoster::FindApp()

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: interfacekit@xxxxxxxxxxxxx
  • Date: Tue, 20 Jan 2004 13:41:06 +0100 CET

Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx> wrote:
> On 2004-01-18 at 03:37:29 [+0100], Axel Dörfler wrote:
> > > I also think that FindApp should ignore the preferred app if an 
> > > app
> > > of applicable signature doesn't exist.  It should fall back to 
> > > the
> > > default application for the mime type.  (don't change the setting 
> > > of 
> > > the preferred app attribute though)
> What default application? The preferred application is the default 
> application. The only thing we can fall back to is the preferred 
> application of the supertype, if you mean that.

Yes, I actually meant it the way you proposed below :)

> Allow me to recapitulate, how FindApp() searches the application for 
> a 
> given entry (assume that the entry exists adn is not a file with 
> executable 
> permission):
> 
> 1) get the preferred app signature of the node
>    a) if found continue with preferred app MIME type
>    b) else with the node's MIME type -- sniff the type, if it has 
> none
> 2) get the preferred app signature of the given MIME type
>    a) if it has one, continue with it
>    b) else if the supertype has one, continue with that
>    c) else fail
> 3) get the type's app hint
>    a) if it has one and the file exists, we're done
>    b) else query for the app file and pick the one with the latest 
> version
>    c) if none exists, fail
> 
> Note that 1a) causes the preferred app of the preferred app to be 
> found, 
> which does no harm, since applications have themselves as preferred 
> app.

I always wondered about this - it looks a bit odd and ugly to me.

> The algorithm may be changed like this:
> 
> 1) get the preferred app signature of the node
>    a) if found, use algorithm 3) to get the app ref and return it
>       if successful, otherwise continue
>    b) else get the node's MIME type -- sniff the type, if it has none
> 2) get the preferred app signature of the given MIME type
>    a) if it has one, use 3) to get the app ref and return it if
>       successful, otherwise continue with b)
>    b) else if the supertype has one, use 3) and be done or
>    c) else fail
> 3) as above
> 
> Does that sound OK?

I am all for that, too!

Bye,
   Axel.


Other related posts: