The livechat plugin includes a Task Application. The present document describes how this is implemented.
This features relies on XEP-0060: Publish-Subscribe. This XEP provide a way to store and retrieve items, and to receive push notifications when an item is created/deleted/modified.
There is a Prosody Module, mod_pubsub_peertubelivechat, to implement some specific use of the pubsub mechanism.
We use the JID+NodeID addressing to specify some nodes related to each MUC room. The JID is the MUC room JID, the NodeID is functionnality we want to address. For now, this modules only implement one such node: “livechat-tasks”, to handle tasks and task lists. But the module code anticipates futur uses.
The “livechat-tasks” node contains two type of objects: Task and TaskList (XML Namespaces: urn:peertube-plugin-livechat:tasklist
and urn:peertube-plugin-livechat:task
). Tasks have an attribute containing their task list id.
On the front-end, we have the livechat-converse-tasks plugin for ConverseJS.
Here is the basic workflow used to subscribe to tasks/task-lists, and receive existing items.
urn:peertube-plugin-livechat:tasklist
and urn:peertube-plugin-livechat:task
.Note: on the backend side, we subscribe all users with the “publisher” affiliation level. This allows them to publish items, but not change the node configuration.
Here is the worflow to create/modify/delete items:
When users leaves a MUC room, they are automatically unsubscribed from the “livechat-tasks” node related to this room.
When users lose the owner/admin affiliation, they are removed from the “livechat-tasks” node subscriptions.
Here we describes the content of node items.
tasklist
urn:peertube-plugin-livechat:tasklist
name
: the text content is the task list nameExample: here is an example of IQ stanza to create a task-list item.
<iq
from="user@example.com"
id="45cf7543-67bf-4d03-bb5d-a55038a0512a:sendIQ"
to="035fcc4b-072f-4827-b296-6998b04e3456@room.example.com"
type="set"
xmlns="jabber:client"
>
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="livechat-tasks">
<item>
<tasklist xmlns="urn:peertube-plugin-livechat:tasklist">
<name>Task List Name</name>
</tasklist>
</item>
</publish>
</pubsub>
</iq>
task
urn:peertube-plugin-livechat:task
done
: if present and equal to “true”, means that the task is donelist
: the list idorder
: the order of the task in the task listname
: the text content is the task namedescription
: the text content is the task descriptionExample: here is an example of IQ stanza to create a task-list item.
<iq
from="user@example.com"
id="9fd9a162-1b6c-4b38-a2a1-2485b34f0d8d:sendIQ"
to="035fcc4b-072f-4827-b296-6998b04e3456@room.example.com"
type="set"
xmlns="jabber:client"
>
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="livechat-tasks">
<item>
<task
list="8302c024-c16e-4fbd-aca7-c94cdb2025de"
order="0"
done="true"
xmlns="urn:peertube-plugin-livechat:task"
>
<name>The task name</name>
<description>here is the description</description>
</task>
</item>
</publish>
</pubsub>
</iq>
Note: in the above example, we added done="true"
just for the example.
Don’t add the attribute if you want not the task to be marked as done (or if you want to undone the task).