]> git.sesse.net Git - vlc/commitdiff
* http.c: fixes about vlm.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 22 Mar 2004 02:58:57 +0000 (02:58 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 22 Mar 2004 02:58:57 +0000 (02:58 +0000)
modules/control/http.c

index 4ffcce35576bacd2b795868c82f6be611133ad0b..68a28cba9e6f40c191ed55d9b4c9e504881fcca0 100644 (file)
@@ -1155,9 +1155,31 @@ static mvar_t *mvar_VlmSetNew( char *name, vlm_t *vlm )
             set = mvar_New( name, "set" );
             mvar_AppendNewVar( set, "name", el->psz_name );
 
+            fprintf( stderr, "#### name=%s\n", el->psz_name );
+
             for( k = 0; k < desc->i_child; k++ )
             {
-                mvar_AppendNewVar( set, desc->child[k]->psz_name, desc->child[k]->psz_value );
+                vlm_message_t *ch = desc->child[k];
+                if( ch->i_child > 0 )
+                {
+                    int c;
+                    mvar_t *n = mvar_New( ch->psz_name, "set" );
+
+                    fprintf( stderr, "        child=%s [%d]\n", ch->psz_name, ch->i_child );
+                    for( c = 0; c < ch->i_child; c++ )
+                    {
+                        mvar_t *in = mvar_New( ch->psz_name, ch->child[c]->psz_name );
+                        mvar_AppendVar( n, in );
+
+                        fprintf( stderr, "            sub=%s\n", ch->child[c]->psz_name );
+                    }
+                    mvar_AppendVar( set, n );
+                }
+                else
+                {
+                    fprintf( stderr, "        child=%s->%s\n", ch->psz_name, ch->psz_value );
+                    mvar_AppendNewVar( set, ch->psz_name, ch->psz_value );
+                }
             }
             vlm_MessageDelete( inf );
 
@@ -1927,8 +1949,10 @@ static void MacroDo( httpd_file_sys_t *p_args,
                 {
                     static const char *vlm_properties[11] =
                     {
-                        "input", "output", "option", "enabled", "disabled",
-                        "loop", "unloop", "append", "date", "period", "repeat",
+                        /* no args */
+                        "enabled", "disabled", "loop", "unloop",
+                        /* args required */
+                        "input", "output", "option", "append", "date", "period", "repeat",
                     };
                     vlm_message_t *vlm_answer;
                     char name[512];
@@ -1955,11 +1979,11 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     {
                         char val[512];
                         uri_extract_value( p_request, vlm_properties[i], val, 512 );
-                        if( strlen( val ) > 0 )
+                        if( strlen( val ) > 0 && i >= 4 )
                         {
                             p += sprintf( p, " %s %s", vlm_properties[i], val );
                         }
-                        else if( uri_test_param( p_request, vlm_properties[i] ) )
+                        else if( uri_test_param( p_request, vlm_properties[i] ) && i < 4 )
                         {
                             p += sprintf( p, " %s", vlm_properties[i] );
                         }