summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ivy/IvyApplication.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/Ivy/IvyApplication.cxx b/Ivy/IvyApplication.cxx
index 53341bc..bad4910 100644
--- a/Ivy/IvyApplication.cxx
+++ b/Ivy/IvyApplication.cxx
@@ -51,8 +51,8 @@ IvyApplication::IvyApplication(Ivy * bus)
IvyApplication::~IvyApplication()
{
// bus->RemoveApplication( this );
- for ( unsigned int i = 0; i < regexp_in.size(); i++)
- delete regexp_in[i];
+ for ( Bindings::iterator iter = regexp_in.begin( ); iter != regexp_in.end( ); iter++ )
+ delete iter->second;
regexp_in.clear();
if ( m_hSocket != INVALID_SOCKET )
Close();
@@ -164,11 +164,11 @@ void IvyApplication::OnReceive(char * line)
return;
}
- if ( regexp_in.size() < (id + 1) )
+ /*if ( regexp_in.size() < (id + 1) )
{
regexp_in.resize( id + 1 );
regexp_str_in.resize( id + 1 );
- }
+ }*/
regexp_in[ id ] = exp;
regexp_str_in[ id ] = arg;
#ifdef IVY_DEBUG
@@ -300,8 +300,8 @@ void IvyApplication::OnClose(int nErrorCode)
if ( AppConnectedCallbackCalled )
bus->CallApplicationDisconnectedCallback( this );
- for ( unsigned int i = 0; i < regexp_in.size(); i++)
- delete regexp_in[i];
+ for ( Bindings::iterator iter = regexp_in.begin( ); iter != regexp_in.end( ); iter++)
+ delete iter->second;
regexp_in.clear();
Close();
//bus->RemoveApplication( this );
@@ -313,9 +313,11 @@ int IvyApplication::SendMsg(const char *message)
IvyBinding *exp;
/* send to already connected */
- for ( unsigned int i = 0; i < regexp_in.size(); i++ )
+ for ( Bindings::iterator iter = regexp_in.begin( ); iter != regexp_in.end( ); iter++ )
{
- exp = regexp_in[i];
+ exp = iter->second;
+ if ( !exp )
+ continue;
int match_count = exp->Exec( message );
if ( match_count > 0 )
{
@@ -326,10 +328,10 @@ int IvyApplication::SendMsg(const char *message)
for ( int j = 1; j < match_count; j++ )
{
exp->Match(message, j, &arglen, &arg);
- buffer += arg;
+ buffer += ivy::string(arg,arglen );
buffer += ARG_END;
}
- SendMsg( Msg, i, buffer.c_str() );
+ SendMsg( Msg, iter->first, buffer.c_str() );
count++;
}