Bug 40537

Summary: Make dependency on libsoup optional
Product: Telepathy Reporter: Mikhail Zabaluev <mikhail.zabaluev>
Component: gabbleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium CC: danielle
Version: git masterKeywords: patch
Hardware: Other   
OS: All   
URL: http://cgit.freedesktop.org/~zabaluev/telepathy-gabble/log/?h=soup-is-optional
Whiteboard: review+
i915 platform: i915 features:

Description Mikhail Zabaluev 2011-09-01 01:33:45 UTC
telepathy-gabble has a dependency on libsoup, which is used only for the special case of allocating Jingle proxies for Google Talk.
For small platform installations where Jingle calls are not a major use case, this dependency becomes an outlier.

The proposed patch makes Google relay support, along with the libsoup dependency, optional.
Comment 1 Danielle Madeley 2011-09-01 01:40:00 UTC
 #ifdef ENABLE_GOOGLE_RELAY
-
   tp_clear_object (&self->soup);
+#endif

Unrequired ifdef. self->soup == NULL.

It would be nice to squash these commits.

+static RelaySessionData *
+relay_session_data_new (guint requests_to_do,
+                        GabbleJingleFactoryRelaySessionCb callback,
+                        gpointer user_data)

+static void
+translate_relay_info (GPtrArray *relays,
+                      const gchar *relay_ip,
+                      const gchar *username,
+                      const gchar *password,
+                      const gchar *static_type,
+                      const gchar *port_string,
+                      guint component)

+static void
+on_http_response (SoupSession *soup,
+                  SoupMessage *msg,
+                  gpointer user_data)

+void
+gabble_google_relay_resolver_resolve (GabbleGoogleRelayResolver *self,
+                                      guint components,
+                                      const gchar *server,
+                                      guint16 port,
+                                      const gchar *token,
+                                      GabbleJingleFactoryRelaySessionCb callback,
+                                      gpointer user_data)

Not in Telepathy style.

As mentioned, it would be nice to make this a GIO-style function, but I don't think that's a blocker.
Comment 2 Mikhail Zabaluev 2011-09-01 02:00:45 UTC
(In reply to comment #1)
>  #ifdef ENABLE_GOOGLE_RELAY
> -
>    tp_clear_object (&self->soup);
> +#endif
> 
> Unrequired ifdef. self->soup == NULL.

soup is not declared in the no-relay case.
I don't think shifting the delta to the structure declaration by defining a dummy GObject *soup member would improve the code much.

> It would be nice to squash these commits.

Done (please force-pull your local branches if any).

> +static RelaySessionData *
> +relay_session_data_new (guint requests_to_do,
> +                        GabbleJingleFactoryRelaySessionCb callback,
> +                        gpointer user_data)
> 
> +static void
> +translate_relay_info (GPtrArray *relays,
> +                      const gchar *relay_ip,
> +                      const gchar *username,
> +                      const gchar *password,
> +                      const gchar *static_type,
> +                      const gchar *port_string,
> +                      guint component)
> 
> +static void
> +on_http_response (SoupSession *soup,
> +                  SoupMessage *msg,
> +                  gpointer user_data)
> 
> Not in Telepathy style.

I copied most of these from older code :) OK, indented properly now.
Comment 3 Mikhail Zabaluev 2011-09-01 03:29:07 UTC
(In reply to comment #2)
> I don't think shifting the delta to the structure declaration by defining a
> dummy GObject *soup member would improve the code much.

In fact, it would, because an empty structure is not too good either.
Fixed:
http://cgit.freedesktop.org/~zabaluev/telepathy-gabble/commit/?h=soup-is-optional&id=28b64163e8bbca02de308612f6653ed291e2b1df
Comment 4 Will Thompson 2011-09-26 09:13:30 UTC
Merged to master: thanks! http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=6211097
Comment 5 Mikhail Zabaluev 2011-10-11 11:14:01 UTC
I had to record another patch to disable tests in jingle/stun-server.py which use Google Relay.
Again, offered here:
http://cgit.freedesktop.org/~zabaluev/telepathy-gabble/log/?h=soup-is-optional
Comment 6 Danielle Madeley 2011-10-11 14:59:16 UTC
(In reply to comment #5)
> I had to record another patch to disable tests in jingle/stun-server.py which
> use Google Relay.
> Again, offered here:
> http://cgit.freedesktop.org/~zabaluev/telepathy-gabble/log/?h=soup-is-optional

++
Comment 7 Mikhail Zabaluev 2011-10-12 03:45:15 UTC
Thanks, merged to master.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.