From f368afc16a40fb6136de668f4287b7f02560a4fc Mon Sep 17 00:00:00 2001 From: paulc Date: Thu, 29 Jun 2006 10:38:55 +0000 Subject: [PATCH] Fixed bug in handling of malformed parameter replacement. git-svn-id: http://yate.null.ro/svn/yate/trunk@911 acf43c95-373e-0410-b603-e72c3f656dc1 --- modules/regexroute.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/modules/regexroute.cpp b/modules/regexroute.cpp index f9e8185c..eae8d2aa 100644 --- a/modules/regexroute.cpp +++ b/modules/regexroute.cpp @@ -126,22 +126,6 @@ static void replaceFuncs(String &str) } } -// handle ${paramname} replacements -static void replaceParams(const Message &msg, String &str) -{ - int p1; - while ((p1 = str.find("${")) >= 0) { - int p2 = str.find('}',p1+2); - if (p2 > 0) { - String v = str.substr(p1+2,p2-p1-2); - v.trimBlanks(); - DDebug("RegexRoute",DebugAll,"Replacing parameter '%s'", - v.c_str()); - str = str.substr(0,p1) + msg.getValue(v) + str.substr(p2+1); - } - } -} - // handle ;paramname[=value] assignments static void setMessage(Message &msg, String &line) { @@ -150,7 +134,7 @@ static void setMessage(Message &msg, String &line) for (ObjList *p = strs; p; p=p->next()) { String *s = static_cast(p->get()); if (s) { - replaceParams(msg,*s); + msg.replaceParams(*s); replaceFuncs(*s); } if (first) { @@ -223,7 +207,7 @@ static bool oneContext(Message &msg, String &str, const String &context, String val = val.replaceMatches(*n); if (val.startSkip("echo") || val.startSkip("output")) { // special case: display the line but don't set params - replaceParams(msg,val); + msg.replaceParams(val); replaceFuncs(val); Output("%s",val.safe()); continue;