From 37594b7ec0b080cb72c326ccecf077fd82d08362 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 22 Jul 2009 16:17:57 +0000 Subject: [PATCH] allow xml_locate to just take section git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14317 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../applications/mod_commands/mod_commands.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index d2b3ee5403..3995ebc004 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -855,7 +855,7 @@ SWITCH_STANDARD_API(xml_locate_function) goto end; } - if (argc < 4) { + if (argc != 1 && argc != 4) { err = "bad args"; goto end; } @@ -868,9 +868,18 @@ SWITCH_STANDARD_API(xml_locate_function) switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); switch_assert(params); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "section", section); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag", tag); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_name", tag_attr_name); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_val", tag_attr_val); + + if (tag) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag", tag); + } + + if (tag_attr_name) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_name", tag_attr_name); + } + + if (tag_attr_val) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_val", tag_attr_val); + } if (switch_xml_locate(section, tag, tag_attr_name, tag_attr_val, &xml, &obj, params, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "can't find anything\n");