Commit graph

166 commits

Author SHA1 Message Date
Tulir Asokan 2023f55f32 Recover from panics in event handlers 2019-06-18 08:24:17 +03:00
Tulir Asokan 5be78dd978 Fix the crash in #69 2019-06-13 21:30:38 +03:00
Tulir Asokan e124641107 Add option to set private chat portal rooms' name/avatar explicitly 2019-06-01 20:03:29 +03:00
Tulir Asokan 9fa0ad923d Fix potential nil pointer crash 2019-06-01 19:20:06 +03:00
Tulir Asokan 1285aa4327 Fix fetching more than one chunk of initial history 2019-05-31 22:30:57 +03:00
Tulir Asokan a40584db41 Add command to delete all own portals for a fresh start 2019-05-31 19:33:18 +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 521a8b74aa Share backfill start/end code between initial and recovery fills 2019-05-30 17:25:56 +03:00
Tulir Asokan c4751f4953 Use default puppet when backfilling to avoid rate limits 2019-05-30 17:22:03 +03:00
Tulir Asokan a9fd97932b Send alerts about incoming calls 2019-05-30 17:00:36 +03:00
Tulir Asokan 1c009b96fe Only load 50 messages per request in initial fill 2019-05-28 21:48:37 +03:00
Tulir Asokan dce08b1422 Add user-portal mapping to database 2019-05-28 21:31:25 +03:00
Tulir Asokan 666194b066 Possibly fix and/or break missed message backfilling 2019-05-28 21:30:39 +03:00
Tulir Asokan 1d43aeca2f Remove message locking as message handling is synchronous per-portal 2019-05-28 14:12:35 +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 5eb06ee43c Update go-whatsapp with new proto version 2019-05-23 22:57:19 +03:00
Tulir Asokan f9c3e99d10 Fix/change things 2019-05-23 20:09:22 +03:00
Tulir Asokan d7b36d55d7 Handle puppet avatar fetch errors properly 2019-05-23 19:07:34 +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 4db9777b9a Fetch initial history in chunks to allow fetching more history 2019-05-22 22:05:28 +03:00
Tulir Asokan 015e42279d Fix handleMessage call in handleHistory 2019-05-22 17:39:33 +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 adc7257490 Add admin command to delete portal and fix some other things 2019-05-21 21:06:27 +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 c1e1964fc5 Add WhatsApp<->Matrix redaction bridging 2019-05-16 02:25:13 +03:00
Tulir Asokan e5085b87c7 Log message ID when failing to download media 2019-05-16 00:35:04 +03:00
Tulir Asokan 6b73c66e12 Improve connection error handling 2019-05-15 23:04:09 +03:00
Tulir Asokan c88e299348 Set name for status broadcast room when creating and reformat example config
Fixes #27
2019-03-14 00:54:05 +02:00
Tulir Asokan c054fbae8e Remove reply fallback before generating new reply fallback. Fixes #26 2019-02-20 14:46:37 +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 0d49bd8d08 Portal.CreateMatrixRoom: ensure the user exists
In the log some message show up with `/_matrix/client/r0/createRoom
code=403 wrapped=M_FORBIDDEN: Application service has not registered this
user`. This is caused by the handling of text messages coming from unknown
users:

    mautrix-whatsapp/vendor/github.com/Rhymen/go-whatsapp/handler.go:106
    mautrix-whatsapp/user.go:250
    mautrix-whatsapp/portal.go:551

Hence, before creating a Matrix room, we must ensure the user for this
room exists.
2018-12-07 16:18:52 +01:00
Jörg Sommer 95c8c01450 Check errors of GetProfilePicThumb
When a request for GetProfilePicThumb fails, WhatsApp sends an JSON object
containing a status field: `{"status":404}`. In my tests, it did send the
codes 401 and 404 which might correspond to the HTTP status codes. At
least, we don't have data to update the avatar and should stop doing so.
2018-12-07 16:18:52 +01:00
Jörg Sommer abe73684d0 Check errors for GetGroupMetaData
When a request for GroupMetadata fails, WhatsApp sends an JSON object
containing a status field: `{"status":500}`. In my tests, it sends the
codes 401, 404 and 500 which might have the meaning of the HTTP status
codes. At least, we don't have data to update the portal and should stop
doing anything.
2018-12-07 16:18:44 +01:00
Tulir Asokan c4ada14c2f Increase length recently handled events array to 100 2018-09-02 00:01:22 +03:00
Tulir Asokan ed27fa775e Re-break everything and fix Matrix->WhatsApp replies 2018-09-01 23:38:03 +03:00
Tulir Asokan 79851a62b4 Add locking for whatsapp->matrix messages for desegregated group chats 2018-08-31 00:13:08 +03: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 b978930c88 Improve handling of weird potentially non-corner case in GetMessageIntent() 2018-08-27 01:06:27 +03:00
Tulir Asokan 6db0dc23ab Handle potential weird corner case in GetMessageIntent() 2018-08-27 00:37:54 +03:00
Tulir Asokan 65f077c645 Fix/improve minor things 2018-08-26 22:50:28 +03:00
Tulir Asokan 9da7f15e8f Add Matrix->WhatsApp room name changes 2018-08-26 17:02:32 +03:00
Tulir Asokan 0d45b5b857 Add power level to Matrix user if they're admin 2018-08-26 16:19:50 +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 060516f9cf Add Matrix->WhatsApp replies and other stuff 2018-08-26 01:56:22 +03:00
Tulir Asokan 6d08a5ff6c Use inline code tags for single-line whatsapp monospace blocks 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 8483af9c0a Stop setting room name for private chats 2018-08-25 00:45:50 +03:00
Tulir Asokan 5f6955d36f Add Matrix->WhatsApp media bridging 2018-08-24 22:31:18 +03:00
Tulir Asokan 0b7d23e897 Add WhatsApp->Matrix formatting 2018-08-24 22:05: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