comparison OrthancServer/main.cpp @ 1433:461e7554bff7

refactoring: LuaScripting
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jun 2015 15:09:34 +0200
parents b22ba8c5edbe
children f9cd40166269
comparison
equal deleted inserted replaced
1432:0ac74fa21db8 1433:461e7554bff7
230 } 230 }
231 231
232 { 232 {
233 std::string lua = "Is" + configuration; 233 std::string lua = "Is" + configuration;
234 234
235 ServerContext::LuaContextLocker locker(context_); 235 LuaScripting::Locker locker(context_.GetLua());
236 236
237 if (locker.GetLua().IsExistingFunction(lua.c_str())) 237 if (locker.GetLua().IsExistingFunction(lua.c_str()))
238 { 238 {
239 LuaFunctionCall call(locker.GetLua(), lua.c_str()); 239 LuaFunctionCall call(locker.GetLua(), lua.c_str());
240 call.PushString(callingAet); 240 call.PushString(callingAet);
263 const char* ip, 263 const char* ip,
264 const char* username) const 264 const char* username) const
265 { 265 {
266 static const char* HTTP_FILTER = "IncomingHttpRequestFilter"; 266 static const char* HTTP_FILTER = "IncomingHttpRequestFilter";
267 267
268 ServerContext::LuaContextLocker locker(context_); 268 LuaScripting::Locker locker(context_.GetLua());
269 269
270 // Test if the instance must be filtered out 270 // Test if the instance must be filtered out
271 if (locker.GetLua().IsExistingFunction(HTTP_FILTER)) 271 if (locker.GetLua().IsExistingFunction(HTTP_FILTER))
272 { 272 {
273 LuaFunctionCall call(locker.GetLua(), HTTP_FILTER); 273 LuaFunctionCall call(locker.GetLua(), HTTP_FILTER);
361 std::string path = Configuration::InterpretStringParameterAsPath(*it); 361 std::string path = Configuration::InterpretStringParameterAsPath(*it);
362 LOG(WARNING) << "Installing the Lua scripts from: " << path; 362 LOG(WARNING) << "Installing the Lua scripts from: " << path;
363 std::string script; 363 std::string script;
364 Toolbox::ReadFile(script, path); 364 Toolbox::ReadFile(script, path);
365 365
366 ServerContext::LuaContextLocker locker(context); 366 LuaScripting::Locker locker(context.GetLua());
367 locker.GetLua().Execute(script); 367 locker.GetLua().Execute(script);
368 } 368 }
369 } 369 }
370 370
371 371