EionRobb/purple-googlechat

Chat history message flood on reconnect with spectrum2

Opened this issue · 3 comments

sfjes commented

Hi,

I'm using purple-googlechat with spectrum2 (which acts as an xmpp-to-libpurple gateway), which seems to work for the most part (though I've only tested basic messaging).

However one issue I've noticed is that each time the spectrum2/purple-googlechat reconnects to Google, my xmpp client gets a flood of messages from each of my contacts containing all the messages from our chat history, and not just since spectrum2/purple-googlechat was last connected. The historical messages have accurate timestamps, but show up as new messages in both my xmpp clients (Adium and Conversations).

I'm not sure how the chat history feature works, and whether this is a case of last-read markers not being passed along and thus too much chat history retrieved, or if it's just normal behavior for libpurple-googlechat to collect the whole history, which it normally handles more gracefully when installed as a plugin in Pidgin. While I could manage without having long-term history available to the XMPP client via the spectrum2 gateway, it would be nice to be able to receive any messages that were sent to me while spectrum2 wasn't connected to Google Chat.

As an aside (and this might be user error), I couldn't get past oauth login normally via spectrum2. I'd receive a message from the gateway JID asking me to enter the code provided by Google, but when I messaged the code back nothing would happen. In the end I worked around this by connecting with purple-googlechat in Pidgin, then copying the saved auth token from accounts.xml into spectrum2's sqlite user database.

@sfjes, If I may ask, how did you manage to link purple-googlechat to spectrum2?

I've plugged a handful of gateways to spectrum2 though the years but this one strangely fails with Invalid protocol prpl-googlechat. I just want to confirm if I've got the right configuration blurb (I found no documentation); here are the salient configs I use:

[service]
server_mode =  0
users_per_backend = 1
backend = /path/to/spectrum2_libpurple_backend
protocol = prpl-googlechat
[purple]
# Empty
[identity]
name = googlechat.my.example.domain.com
type = xmpp
category = gateway
[registration]
enable_public_registration = 1
auto_register = 1
require_local_account = 0

libgooglechat.so is installed at the right location, in the same directory as other gateway plugins such as libslack.so that do work.

sfjes commented

Hi @waptaff, sure. Your configuration looks OK to me (though I only use spectrum for this and prpl-hehoe-whatsmeow. Both used in gateway mode.

[service]
jid = googlechat.example.com
users_per_backend=10  # have only tried one at a time
backend=/usr/bin/spectrum2_libpurple_backend
protocol=prpl-googlechat

[identity]
name=Spectrum Google Chat Transport
type=xmpp
category=gateway

[registration]
enable_public_registration=1

[purple]
unravel_google_url = true
fetch_image_history = true
hide_self = false
treat_invisible_as_offline = false
show-call-links = true

I don't believe any of the [purple] options were necessary for initial setup. I didn't have any problems loading the prpl-googlechat, just getting registered. My build process was the standard Debian/Ubuntu purple-hangouts instructions.

Still having the message dump issue, though less often lately since it seems like GChat has been dropping connections less often.

I have never heard about Spectrum2 and didn't do anything to use it explicitly, but is it possible that my Pidgin is using it anyway? I ask because I am experiencing the same symptoms (message floods on each connect) and am wondering whether this ticket tracks the issue I am experiencing.