]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allow xml_locate to just take section
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 22 Jul 2009 16:17:57 +0000 (16:17 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 22 Jul 2009 16:17:57 +0000 (16:17 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14317 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c

index d2b3ee5403f51e73968a3b8239e53d70f055ee05..3995ebc004c0dc09467870ad08eff1d235d40a6c 100644 (file)
@@ -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(&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");