diff options
-rw-r--r-- | Ivy/Ivy.cxx | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/Ivy/Ivy.cxx b/Ivy/Ivy.cxx index c56356c..3906333 100644 --- a/Ivy/Ivy.cxx +++ b/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)
{
|