]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_commands: Allow cond API to allow returning empty false value
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Thu, 16 Sep 2010 15:03:59 +0000 (11:03 -0400)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Thu, 16 Sep 2010 15:03:59 +0000 (11:03 -0400)
src/mod/applications/mod_commands/mod_commands.c

index e308a0004ff02940bc15f0cde195655c8f72b4b4..0865b2b511c082dd788b11b836c85df875c18c97 100644 (file)
@@ -1387,7 +1387,7 @@ SWITCH_STANDARD_API(cond_function)
 
        argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
 
-       if (argc != 3) {
+       if (! (argc >= 2 && argc <= 3)) {
                goto error;
        }
 
@@ -1464,7 +1464,12 @@ SWITCH_STANDARD_API(cond_function)
                }
                switch_safe_free(s_a);
                switch_safe_free(s_b);
-               stream->write_function(stream, "%s", is_true ? argv[1] : argv[2]);
+
+               if ((argc == 2 && !is_true)) {
+                       stream->write_function(stream, "");
+               } else {
+                       stream->write_function(stream, "%s", is_true ? argv[1] : argv[2]);
+               }
                goto ok;
        }