From 3a7e5fcf2fb2e8e4df39ef7b7114cd87779e0595 Mon Sep 17 00:00:00 2001 From: Hirofumi Kosaka Date: Thu, 21 Jul 2016 17:15:22 +0900 Subject: [PATCH] Added the handling of agent's address list at new_agent/update_agent API call. --- pandora_console/include/functions_api.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index df9942f923..0bdf3125d4 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1088,7 +1088,12 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) { 'id_parent' => $idParent, 'custom_id' => $customId), array('id_agente' => $id_agent)); - + + if ( $return && !empty($ip)) { + // register ip for this agent in 'taddress' + agents_add_address ($id_agent, $ip); + } + returnData('string', array('type' => 'string', 'data' => (int)((bool)$return))); } @@ -1181,7 +1186,12 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) { 'server_name' => $nameServer, 'id_parent' => $idParent, 'custom_id' => $customId)); - + + if (!empty($idAgente) && !empty($ip)) { + // register ip for this agent in 'taddress' + agents_add_address ($idAgente, $ip); + } + returnData('string', array('type' => 'string', 'data' => $idAgente)); }