Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purple-gowhatsapp compatibility #400

Closed
Nunction opened this issue Dec 24, 2020 · 2 comments
Closed

purple-gowhatsapp compatibility #400

Nunction opened this issue Dec 24, 2020 · 2 comments
Labels

Comments

@Nunction
Copy link

I am trying to get purple-gowhatsapp running with Spectrum2. Linking purple-gowhatsapp with WhatsApp Web and subsequent sending and receiving of messages is working. However after completing the linking to WhatsApp Web and having Spectrum2 restart, the linking with WhatsApp Web is lost. This appears to happen because Spectrum2 recreates the accounts.xml on transport restart and purple-gowhatsapp persists the WhatsApp Web session in said file.

Expected Behavior

WhatsApp Web linking (session) is preserved across reboots.

Current Behavior

WhatsApp Web linking (session) is lost during restart.

Possible Solution

Persist and restore purple-gowhatsapp specific session entries from accounts.xml in the database, similar to prpl-steam-mobile and prpl-eionrobb-discord.

Entry names as taken from purple-gowhatsapp source:

  • int: last-new-messages-timestamp
  • string: clientid
  • string: clientToken
  • string: serverToken
  • string: encKey
  • string: macKey
  • string: wid

Steps to Reproduce

  1. Configure purple-gowhatsapp as transport in scpectrum.
  2. Perform registration on transport
  3. Restart Spectrum2
  4. accounts.xml is recreated thus reasing purple-gowhatsapp specific entries.

Environment

System: Debian GNU/Linux 10 (buster)
APT repository: deb https://packages.spectrum.im/spectrum2/ buster main
Spectrum2 version: 2.0.13
Transport config:

[service]
frontend=xmpp
allowed_servers=example.com
jid = whatsapp.example.com
password = <password>
server = 127.0.0.1
port = 5347
backend_host = 127.0.0.1
web_directory=/var/www/spectrum/whatsapp/
web_url=https://example.com/spectrum/whatsapp
users_per_backend=10
backend=/usr/bin/spectrum2_libpurple_backend
protocol=prpl-hehoe-gowhatsapp

[identity]
name=Gateway to WhatsApp
type=whatsapp
category=gateway

[logging]
config = /etc/spectrum2/logging.cfg
backend_config = /etc/spectrum2/backend-logging.cfg

[database]
type = mysql
database = spectrum
server = 127.0.0.1
port = 3306
user = <user>
password = <password>
prefix = whatsapp_

[registration]
enable_public_registration = 0
username_label= You can enter an arbitrary username. However, it is recommended to use your own internationalized number. (e.g. 49123456789):

[purple]
# Use stored credentials for login.
# Default: true
restore-session = true

# Fetch contact list from phone on connect.
# Default: true
pull-contacts = false

# Mark displayed messages as read.
# Default: true
mark-read = true

# Download user profile pictures (may cause GUI hiccups after connecting)
# Default: false
get-icons = true

# Plain text login.
# Default: false
# Gajim sometimes has problems with inline images from this transport. May need to use plain text login and manually convert to a QR code image.
plain-text-login = false

# Display all contacts as online.
# Default: true
fake-online = true

# Number of received messages to remember as already shown.
# Default: 1000
message-id-store-size = 1000

# Do not show messages older than previous session.
# Default: false
message-timestamp-filter = true

# Treat system messages like normal messages (spectrum2 compatibility).
# Default: false
system-messages-are-ordinary-messages = true

# Download files from media (image, audio, video, document) messages.
# Default: false
download-attachments = true

# Try to download once only.
# Default: true
download-try-only-once = false

# Display images in conversation window after download
# Default: true
inline-images = true
@vitalyster
Copy link
Collaborator

vitalyster commented Dec 24, 2020

Yes, that is a known issue, there is an ongoing PR to save/restore all settings from accounts.xml, but it was not complete yet.
Alternative solution - do not delete accounts.xml and keep all libpurple accounts there, need a lot of testing and this may have a lot of issues. Contributions are welcomed :)

@vitalyster
Copy link
Collaborator

Duplicate of #264

@vitalyster vitalyster marked this as a duplicate of #264 Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants