Skip to content
Permalink
Browse files

Fix JSON containers with pubsub

Closes #402
  • Loading branch information
legastero committed Nov 15, 2019
1 parent 2ae3e2e commit 90b6635f41d086995a516d43e5c5321eefb5b6da
@@ -90,7 +90,7 @@
| [XEP-0320](https://xmpp.org/extensions/xep-0320.html) | Use of DTLS-SRTP in Jingle Sessions | 0.3.1 | [Source](../src/protocol/xep0320.ts) | |
| [XEP-0333](https://xmpp.org/extensions/xep-0333.html) | Chat Markers | 0.3.0 | [Source](../src/protocol/xep0333.ts) | [Test Cases](../test/protocol-cases/xep0333) |
| [XEP-0334](https://xmpp.org/extensions/xep-0334.html) | Message Processing Hints | 0.3.0 | [Source](../src/protocol/xep0334.ts) | [Test Cases](../test/protocol-cases/xep0334) |
| [XEP-0335](https://xmpp.org/extensions/xep-0335.html) | JSON Containers | 0.1 | [Source](../src/protocol/xep0335.ts) | |
| [XEP-0335](https://xmpp.org/extensions/xep-0335.html) | JSON Containers | 0.1 | [Source](../src/protocol/xep0335.ts) | [Test Cases](../test/protocol-cases/xep0335) |
| [XEP-0339](https://xmpp.org/extensions/xep-0339.html) | Source-Specific Media Attributes in Jingle | 0.1 | [Source](../src/protocol/xep0167.ts) | [Test Cases](../test/protocol-cases/xep0167) |
| [XEP-0350](https://xmpp.org/extensions/xep-0350.html) | Data Forms Geolocation Element | 0.2 | [Source](../src/protocol/xep0080.ts) | |
| [XEP-0352](https://xmpp.org/extensions/xep-0352.html) | Client State Indication | 0.2.1 | [Source](../src/protocol/xep0352.ts) | |
@@ -5,7 +5,13 @@
// Version: 0.1 (2013-10-25)
// ====================================================================

import { childJSON, DefinitionOptions, extendMessage, pubsubItemContentAliases } from '../jxt';
import {
childJSON,
DefinitionOptions,
extendMessage,
pubsubItemContentAliases,
textJSON
} from '../jxt';
import { NS_JSON_0 } from '../Namespaces';

import { PubsubItemContent } from './';
@@ -29,7 +35,7 @@ const Protocol: DefinitionOptions[] = [
aliases: pubsubItemContentAliases(),
element: 'json',
fields: {
json: childJSON(NS_JSON_0, 'json')
json: textJSON()
},
namespace: NS_JSON_0,
type: NS_JSON_0
@@ -0,0 +1,14 @@
[
"message",
{
"from": "pubsub.shakespeare.lit",
"to": "francisco@denmark.lit",
"id": "foo",
"lang": "",
"json": {
"name": "romeo",
"age": "421",
"status": "single"
}
}
]
@@ -0,0 +1,3 @@
<message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo'>
<json xmlns="urn:xmpp:json:0">{"name":"romeo","age":"421","status":"single"}</json>
</message>
@@ -0,0 +1,55 @@
[
"message",
{
"from": "pubsub.shakespeare.lit",
"id": "foo",
"lang": "",
"pubsub": {
"context": "event",
"items": {
"node": "princely_musings",
"published": [
{
"content": {
"itemType": "urn:xmpp:json:0",
"json": {
"age": "421",
"name": "romeo",
"status": "single"
}
},
"id": "ae890ac52d0df67ed7cfdf51b644e901"
}
]
}
},
"to": "francisco@denmark.lit"
},
{
"from": "pubsub.shakespeare.lit",
"id": "foo",
"lang": "",
"pubsub": {
"context": "event",
"eventType": "items",
"items": {
"node": "princely_musings",
"published": [
{
"content": {
"itemType": "urn:xmpp:json:0",
"json": {
"age": "421",
"name": "romeo",
"status": "single"
}
},
"id": "ae890ac52d0df67ed7cfdf51b644e901"
}
],
"retracted": []
}
},
"to": "francisco@denmark.lit"
}
]
@@ -0,0 +1,9 @@
<message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='princely_musings'>
<item id='ae890ac52d0df67ed7cfdf51b644e901'>
<json xmlns="urn:xmpp:json:0">{"age":"421","name":"romeo","status":"single"}</json>
</item>
</items>
</event>
</message>

0 comments on commit 90b6635

Please sign in to comment.
You can’t perform that action at this time.