diff --git a/content/client-server-api/modules/image_packs.md b/content/client-server-api/modules/image_packs.md index b1c0524d..6cbb7132 100644 --- a/content/client-server-api/modules/image_packs.md +++ b/content/client-server-api/modules/image_packs.md @@ -57,6 +57,8 @@ when creating or editing image packs. {{% event event="m.room.image_pack" %}} +#### Account data + {{% event event="m.image_pack.rooms" %}} #### Image properties @@ -82,6 +84,22 @@ To make a room's image pack available globally across all rooms, a user adds a reference to the pack in their `m.image_pack.rooms` account data event. The reference consists of the room ID and the `state_key` of the pack. +For example, to enable two packs from different rooms: + +```json +{ + "rooms": { + "!someroom:example.org": { + "": {} + }, + "!anotherroom:example.org": { + "": {}, + "sticker_pack": {} + } + } +} +``` + #### Space image packs Clients SHOULD surface image packs defined in the canonical space of the diff --git a/data/event-schemas/examples/m.image_pack.rooms.yaml b/data/event-schemas/examples/m.image_pack.rooms.yaml new file mode 100644 index 00000000..7d4f01eb --- /dev/null +++ b/data/event-schemas/examples/m.image_pack.rooms.yaml @@ -0,0 +1,15 @@ +{ + "$ref": "core/event.json", + "type": "m.image_pack.rooms", + "content": { + "rooms": { + "!someroom:example.org": { + "": {} + }, + "!anotherroom:example.org": { + "": {}, + "sticker_pack": {} + } + } + } +} diff --git a/data/event-schemas/examples/m.room.image_pack.yaml b/data/event-schemas/examples/m.room.image_pack.yaml new file mode 100644 index 00000000..6e580d1d --- /dev/null +++ b/data/event-schemas/examples/m.room.image_pack.yaml @@ -0,0 +1,29 @@ +{ + "$ref": "core/state_event.json", + "type": "m.room.image_pack", + "state_key": "", + "content": { + "images": { + "cat_wave": { + "url": "mxc://example.org/abc123", + "body": "a waving cat", + "info": { + "mimetype": "image/png", + "w": 512, + "h": 512, + "size": 84400 + } + }, + "cat_nap": { + "url": "mxc://example.org/def456", + "body": "a sleeping cat" + } + }, + "pack": { + "display_name": "Cats", + "avatar_url": "mxc://example.org/abc123", + "usage": ["emoticon"], + "attribution": "drawn by @alice:example.org" + } + } +} diff --git a/data/event-schemas/schema/m.room.image_pack.yaml b/data/event-schemas/schema/m.room.image_pack.yaml index 945b4922..bf2ce686 100644 --- a/data/event-schemas/schema/m.room.image_pack.yaml +++ b/data/event-schemas/schema/m.room.image_pack.yaml @@ -18,6 +18,9 @@ properties: A map from a [shortcode](#shortcode-grammar) to an image object. Each entry defines one image available in this pack. type: object + propertyNames: + type: string + pattern: '^[A-Za-z0-9_-]{1,100}$' additionalProperties: title: ImagePackImage type: object