pidgin/pidgin

Pass correct proxy resolver to Facebook soup session.

2019-10-10, Elliott Sales de Andrade
1827a7e715e0
Parents 70a9571132e4
Children e1f89f9596cf
Pass correct proxy resolver to Facebook soup session.
--- a/libpurple/protocols/facebook/api.c Thu Oct 10 01:39:27 2019 -0400
+++ b/libpurple/protocols/facebook/api.c Thu Oct 10 02:38:04 2019 -0400
@@ -522,10 +522,8 @@
fb_api_init(FbApi *api)
{
FbApiPrivate *priv = fb_api_get_instance_private(api);
-
api->priv = priv;
- priv->cons = soup_session_new();
priv->msgs = g_queue_new();
priv->data = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, NULL);
@@ -1948,7 +1946,7 @@
}
FbApi *
-fb_api_new(PurpleConnection *gc)
+fb_api_new(PurpleConnection *gc, GProxyResolver *resolver)
{
FbApi *api;
FbApiPrivate *priv;
@@ -1957,6 +1955,8 @@
priv = api->priv;
priv->gc = gc;
+ priv->cons = soup_session_new_with_options(SOUP_SESSION_PROXY_RESOLVER,
+ resolver, NULL);
priv->mqtt = fb_mqtt_new(gc);
g_signal_connect(priv->mqtt,
--- a/libpurple/protocols/facebook/api.h Thu Oct 10 01:39:27 2019 -0400
+++ b/libpurple/protocols/facebook/api.h Thu Oct 10 02:38:04 2019 -0400
@@ -551,14 +551,14 @@
/**
* fb_api_new:
* @gc: The #PurpleConnection.
+ * @resolver: The proxy resolver to use from the account.
*
* Creates a new #FbApi. The returned #FbApi should be freed with
* #g_object_unref() when no longer needed.
*
* Returns: The new #FbApi.
*/
-FbApi *
-fb_api_new(PurpleConnection *gc);
+FbApi *fb_api_new(PurpleConnection *gc, GProxyResolver *resolver);
/**
* fb_api_rehash:
--- a/libpurple/protocols/facebook/data.c Thu Oct 10 01:39:27 2019 -0400
+++ b/libpurple/protocols/facebook/data.c Thu Oct 10 02:38:04 2019 -0400
@@ -125,7 +125,6 @@
FbDataPrivate *priv = fb_data_get_instance_private(fata);
fata->priv = priv;
- priv->cons = soup_session_new();
priv->msgs = g_queue_new();
priv->imgs = g_hash_table_new_full(g_direct_hash, g_direct_equal,
@@ -167,7 +166,7 @@
}
FbData *
-fb_data_new(PurpleConnection *gc)
+fb_data_new(PurpleConnection *gc, GProxyResolver *resolver)
{
FbData *fata;
FbDataPrivate *priv;
@@ -175,7 +174,9 @@
fata = g_object_new(FB_TYPE_DATA, NULL);
priv = fata->priv;
- priv->api = fb_api_new(gc);
+ priv->cons = soup_session_new_with_options(SOUP_SESSION_PROXY_RESOLVER,
+ resolver, NULL);
+ priv->api = fb_api_new(gc, resolver);
priv->gc = gc;
return fata;
--- a/libpurple/protocols/facebook/data.h Thu Oct 10 01:39:27 2019 -0400
+++ b/libpurple/protocols/facebook/data.h Thu Oct 10 02:38:04 2019 -0400
@@ -83,14 +83,14 @@
/**
* fb_data_new:
* @gc: The #PurpleConnection.
+ * @resolver: The proxy resolver to use from the account.
*
* Creates a new #FbData. The returned #FbData should be freed with
* #g_object_unref() when no longer needed.
*
* Returns: The new #FbData.
*/
-FbData *
-fb_data_new(PurpleConnection *gc);
+FbData *fb_data_new(PurpleConnection *gc, GProxyResolver *resolver);
/**
* fb_data_load:
--- a/libpurple/protocols/facebook/facebook.c Thu Oct 10 01:39:27 2019 -0400
+++ b/libpurple/protocols/facebook/facebook.c Thu Oct 10 02:38:04 2019 -0400
@@ -994,10 +994,20 @@
FbData *fata;
gpointer convh;
PurpleConnection *gc;
+ GProxyResolver *resolver;
+ GError *error = NULL;
gc = purple_account_get_connection(acct);
- fata = fb_data_new(gc);
+ resolver = purple_proxy_get_proxy_resolver(acct, &error);
+ if (resolver == NULL) {
+ fb_util_debug_error("Unable to get account proxy resolver: %s",
+ error->message);
+ purple_connection_g_error(gc, error);
+ return;
+ }
+
+ fata = fb_data_new(gc, resolver);
api = fb_data_get_api(fata);
convh = purple_conversations_get_handle();
purple_connection_set_protocol_data(gc, fata);