[Goodies-commits] r2464 - xfce4-mpc-plugin/trunk/panel-plugin

Landry Breuil landry at xfce.org
Sun Jan 28 17:08:47 CET 2007


Author: landry
Date: 2007-01-28 16:08:47 +0000 (Sun, 28 Jan 2007)
New Revision: 2464

Modified:
   xfce4-mpc-plugin/trunk/panel-plugin/simple-libmpd.c
Log:
finally, the nicest workaround possible...

Modified: xfce4-mpc-plugin/trunk/panel-plugin/simple-libmpd.c
===================================================================
--- xfce4-mpc-plugin/trunk/panel-plugin/simple-libmpd.c	2007-01-28 15:38:45 UTC (rev 2463)
+++ xfce4-mpc-plugin/trunk/panel-plugin/simple-libmpd.c	2007-01-28 16:08:47 UTC (rev 2464)
@@ -209,7 +209,7 @@
          return -1;
       }
 
-      DBG("Read %d bytes, buff=\"%s\"", nbread, mo->buffer);
+      DBG("Read %d bytes, buff=\"%s\"", nbread, mo->recv_buffer);
       mo->buflen = nbread;
       strncpy(mo->buffer, mo->recv_buffer, mo->buflen);
       mo->buffer[mo->buflen] = '\0';
@@ -286,9 +286,8 @@
       DBG("Sent %d bytes",nbwri);
 
       nbread = mpd_wait_for_answer(mo);
-      usleep(1000);
       /* special case for long answers with 'playlistinfo' - hack to loop until we have received the final OK\n*/
-      while (nbread == MAXBUFLEN || 0 != strcmp(mo->buffer + strlen(mo->buffer) - 3,"OK\n"))
+      while (!mo->error && ( nbread == MAXBUFLEN || 0 != strcmp(mo->buffer + strlen(mo->buffer) - 3,"OK\n")))
       {
          /* save the end of the buffer from last occurence of 'file:', and replace it with 'OK\n' */
          ptr = g_strrstr(mo->buffer, "file:");
@@ -300,8 +299,7 @@
          DBG("tmp_buffer contains \"%s\"", tmp_buffer);
          DBG("buffer now contains \"%s\"", mo->buffer);
          /* parse buffer */
-         if (!mo->error)
-            (*parse_answer_fct)(mo, res);
+         (*parse_answer_fct)(mo, res);
 
          /* re-read stuff */
          nbread = mpd_wait_for_answer(mo);




More information about the Goodies-commits mailing list