summaryrefslogtreecommitdiff
path: root/Ivy/Ivy.cxx
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:55:56 +0000
committerfcolin2007-02-01 12:55:56 +0000
commit9af56b54bfcef47df42532d79ab7743548e32c0b (patch)
treee72371634583b85279c63fcdeb6632da258e0370 /Ivy/Ivy.cxx
parent121227691c09257a90493aa8dbf0a57f2f8ad199 (diff)
downloadivy-cplusplus-9af56b54bfcef47df42532d79ab7743548e32c0b.zip
ivy-cplusplus-9af56b54bfcef47df42532d79ab7743548e32c0b.tar.gz
ivy-cplusplus-9af56b54bfcef47df42532d79ab7743548e32c0b.tar.bz2
ivy-cplusplus-9af56b54bfcef47df42532d79ab7743548e32c0b.tar.xz
Utilisateur : Fcolin Date : 25/10/01 Heure : 18:39 Archivé dans $/Ivy (vss 10)
Diffstat (limited to 'Ivy/Ivy.cxx')
-rw-r--r--Ivy/Ivy.cxx33
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)
{