From b18dd91d7868c46f8ee0464838d3b0380fed643c Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 12:55:56 +0000 Subject: Utilisateur : Fcolin Date : 25/10/01 Heure : 18:39 Archivé dans $/Ivy (vss 10) --- Bus/Ivy/Ivy.cxx | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'Bus') diff --git a/Bus/Ivy/Ivy.cxx b/Bus/Ivy/Ivy.cxx index c56356c..3906333 100644 --- a/Bus/Ivy/Ivy.cxx +++ b/Bus/Ivy/Ivy.cxx @@ -83,7 +83,7 @@ const char * Ivy::GetDomain(const char *domainlist) } if ( domain.empty() ) { -#ifdef _WIN_CE +#ifndef _WIN_CE const char *env = getenv ( "IVYBUS" ); if ( env ) domain = env; @@ -210,19 +210,44 @@ void Ivy::SendSubscriptions(IvyApplication *app) } -int Ivy::SendMsg(const char * message) +int Ivy::SendMsg(const char * message, ... ) { int count = 0; + char buffer[4096]; + va_list args; + + va_start( args, message ); /* Initialize variable arguments. */ + vsprintf( buffer, message, args ); + va_end( args); /* send to already connected */ IvyApplicationList::iterator iter; for ( iter = applications.begin() ; iter != applications.end() ; ++iter ) { IvyApplication *app = *iter; - count += app->SendMsg( message ); + count += app->SendMsg( buffer ); } return count; } - +void Ivy::SendDieMsg( IvyApplication *app ) +{ + app->SendMsg( IvyApplication::Die, 0 ); +} +IvyApplication * Ivy::GetApplication(const char *name) +{ + EnterCriticalSection( &m_application_cs ); + IvyApplicationList::iterator iter; + for ( iter = applications.begin() ; iter != applications.end() ; ) + { + IvyApplication *app = *iter++; + if ( (app->m_hSocket != INVALID_SOCKET) && app->appname == name ) + { + return app; + } + } + LeaveCriticalSection( &m_application_cs ); + return NULL; +} + void Ivy::CallMessageCallback(IvyApplication *app, int id, int argc, const char ** argv) { -- cgit v1.1