comparison Plugins/Samples/Basic/Plugin.c @ 1199:a843ee8bb903 db-changes

separated thread for change callbacks in plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 Oct 2014 14:29:45 +0200
parents d49505e377e3
children 1e1390665639
comparison
equal deleted inserted replaced
1198:1169528a9a5f 1199:a843ee8bb903
253 ORTHANC_PLUGINS_API int32_t OnChangeCallback(OrthancPluginChangeType changeType, 253 ORTHANC_PLUGINS_API int32_t OnChangeCallback(OrthancPluginChangeType changeType,
254 OrthancPluginResourceType resourceType, 254 OrthancPluginResourceType resourceType,
255 const char* resourceId) 255 const char* resourceId)
256 { 256 {
257 char info[1024]; 257 char info[1024];
258 OrthancPluginMemoryBuffer tmp;
259
258 sprintf(info, "Change %d on resource %s of type %d", changeType, resourceId, resourceType); 260 sprintf(info, "Change %d on resource %s of type %d", changeType, resourceId, resourceType);
259 OrthancPluginLogWarning(context, info); 261 OrthancPluginLogWarning(context, info);
262
263 if (changeType == OrthancPluginChangeType_NewInstance)
264 {
265 sprintf(info, "/instances/%s/metadata/ReceptionDate", resourceId);
266 if (OrthancPluginRestApiGet(context, &tmp, info) == 0)
267 {
268 sprintf(info, " Instance %s comes from the anonymization of instance %s",
269 resourceId, (const char*) tmp.data);
270 OrthancPluginLogWarning(context, info);
271 OrthancPluginFreeMemoryBuffer(context, &tmp);
272 }
273 }
274
260 return 0; 275 return 0;
261 } 276 }
262 277
263 278
264 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) 279 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)