Commit graph

308 commits

Author SHA1 Message Date
Tulir Asokan
abbff16e66 Switch bridge state system to using state events 2021-08-04 16:14:47 +03:00
Tulir Asokan
4b80c15a0a Add some logs and increase timestamp difference for short-circuiting deduplication 2021-06-21 13:53:08 +03:00
Tulir Asokan
bc7a82c0be Use mutex for accessing go-whatsapp contacts and chats maps 2021-06-19 02:22:01 +03:00
Tulir Asokan
d3b9f4f637 Handle websocket keepalive errors and update deps 2021-06-15 15:07:42 +03:00
Tulir Asokan
b5c3e8abcb Make sure puppet has displayname set when sending message 2021-06-15 12:34:55 +03:00
Tulir Asokan
d4b7595b6e Add better error messages for some send errors 2021-06-15 12:07:31 +03:00
Tulir Asokan
06b84c4bb9 Add option to disable status bridging. Fixes #166 2021-06-01 15:28:15 +03:00
Tulir Asokan
74e21b8e1d Make bridge state monitoring more generic 2021-06-01 15:19:47 +03:00
Tulir Asokan
b07412b421 Don't mark messages older than chat info receive date as read after backfill 2021-05-18 20:09:12 +03:00
Tulir Asokan
66f0b04a31 Send double puppeting identifier with read receipts if server supports it 2021-05-18 15:23:19 +03:00
Tulir Asokan
62e806c8c3 Add option to disable backfill read receipt bridging 2021-05-18 14:16:35 +03:00
Tulir Asokan
1bdbf0a22d Update go-whatsapp 2021-05-18 13:15:40 +03:00
Tulir Asokan
b9b4c11d81 Update dependencies 2021-05-12 14:54:40 +03:00
Tulir Asokan
4c803a6a13 Include message tag when logging raw JSON messages 2021-05-04 21:44:55 +03:00
Tulir Asokan
947f3466b7 Treat muted until -1 as muted forever 2021-05-04 19:53:43 +03:00
Tulir Asokan
29254ee29a Add more logging to debug chat mute bridging 2021-05-04 13:50:35 +03:00
Tulir Asokan
2742d90299 Add option to only bridge mute status and tags when creating portal 2021-04-29 11:57:05 +03:00
Tulir Asokan
f9098cdf18 Add option to bridge chat pin status from WhatsApp 2021-04-20 16:32:23 +03:00
Tulir Asokan
badea9c547 Add option to bridge archive and mute status from WhatsApp 2021-04-19 22:14:32 +03:00
Tulir Asokan
9a6d9f0383 Don't start new post-login sync if old one is still in progress 2021-04-01 14:06:10 +03:00
Tulir Asokan
9f64b357e0 Mark Matrix room as read if WhatsApp chat is read after backfill 2021-03-22 14:16:04 +02:00
Tulir Asokan
c7ecae8129 Update asmux DM endpoint 2021-03-15 22:05:26 +02:00
Tulir Asokan
cbdd10e704 Send real-time whatsapp connection state to asmux 2021-03-15 18:06:16 +02:00
Tulir Asokan
0b5eeef689 Update mautrix-go to add auth type to register requests 2021-03-04 19:46:32 +02:00
Tulir Asokan
1c28fbb49b Fix more connection bugs 2021-02-25 13:49:28 +02:00
Tulir Asokan
37c2a064a5 Update go-whatsapp to handle query timeouts 2021-02-24 17:18:27 +02:00
Tulir Asokan
3b6d4322d6 Disable trying non-takeover reconnect first 2021-02-24 00:13:26 +02:00
Tulir Asokan
69e5a26e01 Improve handling of errors noticed in provisioning API pings 2021-02-24 00:06:11 +02:00
Tulir Asokan
a5d60bf87d Autoreconnect if keepalive ping throws error 2021-02-23 17:36:42 +02:00
Tulir Asokan
3b22015b83 Disable logging of all WebMessageInfos 2021-02-21 17:11:36 +02:00
Tulir Asokan
a911a0c1a9 Add better support for broadcast lists 2021-02-21 14:18:15 +02:00
Tulir Asokan
15b4350622 Save session to db when changed 2021-02-19 20:39:50 +02:00
Tulir Asokan
7bd47fabb2 Update go-whatsapp to break everything and maybe improve things 2021-02-18 23:36:14 +02:00
Tulir Asokan
69dd7f803a Move whatsapp-ext to go-whatsapp 2021-02-17 01:21:30 +02:00
Tulir Asokan
67a39bb6c8 Automatically re-login-matrix on M_UNKNOWN_TOKEN 2021-02-11 20:47:17 +02:00
Tulir Asokan
ba0ec021ba Update go-whatsapp 2021-02-10 21:20:31 +02:00
Tulir Asokan
e6045a3cf5 Fix bug if portal sync finishes early 2021-02-10 20:59:50 +02:00
Tulir Asokan
87ead90e03 Ignore group leaves in message history 2021-02-10 20:27:14 +02:00
Tulir Asokan
db2793c5e1 Maybe handle syncing after repeated dis/connections better 2021-02-10 12:13:18 +02:00
Tulir Asokan
394da69a69 Ignore picture commands if chat meta sync is disabled
We get the same data from the message log
2021-02-09 23:52:55 +02:00
Tulir Asokan
2188dc7701 Add option to not re-sync chat info and user avatars to avoid rate limits 2021-02-09 23:41:13 +02:00
Tulir Asokan
fec43431f7 Cancel login if websocket is closed 2021-02-07 22:14:13 +02:00
Tulir Asokan
1c801594d5 Add option to auto-reconnect even on clean disconnects 2021-02-05 19:26:26 +02:00
Tulir Asokan
3c7ff4bc0c Miscellaneous improvements to connection management 2021-02-05 19:26:09 +02:00
Tulir Asokan
0c3b08cd97 Update mautrix-go 2020-12-28 00:22:40 +02:00
Tulir Asokan
7d54aca762 Add metric for tracking buffer size 2020-11-16 14:28:08 +02:00
Tulir Asokan
56e4a67f42 Update mautrix-go 2020-11-10 12:37:33 +02:00
Tulir Asokan
673f5a8389 Fix dropped message log 2020-11-06 15:56:07 +02:00
Tulir Asokan
4eacece8ba Use ring buffer for message handling
This can sometimes avoid dropping the wrong messages if syncing chats
takes too long.
2020-11-06 15:52:18 +02:00
Tulir Asokan
221326bcbf Add metric for users locked in post-login sync 2020-11-06 02:38:31 +02:00
Tulir Asokan
bf5be3fe62 Add more debug logs in post-connection code 2020-11-06 02:29:14 +02:00
Tulir Asokan
f21f57f09f Fix delete-session not deleting all cached state 2020-10-04 13:55:09 +03:00
Tulir Asokan
3dae9b1999 Add connection state to prometheus metrics 2020-09-27 22:30:08 +03:00
Tulir Asokan
d67c3a8c96 Wait up to 3 seconds for encryption keys to arrive 2020-09-24 15:25:36 +03:00
Tulir Asokan
4b3c411f2f Ping again if stream goes to sleep soon after connection 2020-09-17 18:48:37 +03:00
Tulir Asokan
075689dacf Update go-whatsapp and rename device name config fields 2020-09-04 17:54:59 +03:00
Tulir Asokan
2638204eaa Add option to update m.direct with double puppeting 2020-08-22 13:07:55 +03:00
Tulir Asokan
7c67fe75eb Move post-connection ping to after chat list times out 2020-08-05 22:06:54 +03:00
Tulir Asokan
dd8b5097cb Support both WhatsApp read receipt event types 2020-07-30 18:28:47 +03:00
Tulir Asokan
25a99c4464 Bridge own read receipts from WhatsApp mobile with double puppeting 2020-07-30 18:08:26 +03:00
Tulir Asokan
51f0be415b Disconnect and reconnect automatically if post-login ping fails 2020-07-28 15:58:36 +03:00
Tulir Asokan
31049cd4d5 Call AdminTest() right after connecting 2020-07-27 13:06:03 +03:00
Tulir Asokan
ded9e31315 Add simple method for sending bridge notices 2020-07-27 13:05:42 +03:00
Tulir Asokan
0430446d6d Make message buffers bigger and make locking message handling less hacky 2020-07-23 20:10:21 +03:00
Tulir Asokan
9ac7544b64 Fix handling contact messages 2020-07-16 21:08:20 +03:00
Tulir Asokan
4608c09656 Escape % in battery low warning. Fixes #205 2020-07-04 16:21:41 +03:00
Tulir Asokan
d9874ab1b4 Improve low battery warning 2020-06-30 17:21:17 +03:00
Tulir Asokan
2132bc653b Handle WhatsApp chat create events 2020-06-26 00:13:18 +03:00
Tulir Asokan
8cfb04a5ed Handle WhatsApp invites. Fixes #120 2020-06-26 00:13:03 +03:00
Tulir Asokan
326293303d Handle WhatsApp kicks and Matrix invites 2020-06-25 23:58:35 +03:00
Tulir Asokan
3460d7b6e8 Make WhatsApp device name configurable 2020-06-25 17:59:44 +03:00
Tulir Asokan
f4ce80f98e Handle contact and battery events 2020-06-25 16:44:51 +03:00
Tulir Asokan
5a04f6c871 Add simple disconnection count to metrics 2020-06-22 12:43:25 +03:00
Tulir Asokan
ec86259a20 Update bridge info when portal metadata changes 2020-06-15 14:56:52 +03:00
Tulir Asokan
210b1caf65 Add bridging of location messages to Matrix 2020-06-10 14:58:57 +03:00
Tulir Asokan
e4a160e650 Add basic bridging of contact messages to Matrix 2020-06-10 14:06:36 +03:00
Tulir Asokan
3f35a90145 Send plain version number to WhatsApp 2020-06-03 20:59:44 +03:00
Tulir Asokan
09385713de Include commit information in CI builds. Fixes #158 2020-06-03 20:32:53 +03:00
Tulir Asokan
7947ba616c Hide reconnected successfully message if report_connection_retry is false 2020-05-29 21:06:25 +03:00
Tulir Asokan
c72610f3f0 Fix handling new messages during initial portal backfill 2020-05-28 20:35:43 +03:00
Tulir Asokan
7cf19b0908 Auto-create management room if needed when sending notices 2020-05-27 12:16:05 +03:00
Tulir Asokan
e4bc254a65 Change incoming call notices back to m.text 2020-05-21 20:14:43 +03:00
Tulir Asokan
9002bf62ed Fix needing to reconnect after initial login 2020-05-21 19:49:01 +03:00
Tulir Asokan
acc25a02e4 Update mautrix-go 2020-05-08 22:32:22 +03:00
Tulir Asokan
53fe1b1818 Update go-whatsapp. Fixes #169 2020-04-21 09:25:18 +03:00
Tulir Asokan
16dc3c8699 Add initial provisioning API 2020-02-09 20:32:14 +02:00
Tulir Asokan
8c3807a16d Add puppet to personal filtering community when adding portal 2020-01-07 21:40:51 +02:00
Tulir Asokan
e056459ab4 Add/fix sticker bridging in both directions
* Matrix stickers are sent as images
* WhatsApp stickers were missing the incoming event handler

