Commit Graph

72 Commits

Author SHA1 Message Date
Skip R
b8a01bf9d4 msgconv/from-discord: use a tagged switch instead of if 2026-01-27 19:12:26 -08:00
Skip R
578030a9dd msgconv/from-discord: only complain about portal when we can't find it 2026-01-27 19:11:57 -08:00
Skip R
2f8de6635a msgconv/from-discord: refactor forwarded message conversion 2026-01-27 19:10:58 -08:00
Skip R
138c77c34e provisioning: sketch out implementation
for now, this is completely unauthenticated
2026-01-26 11:33:13 -08:00
Skip R
5e0f9b909a connector: break out guild bridging logic into method 2026-01-26 11:33:13 -08:00
Skip R
b4fdd8b9ed connector: don't crash upon less than 10 private channels 2026-01-26 11:33:13 -08:00
Skip R
7849c09443 connector: send bridge state updates on gateway events
This also makes the account properly appear in client settings after
provisioning.
2026-01-20 16:08:16 -08:00
Skip R
5b7a7a430c connector: fix log messages when downloading guild avatars 2026-01-15 15:53:17 -08:00
Skip R
ac338ee722 msgconv: correctly bridge attachments and embeds
`URL` needs to be set if the room/attachment is unencrypted; otherwise,
`File` needs to be set.
2026-01-14 18:07:15 -08:00
Skip R
bdbfd661a2 msgconv: don't set EncryptedFile if there isn't one
FIXME: This probably isn't proper handling, but this is enough to
prevent panics.
2026-01-13 14:50:35 -08:00
Skip R
3d59a0eb3f login/remoteauth: tolerate multiple attempts to cancel
This will otherwise panic.
2026-01-13 14:50:12 -08:00
Skip R
e38998e68b connector: don't store config as pointer 2026-01-13 14:49:15 -08:00
Skip R
f5292e6a7d connector: first pass at bridging guilds
For each guild specified in the config, create a space and bridge all
contained text channels that the user has permissions to view.

* Finally add a custom config struct where we accept a list of guild IDs
  to bridge. This is intended to be temporary as we flesh out the proper
  interfaces for managing which guilds to bridge.
* Defined a custom meta type for portals that holds the containing guild
  ID of the channel (if any).
* Transferred the responsibility of building a channel's ChatInfo and
  ChatMemberList to the DiscordChatResync event itself.
2026-01-09 19:57:17 -08:00
Skip R
86544bc7af relocate dbmeta models to discordid
While we're about to introduce more metadata structs, it seems like
mautrix-slack keeps these in slackid, so let's keep ours in discordid.
2026-01-09 17:13:15 -08:00
Skip R
fdcfb2b083 chore: bump copyright year 2026-01-08 16:56:13 -08:00
Skip R
bfebeeb7e5 handlematrix: bridge outgoing typing events 2026-01-08 16:49:27 -08:00
Skip R
4fb0cdb847 login: relocate shared login finalization logic into embedded struct
All of the login methods need to do (effectively) the same thing once we
have a token, so refactor this out into something we can reuse.
2026-01-07 20:11:04 -08:00
Skip R
b764f489de login: implement logging in via browser 2026-01-07 18:52:52 -08:00
Skip R
8a28fa0f95 connector: share session construction logic
So we can't forget to set up the logging handler.
2026-01-07 18:51:32 -08:00
Skip R
4314aa9206 handlematrix: simplify read receipt bridging 2026-01-06 18:10:50 -08:00
Skip R
761a850a50 handlematrix: bridge outgoing read receipts 2026-01-06 18:10:50 -08:00
Skip R
ca1168bfc2 clean up stray zerolog import 2026-01-06 16:49:10 -08:00
Skip R
e71075cd0d handlematrix: bridge outgoing message attachments 2026-01-05 22:29:26 -08:00
Skip R
cbfbe65619 login/remoteauth: lowercase Errorf 2025-12-18 19:43:30 -08:00
Skip R
c015148b63 login/remoteauth: simplify copy 2025-12-18 19:40:49 -08:00
Skip R
1fb161f379 lint 2025-12-18 19:37:42 -08:00
Skip R
b18d908489 login: implement remoteauth (QR code login) 2025-12-18 19:36:33 -08:00
Skip R
099b464f84 client: refactor boot logic into SetUp method
This method only has heartbeat session population logic for now, so it's
actually a no-op during provisioning. However, there's probably some
value in "mandating" that clients call this shortly after construction,
so we have a chance to run any setup logic that we might need in the
future.

