Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
0b258003
Commit
0b258003
authored
Dec 19, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add converse-pubsub.js
parent
9c05ca9a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
227 additions
and
37 deletions
+227
-37
CHANGES.md
CHANGES.md
+2
-0
dist/converse.js
dist/converse.js
+141
-33
src/converse.js
src/converse.js
+5
-4
src/headless/converse-core.js
src/headless/converse-core.js
+1
-0
src/headless/converse-pubsub.js
src/headless/converse-pubsub.js
+77
-0
src/headless/headless.js
src/headless/headless.js
+1
-0
No files found.
CHANGES.md
View file @
0b258003
...
...
@@ -4,6 +4,8 @@
-
Bugfix: MUC commands were being ignored
-
UI: Always show the OMEMO lock icon (grayed out if not available).
-
Use
`publish-options`
with
`pubsub#access_model`
set to
`open`
when publishing OMEMO public keys and devices
-
Add a new
`converse-pubsub`
plugin, for generic PubSub operations
-
#1353 Message Delivery Receipts not working because of the message "type" attribute
-
#1374 Can't load embedded chat when changing
`view_mode`
between page reloads
-
#1376 Fixed some alignment issues in the sidebar
...
...
dist/converse.js
View file @
0b258003
This diff is collapsed.
Click to expand it.
src/converse.js
View file @
0b258003
...
...
@@ -2,6 +2,10 @@
* --------------------
* Any of the following components may be removed if they're not needed.
*/
import
"
@converse/headless/converse-mam
"
;
// XEP-0313 Message Archive Management
import
"
@converse/headless/converse-ping
"
;
// XEP-0199 XMPP Ping
import
"
@converse/headless/converse-pubsub
"
;
// XEP-0060 PubSub
import
"
@converse/headless/converse-vcard
"
;
// XEP-0054 VCard-temp
import
"
converse-autocomplete
"
;
import
"
converse-bookmarks
"
;
// XEP-0048 Bookmarks
import
"
converse-caps
"
;
// XEP-0115 Entity Capabilities
...
...
@@ -10,18 +14,15 @@ import "converse-controlbox"; // The control box
import
"
converse-dragresize
"
;
// Allows chat boxes to be resized by dragging them
import
"
converse-embedded
"
;
import
"
converse-fullscreen
"
;
import
"
converse-push
"
;
// XEP-0357 Push Notifications
import
"
converse-headline
"
;
// Support for headline messages
import
"
@converse/headless/converse-mam
"
;
// XEP-0313 Message Archive Management
import
"
converse-minimize
"
;
// Allows chat boxes to be minimized
import
"
converse-muc-views
"
;
// Views related to MUC
import
"
converse-notification
"
;
// HTML5 Notifications
import
"
converse-omemo
"
;
import
"
@converse/headless/converse-ping
"
;
// XEP-0199 XMPP Ping
import
"
converse-push
"
;
// XEP-0357 Push Notifications
import
"
converse-register
"
;
// XEP-0077 In-band registration
import
"
converse-roomslist
"
;
// Show currently open chat rooms
import
"
converse-rosterview
"
;
import
"
@converse/headless/converse-vcard
"
;
// XEP-0054 VCard-temp
/* END: Removable components */
import
converse
from
"
@converse/headless/converse-core
"
;
...
...
src/headless/converse-core.js
View file @
0b258003
...
...
@@ -89,6 +89,7 @@ _converse.core_plugins = [
'
converse-mam
'
,
'
converse-muc
'
,
'
converse-ping
'
,
'
converse-pubsub
'
,
'
converse-roster
'
,
'
converse-vcard
'
];
...
...
src/headless/converse-pubsub.js
0 → 100644
View file @
0b258003
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
import
"
./converse-disco
"
;
import
converse
from
"
./converse-core
"
;
const
{
Strophe
,
Backbone
,
Promise
,
$iq
,
$build
,
$msg
,
$pres
,
b64_sha1
,
f
,
moment
,
_
}
=
converse
.
env
;
Strophe
.
addNamespace
(
'
PUBSUB_ERROR
'
,
Strophe
.
NS
.
PUBSUB
+
"
#errors
"
);
converse
.
plugins
.
add
(
'
converse-pubsub
'
,
{
dependencies
:
[
"
converse-disco
"
],
initialize
()
{
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
const
{
_converse
}
=
this
,
{
__
}
=
_converse
;
/************************ BEGIN API ************************/
// We extend the default converse.js API to add methods specific to MUC groupchats.
_
.
extend
(
_converse
.
api
,
{
/**
* The "pubsub" namespace groups methods relevant to PubSub
*
* @namespace _converse.api.pubsub
* @memberOf _converse.api
*/
'
pubsub
'
:
{
/**
* Publshes an item to a PubSub node
*
* @method _converse.api.pubsub.publish
* @param {string} jid The JID of the pubsub service where the node resides.
* @param {string} node The node being published to
* @param {Strophe.Builder} item The Strophe.Builder representation of the XML element being published
* @param {object} options An object representing the publisher options
* (see https://xmpp.org/extensions/xep-0060.html#publisher-publish-options)
*/
async
'
publish
'
(
jid
,
node
,
item
,
options
)
{
const
stanza
=
$iq
({
'
from
'
:
_converse
.
bare_jid
,
'
type
'
:
'
set
'
,
'
to
'
:
jid
}).
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
publish
'
,
{
'
node
'
:
node
})
.
cnode
(
item
.
tree
()).
up
().
up
();
if
(
options
)
{
jid
=
jid
||
_converse
.
bare_jid
;
const
result
=
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
PUBSUB
+
'
#publish-options
'
,
jid
);
if
(
result
.
length
)
{
stanza
.
c
(
'
publish-options
'
)
.
c
(
'
x
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
XFORM
,
'
type
'
:
'
submit
'
})
.
c
(
'
field
'
,
{
'
var
'
:
'
FORM_TYPE
'
,
'
type
'
:
'
hidden
'
})
.
c
(
'
value
'
).
t
(
'
http://jabber.org/protocol/pubsub#publish-options
'
).
up
().
up
()
Object
.
keys
(
options
).
forEach
(
k
=>
stanza
.
c
(
'
field
'
,
{
'
var
'
:
k
}).
c
(
'
value
'
).
t
(
options
[
k
]).
up
().
up
());
}
else
{
_converse
.
log
(
`_converse.api.publish:
${
jid
}
does not support #publish-options, `
+
`so we didn't set them even though they were provided.`
)
}
}
return
_converse
.
api
.
sendIQ
(
stanza
);
}
}
});
/************************ END API ************************/
}
});
src/headless/headless.js
View file @
0b258003
...
...
@@ -2,6 +2,7 @@
* --------------------
* Any of the following components may be removed if they're not needed.
*/
import
"
./converse-pubsub
"
;
// XEP-0199 XMPP Ping
import
"
./converse-chatboxes
"
;
// Backbone Collection and Models for chat boxes
import
"
./converse-disco
"
;
// Service discovery plugin
import
"
./converse-mam
"
;
// XEP-0313 Message Archive Management
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment