Revision
14317
Author
anthm
Date
2009-07-22 11:17:57 -0500 (Wed, 22 Jul 2009)

Log Message

allow xml_locate to just take section

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (14316 => 14317)


--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-07-22 15:18:32 UTC (rev 14316)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-07-22 16:17:57 UTC (rev 14317)
@@ -855,7 +855,7 @@
 		goto end;
 	}
 
-	if (argc < 4) {
+	if (argc != 1 && argc != 4) {
 		err = "bad args";
 		goto end;
 	}
@@ -868,10 +868,19 @@
 	switch_event_create(&params, 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");
 		goto end;