Update 2.3. Swarm

This commit is contained in:
Sébastien Blin 2021-01-01 11:25:18 -05:00
parent f17f2a5ce0
commit e689be5443
1 changed files with 66 additions and 1 deletions

View File

@ -209,8 +209,73 @@ Conversations requests are represented by a **Map<String, String>** with the fol
+ id: the conversation id
+ from: uri of the sender
+ received: timestamp
+ title: (optional) name for the conversation
+ description: (optional)
+ avatar: (optional)
TODO: title? avatar?
## Conversation's profile synchronization
To be identifiable, a conversation generally needs some metadatas, like a title (eg: Jami), a description (eg: some links, what is the project, etc), and an image (the logo of the project). Those metadatas are optional, but shared across all members, so need to be synced and incorporated in the requests.
### Storage in the repository
The profile of the conversation is stored in a classic vCard file at the root (`/profile.vcf`) like:
```
BEGIN:VCARD
VERSION:2.1
FN:TITLE
DESCRIPTION:DESC
END:VCARD
```
### Synchronization
To update the vCard, an user with enough permissions (by default: =ADMIN) needs to edit `/profile.vcf`. and will commit the file with the mimetype `application/update-profile`. The new message is sent via the same mechanism and all peers will receive the **MessageReceived** signal from the daemon. The branch is dropped if the commit contains other files or too big or if done by a non authorized member (by default: <ADMIN).
### Merge conflicts management
Because two admins can change the description at the same time, a merge conflict can occurs on `profile.vcf`. In this case, the commit with the higher hash (eg ffffff > 000000) will be chosen.
### APIs
The user got 2 methods to get and set conversation's metadatas:
```xml
<method name="updateConversationInfos" tp:name-for-bindings="updateConversationInfos">
<tp:added version="10.0.0"/>
<tp:docstring>
Update conversation's infos (supported keys: title, description, avatar)
</tp:docstring>
<arg type="s" name="accountId" direction="in"/>
<arg type="s" name="conversationId" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="VectorMapStringString"/>
<arg type="a{ss}" name="infos" direction="in"/>
</method>
<method name="conversationInfos" tp:name-for-bindings="conversationInfos">
<tp:added version="10.0.0"/>
<tp:docstring>
Get conversation's infos (mode, title, description, avatar)
</tp:docstring>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
<arg type="a{ss}" name="infos" direction="out"/>
<arg type="s" name="accountId" direction="in"/>
<arg type="s" name="conversationId" direction="in"/>
</method>
```
where `infos` is a `map<str, str>` with the following keys:
+ mode: READ-ONLY
+ title
+ description
+ avatar
## Other mime types
+ `application/call-history+json` with a JSON containing the `id` and the `duration` of the call
+ `application/data-transfer+json` with a JSON containing the `tid` of the file
# Used protocols