Skip to content

feat(matrix): Matrix rooms as Talk conversations - #19214

Draft
karlitschek wants to merge 1 commit into
mainfrom
matrix-integration
Draft

feat(matrix): Matrix rooms as Talk conversations#19214
karlitschek wants to merge 1 commit into
mainfrom
matrix-integration

Conversation

@karlitschek

Copy link
Copy Markdown
Member

Summary

Talk can act as a Matrix client: users link a Matrix account on an admin-configured homeserver and their Matrix rooms appear as ordinary Talk conversations β€” in the web UI as well as in the unchanged mobile and desktop apps (Matrix conversations are regular conversations at the OCS API level, plus additive matrixRoomId / matrixCapabilities fields).

Protocol layer

  • New standalone, framework-free library nextcloud/matrix-client-php under matrix-client/ (PSR-18/17/3/20, no OCP imports β€” CI-enforced, own test suite, works against a plain Synapse: examples/echo-bot.php)
  • Pure-PHP end-to-end encryption: Olm double ratchet, Megolm, device keys, SAS (emoji) verification, room-key sharing/requests/forwarding, encrypted attachments, key-backup restore (recovery key / SSSS) β€” verified byte-for-byte against Element's vodozemac in an interop harness (tests/interop/vodozemac_check.py, 39 checks)

Talk integration (lib/Matrix/)

  • Background /sync per linked account (per-account locks, adaptive interval) + opportunistic foreground sync while a conversation is viewed; history backfill with lazy scroll-back
  • Messages, membership, power levels (β†’ moderator/owner), name/topic/avatar mirrored into Talk rooms; new actor type matrix for members without a Nextcloud account (names, avatars, mentions)
  • Encrypted rooms: decrypt-on-ingest, "waiting for the key" placeholders replaced in place, device verification from another client, key backup restore
  • Reactions, edits, deletions, replies, threads and read receipts in both directions; Matrix media inline with thumbnails, Save to Nextcloud, file shares uploaded as (encrypted) Matrix attachments
  • Room lifecycle from Talk: create rooms/DMs, join by address (#alias, !id, matrix.to, matrix:), public room directory, knock; invitations reuse the existing federation-invitation API
  • Per-room capability detection (calls/lobby/SIP/etc. rejected with 405 for Matrix rooms, call permissions stripped), admin settings with homeserver management + sync health, personal settings with linking and verification, occ commands (talk:matrix:*), docs (docs/matrix.md) and the full specification incl. decision log (docs/matrix/SPEC.md, docs/matrix/PROMPTS.md)

Test coverage

  • Library: 58 unit tests + vodozemac interop suite + Synapse integration suite (docker compose)
  • Talk: tests/php/Matrix/ (17 tests)

Status

🚧 Draft. Working end-to-end against matrix.org (36 rooms, E2EE, media) on our devel instance. Open points are listed in the spec's implementation-status section (Behat/Synapse CI wiring, OpenAPI regeneration, mobile smoke test, appservice push source, library extraction to its own repository).

πŸ€– Generated with Claude Code

Talk can now act as a Matrix client: users link a Matrix account on an
admin-configured homeserver and their Matrix rooms appear as ordinary Talk
conversations - in the web UI as well as in the unchanged mobile and
desktop apps.

Protocol layer: new standalone, framework-free library
nextcloud/matrix-client-php under matrix-client/ (PSR-18/17, no OCP
imports, own test suite) including a pure-PHP implementation of the Matrix
end-to-end encryption stack (Olm, Megolm, SAS verification, key backup)
that is verified byte-for-byte against Element's vodozemac in an interop
harness.

Talk integration under lib/Matrix/: background /sync with per-account
locks and opportunistic foreground sync, ingestion of messages, state,
membership and power levels into Talk rooms/attendees (new actor type
'matrix', object type 'matrix'), decrypt-on-ingest with placeholder
replacement, key sharing/requests and device verification (emoji), room
key backup restore, media proxy with thumbnails and Save-to-Nextcloud,
uploads as (encrypted) Matrix attachments, reactions/edits/deletions/
threads/read receipts in both directions, room creation/DM/join-by-address
and the public room directory, invitations through the existing federation
invitation API, per-room capability detection exposed as
matrixCapabilities, admin settings (homeservers, policies, sync health),
occ commands (talk:matrix:*) and documentation (docs/matrix.md, full
specification in docs/matrix/SPEC.md).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Aug 31, 2026
@karlitschek

Copy link
Copy Markdown
Member Author

I only wanted to play around with this as an experiment. I didn't expect that it just works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits feature: federation 🌐

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants