equal
deleted
inserted
replaced
112 |
112 |
113 |
113 |
114 local function route_modify(make_new, to, drop) |
114 local function route_modify(make_new, to, drop) |
115 local reroute, deps = "session.send(newstanza)", { "st" }; |
115 local reroute, deps = "session.send(newstanza)", { "st" }; |
116 if to then |
116 if to then |
117 reroute = ("newstanza.attr.to = %q; core_post_stanza(session, newstanza)"):format(to); |
117 reroute = ("newstanza.attr.to = %q; core_post_stanza(session, newstanza);"):format(to); |
118 deps[#deps+1] = "core_post_stanza"; |
118 deps[#deps+1] = "core_post_stanza"; |
119 end |
119 end |
120 return ([[local newstanza = st.%s; %s;%s]]) |
120 return ([[local newstanza = st.%s; %s;%s]]) |
121 :format(make_new, reroute, drop and " return true;" or ""), deps; |
121 :format(make_new, reroute, drop and " return true;" or ""), deps; |
122 end |
122 end |
156 end |
156 end |
157 |
157 |
158 function action_handlers.LOG(string) |
158 function action_handlers.LOG(string) |
159 local level = string:match("^%[(%a+)%]") or "info"; |
159 local level = string:match("^%[(%a+)%]") or "info"; |
160 string = string:gsub("^%[%a+%] ?", ""); |
160 string = string:gsub("^%[%a+%] ?", ""); |
161 return meta(("(session.log or log)(%q, %q)"):format(level, string)); |
161 return meta(("(session.log or log)(%q, %q);"):format(level, string)); |
162 end |
162 end |
163 |
163 |
164 function action_handlers.RULEDEP(dep) |
164 function action_handlers.RULEDEP(dep) |
165 return "", { dep }; |
165 return "", { dep }; |
166 end |
166 end |