[interfacekit] Re: BRoster::FindApp()

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: interfacekit@xxxxxxxxxxxxx
  • Date: Sun, 18 Jan 2004 14:32:48 +0100

On 2004-01-18 at 03:37:29 [+0100], Axel Dörfler wrote:
> "Andrew Bachmann" <shatty@xxxxxxxxxxxxx> wrote:
> > "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote:
> > > Okay, it could also just ignore it then, but doesn't change the
> > > preferred application. In any way, it only does something when the
> > > preferred application is not available anymore - only if the MIME
> > > type
> > > meta information was not correct.
> > 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.

> Good, so do we want to do that now?

As soon as it is clear what behavior we exactly want, I can do that.

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.

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?

CU, Ingo

Other related posts: