diff options
author | Gary Kramlich <grim@reaperworld.com> | 2022-11-16 23:44:59 -0600 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2022-11-16 23:44:59 -0600 |
commit | 2b143dd78382a35175adaf3e659c1807f9133c3a (patch) | |
tree | b5e31feaa7df191813535f0d3690aa5d36cf7ca7 | |
parent | 21d0da8361143a970f1320c36d99e328015c6f06 (diff) | |
download | pidgin-2b143dd78382a35175adaf3e659c1807f9133c3a.tar.gz |
Remove soupcompat.h since we require libsoup3 now
Testing Done:
Compiled
Reviewed at https://reviews.imfreedom.org/r/2068/
-rw-r--r-- | finch/plugins/gnttinyurl/gnttinyurl.c | 2 | ||||
-rw-r--r-- | libpurple/meson.build | 1 | ||||
-rw-r--r-- | libpurple/protocols/facebook/api.c | 1 | ||||
-rw-r--r-- | libpurple/protocols/facebook/data.c | 1 | ||||
-rw-r--r-- | libpurple/protocols/facebook/http.c | 2 | ||||
-rw-r--r-- | libpurple/protocols/facebook/meson.build | 3 | ||||
-rw-r--r-- | libpurple/protocols/gg/avatar.c | 1 | ||||
-rw-r--r-- | libpurple/protocols/gg/edisc.c | 1 | ||||
-rw-r--r-- | libpurple/protocols/gg/oauth/oauth-purple.c | 1 | ||||
-rw-r--r-- | libpurple/protocols/gg/pubdir-prpl.c | 1 | ||||
-rw-r--r-- | libpurple/protocols/jabber/bosh.c | 1 | ||||
-rw-r--r-- | libpurple/protocols/jabber/oob.c | 2 | ||||
-rw-r--r-- | libpurple/protocols/jabber/useravatar.c | 1 | ||||
-rw-r--r-- | libpurple/soupcompat.h | 163 | ||||
-rw-r--r-- | meson.build | 21 | ||||
-rw-r--r-- | meson_options.txt | 3 |
16 files changed, 7 insertions, 198 deletions
diff --git a/finch/plugins/gnttinyurl/gnttinyurl.c b/finch/plugins/gnttinyurl/gnttinyurl.c index 59994e10a9..6b9d5dcdae 100644 --- a/finch/plugins/gnttinyurl/gnttinyurl.c +++ b/finch/plugins/gnttinyurl/gnttinyurl.c @@ -27,8 +27,6 @@ #include <purple.h> -#include "soupcompat.h" - #include <gnt.h> #include <finch.h> diff --git a/libpurple/meson.build b/libpurple/meson.build index b0231d7454..56bb392c6a 100644 --- a/libpurple/meson.build +++ b/libpurple/meson.build @@ -342,7 +342,6 @@ pkgconfig.generate( requires : [glib, gdk_pixbuf, 'gplugin'], variables : [ f'plugindir=${libdir}/@purple_filebase@', - f'soupapiversion=@soup_api_version@', ]) if enable_introspection diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c index 660782a7d4..f7578b23c4 100644 --- a/libpurple/protocols/facebook/api.c +++ b/libpurple/protocols/facebook/api.c @@ -27,7 +27,6 @@ #include <string.h> #include "libpurple/glibcompat.h" -#include "libpurple/soupcompat.h" #include "api.h" #include "http.h" diff --git a/libpurple/protocols/facebook/data.c b/libpurple/protocols/facebook/data.c index 7809ac32dc..709db6e931 100644 --- a/libpurple/protocols/facebook/data.c +++ b/libpurple/protocols/facebook/data.c @@ -24,7 +24,6 @@ #include <purple.h> #include "libpurple/glibcompat.h" -#include "libpurple/soupcompat.h" #include "api.h" #include "data.h" diff --git a/libpurple/protocols/facebook/http.c b/libpurple/protocols/facebook/http.c index ce7c397ba5..473f434b8b 100644 --- a/libpurple/protocols/facebook/http.c +++ b/libpurple/protocols/facebook/http.c @@ -25,8 +25,6 @@ #include "http.h" -#include "libpurple/soupcompat.h" - GQuark fb_http_error_quark(void) { diff --git a/libpurple/protocols/facebook/meson.build b/libpurple/protocols/facebook/meson.build index dc9844f516..efa83acd2e 100644 --- a/libpurple/protocols/facebook/meson.build +++ b/libpurple/protocols/facebook/meson.build @@ -44,7 +44,8 @@ if DYNAMIC_FACEBOOK if enable_introspection introspection_sources = FACEBOOK_SOURCES - facebook_gir_includes = ['GObject-2.0', 'Gio-2.0', 'Gst-1.0', 'Json-1.0', f'Soup-@soup_api_version@', libpurple_gir[0]] + facebook_gir_includes = ['GObject-2.0', 'Gio-2.0', 'Gst-1.0', + 'Json-1.0', 'Soup-3.0', libpurple_gir[0]] facebook_gir = gnome.generate_gir(facebook_prpl, sources : introspection_sources, diff --git a/libpurple/protocols/gg/avatar.c b/libpurple/protocols/gg/avatar.c index efa3312a56..d45f9ee6af 100644 --- a/libpurple/protocols/gg/avatar.c +++ b/libpurple/protocols/gg/avatar.c @@ -30,7 +30,6 @@ #include "avatar.h" #include "libpurple/glibcompat.h" -#include "libpurple/soupcompat.h" #include "gg.h" #include "utils.h" diff --git a/libpurple/protocols/gg/edisc.c b/libpurple/protocols/gg/edisc.c index b8d8fd43c1..2508a93b4a 100644 --- a/libpurple/protocols/gg/edisc.c +++ b/libpurple/protocols/gg/edisc.c @@ -36,7 +36,6 @@ #include <glib/gi18n-lib.h> #include <purple.h> -#include "libpurple/soupcompat.h" #define GGP_EDISC_OS "WINNT x86-msvc" #define GGP_EDISC_TYPE "desktop" diff --git a/libpurple/protocols/gg/oauth/oauth-purple.c b/libpurple/protocols/gg/oauth/oauth-purple.c index e1a7e61557..e8a1403498 100644 --- a/libpurple/protocols/gg/oauth/oauth-purple.c +++ b/libpurple/protocols/gg/oauth/oauth-purple.c @@ -35,7 +35,6 @@ #include "../xml.h" #include <purple.h> -#include "libpurple/soupcompat.h" #define GGP_OAUTH_RESPONSE_MAX 10240 diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c index 75ebddc17a..131050f31f 100644 --- a/libpurple/protocols/gg/pubdir-prpl.c +++ b/libpurple/protocols/gg/pubdir-prpl.c @@ -30,7 +30,6 @@ #include <glib/gi18n-lib.h> #include <purple.h> -#include "libpurple/soupcompat.h" #include "pubdir-prpl.h" #include "gg.h" diff --git a/libpurple/protocols/jabber/bosh.c b/libpurple/protocols/jabber/bosh.c index bd2727b014..5a3530abf9 100644 --- a/libpurple/protocols/jabber/bosh.c +++ b/libpurple/protocols/jabber/bosh.c @@ -25,7 +25,6 @@ #include <purple.h> #include <libsoup/soup.h> -#include "libpurple/soupcompat.h" #include "bosh.h" diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index 9e0fe8bd85..a87d47ef6a 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -22,8 +22,6 @@ */ #include <purple.h> -#include "libpurple/soupcompat.h" - #include "jabber.h" #include "iq.h" #include "oob.h" diff --git a/libpurple/protocols/jabber/useravatar.c b/libpurple/protocols/jabber/useravatar.c index c61004d20d..a872c3bf6c 100644 --- a/libpurple/protocols/jabber/useravatar.c +++ b/libpurple/protocols/jabber/useravatar.c @@ -27,7 +27,6 @@ #include <purple.h> #include "libpurple/glibcompat.h" -#include "libpurple/soupcompat.h" #include <libsoup/soup.h> diff --git a/libpurple/soupcompat.h b/libpurple/soupcompat.h deleted file mode 100644 index d79d55450f..0000000000 --- a/libpurple/soupcompat.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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; -} - -static inline SoupMessage * -soup_message_new_from_encoded_form(const gchar *method, - const gchar *uri_string, - gchar *encoded_form) -{ - SoupMessage *msg = NULL; - SoupURI *uri; - - g_return_val_if_fail(method != NULL, NULL); - g_return_val_if_fail(uri_string != NULL, NULL); - g_return_val_if_fail(encoded_form != NULL, NULL); - - uri = soup_uri_new(uri_string); - if (!uri || !uri->host) { - g_free(encoded_form); - soup_uri_free(uri); - return NULL; - } - - if (strcmp(method, "GET") == 0) { - g_free(uri->query); - uri->query = encoded_form; - msg = soup_message_new_from_uri(method, uri); - } else if (strcmp (method, "POST") == 0 || strcmp (method, "PUT") == 0) { - msg = soup_message_new_from_uri(method, uri); - soup_message_body_append_take(msg->request_body, - (guchar *)encoded_form, - strlen(encoded_form)); - } else { - g_free(encoded_form); - } - - soup_uri_free(uri); - - return msg; -} - -static inline void -soup_message_set_request_body_from_bytes(SoupMessage *msg, - const gchar *content_type, - GBytes *bytes) -{ - gconstpointer data = NULL; - gsize length = 0; - - data = g_bytes_get_data(bytes, &length); - soup_message_set_request(msg, content_type, SOUP_MEMORY_COPY, - data, length); -} - -static inline void -soup_session_send_and_read_async_cancel_cb(GCancellable *cancellable, - gpointer data) -{ - GTask *task = data; - SoupSession *session = g_task_get_source_object(task); - SoupMessage *msg = g_task_get_task_data(task); - - soup_session_cancel_message(session, msg, SOUP_STATUS_CANCELLED); -} - -static inline void -soup_session_send_and_read_sync_cb(SoupSession *session, SoupMessage *msg, - gpointer data) -{ - GTask *task = data; - - if(SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) { - GBytes *bytes = g_bytes_new(msg->response_body->data, - msg->response_body->length); - g_task_return_pointer(task, bytes, (GDestroyNotify)g_bytes_unref); - } else { - g_task_return_new_error(task, SOUP_HTTP_ERROR, msg->status_code, - "SoupMessage returned failure: (%d) %s", - msg->status_code, msg->reason_phrase); - } - - g_object_unref(task); -} - -static inline GBytes * -soup_session_send_and_read_finish(SoupSession *session, GAsyncResult *result, - GError **error) -{ - g_return_val_if_fail(SOUP_IS_SESSION(session), NULL); - - return g_task_propagate_pointer(G_TASK(result), error); -} - -static inline void -soup_session_send_and_read_async(SoupSession *session, SoupMessage *msg, - gint priority, GCancellable *cancellable, - GAsyncReadyCallback cb, gpointer data) -{ - GTask *task = NULL; - - task = g_task_new(session, cancellable, cb, data); - g_task_set_priority(task, priority); - g_task_set_task_data(task, g_object_ref(msg), g_object_unref); - g_cancellable_connect(cancellable, - G_CALLBACK(soup_session_send_and_read_async_cancel_cb), - g_object_ref(task), g_object_unref); - - soup_session_queue_message(session, msg, - soup_session_send_and_read_sync_cb, task); -} - -#endif /* SOUP_MAJOR_VERSION < 3 */ - -#endif /* PURPLE_SOUPCOMPAT_H */ diff --git a/meson.build b/meson.build index e1d0a487b7..178c616248 100644 --- a/meson.build +++ b/meson.build @@ -274,22 +274,11 @@ json = dependency('json-glib-1.0', version : '>= 0.14.0') # Check for libsoup (required) ####################################################################### -libsoup = disabler() -if not get_option('soup2') - libsoup = dependency('libsoup-3.0', version : '>= 3') - add_project_arguments( - '-DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_3_0', - '-DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_3_0', - language : 'c') - soup_api_version = '3.0' -else - libsoup = dependency('libsoup-2.4', version : '>= 2.42') - add_project_arguments( - '-DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_42', - '-DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_42', - language : 'c') - soup_api_version = '2.4' -endif +libsoup = dependency('libsoup-3.0', version : '>= 3') +add_project_arguments( + '-DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_3_0', + '-DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_3_0', + language : 'c') ####################################################################### # Check for sqlite3 (required) diff --git a/meson_options.txt b/meson_options.txt index c463fb4929..993871cb52 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,9 +25,6 @@ option('kwallet', type : 'feature', option('libsecret', type : 'feature', description : 'enable libsecret support') -option('soup2', type : 'boolean', value : false, - description : 'compile against libsoup2') - ############################################################################## # Protocol Plugins |