Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 2823:807169f85ba9
OrthancPluginGetPeerUserProperty()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 18 Sep 2018 15:38:18 +0200 |
parents | 3e048b243d20 |
children | d4fd4614f275 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Mon Sep 17 12:08:49 2018 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Sep 18 15:38:18 2018 +0200 @@ -2872,6 +2872,37 @@ } } + case _OrthancPluginService_GetPeerUserProperty: + { + const _OrthancPluginGetPeerProperty& p = + *reinterpret_cast<const _OrthancPluginGetPeerProperty*>(parameters); + + if (p.peers == NULL || + p.userProperty == NULL) + { + throw OrthancException(ErrorCode_NullPointer); + } + else + { + const WebServiceParameters::Dictionary& properties = + reinterpret_cast<const OrthancPeers*>(p.peers)->GetPeerParameters(p.peerIndex).GetUserProperties(); + + WebServiceParameters::Dictionary::const_iterator found = + properties.find(p.userProperty); + + if (found == properties.end()) + { + *(p.target) = NULL; + } + else + { + *(p.target) = found->second.c_str(); + } + + return true; + } + } + case _OrthancPluginService_CallPeerApi: CallPeerApi(parameters); return true;