Added support to set Regexp in javascript message handler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6427 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
75d5ecd7ea
commit
0fb78918f2
|
@ -2302,8 +2302,13 @@ bool JsMessage::runNative(ObjList& stack, const ExpOperation& oper, GenObject* c
|
|||
JsHandler* h = new JsHandler(*name,priority,*func,context);
|
||||
ExpOperation* filterName = static_cast<ExpOperation*>(args[3]);
|
||||
ExpOperation* filterValue = static_cast<ExpOperation*>(args[4]);
|
||||
if (filterName && filterValue && *filterName)
|
||||
h->setFilter(*filterName,*filterValue);
|
||||
if (filterName && filterValue && *filterName) {
|
||||
JsRegExp* rexp = YOBJECT(JsRegExp,filterValue);
|
||||
if (rexp)
|
||||
h->setFilter(new NamedPointer(*filterName,new Regexp(rexp->regexp())));
|
||||
else
|
||||
h->setFilter(*filterName,*filterValue);
|
||||
}
|
||||
if (m_trackName) {
|
||||
if (m_trackPrio)
|
||||
h->trackName(m_trackName + ":" + String(priority));
|
||||
|
@ -2358,7 +2363,10 @@ bool JsMessage::runNative(ObjList& stack, const ExpOperation& oper, GenObject* c
|
|||
const NamedString* f = h->filter();
|
||||
if (f) {
|
||||
jso->params().setParam(new ExpOperation(f->name(),"filterName"));
|
||||
jso->params().setParam(new ExpOperation(*f,"filterValue"));
|
||||
if (h->filterRegexp())
|
||||
jso->params().setParam(new ExpWrapper(new JsRegExp(mutex(),*(h->filterRegexp())),"filterValue"));
|
||||
else
|
||||
jso->params().setParam(new ExpOperation(*f,"filterValue"));
|
||||
}
|
||||
if (h->trackName())
|
||||
jso->params().setParam(new ExpOperation(h->trackName(),"trackName"));
|
||||
|
|
Loading…
Reference in New Issue