Commit graph

206 commits

Author SHA1 Message Date
Tulir Asokan
4bc4e92877 Remove media backfill queue and just request immediately 2022-05-02 15:00:57 +03:00
Tulir Asokan
4b22e786f5 Make signal store retry if postgres dies 2022-04-29 19:38:44 +03:00
Tulir Asokan
573eec44c8 Fix indentation in SQL query 2022-04-29 17:03:27 +03:00
Tulir Asokan
6b69ea707b Use single SQL query for fetching backfill queue items 2022-04-29 10:44:22 +03:00
Sumner Evans
caf0a363c9
backfill: delete messages for rooms the user is not in
If the chat turns out to be not bridgable due to the user not being in
the room, delete the messages, and stop trying to backfill it.
2022-04-27 08:29:20 -06:00
Sumner Evans
e74bb62fc1
backfill logging: fix logging of Backfill structs 2022-04-19 11:19:42 -06:00
Sumner Evans
f2e762680c
media backfill: add ability to automatically request media not on WA server
This adds a new backfill type for media that sends a request to the
phone for every media that is not available on the WA servers. WA
deletes media from their servers after about two weeks, so you have to
ask the phone to re-upload it.

In order to use this, you need to enable
bridge.history_sync.backfill_media and configure the requests that will
be made per portal using bridge.history_sync.media (which is similar to
the deferred backfill config).

