]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afs.c
Change dbinfo1 stat item and use it from afs.
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index 901ae00deca346e78a76be2841acccb2feacd4c4..c410854c1129a91a811d21101886276aae731a2e 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -75,11 +75,15 @@ struct command_task {
        struct task task;
 };
 
        struct task task;
 };
 
+extern struct misc_meta_data *mmd;
+
 static int server_socket;
 static struct command_task command_task_struct;
 static struct signal_task signal_task_struct;
 
 static enum play_mode current_play_mode;
 static int server_socket;
 static struct command_task command_task_struct;
 static struct signal_task signal_task_struct;
 
 static enum play_mode current_play_mode;
+static char *current_mop; /* mode or playlist specifier. NULL means dummy mooe */
+
 
 /**
  * A random number used to "authenticate" the connection.
 
 /**
  * A random number used to "authenticate" the connection.
@@ -431,7 +435,7 @@ int stdin_command(int fd, struct osl_object *arg_obj, callback_function *f,
        return ret;
 }
 
        return ret;
 }
 
-int pass_afd(int fd, char *buf, size_t size)
+static int pass_afd(int fd, char *buf, size_t size)
 {
        struct msghdr msg = {.msg_iov = NULL};
        struct cmsghdr *cmsg;
 {
        struct msghdr msg = {.msg_iov = NULL};
        struct cmsghdr *cmsg;
@@ -508,8 +512,6 @@ destroy:
        return ret;
 }
 
        return ret;
 }
 
-static char *current_mop; /* mode or playlist specifier. NULL means dummy mooe */
-
 /* Never fails if arg == NULL */
 static int activate_mood_or_playlist(char *arg, int *num_admissible)
 {
 /* Never fails if arg == NULL */
 static int activate_mood_or_playlist(char *arg, int *num_admissible)
 {
@@ -536,10 +538,17 @@ static int activate_mood_or_playlist(char *arg, int *num_admissible)
        current_play_mode = mode;
        if (arg != current_mop) {
                free(current_mop);
        current_play_mode = mode;
        if (arg != current_mop) {
                free(current_mop);
-               if (arg)
+               if (arg) {
                        current_mop = para_strdup(arg);
                        current_mop = para_strdup(arg);
-               else
+                       mmd_lock();
+                       strcpy(mmd->afs_mode_string, arg); /* FIXME: check length */
+                       mmd_unlock();
+               } else {
+                       mmd_lock();
+                       strcpy(mmd->afs_mode_string, "dummy");
+                       mmd_unlock();
                        current_mop = NULL;
                        current_mop = NULL;
+               }
        }
        return 1;
 }
        }
        return 1;
 }
@@ -566,7 +575,7 @@ static int com_select_callback(const struct osl_object *query,
                ret = activate_mood_or_playlist(current_mop, &num_admissible);
                if (ret < 0) {
                        para_printf(&pb, "failed, switching to dummy\n");
                ret = activate_mood_or_playlist(current_mop, &num_admissible);
                if (ret < 0) {
                        para_printf(&pb, "failed, switching to dummy\n");
-                       change_current_mood(NULL); /* always successful */
+                       activate_mood_or_playlist(NULL, &num_admissible);
                }
        }
        para_printf(&pb, "activated %s (%d admissible files)\n", current_mop?
                }
        }
        para_printf(&pb, "activated %s (%d admissible files)\n", current_mop?