diff OrthancServer/Sources/ServerContext.cpp @ 4919:676e03e69703

added origin in OrthancPluginReceivedInstanceCallback
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Feb 2022 09:30:42 +0100
parents c1b19f95e166
children 309fb4f02704
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Wed Feb 23 06:36:29 2022 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Wed Feb 23 09:30:42 2022 +0100
@@ -698,12 +698,12 @@
     {
       // New in Orthanc 1.10.0
 
-      OrthancPluginReceivedInstanceCallbackResult action = GetPlugins().ApplyReceivedInstanceCallbacks(
-        modifiedBuffer, receivedDicom.GetBufferData(), receivedDicom.GetBufferSize());
+      OrthancPluginReceivedInstanceAction action = GetPlugins().ApplyReceivedInstanceCallbacks(
+        modifiedBuffer, receivedDicom.GetBufferData(), receivedDicom.GetBufferSize(), receivedDicom.GetOrigin().GetRequestOrigin());
 
       switch (action)
       {
-        case OrthancPluginReceivedInstanceCallbackResult_Discard:
+        case OrthancPluginReceivedInstanceAction_Discard:
         {
           CLOG(INFO, PLUGINS) << "A plugin has discarded the instance in its ReceivedInstanceCallback";
           StoreResult result;
@@ -711,16 +711,17 @@
           return result;
         }
           
-        case OrthancPluginReceivedInstanceCallbackResult_KeepAsIs:
+        case OrthancPluginReceivedInstanceAction_KeepAsIs:
+          // This path is also used when no ReceivedInstanceCallback is installed by the plugins
           break;
 
-        case OrthancPluginReceivedInstanceCallbackResult_Modify:
+        case OrthancPluginReceivedInstanceAction_Modify:
           if (modifiedBuffer.GetSize() > 0 &&
               modifiedBuffer.GetData() != NULL)
           {
             CLOG(INFO, PLUGINS) << "A plugin has modified the instance in its ReceivedInstanceCallback";        
             modifiedDicom.reset(DicomInstanceToStore::CreateFromBuffer(modifiedBuffer.GetData(), modifiedBuffer.GetSize()));
-            modifiedDicom->SetOrigin(dicom->GetOrigin());
+            modifiedDicom->SetOrigin(receivedDicom.GetOrigin());
             dicom = modifiedDicom.get();
           }
           else