If you already have backfilled portals, but want to do a one-off media
backfill for all existing portals, you can set
bridge.history_sync.enqueue_backfill_media_next_start to true.
2022-04-19 08:12:51 -06:00
Tulir Asokan
2c68ccc0a3 Clean up some backfill things 2022-04-18 20:12:24 +03:00
Tulir Asokan
5b9fe8e08a Delete messages by timestamp range instead of message ID 2022-04-18 20:12:01 +03:00
Tulir Asokan
1a5d5f5adf Adjust logs and other things 2022-04-16 22:58:47 +03:00
Tulir Asokan
6e976fb3fc Default to backfilling all chats in history sync 2022-04-16 22:42:17 +03:00
Sumner Evans
bd26fc4af9
Minor cleanups from CR
Co-authored-by: Tulir Asokan <tulir@maunium.net>
2022-04-07 09:20:43 -06:00
Sumner Evans
c664e5f107
Updates from CR
Co-authored-by: Tulir Asokan <tulir@maunium.net>
2022-04-06 08:56:58 -06:00
Sumner Evans
eb0a13a753
historysync: use userID, conversationID, messageID as PK 2022-04-05 13:16:31 -06:00
Sumner Evans
005fbb09f8
backfill queue: don't delete, just mark as complete 2022-04-05 13:16:31 -06:00
Sumner Evans
830c294b91
historysync: delete history sync messages once backfilled 2022-03-30 17:40:23 -06:00
Sumner Evans
12a23e2ca5
historysync: refactor to utilize backfill queue
Also sends the `m.room.marker` event when a backfill stage is complete.
2022-03-29 19:26:11 -06:00
Sumner Evans
1ecdb71ac3
database: add backfill queue and history sync tables 2022-03-29 12:16:30 -06:00
Tulir Asokan
caacac15c7 Check database owner and foreign tables before starting 2022-03-16 01:15:13 +02:00
Tulir Asokan
c82a96dccc Handle incoming reaction removals 2022-03-12 19:47:47 +02:00
Tulir Asokan
1eb210c249 Add support for bridging reactions 2022-03-05 21:22:31 +02:00
Tulir Asokan
dbe25bbce6 Expose db connection max lifetime and idle time settings 2022-02-23 14:30:21 +02:00
Tulir Asokan
b389354bcc Send blank protocol message if phone is offline for too long 2022-02-18 12:12:15 +02:00
Tulir Asokan
cf1ae3b102 Fix check 2022-02-16 00:11:38 +02:00
Tulir Asokan
a40d143cef Update IsFakeJID check to handle backfill end markers 2022-02-16 00:05:23 +02:00
Tulir Asokan
528fbda53f Add initial support for requesting media retries from phone 2022-02-10 19:18:49 +02:00
Tulir Asokan
c3a9f75ffd Add word to unsupported database error message 2022-02-06 21:03:04 +02:00
Tulir Asokan
41272e9dff Include current and latest known versions in unsupported db error 2022-02-06 20:43:36 +02:00
Tulir Asokan
e8c77c7ec6 Try to track when the phone is online and warn user if it's offline for too long 2022-01-25 14:26:24 +02:00
Tulir Asokan
3dd30280a1 Fix state store logging errors when power levels aren't cached 2022-01-17 10:45:36 +02:00
Tulir Asokan
c4a7943775 Add logs to debug read receipts 2022-01-17 10:38:44 +02:00
Tulir Asokan
ccfd7819c3 Don't ignore errors when getting DB schema version
It probably never errors because connection errors would break the
create table call, but this way is safer.
2022-01-07 16:45:20 +02:00
Tulir Asokan
a61a3f5cf9 Only create goroutines for next hour of disappearing messages 2022-01-07 14:46:53 +02:00
Tulir Asokan
18ea5af45e Add support for disappearing messages 2022-01-07 14:32:00 +02:00
Tulir Asokan
658b37f81f Use upserts on SQLite too 2021-12-30 12:30:29 +02:00
Tulir Asokan
ba536f17e7 Add command to sync DM rooms into space 2021-12-29 21:40:58 +02:00
Tulir Asokan
7e5c2769c6 Clean up personal filtering space support 2021-12-29 21:40:08 +02:00
Helder Ferreira
0a8bd7794b
Add persistence
Co-authored-by: clmnin <clament.john.k@gmail.com>
2021-12-29 08:37:57 +00:00
Helder Ferreira
863c375be0
Init space creation
Co-authored-by: clmnin <clament.john.k@gmail.com>
2021-12-29 08:37:24 +00:00
Tulir Asokan
ca5fcc42ba Reroute broadcast list messages to correct DM portal. Fixes #411 2021-12-25 20:50:36 +02:00
Tulir Asokan
5e04577081 Update mautrix-go to fix olm session ordering 2021-12-22 23:04:41 +02:00
Tulir Asokan
6aa704dc56 Fix name of trace levels 2021-12-06 14:13:18 +02:00
Tulir Asokan
4bdb130d13 Prevent setting last_read_ts to lower value 2021-12-01 14:49:38 +02:00
Tulir Asokan
a909750dcc Mark all messages as read instead of only last one 2021-11-30 16:38:37 +02:00
Benjamin Bouvier
83c2e1d698
Update table/column names in DBMS migration (#391) 2021-11-12 17:34:25 +02:00
Tulir Asokan
b489d407c9 Remove old db migration that was merged into initial schema 2021-11-07 23:51:34 +02:00
Tulir Asokan
7c7ac37ba7 Fix updating rows on SQLite. Fixes #380 2021-11-07 23:42:23 +02:00
Tulir Asokan
911fdd37f0 Fix bug in SQLStateStore.SetMember(). Closes #378 2021-11-05 20:04:27 +02:00
Tulir Asokan
433aaf3829 Reimplement more things 2021-11-05 12:17:56 +02:00
Tulir Asokan
752aff48f1 Prioritize backfilling recent messages and fix some bugs 2021-11-03 21:34:06 +02:00
Tulir Asokan
e0d79f2de1 Re-add call start notices 2021-11-02 15:46:31 +02:00
Tulir Asokan
db44ef2b36 Disable SQLite foreign keys. Fixes #360 2021-11-02 12:57:05 +02:00
Tulir Asokan
baf2482c3a Store server timestamp of outgoing messages in db 2021-11-01 11:21:38 +02:00
Tulir Asokan
47105b411f Remove legacy build tags 2021-10-31 13:04:56 +02:00
Tulir Asokan
682c5bff38 Remove/fix some db upgrades 2021-10-30 23:40:38 +03:00
Tulir Asokan
f3d6bbbc4a Replace VARCHAR(255) with TEXT in Matrix state store 2021-10-30 23:31:49 +03:00
Tulir Asokan
5b5cbc2efa Remove legacy state store migration 2021-10-30 23:31:39 +03:00
Tulir Asokan
a829a887f0 Clear stored usernames from postgres in multidevice upgrade 2021-10-30 14:22:58 +03:00
Tulir Asokan
b2e6a614b9 Update delete-all-portals and remove commented code 2021-10-28 14:27:59 +03:00
Tulir Asokan
1f6d316ff3 Update build tags 2021-10-28 14:04:12 +03:00
Tulir Asokan
bb9a0f6528 Make relay mode more like the Signal bridge 2021-10-28 13:57:15 +03:00
Tulir Asokan
b918b4f261 Handle decryption errors from WhatsApp properly 2021-10-27 18:31:33 +03:00
Tulir Asokan
b874d324eb Send dummy event after backfill
This is necessary in case there aren't any real messages before the next
backfill. Otherwise the next backfill would go before the old backfill
(at the top of the room) rather than at the bottom of the room.
2021-10-26 21:30:44 +03:00
Tulir Asokan
0b4d0bbbe1 Handle history sync payloads with MSC2716 batch sending 2021-10-26 17:01:10 +03:00
Tulir Asokan
56850bb698 Initial switch to go.mau.fi/whatsmeow 2021-10-22 20:14:34 +03:00
Tulir Asokan
d52b012b37 Maybe fix database migration
Fixes #335
Fixes #304
2021-08-19 19:32:17 +03:00
Tulir Asokan
4fe179d0d7 Remove content from message table. Fixes #320 2021-08-19 19:17:19 +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
badea9c547 Add option to bridge archive and mute status from WhatsApp 2021-04-19 22:14:32 +03:00
Tulir Asokan
3d778a5a44 Create user_portal row when creating portal for new chat
Closes #273

Co-authored-by: dbedoya <dbedoya@ikono.com.co>
2021-02-26 16:09:24 +02:00
Tulir Asokan
a911a0c1a9 Add better support for broadcast lists 2021-02-21 14:18:15 +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
ca118e8678 Handle 404 errors when backfilling messages 2021-02-17 01:22:06 +02:00
Tulir Asokan
69dd7f803a Move whatsapp-ext to go-whatsapp 2021-02-17 01:21:30 +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
Alexandre Macabies
95f6487912
Make database log a sublogger of Bridge, like all other modules. (#260) 2021-01-25 21:01:54 +02:00
Tulir Asokan
56e4a67f42 Update mautrix-go 2020-11-10 12:37:33 +02:00
Tulir Asokan
2638204eaa Add option to update m.direct with double puppeting 2020-08-22 13:07:55 +03:00
Tulir Asokan
aefe63cba5 Add support for automatic key sharing 2020-08-05 14:58:46 +03:00
Tulir Asokan
05da509c7c Add build tags for disabling crypto independently of cgo 2020-08-02 13:55:02 +03:00
Tulir Asokan
6cb55f3969 Fix bugs in db migration. Fixes #211 2020-07-30 21:41:04 +03:00
Tulir Asokan
b1fd0be345 Update mautrix-go to fix static build 2020-07-10 16:35:38 +03:00
Tulir Asokan
b7275a763a Make bridging receipts togglable separately from presence 2020-07-10 16:26:55 +03:00
Tulir Asokan
f40a91594d Update mautrix-go 2020-07-10 15:56:45 +03:00
Tulir Asokan
7eb4cfb946 Add command to disable bridging presence and read receipts 2020-07-10 14:53:18 +03:00
Tulir Asokan
542d30ead7 Use SQLCryptoStore from mautrix-go and update deps 2020-06-23 23:22:44 +03:00
Tulir Asokan
91db286208 Update mautrix-go 2020-05-26 17:51:20 +03:00
Tulir Asokan
ed978bcb9c Don't use different types for SQLite in DB schema 2020-05-21 20:56:41 +03:00
Tulir Asokan
fc6f8df4d3 Fix replacing outbound group session in db 2020-05-12 23:33:59 +03:00
Tulir Asokan
c9adb3aba3 Store outbound group sessions in database 2020-05-12 23:16:33 +03:00
Tulir Asokan
1c3de877db Maybe support e2be by default and fix some bugs 2020-05-12 22:25:55 +03:00
Tulir Asokan
168a6ff93f Fix static build 2020-05-09 20:25:48 +03:00
Tulir Asokan
ea23907492 Fix some bugs with db crypto store 2020-05-09 20:23:30 +03:00
Tulir Asokan
dfc5722a80 Move crypto store to main database 2020-05-09 20:08:05 +03:00
Tulir Asokan
6e50a7c380 Switch appservice module location 2020-05-09 20:08:05 +03:00
Tulir Asokan
baae66ed04 Add basic end-to-bridge encryption support
Still missing persisting sync tokens and crypto state in DB
2020-05-09 02:04:01 +03:00
Tulir Asokan
acc25a02e4 Update mautrix-go 2020-05-08 22:32:22 +03:00
Tulir Asokan
064b5b8fed Don't use transaction for querying values 2020-04-02 21:53:45 +03:00
Tulir Asokan
6a42de73d1 Check if constraint exists before trying to delete 2020-04-02 21:37:51 +03:00
Tulir Asokan
9b01166f0c Ignore error in upgrade to allow Postgres 12 to work. Fixes #133 2020-04-02 21:11:38 +03:00