From c7a803c9229cc15933c16f354f49dbfdc98c3bef Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Mon, 28 May 2018 19:46:54 +0200
Subject: [PATCH 1/4] increment version number to 0.20.21

---
 NEWS                        | 2 ++
 android/AndroidManifest.xml | 4 ++--
 configure.ac                | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index e8a353c95..252961d43 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+ver 0.20.21 (not yet released)
+
 ver 0.20.20 (2018/05/22)
 * protocol
   - fix "modified-since" filter regression
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index acdf78a17..09536d9c1 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -2,8 +2,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="org.musicpd"
           android:installLocation="auto"
-          android:versionCode="19"
-          android:versionName="0.20.20">
+          android:versionCode="20"
+          android:versionName="0.20.21">
 
   <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17"/>
 
diff --git a/configure.ac b/configure.ac
index 69d233709..ec3dada10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
 AC_PREREQ(2.60)
 
-AC_INIT(mpd, 0.20.20, musicpd-dev-team@lists.sourceforge.net)
+AC_INIT(mpd, 0.20.21, musicpd-dev-team@lists.sourceforge.net)
 
 VERSION_MAJOR=0
 VERSION_MINOR=20
-VERSION_REVISION=20
+VERSION_REVISION=21
 VERSION_EXTRA=0
 
 AC_CONFIG_SRCDIR([src/Main.cxx])

From 04f928e2b0cc6c470097d8083713776a3e949fa8 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Mon, 28 May 2018 20:01:00 +0200
Subject: [PATCH 2/4] doc/user.xml: remove copy&paste fallout

---
 doc/user.xml | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/doc/user.xml b/doc/user.xml
index 961590c4c..a7f809db5 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -2087,13 +2087,6 @@ run</programlisting>
           database.
         </para>
 
-        <para>
-          Note that unless overridden by the below settings (e.g. by
-          setting them to a blank value), general curl configuration
-          from environment variables such as http_proxy or specified
-          in ~/.curlrc will be in effect.
-        </para>
-
         <informaltable>
           <tgroup cols="2">
             <thead>

From a8b9e5b9b951425a4d96d037e1a2c50ae9d811dd Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Mon, 28 May 2018 19:58:38 +0200
Subject: [PATCH 3/4] db/proxy: add "password" setting

Closes #283
---
 NEWS                                   | 2 ++
 doc/user.xml                           | 9 +++++++++
 src/db/plugins/ProxyDatabasePlugin.cxx | 6 ++++++
 3 files changed, 17 insertions(+)

diff --git a/NEWS b/NEWS
index 252961d43..c1deceb9a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
 ver 0.20.21 (not yet released)
+* database
+  - proxy: add "password" setting
 
 ver 0.20.20 (2018/05/22)
 * protocol
diff --git a/doc/user.xml b/doc/user.xml
index a7f809db5..944681153 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -2114,6 +2114,15 @@ run</programlisting>
                   <application>MPD</application> instance.
                 </entry>
               </row>
+              <row>
+                <entry>
+                  <varname>password</varname>
+                </entry>
+                <entry>
+                  The password used to log in to the "master"
+                  <application>MPD</application> instance.
+                </entry>
+              </row>
               <row>
                 <entry>
                   <varname>keepalive</varname>
diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx
index c2bc33c6c..bd6da2f01 100644
--- a/src/db/plugins/ProxyDatabasePlugin.cxx
+++ b/src/db/plugins/ProxyDatabasePlugin.cxx
@@ -82,6 +82,7 @@ class ProxyDatabase final : public Database, SocketMonitor, IdleMonitor {
 	DatabaseListener &listener;
 
 	const std::string host;
+	const std::string password;
 	const unsigned port;
 	const bool keepalive;
 
@@ -359,6 +360,7 @@ ProxyDatabase::ProxyDatabase(EventLoop &_loop, DatabaseListener &_listener,
 	 SocketMonitor(_loop), IdleMonitor(_loop),
 	 listener(_listener),
 	 host(block.GetBlockValue("host", "")),
+	 password(block.GetBlockValue("password", "")),
 	 port(block.GetBlockValue("port", 0u)),
 	 keepalive(block.GetBlockValue("keepalive", false))
 {
@@ -402,6 +404,10 @@ ProxyDatabase::Connect()
 
 	try {
 		CheckError(connection);
+
+		if (!password.empty() &&
+		    !mpd_run_password(connection, password.c_str()))
+			ThrowError(connection);
 	} catch (...) {
 		mpd_connection_free(connection);
 		connection = nullptr;

From 8dcb1f805d39efef31ea63d5c42af9eb6263712f Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Mon, 28 May 2018 20:14:07 +0200
Subject: [PATCH 4/4] db/proxy: support tags "ArtistSort", "AlbumArtistSort",
 "AlbumSort"

Closes #284
---
 NEWS                                   | 1 +
 src/db/plugins/ProxyDatabasePlugin.cxx | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/NEWS b/NEWS
index c1deceb9a..1b0fc1e59 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 ver 0.20.21 (not yet released)
 * database
   - proxy: add "password" setting
+  - proxy: support tags "ArtistSort", "AlbumArtistSort", "AlbumSort"
 
 ver 0.20.20 (2018/05/22)
 * protocol
diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx
index bd6da2f01..b3d2d0a05 100644
--- a/src/db/plugins/ProxyDatabasePlugin.cxx
+++ b/src/db/plugins/ProxyDatabasePlugin.cxx
@@ -170,6 +170,13 @@ static constexpr struct {
 #if LIBMPDCLIENT_CHECK_VERSION(2,10,0)
 	{ TAG_MUSICBRAINZ_RELEASETRACKID,
 	  MPD_TAG_MUSICBRAINZ_RELEASETRACKID },
+#endif
+#if LIBMPDCLIENT_CHECK_VERSION(2,11,0)
+	{ TAG_ARTIST_SORT, MPD_TAG_ARTIST_SORT },
+	{ TAG_ALBUM_ARTIST_SORT, MPD_TAG_ALBUM_ARTIST_SORT },
+#endif
+#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
+	{ TAG_ALBUM_SORT, MPD_TAG_ALBUM_SORT },
 #endif
 	{ TAG_NUM_OF_ITEM_TYPES, MPD_TAG_COUNT }
 };