diff --git a/src/kits/app/Messenger.cpp b/src/kits/app/Messenger.cpp index f46c4cb691..47e0b07688 100644 --- a/src/kits/app/Messenger.cpp +++ b/src/kits/app/Messenger.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2011 Haiku, Inc. All rights reserved. + * Copyright 2001-2015 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -7,26 +7,27 @@ */ -#include -#include -#include -#include "TokenSpace.h" - -#include -#include -#include -#include -#include -#include #include -#include -#include -#include #include #include #include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + // debugging //#define DBG(x) x @@ -328,12 +329,21 @@ BMessenger::_InitData(const char* signature, team_id team, status_t* _result) if (team < 0) { // no team ID given if (signature != NULL) { - result = be_roster->GetAppInfo(signature, &info); - team = info.team; - // B_ERROR means that no application with the given signature - // is running. But we are supposed to return B_BAD_VALUE. - if (result == B_ERROR) - result = B_BAD_VALUE; + // Try existing launch communication data first + BMessage data; + if (BLaunchRoster().GetData(signature, data) == B_OK) { + info.port = data.GetInt32("port", -1); + team = data.GetInt32("team", -5); + } + if (info.port < 0) { + result = be_roster->GetAppInfo(signature, &info); + team = info.team; + // B_ERROR means that no application with the given signature + // is running. But we are supposed to return B_BAD_VALUE. + if (result == B_ERROR) + result = B_BAD_VALUE; + } else + info.flags = 0; } else result = B_BAD_TYPE; } else {