diff OrthancServer/ServerContext.cpp @ 1285:5730f374e4e6

Access to called AET and remote AET from Lua scripts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Feb 2015 15:00:42 +0100
parents 21ea32170764
children 6e7e5ed91c2d
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp	Tue Feb 03 14:07:07 2015 +0100
+++ b/OrthancServer/ServerContext.cpp	Tue Feb 03 15:00:42 2015 +0100
@@ -211,7 +211,9 @@
 
   void ServerContext::ApplyLuaOnStoredInstance(const std::string& instanceId,
                                                const Json::Value& simplifiedDicom,
-                                               const Json::Value& metadata)
+                                               const Json::Value& metadata,
+                                               const std::string& remoteAet,
+                                               const std::string& calledAet)
   {
     LuaContextLocker locker(*this);
 
@@ -223,6 +225,8 @@
       call.PushString(instanceId);
       call.PushJson(simplifiedDicom);
       call.PushJson(metadata);
+      call.PushJson(remoteAet);
+      call.PushJson(calledAet);
       call.Execute();
 
       Json::Value operations;
@@ -360,11 +364,12 @@
 
         try
         {
-          ApplyLuaOnStoredInstance(resultPublicId, simplified, metadata);
+          ApplyLuaOnStoredInstance(resultPublicId, simplified, metadata, 
+                                   dicom.GetRemoteAet(), dicom.GetCalledAet());
         }
         catch (OrthancException& e)
         {
-          LOG(ERROR) << "Error in OnStoredInstance callback (Lua): " << e.What();
+          LOG(ERROR) << "Error in " << ON_STORED_INSTANCE << " callback (Lua): " << e.What();
         }
 
         if (plugins_ != NULL)
@@ -375,7 +380,7 @@
           }
           catch (OrthancException& e)
           {
-            LOG(ERROR) << "Error in OnStoredInstance callback (plugins): " << e.What();
+            LOG(ERROR) << "Error in " << ON_STORED_INSTANCE << " callback (plugins): " << e.What();
           }
         }
       }