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
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
...
...
@@ -60203,31 +60203,40 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var converse_autocomplete__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! converse-autocomplete */ "./src/converse-autocomplete.js");
/* harmony import */ var converse_bookmarks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! converse-bookmarks */ "./src/converse-bookmarks.js");
/* harmony import */ var converse_caps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! converse-caps */ "./src/converse-caps.js");
/* harmony import */ var converse_chatview__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! converse-chatview */ "./src/converse-chatview.js");
/* harmony import */ var converse_controlbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! converse-controlbox */ "./src/converse-controlbox.js");
/* harmony import */ var converse_dragresize__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! converse-dragresize */ "./src/converse-dragresize.js");
/* harmony import */ var converse_embedded__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! converse-embedded */ "./src/converse-embedded.js");
/* harmony import */ var converse_fullscreen__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! converse-fullscreen */ "./src/converse-fullscreen.js");
/* harmony import */ var converse_push__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! converse-push */ "./src/converse-push.js");
/* harmony import */ var converse_headline__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! converse-headline */ "./src/converse-headline.js");
/* harmony import */ var _converse_headless_converse_mam__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @converse/headless/converse-mam */ "./src/headless/converse-mam.js");
/* harmony import */ var converse_minimize__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! converse-minimize */ "./src/converse-minimize.js");
/* harmony import */ var converse_muc_views__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! converse-muc-views */ "./src/converse-muc-views.js");
/* harmony import */ var converse_notification__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! converse-notification */ "./src/converse-notification.js");
/* harmony import */ var converse_omemo__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! converse-omemo */ "./src/converse-omemo.js");
/* harmony import */ var _converse_headless_converse_ping__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @converse/headless/converse-ping */ "./src/headless/converse-ping.js");
/* harmony import */ var converse_register__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! converse-register */ "./src/converse-register.js");
/* harmony import */ var converse_roomslist__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! converse-roomslist */ "./src/converse-roomslist.js");
/* harmony import */ var converse_rosterview__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! converse-rosterview */ "./src/converse-rosterview.js");
/* harmony import */ var _converse_headless_converse_vcard__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @converse/headless/converse-vcard */ "./src/headless/converse-vcard.js");
/* harmony import */ var _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @converse/headless/converse-core */ "./src/headless/converse-core.js");
/* harmony import */ var _converse_headless_converse_mam__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @converse/headless/converse-mam */ "./src/headless/converse-mam.js");
/* harmony import */ var _converse_headless_converse_ping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @converse/headless/converse-ping */ "./src/headless/converse-ping.js");
/* harmony import */ var _converse_headless_converse_pubsub__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @converse/headless/converse-pubsub */ "./src/headless/converse-pubsub.js");
/* harmony import */ var _converse_headless_converse_vcard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @converse/headless/converse-vcard */ "./src/headless/converse-vcard.js");
/* harmony import */ var converse_autocomplete__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! converse-autocomplete */ "./src/converse-autocomplete.js");
/* harmony import */ var converse_bookmarks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! converse-bookmarks */ "./src/converse-bookmarks.js");
/* harmony import */ var converse_caps__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! converse-caps */ "./src/converse-caps.js");
/* harmony import */ var converse_chatview__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! converse-chatview */ "./src/converse-chatview.js");
/* harmony import */ var converse_controlbox__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! converse-controlbox */ "./src/converse-controlbox.js");
/* harmony import */ var converse_dragresize__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! converse-dragresize */ "./src/converse-dragresize.js");
/* harmony import */ var converse_embedded__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! converse-embedded */ "./src/converse-embedded.js");
/* harmony import */ var converse_fullscreen__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! converse-fullscreen */ "./src/converse-fullscreen.js");
/* harmony import */ var converse_headline__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! converse-headline */ "./src/converse-headline.js");
/* harmony import */ var converse_minimize__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! converse-minimize */ "./src/converse-minimize.js");
/* harmony import */ var converse_muc_views__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! converse-muc-views */ "./src/converse-muc-views.js");
/* harmony import */ var converse_notification__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! converse-notification */ "./src/converse-notification.js");
/* harmony import */ var converse_omemo__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! converse-omemo */ "./src/converse-omemo.js");
/* harmony import */ var converse_push__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! converse-push */ "./src/converse-push.js");
/* harmony import */ var converse_register__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! converse-register */ "./src/converse-register.js");
/* harmony import */ var converse_roomslist__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! converse-roomslist */ "./src/converse-roomslist.js");
/* harmony import */ var converse_rosterview__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! converse-rosterview */ "./src/converse-rosterview.js");
/* harmony import */ var _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @converse/headless/converse-core */ "./src/headless/converse-core.js");
/* START: Removable components
* --------------------
* Any of the following components may be removed if they're not needed.
*/
// XEP-0313 Message Archive Management
// XEP-0199 XMPP Ping
// XEP-0060 PubSub
// XEP-0054 VCard-temp
// XEP-0048 Bookmarks
...
...
@@ -60241,12 +60250,8 @@ __webpack_require__.r(__webpack_exports__);
// XEP-0357 Push Notifications
// Support for headline messages
// XEP-0313 Message Archive Management
// Allows chat boxes to be minimized
// Views related to MUC
...
...
@@ -60254,23 +60259,21 @@ __webpack_require__.r(__webpack_exports__);
// HTML5 Notifications
// XEP-0
199 XMPP Ping
// XEP-0
357 Push Notifications
// XEP-0077 In-band registration
// Show currently open chat rooms
// XEP-0054 VCard-temp
/* END: Removable components */
const WHITELISTED_PLUGINS = ['converse-autocomplete', 'converse-bookmarks', 'converse-caps', 'converse-chatboxviews', 'converse-chatview', 'converse-controlbox', 'converse-dragresize', 'converse-embedded', 'converse-fullscreen', 'converse-headline', 'converse-message-view', 'converse-minimize', 'converse-modal', 'converse-muc-views', 'converse-notification', 'converse-oauth', 'converse-omemo', 'converse-profile', 'converse-push', 'converse-register', 'converse-roomslist', 'converse-rosterview', 'converse-singleton'];
const initialize = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
0
__["default"].initialize;
const initialize = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
1
__["default"].initialize;
_converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
0
__["default"].initialize = function (settings, callback) {
if (_converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
0
__["default"].env._.isArray(settings.whitelisted_plugins)) {
_converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
1
__["default"].initialize = function (settings, callback) {
if (_converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
1
__["default"].env._.isArray(settings.whitelisted_plugins)) {
settings.whitelisted_plugins = settings.whitelisted_plugins.concat(WHITELISTED_PLUGINS);
} else {
settings.whitelisted_plugins = WHITELISTED_PLUGINS;
...
...
@@ -60279,7 +60282,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_20__["default"].initia
return initialize(settings, callback);
};
/* harmony default export */ __webpack_exports__["default"] = (_converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
0
__["default"]);
/* harmony default export */ __webpack_exports__["default"] = (_converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2
1
__["default"]);
/***/ }),
...
...
@@ -62663,7 +62666,7 @@ pluggable_js_dist_pluggable__WEBPACK_IMPORTED_MODULE_8___default.a.enable(_conve
// These are just the @converse/headless plugins, for the full converse,
// the other plugins are whitelisted in src/converse.js
_converse.core_plugins = ['converse-chatboxes', 'converse-core', 'converse-disco', 'converse-mam', 'converse-muc', 'converse-ping', 'converse-roster', 'converse-vcard'];
_converse.core_plugins = ['converse-chatboxes', 'converse-core', 'converse-disco', 'converse-mam', 'converse-muc', 'converse-ping', 'converse-
pubsub', 'converse-
roster', 'converse-vcard'];
_converse.keycodes = {
TAB: 9,
ENTER: 13,
...
...
@@ -67808,6 +67811,111 @@ _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins.add('converse-pin
/***/ }),
/***/ "./src/headless/converse-pubsub.js":
/*!*****************************************!*\
!*** ./src/headless/converse-pubsub.js ***!
\*****************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _converse_disco__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./converse-disco */ "./src/headless/converse-disco.js");
/* harmony import */ var _converse_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./converse-core */ "./src/headless/converse-core.js");
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
const _converse$env = _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].env,
Strophe = _converse$env.Strophe,
Backbone = _converse$env.Backbone,
Promise = _converse$env.Promise,
$iq = _converse$env.$iq,
$build = _converse$env.$build,
$msg = _converse$env.$msg,
$pres = _converse$env.$pres,
b64_sha1 = _converse$env.b64_sha1,
f = _converse$env.f,
moment = _converse$env.moment,
_ = _converse$env._;
Strophe.addNamespace('PUBSUB_ERROR', Strophe.NS.PUBSUB + "#errors");
_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].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,
__ = _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/converse-roster.js":
/*!*****************************************!*\
!*** ./src/headless/converse-roster.js ***!
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