Fixes #124
Fixes #127
Closes #126
Closes #129

Co-authored-by: rafaeltheraven <rafael.dulfer@gmail.com>
2019-12-31 20:22:04 +02:00
Tulir Asokan
ec0e60c71c Add option to automatically enable custom puppeting with shared secret login 2019-12-30 20:21:04 +02:00
Tulir Asokan
3caca1b9a0 Fix NeedsRelaybot check for groups too 2019-11-11 22:41:58 +02:00
Tulir Asokan
691d2ea1b3 Fix NeedsRelaybot check and relaybot command handling without arguments 2019-11-11 22:30:59 +02:00
Tulir Asokan
03d42640fe Add basic relaybot support. Fixes #20 2019-11-10 21:22:11 +02:00
Tulir Asokan
d91f705e95 Fix most unexpected logout bugs, handle connection-in-progress states better and send warning message if sending to whatsapp times out 2019-08-30 22:04:57 +03:00
Tulir Asokan
fccf6e981f Disconnect if session restore fails
Otherwise the connection sticks around and can suddenly become logged in
2019-08-30 21:31:56 +03:00
Tulir Asokan
2313321d01 Improve startup sync timeout handling 2019-08-30 20:57:08 +03:00
Tulir Asokan
db53b95ab1 Try to ensure recovered panics still print stack traces 2019-08-30 09:39:41 +03:00
Tulir Asokan
1490830be2 Use handlers instead of sleeping for startup chat/contact sync 2019-08-25 00:25:29 +03:00
Tulir Asokan
80a0edd855 Add option to disable call start/end notifications. Fixes #68 2019-08-24 22:42:03 +03:00
Tulir Asokan
44a0fc65b8 Handle 400 init response and add ping command. Fixes #87 2019-08-24 22:39:12 +03:00
Tulir Asokan
7bf470d69e Add portal rooms to user-specific community for filtering 2019-08-10 15:28:12 +03:00
Andrew Morgan
5d0b15f7f7 Remove command prefix from reconnect prompt (#81) 2019-07-18 00:22:00 +03:00
Tulir Asokan
91e8000c14 Edit message with regenerated QR code when logging in 2019-07-18 00:17:25 +03:00
Tulir Asokan
29f5ae45c4 Print clean websocket disconnections if they weren't announced by the server beforehand
Also print message send errors when Session is not nil even if Connection is nil
2019-07-04 15:08:59 +03:00
Tulir Asokan
37fd5dba2c Fix syncing chats for users with old chats 2019-05-31 21:59:23 +03:00
Tulir Asokan
83f4cf2811 Fix crash and add more logging 2019-05-31 20:51:16 +03:00
Tulir Asokan
37cd34e4bf Make contact wait delay configurable and fix nil pointer usage 2019-05-30 20:25:04 +03:00
Tulir Asokan
02f78155b5 Only invite default puppet for backfilling when needed 2019-05-30 17:48:22 +03:00
Tulir Asokan
a9fd97932b Send alerts about incoming calls 2019-05-30 17:00:36 +03:00
Tulir Asokan
dce08b1422 Add user-portal mapping to database 2019-05-28 21:31:25 +03:00
Tulir Asokan
7f0c67168c Fix potential autoreconnect problem and add exponential backoff 2019-05-28 14:09:49 +03:00
Tulir Asokan
498c0e4130 Ignore invalid data received errors 2019-05-27 14:15:45 +03:00
Tulir Asokan
bfe5af7edc Add Matrix->WhatsApp EDU bridging 2019-05-27 13:46:04 +03:00
Tulir Asokan
2c9c473040 Add basic Matrix puppeting support
May contain bugs.
EDUs from /sync are not yet handled.
2019-05-24 02:33:30 +03:00
Tulir Asokan
8d0d5ff504 Switch sync command to use syncPortals and syncPuppets methods used at startup 2019-05-23 22:57:59 +03:00
Tulir Asokan
0408db5c07 Add config option for max age of chats to sync 2019-05-23 20:25:46 +03:00
Tulir Asokan
7b067b4737 Set avatar in room create request and sync participants before filling history 2019-05-22 23:27:58 +03:00
Tulir Asokan
14f96bd96f Fix some bugs in missed message and initial history filling 2019-05-22 23:05:58 +03:00
Tulir Asokan
b363547bdf Possibly significantly improve how portals are created and synced 2019-05-22 16:46:18 +03:00
Tulir Asokan
6f2a51410f Make message handling more synchronous and fill history on portal create 2019-05-21 23:44:14 +03:00
Tulir Asokan
23747d4917 Add automatic connection retries 2019-05-17 23:53:57 +03:00
Tulir Asokan
b0d774a5a5 Add database migrations and handle leaving private chat portals. Fixes #7 2019-05-16 21:26:43 +03:00
Tulir Asokan
97e740d93d Maybe improve connecting errors 2019-05-16 18:24:59 +03:00
Tulir Asokan
2381eb029b Report WhatsApp server connection errors to user too. Fixes #18 2019-05-16 18:18:11 +03:00
Tulir Asokan
b5af35684d Make connection timeout configurable 2019-05-16 18:08:30 +03:00
Tulir Asokan
5d0edda04a Add command to delete session information to force logout when the bridge gets stuck 2019-05-16 18:00:46 +03:00
Tulir Asokan
c1e1964fc5 Add WhatsApp<->Matrix redaction bridging 2019-05-16 02:25:13 +03:00
Tulir Asokan
ae92d71d5a Handle connection failures like disconnections 2019-05-16 01:56:33 +03:00
Tulir Asokan
e25bf29609 Handle startup connection errors 2019-05-16 00:18:43 +03:00
Tulir Asokan
adbdf55926 Improve edge case handling in login command by not assuming connection status 2019-05-15 23:17:09 +03:00
Tulir Asokan
6b73c66e12 Improve connection error handling 2019-05-15 23:04:09 +03:00
Tulir Asokan
043820755f Revert go-whatsapp update again
This partly reverts commit b092e71a44
2019-03-30 19:25:26 +02:00
Tulir Asokan
b10fac2bb1 Update go-whatsapp. Fixes #35 2019-03-14 01:15:39 +02:00
Sami Olmari
d634addafc Change help 'import contacts' to 'sync'
After user succesfully sets up bridge, bot will tell what to do next. This info had still old command so I updated message to reflect new 'sync' directive.
2019-03-05 18:56:14 +02:00
Tulir Asokan
9e170f3d04 Add a bunch of new logging 2019-01-21 23:55:16 +02:00
Tulir Asokan
79bd35964f Update license year, Dockerfile, docker-run.sh and deps and add editorconfig 2019-01-12 15:54:04 +02:00
Tulir Asokan
1cccefd34c Switch to Go modules 2019-01-11 21:17:39 +02:00
Jörg Sommer
a626d14a3f No sync on startup; new command import contacts
Having an import of all contacts on each startup and after login is very
annoying, if you have a big list of contacts. If you choose to not join a
room with all contacts, you get the invitation over and over on each
restart of the service. Better is to have a command for the management
room to explicitly start the import.
2018-12-07 20:08:06 +01:00
Tulir Asokan
22cdf519f2 Fix desegregation changes to make the bridge work again 2018-08-30 01:10:26 +03:00
Tulir Asokan
c7348f29b0 Initial desegregation of users and automatic config updating 2018-08-29 00:40:54 +03:00
Tulir Asokan
6ad224a58b Convert mentions to names in plaintext body. Fixes #3 2018-08-28 20:09:37 +03:00
Tulir Asokan
dad2fc29ab Send captions in a different message and improve other things 2018-08-27 23:15:05 +03:00
Tulir Asokan
941ab724c6 Add bridge permission checks 2018-08-26 17:08:37 +03:00
Tulir Asokan
f78fb72622 Implement WhatsApp->Matrix power level bridging 2018-08-26 16:11:48 +03:00
Tulir Asokan
d3a178ecf3 Add handling for group metadata changes and refactor things
Group metadata temporarily broken until power level bridging is implemented
2018-08-26 01:56:22 +03:00
Tulir Asokan
ccfa85e44a Handle user avatar changes 2018-08-26 01:56:22 +03:00
Tulir Asokan
060516f9cf Add Matrix->WhatsApp replies and other stuff 2018-08-26 01:56:22 +03:00
Tulir Asokan
7f91d91f1b Fix read receipts in private chats and remove unnecessary stuff 2018-08-26 01:56:22 +03:00
Tulir Asokan
5eacaafc93 Add last typing update timestamp to check intended action of available presence properly 2018-08-24 22:06:17 +03:00
Tulir Asokan
a7f7295528 Add WhatsApp->Matrix typing notifications and presence 2018-08-24 20:02:38 +03:00
Tulir Asokan
1f87deb317 Add WhatsApp->Matrix read receipts and phone connection notifications 2018-08-24 20:02:18 +03:00
Tulir Asokan
b62a85a6df Implement matrix->whatsapp formatting and fix whatsapp->matrix files 2018-08-24 00:52:06 +03:00
Tulir Asokan
329bc9d8ce Add avatars, room topics and message deduplication 2018-08-23 01:12:26 +03:00
Tulir Asokan
c1f8d264f4 Fix portal DB scanning and add initial message bridging 2018-08-19 18:21:38 +03:00
Tulir Asokan
a9124b89bd Fix and add things
* Fix user ID reservation in registration
* Fix some database things
* Add commands
* Add basic contact syncing and portal creation
* Add better error logging
2018-08-18 22:57:33 +03:00
Tulir Asokan
edd4f817e4 Use type aliases for different ID types and add puppet type 2018-08-17 00:11:28 +03:00
Tulir Asokan
141eba644b Fix data storage and other things 2018-08-16 19:20:07 +03:00
Tulir Asokan
9c48eeb534 Add puppet and portal stuff and fix config stuff 2018-08-16 15:59:18 +03:00
Tulir Asokan
fd3c1fb77c Add database models and improve config/main 2018-08-13 23:24:44 +03:00