Bug 27913

Summary: Backlog messages for users not in a MUC are dropped or received as private messages
Product: Wocky Reporter: Marco Barisione <marco.barisione>
Component: GeneralAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/wjt/wocky.git;a=shortlog;h=refs/heads/muc
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 27964    
Bug Blocks:    

Description Marco Barisione 2010-04-30 07:47:03 UTC
1. User A and B join a MUC
2. Both A and B write something
3. A leaves the MUC, while B doesn't
4. C joins the MUC and receive the backlog

The right behaviour would be to show the backlog with what both A and B wrote.
The actual behaviour is that in the MUC C receives what B said and not what A said.
The messages that A sent appear as a normal text channel coming directly from the conference room (like if the conference room was a normal user writing C something) or sometimes they are not received at all.
Comment 1 Will Thompson 2010-04-30 08:21:21 UTC
Here's a failing test case: http://git.collabora.co.uk/?p=user/wjt/telepathy-gabble-wjt.git;a=shortlog;h=refs/heads/fd.o-27913-broken-muc-scrollback

AFAICT MUC scrollback is previously entirely untested, which is pretty cool. But this test passes for scrollback from ourself and another current MUC member. It only fails when we hit the scrollback message from someone not in the MUC:

AssertionError: expected:
'/org/freedesktop/Telepathy/Connection/gabble/jabber/test_40localhost_2fResource/MucChannel1'
got:
'/org/freedesktop/Telepathy/Connection/gabble/jabber/test_40localhost_2fResource/ImChannel4'
FAIL: muc/scrollback.py
Comment 2 Will Thompson 2010-04-30 10:27:24 UTC
This is a WockyMuc bug. In wocky-muc.c, handle_message():


      who = g_hash_table_lookup (priv->members, from);
      if (who == NULL)
        {
          /* not another member, is it from 'ourselves'? */
          gchar *from_jid = wocky_normalise_jid (from);

          /* is it from us? fake up a member struct */
          if (g_str_equal (from_jid, priv->jid))
            {
              from_self = TRUE;
              g_free (from_jid);
            }
          else
            {
              DEBUG ("Message received from unknown MUC member %s.", from_jid);
              g_free (from_jid);
              return FALSE;
            }
        }

The else block is wrong.
Comment 3 Will Thompson 2010-05-04 09:10:26 UTC
I fixed this, because I was looking at the MUC code anyway while fixing things for bug 27964.

The branch refactors the function which handles MUC messages a bunch to be a bit clearer, and fixes some stuff that was mis-translated from the Gabble code. Unfortunately it added 24 lines of code. I consider this a personal failure.
Comment 4 Will Thompson 2010-06-03 11:27:23 UTC
Merged courtesy of review by Sjoerd! The snapshot in gabble 0.9.12 will include this fix.

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.