Source

belak.gentoo / media-sound / pianobar / files / pianobar-protocol-34-fix.patch

diff --git a/src/libpiano/piano.c b/src/libpiano/piano.c
index 342e4ec..b70477e 100644
--- a/src/libpiano/piano.c
+++ b/src/libpiano/piano.c
@@ -42,7 +42,7 @@ THE SOFTWARE.
 #include "crypt.h"
 #include "config.h"
 
-#define PIANO_PROTOCOL_VERSION "33"
+#define PIANO_PROTOCOL_VERSION "34"
 #define PIANO_RPC_HOST "www.pandora.com"
 #define PIANO_RPC_PORT "80"
 #define PIANO_RPC_PATH "/radio/xmlrpc/v" PIANO_PROTOCOL_VERSION "?"
@@ -272,6 +272,7 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
 							"<?xml version=\"1.0\"?><methodCall>"
 							"<methodName>listener.authenticateListener</methodName>"
 							"<params><param><value><int>%lu</int></value></param>"
+							"<param><value><string></string></value></param>"
 							/* user */
 							"<param><value><string>%s</string></value></param>"
 							/* password */
diff --git a/src/main.c b/src/main.c
index 43f3ffc..9a637cf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -77,10 +77,31 @@ static bool BarMainLoginUser (BarApp_t *app) {
 	WaitressReturn_t wRet;
 	PianoRequestDataLogin_t reqData;
 	bool ret;
+	WaitressHandle_t waithSync;
+	char *syncTime;
+	unsigned long int syncTimeInt;
+
+	/* skip sync step by fetching time from somewhere else */
+	WaitressInit (&waithSync);
+	WaitressSetUrl (&waithSync, "http://ridetheclown.com/s2/synctime.php");
+	if (app->settings.proxy != NULL && strlen (app->settings.proxy) > 0) {
+		WaitressSetProxy (&waithSync, app->settings.proxy);
+	}
+	wRet = WaitressFetchBuf (&waithSync, &syncTime);
+	WaitressFree (&waithSync);
+	if (wRet != WAITRESS_RET_OK) {
+		BarUiMsg (&app->settings, MSG_ERR, "Unable to sync: %s\n",
+				WaitressErrorToStr (wRet));
+		return false;
+	}
+
+	syncTimeInt = strtoul (syncTime, NULL, 0);
+	app->ph.timeOffset = time (NULL) - syncTimeInt;
+	free (syncTime);
 
 	reqData.user = app->settings.username;
 	reqData.password = app->settings.password;
-	reqData.step = 0;
+	reqData.step = 1;
 
 	BarUiMsg (&app->settings, MSG_INFO, "Login... ");
 	ret = BarUiPianoCall (app, PIANO_REQUEST_LOGIN, &reqData, &pRet, &wRet);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.