Module: sems Branch: master Commit: 2c27cdad65c329634ad3decb1c7b7cc343772510 URL: https://github.com/sems-server/sems/commit/2c27cdad65c329634ad3decb1c7b7cc343772510
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: 2015-06-08T22:15:09+02:00 dsm: helper functions / macros for modules: replaceParams/SET_ERROR/CLR_ERROR use resolveVars in module actions/condition to replace only one variable/param, use replaceParams to replace substrings as well, e.g. myAction($myvar) - resolveVars myOtherAction("this is $(myvar) and #(myparam) replaced") - replaceParams --- Modified: apps/dsm/DSMCoreModule.h Modified: apps/dsm/DSMSession.h --- Diff: https://github.com/sems-server/sems/commit/2c27cdad65c329634ad3decb1c7b7cc343772510.diff Patch: https://github.com/sems-server/sems/commit/2c27cdad65c329634ad3decb1c7b7cc343772510.patch --- diff --git a/apps/dsm/DSMCoreModule.h b/apps/dsm/DSMCoreModule.h index 62efe1a..b5eefc3 100644 --- a/apps/dsm/DSMCoreModule.h +++ b/apps/dsm/DSMCoreModule.h @@ -163,4 +163,8 @@ class TestDSMCondition map<string,string>* event_params); }; +/** return string q with variables/params/selects replaced */ +string replaceParams(const string& q, AmSession* sess, DSMSession* sc_sess, + map<string,string>* event_params); + #endif diff --git a/apps/dsm/DSMSession.h b/apps/dsm/DSMSession.h index 4fd007b..3bbbe4e 100644 --- a/apps/dsm/DSMSession.h +++ b/apps/dsm/DSMSession.h @@ -99,6 +99,18 @@ using std::map; #define CLR_STRERROR \ var["strerror"] = ""; +#define SET_ERROR(s, errno, errstr) \ + do { \ + s->SET_ERRNO(errno); \ + s->SET_STRERROR(errstr); \ + } while (0) + +#define CLR_ERROR(s) \ + do { \ + s->CLR_ERRNO; \ + s->CLR_STRERROR; \ + } while (0) + typedef map<string, string> VarMapT; typedef map<string, AmArg> AVarMapT; _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
