[haiku-appserver] Re: App Activation

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Sun, 24 Jul 2005 23:07:52 +0200

On 2005-07-12 at 16:02:38 [+0200], Axel Dörfler wrote:
> Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx> wrote:
> > 1) The app server needs to receive and process app activations
> > requests (as
> > issued by BRoster::ActivateApp()).
> > 
> > 2) The app server needs to notify the registrar when the active app
> > changed.
> > 
> > The second part should be relatively easy. If the app server is
> > started by
> > the Bootscript after the registrar (which should be no problem
> > anymore), it
> > will have a fully working BRoster and can simply send a message to
> > the
> > registrar (BRoster::Private::SendTo()).
> Sounds good, just tell me the message you want to get, and how it
> should look alike, and I'll add it to the server :-)

Something like the following should do:

        #include <RegistrarDefs.h>

        BRoster roster;
        BRoster::Private::Private rosterPrivate(roster);

        BMessage request(B_REG_ACTIVATE_APP);
        if (request.AddInt32("team", team) == B_OK)
                rosterPrivate.SendMessage(&request, NULL, false);

It would probably make sense to cache a BRoster, so that it doesn't need to 
be created each time. Or create a BApplication (BServer) and use be_roster.

> > Regarding the first part, BRoster::ActivateApp() could send the
> > request
> > directly to the app server. Since there might not exist a
> > BApplication when
> > the method is invoked, sending it to the port that receives the
> > BApplication registration (the one called SERVER_PORT_NAME) might be
> > the
> > most sensible choice. But I guess you guys know best...
> For now that port would be the one to handle these requests, right.
> Just add a message code like AS_ACTIVATE_APP to private/headers/app/
> ServerProtocol.h and add the calling code to the registrar, and I will
> then implement the app_server's part sooner or later :-)

The registrar code was already there anyway. So I implemented 
BRoster::ActivateApp() and added a respective case statement in 
AppServer::DispatchMessage() with the meaty stuff missing.

CU, Ingo

PS: The RosterShell test app has an "activate" (or "a") command, which can 
be used for testing.

Other related posts: