diff --git a/pandora_agents/win32/ChangeLog b/pandora_agents/win32/ChangeLog index aed9790b08..cabd85e720 100644 --- a/pandora_agents/win32/ChangeLog +++ b/pandora_agents/win32/ChangeLog @@ -1,3 +1,8 @@ +2012-11-20 Sergio Martin + + * pandora_windows_service.cc: Added support for + custom fields + 2012-11-20 Sergio Martin * modules/pandora_module_factory.cc: Fix a few diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc index 50a73a2bb1..1fea5bfd9a 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -1334,6 +1334,29 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) { data_xml = getXmlHeader (); + /* Write custom fields */ + int c = 1; + char numstr[21]; // enough to hold all numbers up to 64-bits + sprintf(numstr, "%d", c); + string token_name = conf->getValue ("custom_field"+numstr+"_name"); + string token_value = conf->getValue ("custom_field"+numstr+"_value"); + + if(token_name != "" && token_value != "") { + data_xml += "\n"; + while(token_name != "" && token_value != "") { + data_xml += " \n"; + data_xml += " \n"; + data_xml += " \n"; + data_xml += " \n"; + + c++; + sprintf(numstr, "%d", c); + token_name = conf->getValue ("custom_field"+numstr+"_name"); + token_value = conf->getValue ("custom_field"+numstr+"_value"); + } + data_xml += "\n"; + } + /* Write module data */ if (modules != NULL) { modules->goFirst ();