BRoster: find the registrar port via launch roster.

This commit is contained in:
Axel Dörfler 2015-04-15 18:04:46 +02:00
parent d32061151e
commit 9bfc8331bb
1 changed files with 11 additions and 6 deletions

View File

@ -42,6 +42,7 @@
#include <AppMisc.h>
#include <DesktopLink.h>
#include <LaunchRoster.h>
#include <MessengerPrivate.h>
#include <PortLink.h>
#include <RosterPrivate.h>
@ -2585,14 +2586,18 @@ BRoster::_InitMessenger()
DBG(OUT("BRoster::InitMessengers()\n"));
// find the registrar port
port_id rosterPort = find_port(BPrivate::get_roster_port_name());
port_info info;
if (rosterPort >= 0 && get_port_info(rosterPort, &info) == B_OK) {
BMessage data;
if (BLaunchRoster().GetData("application/x-vnd.Haiku-registrar", data)
== B_OK) {
port_id port = data.GetInt32("port", -1);
team_id team = data.GetInt32("team", -1);
if (port >= 0) {
DBG(OUT(" found roster port\n"));
BMessenger::Private(fMessenger).SetTo(info.team, rosterPort,
BMessenger::Private(fMessenger).SetTo(team, port,
B_PREFERRED_TOKEN);
}
}
DBG(OUT("BRoster::InitMessengers() done\n"));
}