diff --git a/src/screen_queue.c b/src/screen_queue.c
index 3d20da3bc999ad10f62e13dfb3a9aa9c7e0471f5..a5383fa19927d6536db98f7f60cc0aff7450415a 100644 (file)
--- a/src/screen_queue.c
+++ b/src/screen_queue.c
#include "screen_utils.h"
#include "screen_song.h"
#include "screen_lyrics.h"
+#include "db_completion.h"
#include "Compiler.h"
#ifndef NCMPC_MINI
#define MAX_SONG_LENGTH 512
#ifndef NCMPC_MINI
-typedef struct
-{
- GList **list;
- GList **dir_list;
- struct mpdclient *c;
-} completion_callback_data_t;
-
static struct hscroll hscroll;
#endif
*dir_list = g_list_append(*dir_list, g_strdup(dir));
}
+struct completion_callback_data {
+ GList **list;
+ GList **dir_list;
+ struct mpdclient *c;
+};
+
static void add_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data)
{
- completion_callback_data_t *tmp = (completion_callback_data_t *)data;
+ struct completion_callback_data *tmp = data;
GList **dir_list = tmp->dir_list;
GList **list = tmp->list;
struct mpdclient *c = tmp->c;
static void add_post_completion_cb(GCompletion *gcmp, gchar *line,
GList *items, void *data)
{
- completion_callback_data_t *tmp = (completion_callback_data_t *)data;
+ struct completion_callback_data *tmp = data;
GList **dir_list = tmp->dir_list;
GList **list = tmp->list;
struct mpdclient *c = tmp->c;
GList *list = NULL;
GList *dir_list = NULL;
- completion_callback_data_t data = {
+ struct completion_callback_data data = {
.list = &list,
.dir_list = &dir_list,
.c = c,
list_window_free(lw);
}
+/**
+ * Extract the host portion (without the optional password) from the
+ * MPD_HOST string.
+ */
+static const char *
+host_without_password(const char *host)
+{
+ const char *separator = strchr(host, '@');
+ if (separator != NULL && separator != host && separator[1] != 0)
+ host = separator + 1;
+
+ return host;
+}
+
static const char *
screen_queue_title(char *str, size_t size)
{
if (options.host == NULL)
return _("Queue");
- g_snprintf(str, size, _("Queue on %s"), options.host);
+ g_snprintf(str, size, _("Queue on %s"),
+ host_without_password(options.host));
return str;
}