Commit Graph

171 Commits

Author SHA1 Message Date
Tulir Asokan a84dd2f30c handletelegram: add log for stuck update handlers 2026-03-03 16:23:50 +02:00
Tulir Asokan 274141a1b0 client: add lock for onTransfer
There should never be multiple clients to actually need this, but just in case
2025-12-29 23:21:08 +02:00
Tulir Asokan 09227510bc startchat: clean up resolving identifiers 2025-12-17 12:48:11 +02:00
Tulir Asokan 7f17c2728e client: use context rather than separate flag for expected disconnects 2025-12-15 16:23:44 +02:00
Tulir Asokan 4873ed77ff client: disconnect on auth error 2025-12-12 17:26:16 +02:00
Tulir Asokan ba4dd48d5a gotd: ensure user is member of channels before starting getDifference loop 2025-12-12 15:45:39 +02:00
Tulir Asokan ae05331420 startchat: don't allow spamming get contact list request 2025-12-12 14:30:06 +02:00
Tulir Asokan ef65f9f1ea client: log main context status on disconnect 2025-12-12 13:19:44 +02:00
Tulir Asokan 29d8c1b7dd client: send error state if client.Run returns unexpectedly 2025-12-12 13:12:33 +02:00
Tulir Asokan 4775e67476 client: adjust start/stop logs 2025-12-11 15:29:42 +02:00
Tulir Asokan 43b230148b client: don't drop errors from client.Run() 2025-12-11 15:01:12 +02:00
Tulir Asokan d03260c4a7 gotd/updates: initialize channel state runctx immediately 2025-12-11 14:55:43 +02:00
Tulir Asokan de2e87ed52 client,gotd: remove unnecessary dispatcher wrapper 2025-12-11 14:07:48 +02:00
Tulir Asokan 10f1583da9 login: add support for bot tokens 2025-12-07 20:06:30 +02:00
Tulir Asokan 48fed1c026 login: refactor to share more code 2025-12-07 20:02:19 +02:00
Tulir Asokan abb4671a16 client: add shortcut field for user login metadata 2025-12-07 20:02:19 +02:00
Tulir Asokan d5f87d2ec1 all: add support for topics and refactor other things 2025-12-06 15:27:51 +02:00
Tulir Asokan 548672d243 client: simplify IsLoggedIn check 2025-12-05 23:50:44 +02:00
Tulir Asokan 9dd8f30480 handlematrix: fix reaction polling logic
Only supergroups need it. The map also needed a lock
2025-12-05 14:55:52 +02:00
Tulir Asokan 19c3121e77 login*: apply zap log level shifting 2025-12-04 16:32:26 +02:00
Tulir Asokan 526903cb7c userinfo: refactor GetUserInfo and remote profile handling 2025-12-04 15:39:46 +02:00
Tulir Asokan 2cac8f8b4a client,gotd: refactor connection event handling
This might cause regressions if the onSession handler was load bearing
2025-12-04 14:53:35 +02:00
Tulir Asokan c6dd85040c client: fix parsing username message links 2025-12-03 23:23:07 +02:00
Tulir Asokan 1ecb9e8b64 login*: set device config on login clients 2025-12-03 17:11:20 +02:00
Tulir Asokan 2004085312 connector: fix import ordering 2025-12-03 17:11:20 +02:00
Conan 3aa7bdfa91 handlematrix: fix delete chat (#125) 2025-10-28 02:34:24 +08:00
Conan b1f3c4c1db handlematrix: Implement DeleteChatHandlingNetworkAPI (#122) 2025-10-07 21:26:10 +08:00
Tulir Asokan d359bafb53 connector: rename files to be more consistent with other bridges 2025-09-16 22:47:48 +03:00
Tulir Asokan 4f12f5103a matrix: add support for changing disappearing message timer 2025-08-26 18:17:50 +03:00
Tulir Asokan a31787f894 client: include event handling error in returns 2025-07-31 14:02:15 +03:00
Adam Van Ymeren e9abeda916 Rework telegram client lifecycle to hopefully fix not stopping issues (#112) 2025-07-17 09:56:11 -04:00
Tulir Asokan 3fb554b934 client: add todo for usernames in links
[skip ci]
2025-07-15 16:39:50 +03:00
Adam Van Ymeren 7a04f298d2 move gotd fork into repo. (#111)
- update to latest telegram layer
- remove some references to fields in tg.Entities that don't exist in
the schema
- originally added here:
https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e
  - referenced here
-
https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3
-
https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
2025-06-27 20:03:37 -07:00
Adam Van Ymeren 0952df0244 all: respect/propagate errors from QueueRemoteEvent (#110) 2025-06-26 13:43:35 -07:00
Toni Spets 8ac519d1e5 connector: Disconnect in a goroutine on auth error
If we get bad creds on initial connect the lock is being held when the
callback is called.
2025-06-25 08:55:36 +03:00
Toni Spets fa237a20f7 logging: Move gotd debug logs to trace
Zap doesn't have trace level logging so to make it less noisy we need to
shift them to trace.
2025-06-09 15:01:25 +03:00
Toni Spets e7b87835b6 Fix a race between connect and disconnect
If we get an auth error during connect we did deadlock.
2025-06-06 10:57:07 +03:00
Toni Spets 3c3c3f1dec client: Prefer contact name if exists
Don't allow TG user to override your own contact name for them after
they have been made a contact.
2025-05-30 13:22:57 +03:00
Toni Spets 0f36833e89 Revert "Revert "client: unblock connect without network""
This reverts commit ea4626107c.

Adds waiting support for initial connection established to avoid locking
up gotd. This isn't extremely pretty but should do the job for now.
2025-05-27 07:40:38 +03:00
Toni Spets ea4626107c Revert "client: unblock connect without network"
This reverts commit 14c784f2a2.
2025-05-23 10:32:51 +03:00
Toni Spets 39c1b685d6 client: logout with timeout to API call to unblock it 2025-05-23 09:28:32 +03:00
Toni Spets 14c784f2a2 client: unblock connect without network
It'll still probably not race too much if disconnect gets called while
connecting is still stuck doing something.
2025-05-23 09:20:38 +03:00
Toni Spets 7e75c8ef83 media: make all media direct downloadable
The only exception is emojis.

Also changed direct download encoding field names to be more generic
when used in mixed manner depending on peer type.

Direct downloads are still somewhat inefficient as they require an API
round trip to succeed but we can cache things in the database if needed.
2025-05-07 06:43:51 +03:00
Toni Spets 7c13481ede client: Handle connect/disconnect/auth races properly
When logging out, we should first handle network level logout and after
that ensure the client is disconnected before removing state to avoid
having event handling during disconnect from touching anything anymore.

I don't know why we nilled the client but since so many places use it
we'd rather get errors rather than panics if it's being used after
logging out but previous lifecycle fixes should avoid that.
2025-04-26 08:19:33 +03:00
Toni Spets 224b01e7a4 client: Wait for updates manager to finish on disconnect 2025-04-15 12:19:28 +03:00
Toni Spets a64a178dc3 client: Don't try to reconnect with canceled context 2025-04-10 10:13:02 +03:00
Toni Spets 538f2a2ec0 client: Wait before returning from disconnect 2025-04-09 10:49:45 +03:00
Tulir Asokan 28d8276554 dependencies: update mautrix-go 2025-03-25 17:00:55 +02:00
Sumner Evans 1bc3a2538e treewide: add copyright/license notices
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2025-03-05 10:16:50 -07:00
Sumner Evans 0712ca5d0c dependencies: update go
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2025-02-17 14:13:12 -07:00