# HG changeset patch
# Node ID 54489b067309
# Parent  d41dd64add2a
diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c
--- a/finch/plugins/gnttinyurl.c
+++ b/finch/plugins/gnttinyurl.c
@@ -27,7 +27,7 @@
 
 #include <purple.h>
 
-#include <glib.h>
+#include "soupcompat.h"
 
 #include <gnt.h>
 
@@ -206,7 +206,7 @@ url_fetched(G_GNUC_UNUSED SoupSession *s
 	manager = purple_conversation_manager_get_default();
 	convs = purple_conversation_manager_get_all(manager);
 
-	if (SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		url = msg->response_body->data;
 		g_hash_table_insert(tinyurl_cache, data->original_url, g_strdup(url));
 	} else {
@@ -377,7 +377,7 @@ tinyurl_notify_fetch_cb(G_GNUC_UNUSED So
 	const gchar *url;
 	const gchar *original_url;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		return;
 	}
 
@@ -529,4 +529,4 @@ tiny_url_unload(GPluginPlugin *plugin, g
 	return TRUE;
 }
 
-GPLUGIN_NATIVE_PLUGIN_DECLARE(tiny_url)
\ No newline at end of file
+GPLUGIN_NATIVE_PLUGIN_DECLARE(tiny_url)
diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -27,6 +27,7 @@
 #include <string.h>
 
 #include "libpurple/glibcompat.h"
+#include "libpurple/soupcompat.h"
 
 #include "api.h"
 #include "http.h"
@@ -643,8 +644,8 @@ fb_api_http_chk(FbApi *api, SoupMessage 
 	gint code;
 	gsize size;
 
-	msg = res->reason_phrase;
-	code = res->status_code;
+	msg = soup_message_get_reason_phrase(res);
+	code = soup_message_get_status(res);
 	data = res->response_body->data;
 	size = res->response_body->length;
 
@@ -732,8 +733,8 @@ fb_api_http_req(FbApi *api, const gchar 
 
 	if (priv->token != NULL) {
 		data = g_strdup_printf("OAuth %s", priv->token);
-		soup_message_headers_replace(msg->request_headers, "Authorization",
-		                             data);
+		soup_message_headers_replace(soup_message_get_request_headers(msg),
+		                             "Authorization", data);
 		g_free(data);
 	}
 
diff --git a/libpurple/protocols/facebook/http.c b/libpurple/protocols/facebook/http.c
--- a/libpurple/protocols/facebook/http.c
+++ b/libpurple/protocols/facebook/http.c
@@ -25,6 +25,8 @@
 
 #include "http.h"
 
+#include "libpurple/soupcompat.h"
+
 GQuark
 fb_http_error_quark(void)
 {
@@ -40,12 +42,14 @@ fb_http_error_quark(void)
 gboolean
 fb_http_error_chk(SoupMessage *res, GError **error)
 {
-	if (SOUP_STATUS_IS_SUCCESSFUL(res->status_code)) {
+	SoupStatus status_code = soup_message_get_status(res);
+
+	if (SOUP_STATUS_IS_SUCCESSFUL(status_code)) {
 		return TRUE;
 	}
 
-	g_set_error(error, FB_HTTP_ERROR, res->status_code, "%s",
-	            res->reason_phrase);
+	g_set_error(error, FB_HTTP_ERROR, status_code, "%s",
+	            soup_message_get_reason_phrase(res));
 	return FALSE;
 }
 
diff --git a/libpurple/protocols/gg/avatar.c b/libpurple/protocols/gg/avatar.c
--- a/libpurple/protocols/gg/avatar.c
+++ b/libpurple/protocols/gg/avatar.c
@@ -30,6 +30,7 @@
 #include "avatar.h"
 
 #include "libpurple/glibcompat.h"
+#include "libpurple/soupcompat.h"
 
 #include "gg.h"
 #include "utils.h"
@@ -112,11 +113,12 @@ ggp_avatar_buddy_update_received(G_GNUC_
 
 	PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		purple_debug_error("gg",
 		                   "ggp_avatar_buddy_update_received: bad response "
 		                   "while getting avatar for %u: %s",
-		                   pending_update->uin, msg->reason_phrase);
+		                   pending_update->uin,
+		                   soup_message_get_reason_phrase(msg));
 		g_free(pending_update);
 		return;
 	}
@@ -214,8 +216,8 @@ ggp_avatar_buddy_update(PurpleConnection
 	url = g_strdup_printf(GGP_AVATAR_BUDDY_URL, pending_update->uin);
 	req = soup_message_new("GET", url);
 	g_free(url);
-	soup_message_headers_replace(req->request_headers, "User-Agent",
-	                             GGP_AVATAR_USERAGENT);
+	soup_message_headers_replace(soup_message_get_request_headers(req),
+	                             "User-Agent", GGP_AVATAR_USERAGENT);
 	// purple_http_request_set_max_len(req, GGP_AVATAR_SIZE_MAX);
 	soup_session_queue_message(
 	        info->http, req, ggp_avatar_buddy_update_received, pending_update);
@@ -241,9 +243,9 @@ ggp_avatar_own_sent(G_GNUC_UNUSED SoupSe
 
 	PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		purple_debug_error("gg", "ggp_avatar_own_sent: avatar not sent. %s\n",
-		                   msg->reason_phrase);
+		                   soup_message_get_reason_phrase(msg));
 		return;
 	}
 	purple_debug_info("gg", "ggp_avatar_own_sent: %s\n",
@@ -257,6 +259,7 @@ ggp_avatar_own_got_token(PurpleConnectio
 	GGPInfo *info = purple_connection_get_protocol_data(gc);
 	ggp_avatar_session_data *avdata = ggp_avatar_get_avdata(gc);
 	SoupMessage *req;
+	SoupMessageHeaders *headers;
 	PurpleImage *img = _img;
 	gchar *img_data, *uin_str;
 	PurpleAccount *account = purple_connection_get_account(gc);
@@ -279,9 +282,9 @@ ggp_avatar_own_got_token(PurpleConnectio
 	req = soup_form_request_new("POST", "http://avatars.nowe.gg/upload", "uin",
 	                            uin_str, "photo", img_data, NULL);
 	// purple_http_request_set_max_len(req, GGP_AVATAR_RESPONSE_MAX);
-	soup_message_headers_replace(req->request_headers, "Authorization", token);
-	soup_message_headers_replace(req->request_headers, "From",
-	                             "avatars to avatars");
+	headers = soup_message_get_request_headers(req);
+	soup_message_headers_replace(headers, "Authorization", token);
+	soup_message_headers_replace(headers, "From", "avatars to avatars");
 	soup_session_queue_message(info->http, req, ggp_avatar_own_sent, gc);
 	g_free(img_data);
 	g_free(uin_str);
diff --git a/libpurple/protocols/gg/edisc.c b/libpurple/protocols/gg/edisc.c
--- a/libpurple/protocols/gg/edisc.c
+++ b/libpurple/protocols/gg/edisc.c
@@ -36,6 +36,7 @@
 #include <glib/gi18n-lib.h>
 
 #include <purple.h>
+#include "libpurple/soupcompat.h"
 
 #define GGP_EDISC_OS "WINNT x86-msvc"
 #define GGP_EDISC_TYPE "desktop"
@@ -140,28 +141,29 @@ void ggp_edisc_cleanup(PurpleConnection 
 static void
 ggp_edisc_set_defaults(SoupMessage *msg)
 {
+	SoupMessageHeaders *headers = soup_message_get_request_headers(msg);
+
 	// purple_http_request_set_max_len(msg, GGP_EDISC_RESPONSE_MAX);
-	soup_message_headers_replace(msg->request_headers, "X-gged-api-version",
+	soup_message_headers_replace(headers, "X-gged-api-version",
 	                             GGP_EDISC_API);
 
 	/* optional fields */
 	soup_message_headers_replace(
-	        msg->request_headers, "User-Agent",
+	        headers, "User-Agent",
 	        "Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120613 "
 	        "GG/11.0.0.8169 (WINNT_x86-msvc; pl; beta; standard)");
 	soup_message_headers_replace(
-	        msg->request_headers, "Accept",
+	        headers, "Accept",
 	        "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
-	soup_message_headers_replace(msg->request_headers, "Accept-Language",
+	soup_message_headers_replace(headers, "Accept-Language",
 	                             "pl,en-us;q=0.7,en;q=0.3");
-	/* soup_message_headers_replace(msg->request_headers, "Accept-Encoding",
+	/* soup_message_headers_replace(headers, "Accept-Encoding",
 	 *                              "gzip, deflate"); */
-	soup_message_headers_replace(msg->request_headers, "Accept-Charset",
+	soup_message_headers_replace(headers, "Accept-Charset",
 	                             "ISO-8859-2,utf-8;q=0.7,*;q=0.7");
-	soup_message_headers_replace(msg->request_headers, "Connection",
-	                             "keep-alive");
+	soup_message_headers_replace(headers, "Connection", "keep-alive");
 	soup_message_headers_replace(
-	        msg->request_headers, "Content-Type",
+	        headers, "Content-Type",
 	        "application/x-www-form-urlencoded; charset=UTF-8");
 }
 
@@ -267,6 +269,7 @@ ggp_ggdrive_auth_done(G_GNUC_UNUSED Soup
 {
 	PurpleConnection *gc = user_data;
 	ggp_edisc_session_data *sdata = ggp_edisc_get_sdata(gc);
+	SoupStatus status_code;
 	JsonParser *parser;
 	JsonObject *result;
 	int status = -1;
@@ -275,11 +278,12 @@ ggp_ggdrive_auth_done(G_GNUC_UNUSED Soup
 
 	sdata->auth_request = NULL;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	status_code = soup_message_get_status(msg);
+	if (!SOUP_STATUS_IS_SUCCESSFUL(status_code)) {
 		purple_debug_misc("gg",
 		                  "ggp_ggdrive_auth_done: authentication failed due to "
 		                  "unsuccessful request (code = %d)",
-		                  msg->status_code);
+		                  status_code);
 		ggp_ggdrive_auth_results(gc, FALSE);
 		return;
 	}
@@ -305,7 +309,8 @@ ggp_ggdrive_auth_done(G_GNUC_UNUSED Soup
 	}
 
 	sdata->security_token = g_strdup(soup_message_headers_get_one(
-	        msg->response_headers, "X-gged-security-token"));
+	        soup_message_get_response_headers(msg),
+	        "X-gged-security-token"));
 	if (!sdata->security_token) {
 		purple_debug_misc("gg", "ggp_ggdrive_auth_done: authentication failed "
 		                        "due to missing security token header");
@@ -331,6 +336,7 @@ ggp_ggdrive_auth(PurpleConnection *gc, g
 	gchar *metadata;
 	gchar *tmp;
 	SoupMessage *msg;
+	SoupMessageHeaders *headers;
 
 	g_return_if_fail(sdata != NULL);
 
@@ -358,6 +364,7 @@ ggp_ggdrive_auth(PurpleConnection *gc, g
 
 	msg = soup_message_new("PUT", "https://drive.mpa.gg.pl/signin");
 	ggp_edisc_set_defaults(msg);
+	headers = soup_message_get_request_headers(msg);
 
 	metadata = g_strdup_printf("{"
 	                           "\"id\": \"%032x\", "
@@ -369,13 +376,12 @@ ggp_ggdrive_auth(PurpleConnection *gc, g
 	                           g_get_host_name(), ggp_libgaduw_version(gc));
 
 	tmp = g_strdup_printf("IMToken %s", imtoken);
-	soup_message_headers_replace(msg->request_headers, "Authorization", tmp);
+	soup_message_headers_replace(headers, "Authorization", tmp);
 	g_free(tmp);
 	tmp = g_strdup_printf("gg/pl:%u", accdata->session->uin);
-	soup_message_headers_replace(msg->request_headers, "X-gged-user", tmp);
+	soup_message_headers_replace(headers, "X-gged-user", tmp);
 	g_free(tmp);
-	soup_message_headers_replace(msg->request_headers, "X-gged-client-metadata",
-	                             metadata);
+	soup_message_headers_replace(headers, "X-gged-client-metadata", metadata);
 	g_free(metadata);
 
 	soup_session_queue_message(sdata->session, msg, ggp_ggdrive_auth_done, gc);
@@ -456,7 +462,7 @@ ggp_edisc_xfer_send_init_ticket_created(
 
 	edisc_xfer->msg = NULL;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		int error_id = ggp_edisc_parse_error(msg->response_body->data);
 		if (error_id == 206) /* recipient not logged in */
 			ggp_edisc_xfer_error(xfer,
@@ -526,7 +532,8 @@ ggp_edisc_xfer_send_init_authenticated(P
 	msg = soup_message_new("PUT", "https://drive.mpa.gg.pl/send_ticket");
 	ggp_edisc_set_defaults(msg);
 
-	soup_message_headers_replace(msg->request_headers, "X-gged-security-token",
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "X-gged-security-token",
 	                             sdata->security_token);
 
 	data = g_strdup_printf("{\"send_ticket\":{"
@@ -604,7 +611,7 @@ ggp_edisc_xfer_send_done(G_GNUC_UNUSED S
 
 	edisc_xfer->msg = NULL;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		ggp_edisc_xfer_error(xfer, _("Error while sending a file"));
 		return;
 	}
@@ -631,6 +638,7 @@ static void ggp_edisc_xfer_send_start(Pu
 	GGPXfer *edisc_xfer;
 	gchar *upload_url, *filename_e;
 	SoupMessage *msg;
+	SoupMessageHeaders *headers;
 
 	g_return_if_fail(xfer != NULL);
 	edisc_xfer = GGP_XFER(xfer);
@@ -647,16 +655,16 @@ static void ggp_edisc_xfer_send_start(Pu
 
 	ggp_edisc_set_defaults(msg);
 
-	soup_message_headers_replace(msg->request_headers, "X-gged-local-revision",
-	                             "0");
-	soup_message_headers_replace(msg->request_headers, "X-gged-security-token",
+	headers = soup_message_get_request_headers(msg);
+	soup_message_headers_replace(headers, "X-gged-local-revision", "0");
+	soup_message_headers_replace(headers, "X-gged-security-token",
 	                             sdata->security_token);
-	soup_message_headers_replace(msg->request_headers, "X-gged-metadata",
+	soup_message_headers_replace(headers, "X-gged-metadata",
 	                             "{\"node_type\": \"file\"}");
 
 	soup_message_set_flags(msg, SOUP_MESSAGE_CAN_REBUILD);
 	soup_message_body_set_accumulate(msg->request_body, FALSE);
-	soup_message_headers_set_content_length(msg->request_headers,
+	soup_message_headers_set_content_length(headers,
 	                                        purple_xfer_get_size(xfer));
 	g_signal_connect(msg, "wrote-headers",
 	                 G_CALLBACK(ggp_edisc_xfer_send_reader), xfer);
@@ -741,7 +749,7 @@ ggp_edisc_xfer_recv_ack_done(G_GNUC_UNUS
 	edisc_xfer = GGP_XFER(xfer);
 	edisc_xfer->msg = NULL;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		ggp_edisc_xfer_error(xfer, _("Cannot confirm file transfer."));
 		return;
 	}
@@ -755,6 +763,7 @@ static void ggp_edisc_xfer_recv_ack(Purp
 	GGPXfer *edisc_xfer = GGP_XFER(xfer);
 	ggp_edisc_session_data *sdata = ggp_edisc_get_sdata(edisc_xfer->gc);
 	SoupMessage *msg;
+	SoupMessageHeaders *headers;
 
 	g_return_if_fail(sdata != NULL);
 
@@ -764,9 +773,10 @@ static void ggp_edisc_xfer_recv_ack(Purp
 	                       ggp_edisc_xfer_ticket_url(edisc_xfer->ticket_id));
 	ggp_edisc_set_defaults(msg);
 
-	soup_message_headers_replace(msg->request_headers, "X-gged-security-token",
+	headers = soup_message_get_request_headers(msg);
+	soup_message_headers_replace(headers, "X-gged-security-token",
 	                             sdata->security_token);
-	soup_message_headers_replace(msg->request_headers, "X-gged-ack-status",
+	soup_message_headers_replace(headers, "X-gged-ack-status",
 	                             accept ? "allow" : "reject");
 
 	soup_session_queue_message(sdata->session, msg,
@@ -842,7 +852,7 @@ ggp_edisc_xfer_recv_done(G_GNUC_UNUSED S
 
 	edisc_xfer->msg = NULL;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		ggp_edisc_xfer_error(xfer, _("Error while receiving a file"));
 		return;
 	}
@@ -907,12 +917,14 @@ ggp_edisc_xfer_recv_ticket_update_got(G_
 	const gchar *ticket_id, *file_name, *send_mode_str;
 	uin_t sender, recipient;
 	int file_size;
+	SoupStatus status_code;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	status_code = soup_message_get_status(msg);
+	if (!SOUP_STATUS_IS_SUCCESSFUL(status_code)) {
 		purple_debug_error("gg",
 		                   "ggp_edisc_xfer_recv_ticket_update_got: cannot "
 		                   "fetch update for ticket (code=%d)",
-		                   msg->status_code);
+		                   status_code);
 		return;
 	}
 
@@ -1019,7 +1031,8 @@ ggp_edisc_xfer_recv_ticket_update_authen
 
 	ggp_edisc_set_defaults(msg);
 
-	soup_message_headers_replace(msg->request_headers, "X-gged-security-token",
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "X-gged-security-token",
 	                             sdata->security_token);
 
 	soup_session_queue_message(sdata->session, msg,
diff --git a/libpurple/protocols/gg/oauth/oauth-purple.c b/libpurple/protocols/gg/oauth/oauth-purple.c
--- a/libpurple/protocols/gg/oauth/oauth-purple.c
+++ b/libpurple/protocols/gg/oauth/oauth-purple.c
@@ -35,6 +35,7 @@
 #include "../xml.h"
 
 #include <purple.h>
+#include "libpurple/soupcompat.h"
 
 #define GGP_OAUTH_RESPONSE_MAX 10240
 
@@ -118,6 +119,7 @@ ggp_oauth_authorization_done(SoupSession
 {
 	ggp_oauth_data *data = user_data;
 	PurpleAccount *account;
+	SoupStatus status_code;
 	char *auth;
 	const char *method = "POST";
 	const char *url = "http://api.gadu-gadu.pl/access_token";
@@ -126,10 +128,11 @@ ggp_oauth_authorization_done(SoupSession
 
 	account = purple_connection_get_account(data->gc);
 
-	if (msg->status_code != 302) {
+	status_code = soup_message_get_status(msg);
+	if (status_code != 302) {
 		purple_debug_error("gg",
 		                   "ggp_oauth_authorization_done: failed (code = %d)",
-		                   msg->status_code);
+		                   status_code);
 		ggp_oauth_data_free(data);
 		return;
 	}
@@ -144,7 +147,8 @@ ggp_oauth_authorization_done(SoupSession
 
 	msg = soup_message_new(method, url);
 	// purple_http_request_set_max_len(req, GGP_OAUTH_RESPONSE_MAX);
-	soup_message_headers_replace(msg->request_headers, "Authorization", auth);
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "Authorization", auth);
 	soup_session_queue_message(session, msg, ggp_oauth_access_token_got, data);
 
 	g_free(auth);
@@ -164,7 +168,7 @@ ggp_oauth_request_token_got(SoupSession 
 
 	account = purple_connection_get_account(data->gc);
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		purple_debug_error("gg", "ggp_oauth_request_token_got: "
 			"requested token not received\n");
 		ggp_oauth_data_free(data);
@@ -238,7 +242,8 @@ ggp_oauth_request(PurpleConnection *gc, 
 
 	msg = soup_message_new(method, url);
 	// purple_http_request_set_max_len(req, GGP_OAUTH_RESPONSE_MAX);
-	soup_message_headers_replace(msg->request_headers, "Authorization", auth);
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "Authorization", auth);
 	soup_session_queue_message(info->http, msg, ggp_oauth_request_token_got,
 	                           data);
 
diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c
--- a/libpurple/protocols/gg/pubdir-prpl.c
+++ b/libpurple/protocols/gg/pubdir-prpl.c
@@ -30,6 +30,7 @@
 #include <glib/gi18n-lib.h>
 
 #include <purple.h>
+#include "libpurple/soupcompat.h"
 
 #include "pubdir-prpl.h"
 #include "gg.h"
@@ -296,7 +297,8 @@ ggp_pubdir_get_info_got_token(PurpleConn
 	                      request->params.user_info.uin);
 	msg = soup_message_new("GET", url);
 	g_free(url);
-	soup_message_headers_replace(msg->request_headers, "Authorization", token);
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "Authorization", token);
 	soup_session_queue_message(info->http, msg, ggp_pubdir_got_data, request);
 }
 
@@ -536,7 +538,8 @@ static void ggp_pubdir_search_got_token(
 
 	url = g_strdup_printf("http://api.gadu-gadu.pl%s", query);
 	msg = soup_message_new("GET", url);
-	soup_message_headers_replace(msg->request_headers, "Authorization", token);
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "Authorization", token);
 	soup_session_queue_message(info->http, msg, ggp_pubdir_got_data, request);
 
 	g_free(url);
@@ -764,7 +767,7 @@ static void
 ggp_pubdir_set_info_got_response(G_GNUC_UNUSED SoupSession *session,
                                  SoupMessage *msg, gpointer user_data)
 {
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		purple_debug_error("gg", "ggp_pubdir_set_info_got_response: failed");
 		return;
 	}
@@ -830,7 +833,8 @@ static void ggp_pubdir_set_info_got_toke
 
 	url = g_strdup_printf("http://api.gadu-gadu.pl/users/%u.xml", uin);
 	msg = soup_message_new("PUT", url);
-	soup_message_headers_replace(msg->request_headers, "Authorization", token);
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "Authorization", token);
 	soup_message_set_request(msg, "application/x-www-form-urlencoded",
 	                         SOUP_MEMORY_TAKE, request_data, -1);
 	soup_session_queue_message(info->http, msg,
diff --git a/libpurple/protocols/jabber/bosh.c b/libpurple/protocols/jabber/bosh.c
--- a/libpurple/protocols/jabber/bosh.c
+++ b/libpurple/protocols/jabber/bosh.c
@@ -25,6 +25,7 @@
 #include <purple.h>
 
 #include <libsoup/soup.h>
+#include "libpurple/soupcompat.h"
 
 #include "bosh.h"
 
@@ -199,9 +200,9 @@ jabber_bosh_connection_parse(PurpleJabbe
 		return NULL;
 	}
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(response->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(response))) {
 		gchar *tmp = g_strdup_printf(_("Unable to connect: %s"),
-		                             response->reason_phrase);
+		                             soup_message_get_reason_phrase(response));
 		purple_connection_error(conn->js->gc,
 		                        PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
 		g_free(tmp);
diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c
--- a/libpurple/protocols/jabber/oob.c
+++ b/libpurple/protocols/jabber/oob.c
@@ -22,6 +22,8 @@
  */
 #include <purple.h>
 
+#include "libpurple/soupcompat.h"
+
 #include "jabber.h"
 #include "iq.h"
 #include "oob.h"
@@ -65,7 +67,7 @@ jabber_oob_xfer_got(G_GNUC_UNUSED SoupSe
 	jox = JABBER_OOB_XFER(xfer);
 	jox->msg = NULL;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code) ||
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg)) ||
 	    purple_xfer_get_bytes_remaining(xfer) > 0) {
 		purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE);
 		purple_xfer_end(xfer);
@@ -79,9 +81,11 @@ static void
 jabber_oob_xfer_got_content_length(SoupMessage *msg, gpointer user_data)
 {
 	PurpleXfer *xfer = user_data;
+	SoupMessageHeaders *headers;
 	goffset total;
 
-	total = soup_message_headers_get_content_length(msg->response_headers);
+	headers = soup_message_get_response_headers(msg);
+	total = soup_message_headers_get_content_length(headers);
 
 	purple_xfer_set_size(xfer, total);
 }
diff --git a/libpurple/protocols/jabber/useravatar.c b/libpurple/protocols/jabber/useravatar.c
--- a/libpurple/protocols/jabber/useravatar.c
+++ b/libpurple/protocols/jabber/useravatar.c
@@ -27,6 +27,7 @@
 
 #include <purple.h>
 #include "libpurple/glibcompat.h"
+#include "libpurple/soupcompat.h"
 
 #include <libsoup/soup.h>
 
@@ -217,10 +218,10 @@ do_buddy_avatar_update_fromurl(G_GNUC_UN
 	JabberBuddyAvatarUpdateURLInfo *info = data;
 	gpointer icon_data;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		purple_debug_error("jabber",
 		                   "do_buddy_avatar_update_fromurl got error \"%s\"",
-		                   msg->reason_phrase);
+		                   soup_message_get_reason_phrase(msg));
 		goto out;
 	}
 
diff --git a/libpurple/soupcompat.h b/libpurple/soupcompat.h
new file mode 100644
--- /dev/null
+++ b/libpurple/soupcompat.h
@@ -0,0 +1,56 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * 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, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef PURPLE_SOUPCOMPAT_H
+#define PURPLE_SOUPCOMPAT_H
+/*
+ * This file is internal to libpurple. Do not use!
+ * Also, any public API should not depend on this file.
+ */
+
+#include <libsoup/soup.h>
+
+#if SOUP_MAJOR_VERSION < 3
+
+static inline const char *
+soup_message_get_reason_phrase(SoupMessage *msg) {
+	return msg->reason_phrase;
+}
+
+static inline SoupMessageHeaders *
+soup_message_get_response_headers(SoupMessage *msg) {
+	return msg->response_headers;
+}
+
+static inline SoupMessageHeaders *
+soup_message_get_request_headers(SoupMessage *msg) {
+	return msg->request_headers;
+}
+
+static inline SoupStatus
+soup_message_get_status(SoupMessage *msg) {
+	return msg->status_code;
+}
+
+#endif /* SOUP_MAJOR_VERSION < 3 */
+
+#endif /* PURPLE_SOUPCOMPAT_H */
diff --git a/libpurple/upnp.c b/libpurple/upnp.c
--- a/libpurple/upnp.c
+++ b/libpurple/upnp.c
@@ -26,6 +26,7 @@
 #include "upnp.h"
 
 #include "glibcompat.h"
+#include "soupcompat.h"
 
 #include "debug.h"
 #include "eventloop.h"
@@ -374,7 +375,7 @@ upnp_parse_description_cb(G_GNUC_UNUSED 
 	UPnPDiscoveryData *dd = _dd;
 	gchar *control_url = NULL;
 
-	if (msg && SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (msg && SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		control_url = purple_upnp_parse_description_response(
 		        msg->response_body->data, msg->response_body->length,
 		        dd->full_url, dd->service_type);
@@ -677,7 +678,8 @@ purple_upnp_generate_action_message_and_
 	// purple_http_request_set_max_len(msg, MAX_UPNP_DOWNLOAD);
 	action = g_strdup_printf("\"urn:schemas-upnp-org:service:%s#%s\"",
 	                         control_info.service_type, actionName);
-	soup_message_headers_replace(msg->request_headers, "SOAPAction", action);
+	soup_message_headers_replace(soup_message_get_request_headers(msg),
+	                             "SOAPAction", action);
 	g_free(action);
 	soup_message_set_request(msg, "text/xml; charset=utf-8", SOUP_MEMORY_TAKE,
 	                         soapMessage, strlen(soapMessage));
@@ -712,7 +714,7 @@ looked_up_public_ip_cb(G_GNUC_UNUSED Sou
 	const gchar *got_data;
 	size_t got_len;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		return;
 	}
 
@@ -857,10 +859,10 @@ done_port_mapping_cb(G_GNUC_UNUSED SoupS
 	gboolean success = TRUE;
 
 	/* determine if port mapping was a success */
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		purple_debug_error("upnp",
 		                   "purple_upnp_set_port_mapping(): Failed HTTP_OK: %s",
-		                   msg->reason_phrase);
+		                   soup_message_get_reason_phrase(msg));
 		success =  FALSE;
 	} else {
 		purple_debug_info("upnp",
diff --git a/pidgin/plugins/relnot.c b/pidgin/plugins/relnot.c
--- a/pidgin/plugins/relnot.c
+++ b/pidgin/plugins/relnot.c
@@ -25,6 +25,7 @@
 #include <string.h>
 
 #include <purple.h>
+#include "soupcompat.h"
 
 #include <pidgin.h>
 
@@ -61,7 +62,7 @@ version_fetch_cb(G_GNUC_UNUSED SoupSessi
 	GString *message;
 	int i = 0;
 
-	if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
 		return;
 	}
 
