Module: sems Branch: master Commit: 23ab8c5c41dd6528033a4d98d4f976bc45da05d0 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=23ab8c5c41dd6528033a4d98d4f976bc45da05d0
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Mon May 23 14:24:06 2011 +0200 dsm: make postEvent work with structs based on a patch by Matthew Williams --- apps/dsm/DSMCoreModule.cpp | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/dsm/DSMCoreModule.cpp b/apps/dsm/DSMCoreModule.cpp index 3679155..ae34ac4 100644 --- a/apps/dsm/DSMCoreModule.cpp +++ b/apps/dsm/DSMCoreModule.cpp @@ -234,8 +234,26 @@ EXEC_ACTION_START(SCPostEventAction){ else { vector<string> vars = explode(var, ";"); for (vector<string>::iterator it = - vars.begin(); it != vars.end(); it++) - ev->params[*it] = sc_sess->var[*it]; + vars.begin(); it != vars.end(); it++) { + string varname = *it; + + if (varname.length() && varname[varname.length()-1]=='.') { + DBG("adding postEvent param %s (struct)\n", varname.c_str()); + + map<string, string>::iterator lb = sc_sess->var.lower_bound(varname); + while (lb != sc_sess->var.end()) { + if ((lb->first.length() < varname.length()) || + strncmp(lb->first.c_str(), varname.c_str(), varname.length())) + break; + ev->params[lb->first] = lb->second; + lb++; + } + } else { + DBG("adding postEvent param %s=%s\n", + it->c_str(), sc_sess->var[*it].c_str()); + ev->params[*it] = sc_sess->var[*it]; + } + } } } _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
