From 2e418cb4dd7804abf714cea0fb94903bad70a985 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 12:59:31 +0000 Subject: Utilisateur : Fcolin Date : 20/07/00 Heure : 10:57 Archivé dans $/Ivy (vss 2) --- Ivy/IvyApplication.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Ivy/IvyApplication.cxx') diff --git a/Ivy/IvyApplication.cxx b/Ivy/IvyApplication.cxx index 26d0adf..de43bd0 100644 --- a/Ivy/IvyApplication.cxx +++ b/Ivy/IvyApplication.cxx @@ -129,20 +129,18 @@ void IvyApplication::OnReceive(char * line) TRACE("IvyApplication %s\n",err.c_str()); return; } - if ( id +1 < regexp_in.size() ) - regexp_in[ id ] = exp ; - else regexp_in.push_back( exp ); + regexp_in[ id ] = exp ; break; case DelRegexp: #ifdef DEBUG TRACE("Regexp Delete id=%d\n", id); #endif //DEBUG - if ( id < regexp_in.size() ) + if ( regexp_in.find(id) != regexp_in.end() ) { exp = regexp_in[ id ]; delete exp; - regexp_in[ id ] = NULL ; + regexp_in.erase( id ); } break; case StartRegexp: @@ -263,11 +261,12 @@ int IvyApplication::SendMsg(const char *message) { int count = 0; Regexp *exp; - + map::iterator iter; /* send to already connected */ - for ( int id = 0; id < regexp_in.size(); id++ ) + if ( !regexp_in.empty() ) + for ( iter = regexp_in.begin(); iter != regexp_in.end(); iter++ ) { - exp = regexp_in[ id ]; + exp = (*iter).second; if ( exp && exp->Match( message ) ) { @@ -277,7 +276,7 @@ int IvyApplication::SendMsg(const char *message) buffer += (*exp)[i]; buffer += ARG_END; } - SendMsg( Msg, id, buffer.c_str() ); + SendMsg( Msg, (*iter).first, buffer.c_str() ); count++; } } -- cgit v1.1