Author: patrys                       Date: Thu Feb  7 12:56:35 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add support for libsoup-2.4

---- Files affected:
SOURCES:
   rhythmbox-as-needed.patch (NONE -> 1.1)  (NEW), rhythmbox-soup24.patch (NONE 
-> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/rhythmbox-as-needed.patch
diff -u /dev/null SOURCES/rhythmbox-as-needed.patch:1.1
--- /dev/null   Thu Feb  7 13:56:35 2008
+++ SOURCES/rhythmbox-as-needed.patch   Thu Feb  7 13:56:30 2008
@@ -0,0 +1,13 @@
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index 21fc6d8..6cd69c2 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -51,6 +51,8 @@ INCLUDES =                                           \
+       $(SOUP_CFLAGS)                                  \
+       $(RHYTHMBOX_CFLAGS)
+ 
++librb_la_LIBADD = $(SOUP_LIBS)
++
+ BUILT_SOURCES=
+ 
+ CLEAN_FILES = $(BUILT_SOURCES)

================================================================
Index: SOURCES/rhythmbox-soup24.patch
diff -u /dev/null SOURCES/rhythmbox-soup24.patch:1.1
--- /dev/null   Thu Feb  7 13:56:35 2008
+++ SOURCES/rhythmbox-soup24.patch      Thu Feb  7 13:56:30 2008
@@ -0,0 +1,1743 @@
+diff -urN rhythmbox-0.11.4/configure.ac rhythmbox-0.11.4.new/configure.ac
+--- rhythmbox-0.11.4/configure.ac      2007-12-20 11:56:44.000000000 +0000
++++ rhythmbox-0.11.4.new/configure.ac  2008-02-06 00:57:27.000000000 +0000
+@@ -441,18 +441,25 @@
+ dnl Check for libsoup, needed for DAAP and audioscrobbler
+ if test "x$enable_daap" = "xyes" || test "x$enable_audioscrobbler" != "xno"; 
then
+       PKG_CHECK_MODULES(SOUP,                            \
+-              libsoup-2.2,
+-              have_libsoup=yes,
+-              have_libsoup=no)
+-      if test x"$have_libsoup" = "xno"; then
++              libsoup-2.4,
++              have_libsoup24=yes,
++              have_libsoup24=no)
++      if test x"$have_libsoup24" = "xno"; then
+               PKG_CHECK_MODULES(SOUP,
+-                      libsoup-2.4,
+-                      have_libsoup=yes,
+-                      have_libsoup=no)
++                      libsoup-2.2,
++                      have_libsoup22=yes,
++                      have_libsoup22=no)
+       fi
+-      if test x"$have_libsoup" = "xyes"; then
++      if test x"$have_libsoup24" = "xyes" || test x"$have_libsoup22" = 
"xyes"; then
++              have_libsoup=yes
+               AC_DEFINE(HAVE_LIBSOUP, 1, [Define if libsoup support is 
enabled])
+       fi
++      if test x"$have_libsoup24" = "xyes"; then
++              AC_DEFINE(HAVE_LIBSOUP_2_4, 1, [Define if libsoup 2.4 support 
is enabled])
++      fi
++      if test x"$have_libsoup22" = "xyes"; then
++              AC_DEFINE(HAVE_LIBSOUP_2_2, 1, [Define if libsoup 2.2 support 
is enabled])
++      fi
+ fi
+ 
+ AM_CONDITIONAL(USE_LIBSOUP, test x"$have_libsoup" = "xyes")
+@@ -513,27 +520,9 @@
+ 
+ 
+ 
+-AC_PATH_X
+-
+-if test x"$x_includes" != x"NONE" && test -n "$x_includes" ; then
+-      CFLAGS=$CFLAGS -I`echo $x_includes | sed -e "s/:/ -I/g"`
+-fi
+-if test x"$x_libraries" != x"NONE" && test -n "$x_libraries" ; then
+-      LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`
+-fi
+-
+-have_xidle=no
+-AC_COMPILE_IFELSE([
+-      #include <X11/extensions/xidle.h>
+-int main(int argc,char **argv) {
+-  return 0;
+-}
+-], have_xidle=yes)
+-AC_MSG_CHECKING(for XIDLE extension)
+-AC_MSG_RESULT($have_xidle)
+-if test x"$have_xidle" = "xyes" ; then
+-      AC_DEFINE(HAVE_XIDLE_EXTENSION, 1, [defined if you have 
X11/extensions/xidle.h])
+-fi
++AC_PATH_XTRA
++CFLAGS="$CFLAGS $X_CFLAGS"
++#LIBS=$X_LIBS
+ 
+ dnl Multimedia keys
+ have_xfree=no
+@@ -1167,7 +1156,11 @@
+       AC_MSG_NOTICE([   CD burning support disabled])
+ fi
+ if test x"$enable_daap" = xyes; then
+-      AC_MSG_NOTICE([** DAAP (music sharing) support is enabled])
++      if test x"$have_libsoup24" = "xyes"; then
++              AC_MSG_NOTICE([** DAAP (music sharing) support is enabled 
(using libsoup 2.4)])
++      elif test x"$have_libsoup22" = "xyes"; then
++              AC_MSG_NOTICE([** DAAP (music sharing) support is enabled 
(using libsoup 2.2)])
++      fi
+ else
+       AC_MSG_NOTICE([   DAAP (music sharing) support is disabled])
+ fi
+@@ -1197,7 +1190,11 @@
+       AC_MSG_NOTICE([   gnome-keyring support disabled])
+ fi
+ if test x"$enable_audioscrobbler" != xno; then
+-      AC_MSG_NOTICE([** Audioscrobbler support enabled])
++      if test x"$have_libsoup24" = "xyes"; then
++              AC_MSG_NOTICE([** Audioscrobbler support enabled (using libsoup 
2.4)])
++      elif test x"$have_libsoup22" = "xyes"; then
++              AC_MSG_NOTICE([** Audioscrobbler support enabled (using libsoup 
2.2)])
++      fi
+ else
+       AC_MSG_NOTICE([   Audioscrobbler support disabled])
+ fi
+diff -urN rhythmbox-0.11.4/lib/Makefile.am rhythmbox-0.11.4.new/lib/Makefile.am
+--- rhythmbox-0.11.4/lib/Makefile.am   2007-08-01 09:04:11.000000000 +0100
++++ rhythmbox-0.11.4.new/lib/Makefile.am       2008-02-06 00:57:27.000000000 
+0000
+@@ -34,7 +34,8 @@
+       rb-string-value-map.c                           \
+       rb-string-value-map.h                           \
+       rb-async-queue-watch.c                          \
+-      rb-async-queue-watch.h
++      rb-async-queue-watch.h                          \
++      rb-soup-compat.h
+ 
+ if WITH_INTERNAL_GSEQUENCE
+ librb_la_SOURCES += gsequence.c gsequence.h
+diff -urN rhythmbox-0.11.4/lib/rb-proxy-config.c 
rhythmbox-0.11.4.new/lib/rb-proxy-config.c
+--- rhythmbox-0.11.4/lib/rb-proxy-config.c     2007-06-03 02:55:02.000000000 
+0100
++++ rhythmbox-0.11.4.new/lib/rb-proxy-config.c 2008-02-06 00:57:27.000000000 
+0000
+@@ -231,7 +231,28 @@
+       }
+ }
+ 
+-#if defined(HAVE_LIBSOUP)
++#if defined(HAVE_LIBSOUP_2_4)
++SoupURI *
++rb_proxy_config_get_libsoup_uri (RBProxyConfig *config)
++{
++      SoupURI *uri = NULL;
++
++      if (!config->enabled)
++              return NULL;
++
++      uri = soup_uri_new (NULL);
++      soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTP);
++      soup_uri_set_host (uri, config->host);
++      soup_uri_set_port (uri, config->port);
++
++      if (config->auth_enabled) {
++              soup_uri_set_user (uri, config->username);
++              soup_uri_set_password (uri, config->password);
++      }
++
++      return uri;
++}
++#elif defined(HAVE_LIBSOUP_2_2)
+ SoupUri *
+ rb_proxy_config_get_libsoup_uri (RBProxyConfig *config)
+ {
+diff -urN rhythmbox-0.11.4/lib/rb-proxy-config.h 
rhythmbox-0.11.4.new/lib/rb-proxy-config.h
+--- rhythmbox-0.11.4/lib/rb-proxy-config.h     2007-06-03 02:55:02.000000000 
+0100
++++ rhythmbox-0.11.4.new/lib/rb-proxy-config.h 2008-02-06 00:57:27.000000000 
+0000
+@@ -24,8 +24,8 @@
+ #include <glib-object.h>
+ 
+ #if defined(HAVE_LIBSOUP)
++#include "rb-soup-compat.h"
+ #include <libsoup/soup.h>
+-#include <libsoup/soup-uri.h>
+ #endif
+ 
+ G_BEGIN_DECLS
+@@ -65,9 +65,7 @@
+ 
+ RBProxyConfig *       rb_proxy_config_new (void);
+ 
+-#if defined(HAVE_LIBSOUP)
+-SoupUri *     rb_proxy_config_get_libsoup_uri (RBProxyConfig *config);
+-#endif
++SoupURI *     rb_proxy_config_get_libsoup_uri (RBProxyConfig *config);
+ 
+ #endif        /* RB_PROXY_CONFIG_H */
+ 
+diff -urN rhythmbox-0.11.4/lib/rb-soup-compat.h 
rhythmbox-0.11.4.new/lib/rb-soup-compat.h
+--- rhythmbox-0.11.4/lib/rb-soup-compat.h      1970-01-01 01:00:00.000000000 
+0100
++++ rhythmbox-0.11.4.new/lib/rb-soup-compat.h  2008-02-06 00:57:27.000000000 
+0000
+@@ -0,0 +1,59 @@
++/*
++ *  Copyright (C) 2008  Jonathan Matthew <[EMAIL PROTECTED]>
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, write to the Free Software
++ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
++ *  02110-1301  USA
++ */
++
++#ifndef RB_SOUP_COMPAT_H
++#define RB_SOUP_COMPAT_H
++
++#include <libsoup/soup.h>
++
++/* compatibility junk for libsoup 2.2.
++ * not intended to obviate the need for #ifdefs in code, but
++ * should remove a lot of the trivial ones and make it easier
++ * to drop libsoup 2.2
++ */
++#if defined(HAVE_LIBSOUP_2_2)
++
++#include <libsoup/soup-uri.h>
++#include <libsoup/soup-address.h>
++#include <libsoup/soup-connection.h>
++#include <libsoup/soup-headers.h>
++#include <libsoup/soup-message.h>
++#include <libsoup/soup-misc.h>
++#include <libsoup/soup-session-sync.h>
++#include <libsoup/soup-server.h>
++#include <libsoup/soup-server-auth.h>
++#include <libsoup/soup-server-message.h>
++
++
++typedef SoupUri                               SoupURI;
++typedef SoupMessageCallbackFn         SoupSessionCallback;
++typedef SoupServerContext             SoupClientContext;
++
++#define SOUP_MEMORY_TAKE              SOUP_BUFFER_SYSTEM_OWNED
++#define SOUP_MEMORY_TEMPORARY         SOUP_BUFFER_USER_OWNED
++
++#define soup_message_headers_append   soup_message_add_header
++#define soup_message_headers_get      soup_message_get_header
++
++#define soup_client_context_get_host  soup_server_context_get_client_host
++
++#endif        /* HAVE_LIBSOUP_2_2 */
++
++#endif        /* RB_SOUP_COMPAT_H */
++
+diff -urN rhythmbox-0.11.4/plugins/audioscrobbler/rb-audioscrobbler.c 
rhythmbox-0.11.4.new/plugins/audioscrobbler/rb-audioscrobbler.c
+--- rhythmbox-0.11.4/plugins/audioscrobbler/rb-audioscrobbler.c        
2007-12-17 09:26:53.000000000 +0000
++++ rhythmbox-0.11.4.new/plugins/audioscrobbler/rb-audioscrobbler.c    
2008-02-06 00:59:48.000000000 +0000
+@@ -24,6 +24,8 @@
+ 
+ #define __EXTENSIONS__
+ 
++#include "config.h"
++
+ #include <errno.h>
+ 
+ #include <string.h>
+@@ -35,10 +37,9 @@
+ #include <gtk/gtk.h>
+ #include <gconf/gconf-value.h>
+ 
++#include "rb-soup-compat.h"
+ #include <libsoup/soup.h>
+-#include <libsoup/soup-uri.h>
+ 
+-#include "config.h"
+ #include "eel-gconf-extensions.h"
+ #include "rb-audioscrobbler.h"
+ #include "rb-debug.h"
+@@ -193,14 +194,20 @@
+ 
+ static gchar *             mkmd5 (char *string);
+ static void        rb_audioscrobbler_parse_response (RBAudioscrobbler 
*audioscrobbler, SoupMessage *msg);
+-static void        rb_audioscrobbler_perform (RBAudioscrobbler 
*audioscrobbler,
+-                                             char *url,
+-                                             char *post_data,
+-                                                 SoupMessageCallbackFn 
response_handler);
++
+ static void        rb_audioscrobbler_do_handshake (RBAudioscrobbler 
*audioscrobbler);
+-static void        rb_audioscrobbler_do_handshake_cb (SoupMessage *msg, 
gpointer user_data);
+ static void        rb_audioscrobbler_submit_queue (RBAudioscrobbler 
*audioscrobbler);
++static void        rb_audioscrobbler_perform (RBAudioscrobbler 
*audioscrobbler,
++                                              char *url,
++                                              char *post_data,
++                                              SoupSessionCallback 
response_handler);
++#if defined(HAVE_LIBSOUP_2_4)
++static void        rb_audioscrobbler_do_handshake_cb (SoupSession *session, 
SoupMessage *msg, gpointer user_data);
++static void        rb_audioscrobbler_submit_queue_cb (SoupSession *session, 
SoupMessage *msg, gpointer user_data);
++#else
++static void        rb_audioscrobbler_do_handshake_cb (SoupMessage *msg, 
gpointer user_data);
+ static void        rb_audioscrobbler_submit_queue_cb (SoupMessage *msg, 
gpointer user_data);
++#endif
+ 
+ static void        rb_audioscrobbler_import_settings (RBAudioscrobbler 
*audioscrobbler);
+ static void        rb_audioscrobbler_preferences_sync (RBAudioscrobbler 
*audioscrobbler);
+@@ -688,18 +695,31 @@
+ static void
+ rb_audioscrobbler_parse_response (RBAudioscrobbler *audioscrobbler, 
SoupMessage *msg)
+ {
++      gboolean successful;
+       rb_debug ("Parsing response, status=%d", msg->status_code);
+-
+-      if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code) && 
(msg->response).body != NULL) {
+-              gchar *body;
++      
++      successful = FALSE;
++#if defined(HAVE_LIBSOUP_2_4)
++      if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code) && 
msg->response_body->length != 0)
++              successful = TRUE;
++#else
++      if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code) && 
(msg->response).body != NULL)
++              successful = TRUE;
++#endif
++      if (successful) {
+               gchar **breaks;
++              int i;
++#if defined(HAVE_LIBSOUP_2_2)
++              gchar *body;
+ 
+               body = g_malloc0 ((msg->response).length + 1);
+               memcpy (body, (msg->response).body, (msg->response).length);
+ 
+               g_strstrip (body);
+               breaks = g_strsplit (body, "\n", 4);
+-              int i;
++#else
++              breaks = g_strsplit (msg->response_body->data, "\n", 4);
++#endif
+ 
+               g_free (audioscrobbler->priv->status_msg);
+               audioscrobbler->priv->status = STATUS_OK;
+@@ -771,10 +791,12 @@
+                       audioscrobbler->priv->submit_next = time(NULL) + 
audioscrobbler->priv->submit_interval;
+ 
+               g_strfreev (breaks);
++#if defined(HAVE_LIBSOUP_2_2)
+               g_free (body);
++#endif
+       } else {
+               audioscrobbler->priv->status = REQUEST_FAILED;
+-              audioscrobbler->priv->status_msg = g_strdup 
(soup_status_get_phrase (msg->status_code));
++              audioscrobbler->priv->status_msg = g_strdup 
(msg->reason_phrase);
+       }
+ }
+ 
+@@ -793,24 +815,25 @@
+ rb_audioscrobbler_perform (RBAudioscrobbler *audioscrobbler,
+                          char *url,
+                          char *post_data,
+-                         SoupMessageCallbackFn response_handler)
++                         SoupSessionCallback response_handler)
+ {
+       SoupMessage *msg;
+ 
+       msg = soup_message_new (post_data == NULL ? "GET" : "POST", url);
++      soup_message_headers_append (msg->request_headers, "User-Agent", 
"Rhythmbox/" VERSION);
+ 
+       if (post_data != NULL) {
+               rb_debug ("Submitting to Audioscrobbler: %s", post_data);
+               soup_message_set_request (msg,
+                                         "application/x-www-form-urlencoded",
+-                                        SOUP_BUFFER_SYSTEM_OWNED,
++                                        SOUP_MEMORY_TAKE,
+                                         post_data,
+                                         strlen (post_data));
+       }
+ 
+       /* create soup session, if we haven't got one yet */
+       if (!audioscrobbler->priv->soup_session) {
+-              SoupUri *uri;
++              SoupURI *uri;
+ 
+               uri = rb_proxy_config_get_libsoup_uri 
(audioscrobbler->priv->proxy_config);
+               audioscrobbler->priv->soup_session = 
soup_session_async_new_with_options (
+@@ -891,8 +914,13 @@
+ }
+ 
+ 
++#if defined(HAVE_LIBSOUP_2_4)
++static void
++rb_audioscrobbler_do_handshake_cb (SoupSession *session, SoupMessage *msg, 
gpointer user_data)
++#else
+ static void
+ rb_audioscrobbler_do_handshake_cb (SoupMessage *msg, gpointer user_data)
++#endif
+ {
+       RBAudioscrobbler *audioscrobbler = RB_AUDIOSCROBBLER(user_data);
+ 
+@@ -1049,8 +1077,13 @@
+       }
+ }
+ 
++#if defined(HAVE_LIBSOUP_2_4)
++static void
++rb_audioscrobbler_submit_queue_cb (SoupSession *session, SoupMessage *msg, 
gpointer user_data)
++#else
+ static void
+ rb_audioscrobbler_submit_queue_cb (SoupMessage *msg, gpointer user_data)
++#endif
+ {
+       RBAudioscrobbler *audioscrobbler = RB_AUDIOSCROBBLER (user_data);
+ 
+@@ -1232,7 +1265,7 @@
+ rb_audioscrobbler_proxy_config_changed_cb (RBProxyConfig *config,
+                                          RBAudioscrobbler *audioscrobbler)
+ {
+-      SoupUri *uri;
++      SoupURI *uri;
+ 
+       if (audioscrobbler->priv->soup_session) {
+               uri = rb_proxy_config_get_libsoup_uri (config);
+diff -urN rhythmbox-0.11.4/plugins/audioscrobbler/rb-lastfm-gst-src.c 
rhythmbox-0.11.4.new/plugins/audioscrobbler/rb-lastfm-gst-src.c
+--- rhythmbox-0.11.4/plugins/audioscrobbler/rb-lastfm-gst-src.c        
2007-06-19 12:38:41.000000000 +0100
++++ rhythmbox-0.11.4.new/plugins/audioscrobbler/rb-lastfm-gst-src.c    
2008-02-06 00:57:27.000000000 +0000
+@@ -25,7 +25,6 @@
+ 
+ #include "rb-debug.h"
+ 
+-#include <libsoup/soup.h>
+ #include <gst/gst.h>
+ 
+ #define RB_TYPE_LASTFM_SRC (rb_lastfm_src_get_type())
+diff -urN rhythmbox-0.11.4/plugins/audioscrobbler/rb-lastfm-source.c 
rhythmbox-0.11.4.new/plugins/audioscrobbler/rb-lastfm-source.c
+--- rhythmbox-0.11.4/plugins/audioscrobbler/rb-lastfm-source.c 2007-12-04 
03:05:39.000000000 +0000
++++ rhythmbox-0.11.4.new/plugins/audioscrobbler/rb-lastfm-source.c     
2008-02-06 01:01:13.000000000 +0000
+@@ -42,8 +42,8 @@
+ 
+ #include <gconf/gconf-value.h>
+ 
++#include "rb-soup-compat.h"
+ #include <libsoup/soup.h>
+-#include <libsoup/soup-uri.h>
+ 
+ #include "md5.h"
+ 
+@@ -100,8 +100,12 @@
+ static void rb_lastfm_perform (RBLastfmSource *lastfm,
+                              const char *url,
+                              char *post_data, /* this takes ownership */
+-                             SoupMessageCallbackFn response_handler);
++                             SoupSessionCallback response_handler);
++#if defined(HAVE_LIBSOUP_2_4)
++static void rb_lastfm_message_cb (SoupSession *session, SoupMessage *req, 
gpointer user_data);
++#else
+ static void rb_lastfm_message_cb (SoupMessage *req, gpointer user_data);
++#endif
+ static void rb_lastfm_change_station (RBLastfmSource *source, const char 
*station);
+ 
+ static void rb_lastfm_proxy_config_changed_cb (RBProxyConfig *config,
+@@ -724,30 +728,29 @@
+ rb_lastfm_perform (RBLastfmSource *source,
+                  const char *url,
+                  char *post_data,
+-                 SoupMessageCallbackFn response_handler)
++                 SoupSessionCallback response_handler)
+ {
+       SoupMessage *msg;
+       msg = soup_message_new ("GET", url);
++      soup_message_headers_append (msg->request_headers, "User-Agent", 
"Rhythmbox/" VERSION);
+ 
+       if (msg == NULL)
+               return;
+ 
+-      soup_message_set_http_version (msg, SOUP_HTTP_1_1);
+-
+       rb_debug ("Last.fm communicating with %s", url);
+ 
+       if (post_data != NULL) {
+               rb_debug ("POST data: %s", post_data);
+               soup_message_set_request (msg,
+                                         "application/x-www-form-urlencoded",
+-                                        SOUP_BUFFER_SYSTEM_OWNED,
++                                        SOUP_MEMORY_TAKE,
+                                         post_data,
+                                         strlen (post_data));
+       }
+ 
+       /* create soup session, if we haven't got one yet */
+       if (!source->priv->soup_session) {
+-              SoupUri *uri;
++              SoupURI *uri;
+ 
+               uri = rb_proxy_config_get_libsoup_uri 
(source->priv->proxy_config);
+               source->priv->soup_session = 
soup_session_async_new_with_options (
+@@ -759,27 +762,45 @@
+ 
+       soup_session_queue_message (source->priv->soup_session,
+                                   msg,
+-                                  (SoupMessageCallbackFn) response_handler,
++                                  response_handler,
+                                   source);
+       source->priv->status = COMMUNICATING;
+       rb_source_notify_status_changed (RB_SOURCE(source));
+ }
+ 
++#if defined(HAVE_LIBSOUP_2_4)
++static void
++rb_lastfm_message_cb (SoupSession *session, SoupMessage *req, gpointer 
user_data)
++#else
+ static void
+ rb_lastfm_message_cb (SoupMessage *req, gpointer user_data)
++#endif
+ {
+       RBLastfmSource *source = RB_LASTFM_SOURCE (user_data);
+-      char *body;
+       char **pieces;
+       int i;
++      const char *body;
++
++#if defined(HAVE_LIBSOUP_2_2)
++      char *free_body;
+ 
+       if ((req->response).body == NULL) {
+               rb_debug ("Lastfm: Server failed to respond");
+               return;
+       }
+ 
+-      body = g_malloc0 ((req->response).length + 1);
+-      memcpy (body, (req->response).body, (req->response).length);
++      free_body = g_malloc0 ((req->response).length + 1);
++      memcpy (free_body, (req->response).body, (req->response).length);
++      g_strstrip (free_body);
++
++      body = free_body;
++#else
++      if (req->response_body->length == 0) {
++              rb_debug ("Lastfm: Server failed to respond");
++              return;
++      }
++      body = req->response_body->data;
++#endif
+ 
+       rb_debug ("response body: %s", body);
+ 
+@@ -787,7 +808,6 @@
+               source->priv->status = NO_ARTIST;
+       }
+ 
+-      g_strstrip (body);
+       pieces = g_strsplit (body, "\n", 0);
+       for (i = 0; pieces[i] != NULL; i++) {
+               gchar **values = g_strsplit (pieces[i], "=", 2);
+@@ -856,10 +876,14 @@
+                       rhythmdb_commit (source->priv->db);
+ 
+               }
++
++              g_strfreev (values);
+       }
+ 
+       g_strfreev (pieces);
+-      g_free (body);
++#if defined(HAVE_LIBSOUP_2_2)
++      g_free (free_body);
++#endif
+ 
+       /* doesn't work yet
+       if (source->priv->pending_entry) {
+@@ -898,7 +922,7 @@
+ rb_lastfm_proxy_config_changed_cb (RBProxyConfig *config,
+                                          RBLastfmSource *source)
+ {
+-      SoupUri *uri;
++      SoupURI *uri;
+ 
+       if (source->priv->soup_session) {
+               uri = rb_proxy_config_get_libsoup_uri (config);
+@@ -1163,10 +1187,16 @@
+       g_free(title);
+ }
+ 
++#if defined(HAVE_LIBSOUP_2_4)
++static void
++rb_lastfm_source_metadata_cb (SoupSession *session, SoupMessage *req, 
RBLastfmSource *source)
++#else
+ static void
+ rb_lastfm_source_metadata_cb (SoupMessage *req, RBLastfmSource *source)
++#endif
+ {
+-      char *body;
++      const char *body;
++      char *free_body;
+       char **pieces;
+       int p;
+       RhythmDBEntry *entry;
+@@ -1179,10 +1209,16 @@
+       }
+ 
+       rb_debug ("got response to metadata request");
+-      body = g_malloc0 ((req->response).length + 1);
<<Diff was trimmed, longer than 597 lines>>
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to