Clean up connection initialisation

Also, do not set up the spectrum visualiser before a password is sent.

It would look a bit weird to have it run but display "Disconnected",
even though technically, it would probably work.
This commit is contained in:
Přemysl Eric Janouch 2021-09-06 21:48:27 +02:00
parent 30777e8fd3
commit fba1210e9f
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 10 additions and 10 deletions

View File

@ -4186,6 +4186,14 @@ mpd_queue_reconnect (void)
poller_timer_set (&g.connect_event, 5 * 1000); poller_timer_set (&g.connect_event, 5 * 1000);
} }
static void
mpd_on_ready (struct mpd_client *c)
{
mpd_request_info ();
library_tab_reload (NULL);
spectrum_setup_fifo ();
}
static void static void
mpd_on_password_response (const struct mpd_response *response, mpd_on_password_response (const struct mpd_response *response,
const struct strv *data, void *user_data) const struct strv *data, void *user_data)
@ -4195,10 +4203,7 @@ mpd_on_password_response (const struct mpd_response *response,
struct mpd_client *c = &g.client; struct mpd_client *c = &g.client;
if (response->success) if (response->success)
{ mpd_on_ready (c);
mpd_request_info ();
library_tab_reload (NULL);
}
else else
{ {
print_error ("%s: %s", print_error ("%s: %s",
@ -4221,12 +4226,7 @@ mpd_on_connected (void *user_data)
mpd_client_add_task (c, mpd_on_password_response, NULL); mpd_client_add_task (c, mpd_on_password_response, NULL);
} }
else else
{ mpd_on_ready (c);
mpd_request_info ();
library_tab_reload (NULL);
}
spectrum_setup_fifo ();
} }
static void static void