This _feels_ unidiomatic...?
2025-12-18 19:34:50 -08:00
Skip R
2075a4b853 client: don't nil out discordgo.Session when disconnecting
I don't have the logs anymore unfortunately, but I witnessed a
(seemingly?) rare nil dereference _within discordgo's event handling
code_ after Disconnect on the client was called (caused by SIGINT). My
thinking is that this caused the Session to get garbage collected, so
the method receiver became nil out from under it.

To let discordgo clean up after itself, keep a reference to it in the
client.
2025-12-18 19:31:40 -08:00
Skip R
776ddd7c96 login: make complete step id a constant 2025-12-18 19:31:30 -08:00
Skip R
2c669413cc login/token: remove misleading comment about LoadUserLogin
This comment seems to imply that specifying this function is a shortcut
of sorts, when it's actually required and mautrix-go doesn't fallback to
the connector in the way described.
2025-12-18 19:30:34 -08:00
Skip R
0c82f6551d login: move token login to own file, rename
To make room for other login flows.
2025-12-18 18:28:19 -08:00
Skip R
d79406e05b handlematrix: clean up stale comment 2025-12-17 19:17:36 -08:00
Skip R
7a19f09683 handlematrix: bridge outgoing message redactions 2025-12-17 19:04:54 -08:00
Skip R
e030c9548c handlematrix: bridge outgoing reactions 2025-12-17 18:51:36 -08:00
Skip R
2cacd4ec81 msgconv: bridge outgoing replies 2025-12-17 18:23:08 -08:00
Skip R
09414cb59d handlediscord: drop messages lacking an author
DiscordMessage's GetSender is dereferencing nil sometimes and I'm not
sure why.
2025-12-17 18:04:37 -08:00
Skip R
d82b74fb29 handlematrix: handle basic matrix rich text messages
Added the necessary room capabilities, too. Support for replies,
editing, deletion, and attachments are forthcoming.
2025-12-16 18:37:35 -08:00
Skip R
60171b4fca lint 2025-12-11 19:56:31 -08:00
Skip R
ab82f8b131 backfill: document why we aren't backfilling reactions (for now) 2025-12-11 19:50:25 -08:00
Skip R
506f42f93b bridge basic emoji reactions from gateway to matrix 2025-12-11 19:24:19 -08:00
Skip R
25b73bd7cb handlediscord: bail if we're in the middle of provisioning 2025-12-11 18:34:47 -08:00
Skip R
d464cb8b66 bridge discord messages to matrix 2025-12-11 18:22:36 -08:00
Skip R
7b32aad13f attachments: remove trace logging
This was for debugging in development only. Also, bridges default to the
DEBUG level, so this would not be logged at all unless you intentionally
modified your logging configuration.
2025-11-26 18:29:00 -08:00
Skip R
b5e6db06f8 msgconv: port most of attachment and text message bridging
* Created a separate discordid package to avoid import cycles.
* Implemented attachment bridging. We still need to implement direct
  media, but this will do for now.
* Corrected how encrypted files (e.g. embed images and attachments) were
  bridged. Previously, the URL field would be empty.

Still a lot of missing pieces. Thoughts:

* Mentions to roles and custom emoji are not rendered properly. We need
  to maintain our own DB.
* We might not need the "attachments" leaf package anymore? It's just
  there to avoid an import cycle.

Bridging actual events (i.e. wiring up discordgo's event handlers) is
probably next.
2025-11-26 18:13:07 -08:00
Skip R
86e18c1f7d msgconv: port the majority of embed and attachment bridging
We still need to implement direct media support, so for now we encrypt
and reupload to Matrix. Notably remaining is conversion to HTML.
2025-11-26 15:18:29 -08:00
Skip R
17fed9aca5 msgconv: initial impl of ToMatrix, porting convertDiscordTextMessage 2025-11-25 18:01:31 -08:00
Skip R
66d9ca6394 backfill: set ConvertedMessagePart.Type for call/guild join 2025-11-25 16:19:12 -08:00
Skip R
45dae8fafb backfill: set ConvertedMessagePart.Type 2025-11-25 16:10:31 -08:00
Skip R
5fa9645012 connector/id: actually use user as UserLogin 2025-11-25 16:10:04 -08:00