On Sun, Sep 08, 2013 at 10:37:13AM +0100, Simon McVittie wrote:
> telepathy-gabble 0.18.1 has the same patch and basically no other
> changes. I'll try to get it uploaded on Monday if nobody gets there first.

Cool.

FWIW, I'm attaching a patch which fixes Facebook chat on squeeze as
well.  There, a further patch is required (taken from 0ca8f572) to make
gabble not discard the roster sent by the Facebook XMPP (resulting in no
contacts being displayed).  Not sure this warrants a seperate bug as it
appears to be due to the same root cause, but I think stable/oldstable
uploads are in order to fix this.


Michael
commit c4e19a478599d12824dddcba83de907fa8adf310
Author: Xavier Claessens <xclae...@gmail.com>
Date:   Tue Oct 25 16:44:36 2011 +0200

    Accept from="server.com" as stanzas coming from server
    
    Some servers does not set the full/bare jid.
    
    Fixes fdo#39057

diff --git a/tests/wocky-porter-test.c b/tests/wocky-porter-test.c
index ca64f0f..08e9d4d 100644
diff --git a/wocky/wocky-c2s-porter.c b/wocky/wocky-c2s-porter.c
index 52ee2f9..713df5a 100644
--- a/lib/ext/wocky/wocky/wocky-porter.c
+++ b/lib/ext/wocky/wocky/wocky-porter.c
@@ -76,6 +76,7 @@ struct _WockyC2SPorterPrivate
   gchar *full_jid;
   gchar *bare_jid;
   gchar *resource;
+  gchar *domain;
 
   /* Queue of (sending_queue_elem *) */
   GQueue *sending_queue;
@@ -361,7 +362,7 @@ wocky_c2s_porter_set_property (GObject *object,
 
   switch (property_id)
     {
-      gchar *node, *domain;
+      gchar *node;
 
       case PROP_CONNECTION:
         g_assert (priv->connection == NULL);
@@ -376,10 +377,9 @@ wocky_c2s_porter_set_property (GObject *object,
 
         priv->full_jid = g_value_dup_string (value);
         g_assert (priv->full_jid != NULL);
-        wocky_decode_jid (priv->full_jid, &node, &domain, &priv->resource);
-        priv->bare_jid = wocky_compose_jid (node, domain, NULL);
+        wocky_decode_jid (priv->full_jid, &node, &priv->domain, &priv->resource);
+        priv->bare_jid = wocky_compose_jid (node, priv->domain, NULL);
         g_free (node);
-        g_free (domain);
         break;
 
       default:
@@ -844,7 +846,7 @@ check_spoofing (WockyC2SPorter *self,
     goto finally;
 
   /* if we sent an IQ without a 'to' attribute, it's to our server: allow it
-   * to use our full or bare JID to reply */
+   * to use our full/bare JID or domain to reply */
   if (should_be_from == NULL)
     {
       if (stanza_is_from_server (self, nfrom))
>From cd51cd6973941e08b854a2b3a56e3c47e5f3c7d9 Mon Sep 17 00:00:00 2001
From: David Edmundson <k...@davidedmundson.co.uk>
Date: Mon, 2 Sep 2013 01:32:14 +0000
Subject: [PATCH] If we send an IQ to a server allow "from" to be empty

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68829
Origin: upstream, 0.18.1
---
 wocky/wocky-c2s-porter.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/wocky/wocky-c2s-porter.c b/wocky/wocky-c2s-porter.c
index 8f0daa0..02c46cd 100644
--- a/lib/ext/wocky/wocky/wocky-porter.c
+++ b/lib/ext/wocky/wocky/wocky-porter.c
@@ -859,6 +859,16 @@ check_spoofing (WockyC2SPorter *self,
         goto finally;
     }
 
+  /* If we sent an IQ to the server itself, allow it to
+   * omit 'from' in its reply, which is normally used
+   * for messages from the server on behalf of our own
+   * account (as of 2013-09-02, the Facebook beta server
+   * does this). See fd.o #68829 */
+
+  if (from == NULL && !wocky_strdiff (should_be_from, self->priv->domain)) {
+      goto finally;
+  }
+
   /* if we sent an IQ to our full or bare JID, allow our server to omit 'to'
    * in the reply (Prosody 0.6.1 does this with the resulting error if we
    * send disco#info to our own bare JID), or to use our full JID. */
-- 
1.8.3.4

--- ./src/roster.c.orig	2013-09-08 15:06:04.487098988 +0200
+++ ./src/roster.c	2013-09-08 15:06:40.820177614 +0200
@@ -1579,23 +1579,6 @@
   if (query_node == NULL)
     return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
 
-  from = lm_message_node_get_attribute (
-      wocky_stanza_get_top_node (message), "from");
-
-  if (from != NULL)
-    {
-      TpHandle sender;
-
-      sender = tp_handle_lookup (contact_repo, from, NULL, NULL);
-
-      if (sender != conn->self_handle)
-        {
-           NODE_DEBUG (iq_node, "discarding roster IQ which is not from "
-              "ourselves or the server");
-          return LM_HANDLER_RESULT_REMOVE_MESSAGE;
-        }
-    }
-
   sub_type = lm_message_get_sub_type (message);
 
   /* if this is a result, it's from our initial query. if it's a set,

Reply via email to