Opened 5 years ago

Last modified 4 years ago

#16524 new patch

XMPP group chat history is duplicated

Reported by: ralfj Owned by: deryni
Milestone: Patches Needing Review Component: XMPP
Version: 2.10.11 Keywords:


Each time I join a group chat (after booting, coming back from suspend, regaining WiFi? connectivity, ...), Pidgin duplicates the last few lines of history of all group chats I joined. If there's a message containing my nick, it even shows a notification due to the highlight.

Steps to reproduce:

  • Join some group chat and type a message or two
  • disconnect
  • reconnect

Actual behavior: The last few messages are duplicated, resulting in the overall history being a total mess (after this is repeated a few times).

Expected behavior: Only new messages should be added, no existing ones duplicated.

Further information: With Gajim on the same servers and chats, things are working fine - so it seems to me that the problem is on the client-side, not the server-side.

It seems this problem was fixed in Adium four years ago: <>. Also see <>. I checked the XMPP console, but it seems that the "presence" message sent when joining a group chat, lacks the "history" tag indicating to the server what messages to send.

This is what Gajim sends when joining the group chat:

<presence xmlns="jabber:client" to="XXX" xml:lang="en" id="gajim_muc_90_3dcffd">
<x xmlns="vcard-temp:x:update">
<c xmlns="" node="" ver="OHkcneXc9eqyD5VIJDibu4fR0QY=" hash="sha-1" />
<x xmlns="">
<history maxstanzas="20" since="2015-01-03T11:13:28Z" />

And this is what Pidgin sends:

<presence to='XXX'>
	<c xmlns='' node='' hash='sha-1' ver='MBEjTtnkpI3a77SVLRwpSTU2KpA=' ext='voice-v1 camera-v1 video-v1'/>
	<x xmlns=''/>

Note the missing "history" tag below the "x".

Attachments (1)

0001-only-request-unseed-chat-history-from-jabber-group-c.patch (3.0 KB) - added by ralfj 4 years ago.
A first proposal for a patch implementing this

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by ralfj

A first proposal for a patch implementing this

comment:1 Changed 4 years ago by ralfj

I attached a first proposal for a patch implementing this - it's ready for review!

I should probably explain my change to pidgin_conv_write_conv: The purpose of this is to achieve the following behavior.

  • Log in to a bunch of group chats
  • Disconnect from LAN
  • Reconnect
  • If no new message has been posted, then the Pidgin status icon does *not* turn into "there are unseen messages"

This behavior is desirable as otherwise, being in several chats permanently becomes pretty annoying with Pidgin: Each time I come back from standby, or change WiFi?, I have to click away the "new" messages from all chats, even though there's not actually anything "new".

Not getting duplicate history is only one half to the story here. There are still system status messages that Pidgin itself adds to the conversation on every reconnect:

(18:23:55) The account has disconnected and you are no longer in this chat. You will automatically rejoin the chat when the account reconnects.
(18:23:58) %s has set the topic to: %s

The second of these triggers the "unseen messages" behavior. By excluding SYSTEM messages from this, I obtain the desired behavior.

I realize this may not be what you want. I'd actually prefer a solution where the topic message is not added needlessly, e.g. if the topic did not even change. But I found so such solution so far. In any case the rest of this patch should be useful independently, and any feedback is welcome.

comment:2 Changed 4 years ago by Robby

  • Milestone set to Patches Needing Review
  • Type changed from defect to patch

comment:3 Changed 4 years ago by dx

  • Component changed from unclassified to XMPP
  • Owner changed from EionRobb to deryni
Note: See TracTickets for help on using tickets.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!