Implemented InitData(). BMessenger is complete.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@455 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2002-07-26 19:48:49 +00:00
parent 496ffb0aa7
commit 3b04471572

View File

@ -41,6 +41,7 @@
#include <Message.h>
#include <Messenger.h>
#include <OS.h>
#include <Roster.h>
// Project Includes ------------------------------------------------------------
#include "TokenSpace.h"
@ -574,14 +575,37 @@ BMessenger::BMessenger(team_id team, port_id port, int32 token, bool preferred)
\param team The target application's team ID. May be < 0.
\param result An optional pointer to a pre-allocated status_t into which
the result of the initialization is written.
\todo Implement!
*/
void
BMessenger::InitData(const char *signature, team_id team, status_t *result)
{
status_t error = B_OK;
// if no team ID is given, get one using the signature
if (team < 0) {
if (signature) {
team = be_roster->TeamFor(signature);
if (team < 0)
error = team;
} else
error = B_BAD_VALUE;
}
// get the app_info of the team
app_info info;
if (error == B_OK)
error = be_roster->GetRunningAppInfo(team, &info);
// check, whether the signature is correct
if (error == B_OK && signature && strcmp(signature, info.signature) != 0)
error = B_BAD_VALUE;
// init our members
if (error == B_OK) {
fTeam = team;
fPort = info.port;
fHandlerToken = 0;
fPreferredTarget = true;
}
// return the error
if (result)
*result = NOT_IMPLEMENTED;
*result = error;
}
// <