BRoster: find the registrar port via launch roster.

This commit is contained in:
Axel Dörfler
2015-07-22 20:40:15 +02:00
parent d32061151e
commit 9bfc8331bb
+11 -6
View File
@@ -42,6 +42,7 @@
#include <AppMisc.h> #include <AppMisc.h>
#include <DesktopLink.h> #include <DesktopLink.h>
#include <LaunchRoster.h>
#include <MessengerPrivate.h> #include <MessengerPrivate.h>
#include <PortLink.h> #include <PortLink.h>
#include <RosterPrivate.h> #include <RosterPrivate.h>
@@ -2585,13 +2586,17 @@ BRoster::_InitMessenger()
DBG(OUT("BRoster::InitMessengers()\n")); DBG(OUT("BRoster::InitMessengers()\n"));
// find the registrar port // find the registrar port
port_id rosterPort = find_port(BPrivate::get_roster_port_name()); BMessage data;
port_info info; if (BLaunchRoster().GetData("application/x-vnd.Haiku-registrar", data)
if (rosterPort >= 0 && get_port_info(rosterPort, &info) == B_OK) { == B_OK) {
DBG(OUT(" found roster port\n")); 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); B_PREFERRED_TOKEN);
}
} }
DBG(OUT("BRoster::InitMessengers() done\n")); DBG(OUT("BRoster::InitMessengers() done\n"));