]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afs.c
paraslash 0.7.3
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index 865effde671a4848298ab09d502898c6225a937c..445d5871097b79cdcd14170c2a1f59998354dc98 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -437,14 +437,14 @@ static int activate_mood_or_playlist(const char *arg, struct para_buffer *pb)
        int ret;
        char *msg;
 
-       if (!arg) {
-               ret = mood_load(NULL, &msg);
+       if (!arg) { /* load dummy mood */
+               ret = mood_load(NULL, NULL, &msg);
                mode = PLAY_MODE_MOOD;
        } else if (!strncmp(arg, "p/", 2)) {
-               ret = playlist_load(arg + 2, &msg);
+               ret = playlist_load(arg + 2, NULL, &msg);
                mode = PLAY_MODE_PLAYLIST;
        } else if (!strncmp(arg, "m/", 2)) {
-               ret = mood_load(arg + 2, &msg);
+               ret = mood_load(arg + 2, NULL, &msg);
                mode = PLAY_MODE_MOOD;
        } else {
                ret = -ERRNO_TO_PARA_ERROR(EINVAL);
@@ -951,8 +951,8 @@ __noreturn void afs_init(int socket_fd)
        }
        ret = schedule(&s);
        sched_shutdown(&s);
-       mood_unload();
-       playlist_unload();
+       mood_unload(NULL);
+       playlist_unload(NULL);
 out_close:
        close_afs_tables();
 out:
@@ -970,29 +970,32 @@ static int com_select_callback(struct afs_callback_arg *aca)
        const struct lls_command *cmd = SERVER_CMD_CMD_PTR(SELECT);
        const char *arg;
        int ret;
+       struct para_buffer *pbout;
 
        ret = lls_deserialize_parse_result(aca->query.data, cmd, &aca->lpr);
        assert(ret >= 0);
        arg = lls_input(0, aca->lpr);
+       pbout = SERVER_CMD_OPT_GIVEN(SELECT, VERBOSE, aca->lpr)?
+               &aca->pbout : NULL;
        score_clear();
        if (current_play_mode == PLAY_MODE_MOOD)
-               mood_unload();
+               mood_unload(NULL);
        else
-               playlist_unload();
-       ret = activate_mood_or_playlist(arg, &aca->pbout);
+               playlist_unload(NULL);
+       ret = activate_mood_or_playlist(arg, pbout);
        if (ret >= 0)
                goto free_lpr;
        /* ignore subsequent errors (but log them) */
        if (current_mop && strcmp(current_mop, arg) != 0) {
                int ret2;
                afs_error(aca, "switching back to %s\n", current_mop);
-               ret2 = activate_mood_or_playlist(current_mop, &aca->pbout);
+               ret2 = activate_mood_or_playlist(current_mop, pbout);
                if (ret2 >= 0)
                        goto free_lpr;
                afs_error(aca, "could not reactivate %s: %s\n", current_mop,
                        para_strerror(-ret2));
        }
-       activate_mood_or_playlist(NULL, &aca->pbout);
+       activate_mood_or_playlist(NULL, pbout);
 free_lpr:
        lls_free_parse_result(aca->lpr, cmd);
        return ret;