summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8cfa274)
raw | patch | inline | side by side (parent: 8cfa274)
author | Max Kellermann <max.kellermann@gmail.com> | |
Wed, 2 Aug 2017 06:33:00 +0000 (08:33 +0200) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Wed, 2 Aug 2017 06:33:00 +0000 (08:33 +0200) |
Closes #2
NEWS | patch | blob | history | |
src/screen_queue.c | patch | blob | history |
index 89bb4a4c902b24e0529c2b59c899b869a051f906..157b39dadf390e7f6ede7f383fd893cfafc290f7 100644 (file)
--- a/NEWS
+++ b/NEWS
ncmpc 0.28 - not yet released
* fix crash on lyrics screen
* fix memory leak
+* hide the MPD password from the queue screen title
* build with Meson instead of autotools
ncmpc 0.27 - (2017-03-25)
diff --git a/src/screen_queue.c b/src/screen_queue.c
index d98445ded49bc0a1a6b3f8e2406e191dcd69dc27..47eb7165eee0404db24505cf1b659124f7c012e6 100644 (file)
--- a/src/screen_queue.c
+++ b/src/screen_queue.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;
}