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
d41a7a14
Commit
d41a7a14
authored
Mar 29, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use API to emit and listen to events
parent
74816434
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
291 additions
and
291 deletions
+291
-291
dist/converse.js
dist/converse.js
+114
-114
docs/source/developer_api.rst
docs/source/developer_api.rst
+1
-1
docs/source/plugin_development.rst
docs/source/plugin_development.rst
+2
-2
src/converse-bookmarks.js
src/converse-bookmarks.js
+4
-4
src/converse-chatboxviews.js
src/converse-chatboxviews.js
+1
-1
src/converse-chatview.js
src/converse-chatview.js
+14
-14
src/converse-controlbox.js
src/converse-controlbox.js
+7
-7
src/converse-headline.js
src/converse-headline.js
+6
-6
src/converse-mam-views.js
src/converse-mam-views.js
+2
-2
src/converse-minimize.js
src/converse-minimize.js
+4
-4
src/converse-muc-views.js
src/converse-muc-views.js
+4
-4
src/converse-notification.js
src/converse-notification.js
+6
-6
src/converse-omemo.js
src/converse-omemo.js
+1
-1
src/converse-profile.js
src/converse-profile.js
+1
-1
src/converse-roomslist.js
src/converse-roomslist.js
+1
-1
src/converse-rosterview.js
src/converse-rosterview.js
+3
-3
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+6
-6
src/headless/converse-core.js
src/headless/converse-core.js
+27
-27
src/headless/converse-disco.js
src/headless/converse-disco.js
+5
-5
src/headless/converse-mam.js
src/headless/converse-mam.js
+2
-2
src/headless/converse-muc.js
src/headless/converse-muc.js
+6
-6
src/headless/converse-ping.js
src/headless/converse-ping.js
+2
-2
src/headless/converse-roster.js
src/headless/converse-roster.js
+11
-11
src/headless/converse-vcard.js
src/headless/converse-vcard.js
+1
-1
src/headless/dist/converse-headless.js
src/headless/dist/converse-headless.js
+60
-60
No files found.
dist/converse.js
View file @
d41a7a14
...
@@ -48545,10 +48545,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -48545,10 +48545,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
await _converse.bookmarks.fetchBookmarks();
await _converse.bookmarks.fetchBookmarks();
}
}
_converse.emit('bookmarksInitialized');
_converse.
api.
emit('bookmarksInitialized');
};
};
_converse.on('clearSession', () => {
_converse.
api.listen.
on('clearSession', () => {
if (!_.isUndefined(_converse.bookmarks)) {
if (!_.isUndefined(_converse.bookmarks)) {
_converse.bookmarks.browserStorage._clear();
_converse.bookmarks.browserStorage._clear();
...
@@ -48556,9 +48556,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -48556,9 +48556,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
}
}
});
});
_converse.on('reconnected', initBookmarks);
_converse.
api.listen.
on('reconnected', initBookmarks);
_converse.on('connected', async () => {
_converse.
api.listen.
on('connected', async () => {
// Add a handler for bookmarks pushed from other connected clients
// Add a handler for bookmarks pushed from other connected clients
// (from the same user obviously)
// (from the same user obviously)
_converse.connection.addHandler(message => {
_converse.connection.addHandler(message => {
...
@@ -48848,7 +48848,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
...
@@ -48848,7 +48848,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
'model': _converse.chatboxes
'model': _converse.chatboxes
});
});
_converse.emit('chatBoxViewsInitialized');
_converse.
api.
emit('chatBoxViewsInitialized');
});
});
_converse.api.listen.on('clearSession', () => _converse.chatboxviews.closeAllChatBoxes());
_converse.api.listen.on('clearSession', () => _converse.chatboxviews.closeAllChatBoxes());
...
@@ -49090,7 +49090,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -49090,7 +49090,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
onStatusMessageChanged(item) {
onStatusMessageChanged(item) {
this.render();
this.render();
_converse.emit('contactStatusMessageChanged', {
_converse.
api.
emit('contactStatusMessageChanged', {
'contact': item.attributes,
'contact': item.attributes,
'message': item.get('status')
'message': item.get('status')
});
});
...
@@ -49111,7 +49111,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -49111,7 +49111,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.model.on('change', this.render, this);
this.model.on('change', this.render, this);
this.registerContactEventHandlers();
this.registerContactEventHandlers();
_converse.emit('userDetailsModalInitialized', this.model);
_converse.
api.
emit('userDetailsModalInitialized', this.model);
},
},
toHTML() {
toHTML() {
...
@@ -49221,9 +49221,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -49221,9 +49221,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.render();
this.render();
this.fetchMessages();
this.fetchMessages();
_converse.emit('chatBoxOpened', this);
_converse.
api.
emit('chatBoxOpened', this);
_converse.emit('chatBoxInitialized', this);
_converse.
api.
emit('chatBoxInitialized', this);
},
},
initDebounced() {
initDebounced() {
...
@@ -49257,7 +49257,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -49257,7 +49257,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.addSpoilerButton(options);
this.addSpoilerButton(options);
this.addFileUploadButton();
this.addFileUploadButton();
_converse.emit('renderToolbar', this);
_converse.
api.
emit('renderToolbar', this);
return this;
return this;
},
},
...
@@ -49407,7 +49407,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -49407,7 +49407,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.scrollDown();
this.scrollDown();
this.content.addEventListener('scroll', this.markScrolled.bind(this));
this.content.addEventListener('scroll', this.markScrolled.bind(this));
_converse.emit('afterMessagesFetched', this);
_converse.
api.
emit('afterMessagesFetched', this);
},
},
fetchMessages() {
fetchMessages() {
...
@@ -49722,7 +49722,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -49722,7 +49722,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.insertIntoTextArea(message.get('message'), true, true);
this.insertIntoTextArea(message.get('message'), true, true);
}
}
_converse.emit('messageAdded', {
_converse.
api.
emit('messageAdded', {
'message': message,
'message': message,
'chatbox': this.model
'chatbox': this.model
});
});
...
@@ -49800,7 +49800,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -49800,7 +49800,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
_converse_headless_utils_emoji__WEBPACK_IMPORTED_MODULE_21__["default"].removeClass('correcting', textarea);
_converse_headless_utils_emoji__WEBPACK_IMPORTED_MODULE_21__["default"].removeClass('correcting', textarea);
textarea.style.height = 'auto'; // Fixes weirdness
textarea.style.height = 'auto'; // Fixes weirdness
_converse.emit('messageSend', message);
_converse.
api.
emit('messageSend', message);
}
}
textarea.removeAttribute('disabled');
textarea.removeAttribute('disabled');
...
@@ -50039,7 +50039,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50039,7 +50039,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
toggleCall(ev) {
toggleCall(ev) {
ev.stopPropagation();
ev.stopPropagation();
_converse.emit('callButtonClicked', {
_converse.
api.
emit('callButtonClicked', {
connection: _converse.connection,
connection: _converse.connection,
model: this.model
model: this.model
});
});
...
@@ -50125,7 +50125,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50125,7 +50125,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.remove();
this.remove();
_converse.emit('chatBoxClosed', this);
_converse.
api.
emit('chatBoxClosed', this);
return this;
return this;
},
},
...
@@ -50149,7 +50149,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50149,7 +50149,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
if (!_.isNull(textarea_el)) {
if (!_.isNull(textarea_el)) {
textarea_el.focus();
textarea_el.focus();
_converse.emit('chatBoxFocused', this);
_converse.
api.
emit('chatBoxFocused', this);
}
}
return this;
return this;
...
@@ -50240,7 +50240,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50240,7 +50240,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.model.clearUnreadMsgCounter();
this.model.clearUnreadMsgCounter();
}
}
_converse.emit('chatBoxScrolledDown', {
_converse.
api.
emit('chatBoxScrolledDown', {
'chatbox': this.model
'chatbox': this.model
});
});
},
},
...
@@ -50264,7 +50264,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50264,7 +50264,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
});
});
_converse.on('chatBoxViewsInitialized', () => {
_converse.
api.listen.
on('chatBoxViewsInitialized', () => {
const that = _converse.chatboxviews;
const that = _converse.chatboxviews;
_converse.chatboxes.on('add', item => {
_converse.chatboxes.on('add', item => {
...
@@ -50276,7 +50276,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50276,7 +50276,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
});
});
});
});
_converse.on('connected', () => {
_converse.
api.listen.
on('connected', () => {
// Advertise that we support XEP-0382 Message Spoilers
// Advertise that we support XEP-0382 Message Spoilers
_converse.api.disco.own.features.add(Strophe.NS.SPOILER);
_converse.api.disco.own.features.add(Strophe.NS.SPOILER);
});
});
...
@@ -50597,7 +50597,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50597,7 +50597,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.insertRoster();
this.insertRoster();
}
}
_converse.emit('controlboxInitialized', this);
_converse.
api.
emit('controlboxInitialized', this);
},
},
render() {
render() {
...
@@ -50714,7 +50714,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50714,7 +50714,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.model.trigger('hide');
this.model.trigger('hide');
}
}
_converse.emit('controlBoxClosed', this);
_converse.
api.
emit('controlBoxClosed', this);
return this;
return this;
},
},
...
@@ -50734,7 +50734,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50734,7 +50734,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
u.addClass('hidden', this.el);
u.addClass('hidden', this.el);
_converse.emit('chatBoxClosed', this);
_converse.
api.
emit('chatBoxClosed', this);
if (!_converse.connection.connected) {
if (!_converse.connection.connected) {
_converse.controlboxtoggle.render();
_converse.controlboxtoggle.render();
...
@@ -50749,7 +50749,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50749,7 +50749,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.model.set('closed', false);
this.model.set('closed', false);
this.el.classList.remove('hidden');
this.el.classList.remove('hidden');
_converse.emit('controlBoxOpened', this);
_converse.
api.
emit('controlBoxOpened', this);
},
},
show() {
show() {
...
@@ -50996,7 +50996,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -50996,7 +50996,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
});
});
_converse.on('chatBoxViewsInitialized', () => {
_converse.
api.listen.
on('chatBoxViewsInitialized', () => {
const that = _converse.chatboxviews;
const that = _converse.chatboxviews;
_converse.chatboxes.on('add', item => {
_converse.chatboxes.on('add', item => {
...
@@ -51015,7 +51015,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -51015,7 +51015,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
});
});
});
});
_converse.on('clearSession', () => {
_converse.
api.listen.
on('clearSession', () => {
if (_converse.config.get('trusted')) {
if (_converse.config.get('trusted')) {
const chatboxes = _.get(_converse, 'chatboxes', null);
const chatboxes = _.get(_converse, 'chatboxes', null);
...
@@ -51033,7 +51033,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -51033,7 +51033,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
Promise.all([_converse.api.waitUntil('connectionInitialized'), _converse.api.waitUntil('chatBoxViewsInitialized')]).then(addControlBox).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
Promise.all([_converse.api.waitUntil('connectionInitialized'), _converse.api.waitUntil('chatBoxViewsInitialized')]).then(addControlBox).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
_converse.on('chatBoxesFetched', () => {
_converse.
api.listen.
on('chatBoxesFetched', () => {
const controlbox = _converse.chatboxes.get('controlbox') || addControlBox();
const controlbox = _converse.chatboxes.get('controlbox') || addControlBox();
controlbox.save({
controlbox.save({
connected: true
connected: true
...
@@ -51741,9 +51741,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -51741,9 +51741,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
this.model.on('change:minimized', this.onMinimizedChanged, this);
this.model.on('change:minimized', this.onMinimizedChanged, this);
this.render().insertHeading().fetchMessages().insertIntoDOM().hide();
this.render().insertHeading().fetchMessages().insertIntoDOM().hide();
_converse.emit('chatBoxOpened', this);
_converse.
api.
emit('chatBoxOpened', this);
_converse.emit('chatBoxInitialized', this);
_converse.
api.
emit('chatBoxInitialized', this);
},
},
render() {
render() {
...
@@ -51789,7 +51789,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -51789,7 +51789,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
const attrs = await chatbox.getMessageAttributesFromStanza(message, message);
const attrs = await chatbox.getMessageAttributesFromStanza(message, message);
await chatbox.messages.create(attrs);
await chatbox.messages.create(attrs);
_converse.emit('message', {
_converse.
api.
emit('message', {
'chatbox': chatbox,
'chatbox': chatbox,
'stanza': message
'stanza': message
});
});
...
@@ -51803,11 +51803,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -51803,11 +51803,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
}, null, 'message');
}, null, 'message');
}
}
_converse.on('connected', registerHeadlineHandler);
_converse.
api.listen.
on('connected', registerHeadlineHandler);
_converse.on('reconnected', registerHeadlineHandler);
_converse.
api.listen.
on('reconnected', registerHeadlineHandler);
_converse.on('chatBoxViewsInitialized', () => {
_converse.
api.listen.
on('chatBoxViewsInitialized', () => {
const that = _converse.chatboxviews;
const that = _converse.chatboxviews;
_converse.chatboxes.on('add', item => {
_converse.chatboxes.on('add', item => {
...
@@ -52030,9 +52030,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -52030,9 +52030,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
const _converse = this._converse;
const _converse = this._converse;
/* Event handlers */
/* Event handlers */
_converse.on('afterMessagesFetched', view => view.fetchNewestMessages());
_converse.
api.listen.
on('afterMessagesFetched', view => view.fetchNewestMessages());
_converse.on('reconnected', () => {
_converse.
api.listen.
on('reconnected', () => {
const private_chats = _converse.chatboxviews.filter(view => _.at(view, 'model.attributes.type')[0] === 'chatbox');
const private_chats = _converse.chatboxviews.filter(view => _.at(view, 'model.attributes.type')[0] === 'chatbox');
_.each(private_chats, view => view.fetchNewestMessages());
_.each(private_chats, view => view.fetchNewestMessages());
...
@@ -52535,7 +52535,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -52535,7 +52535,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
this.show();
this.show();
this.__super__._converse.emit('chatBoxMaximized', this);
this.__super__._converse.
api.
emit('chatBoxMaximized', this);
return this;
return this;
},
},
...
@@ -52561,7 +52561,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -52561,7 +52561,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
this.setChatState(_converse.INACTIVE).model.minimize();
this.setChatState(_converse.INACTIVE).model.minimize();
this.hide();
this.hide();
_converse.emit('chatBoxMinimized', this);
_converse.
api.
emit('chatBoxMinimized', this);
}
}
},
},
...
@@ -52785,7 +52785,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -52785,7 +52785,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
} else {
} else {
this.model.destroy();
this.model.destroy();
_converse.emit('chatBoxClosed', this);
_converse.
api.
emit('chatBoxClosed', this);
}
}
return this;
return this;
...
@@ -52969,7 +52969,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -52969,7 +52969,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
model: _converse.chatboxes
model: _converse.chatboxes
});
});
_converse.emit('minimizedChatsInitialized');
_converse.
api.
emit('minimizedChatsInitialized');
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
const debouncedTrim = _.debounce(ev => {
const debouncedTrim = _.debounce(ev => {
...
@@ -53282,7 +53282,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -53282,7 +53282,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.roomspanel.model.fetch();
this.roomspanel.model.fetch();
this.el.querySelector('.controlbox-pane').insertAdjacentElement('beforeEnd', this.roomspanel.render().el);
this.el.querySelector('.controlbox-pane').insertAdjacentElement('beforeEnd', this.roomspanel.render().el);
_converse.emit('roomsPanelRendered');
_converse.
api.
emit('roomsPanelRendered');
},
},
renderControlBoxPane() {
renderControlBoxPane() {
...
@@ -53787,7 +53787,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -53787,7 +53787,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.fetchMessages();
this.fetchMessages();
}
}
_converse.emit('chatRoomOpened', this);
_converse.
api.
emit('chatRoomOpened', this);
},
},
render() {
render() {
...
@@ -55402,7 +55402,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -55402,7 +55402,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse.on('chatBoxViewsInitialized', () => {
_converse.
api.listen.
on('chatBoxViewsInitialized', () => {
function openChatRoomFromURIClicked(ev) {
function openChatRoomFromURIClicked(ev) {
ev.preventDefault();
ev.preventDefault();
...
@@ -55453,7 +55453,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -55453,7 +55453,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
});
});
}
}
_converse.on('reconnected', reconnectToChatRooms);
_converse.
api.listen.
on('reconnected', reconnectToChatRooms);
/************************ END Event Handlers ************************/
/************************ END Event Handlers ************************/
/************************ BEGIN API ************************/
/************************ BEGIN API ************************/
...
@@ -55854,19 +55854,19 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -55854,19 +55854,19 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
}
}
};
};
_converse.on('pluginsInitialized', function () {
_converse.
api.listen.
on('pluginsInitialized', function () {
// We only register event handlers after all plugins are
// We only register event handlers after all plugins are
// registered, because other plugins might override some of our
// registered, because other plugins might override some of our
// handlers.
// handlers.
_converse.on('contactRequest', _converse.handleContactRequestNotification);
_converse.
api.listen.
on('contactRequest', _converse.handleContactRequestNotification);
_converse.on('contactPresenceChanged', _converse.handleChatStateNotification);
_converse.
api.listen.
on('contactPresenceChanged', _converse.handleChatStateNotification);
_converse.on('message', _converse.handleMessageNotification);
_converse.
api.listen.
on('message', _converse.handleMessageNotification);
_converse.on('feedback', _converse.handleFeedback);
_converse.
api.listen.
on('feedback', _converse.handleFeedback);
_converse.on('connected', _converse.requestPermission);
_converse.
api.listen.
on('connected', _converse.requestPermission);
});
});
}
}
...
@@ -57162,7 +57162,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -57162,7 +57162,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
await restoreOMEMOSession();
await restoreOMEMOSession();
await _converse.omemo_store.publishBundle();
await _converse.omemo_store.publishBundle();
_converse.emit('OMEMOInitialized');
_converse.
api.
emit('OMEMOInitialized');
}
}
async function onOccupantAdded(chatroom, occupant) {
async function onOccupantAdded(chatroom, occupant) {
...
@@ -57372,7 +57372,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
...
@@ -57372,7 +57372,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
_converse.BootstrapModal.prototype.initialize.apply(this, arguments);
_converse.BootstrapModal.prototype.initialize.apply(this, arguments);
_converse.emit('profileModalInitialized', this.model);
_converse.
api.
emit('profileModalInitialized', this.model);
},
},
toHTML() {
toHTML() {
...
@@ -58882,7 +58882,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -58882,7 +58882,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.api.emit('roomsListInitialized');
_converse.api.emit('roomsListInitialized');
};
};
_converse.on('connected', async () => {
_converse.
api.listen.
on('connected', async () => {
if (_converse.allow_bookmarks) {
if (_converse.allow_bookmarks) {
await _converse.api.waitUntil('bookmarksInitialized');
await _converse.api.waitUntil('bookmarksInitialized');
} else {
} else {
...
@@ -59824,9 +59824,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
...
@@ -59824,9 +59824,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
// storage or the XMPP server and once they've been
// storage or the XMPP server and once they've been
// assigned to their various groups.
// assigned to their various groups.
_converse.on('rosterGroupsFetched', this.sortAndPositionAllItems.bind(this));
_converse.
api.listen.
on('rosterGroupsFetched', this.sortAndPositionAllItems.bind(this));
_converse.on('rosterContactsFetched', () => {
_converse.
api.listen.
on('rosterContactsFetched', () => {
_converse.roster.each(contact => this.addRosterContact(contact, {
_converse.roster.each(contact => this.addRosterContact(contact, {
'silent': true
'silent': true
}));
}));
...
@@ -60077,7 +60077,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
...
@@ -60077,7 +60077,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
_converse.rosterview.render();
_converse.rosterview.render();
_converse.emit('rosterViewInitialized');
_converse.
api.
emit('rosterViewInitialized');
}
}
_converse.api.listen.on('rosterInitialized', initRoster);
_converse.api.listen.on('rosterInitialized', initRoster);
...
@@ -62374,7 +62374,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -62374,7 +62374,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
}
}
});
});
_converse.emit('chatBoxesFetched');
_converse.
api.
emit('chatBoxesFetched');
},
},
onConnected() {
onConnected() {
...
@@ -62534,7 +62534,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -62534,7 +62534,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
}
}
}
}
_converse.emit('message', {
_converse.
api.
emit('message', {
'stanza': original_stanza,
'stanza': original_stanza,
'chatbox': chatbox
'chatbox': chatbox
});
});
...
@@ -62598,14 +62598,14 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -62598,14 +62598,14 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
}
}
});
});
_converse.emit('privateChatsAutoJoined');
_converse.
api.
emit('privateChatsAutoJoined');
}
}
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse.on('chatBoxesFetched', autoJoinChats);
_converse.
api.listen.
on('chatBoxesFetched', autoJoinChats);
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
_converse.api.disco.own.features.add(Strophe.NS.MESSAGE_CORRECT);
_converse.api.disco.own.features.add(Strophe.NS.MESSAGE_CORRECT);
_converse.api.disco.own.features.add(Strophe.NS.HTTPUPLOAD);
_converse.api.disco.own.features.add(Strophe.NS.HTTPUPLOAD);
...
@@ -62616,7 +62616,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -62616,7 +62616,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
_converse.api.listen.on('pluginsInitialized', () => {
_converse.api.listen.on('pluginsInitialized', () => {
_converse.chatboxes = new _converse.ChatBoxes();
_converse.chatboxes = new _converse.ChatBoxes();
_converse.emit('chatBoxesInitialized');
_converse.
api.
emit('chatBoxesInitialized');
});
});
_converse.api.listen.on('presencesInitialized', () => _converse.chatboxes.onConnected());
_converse.api.listen.on('presencesInitialized', () => _converse.chatboxes.onConnected());
...
@@ -63160,7 +63160,7 @@ function initPlugins() {
...
@@ -63160,7 +63160,7 @@ function initPlugins() {
*/
*/
_converse.emit('pluginsInitialized');
_converse.
api.
emit('pluginsInitialized');
}
}
function initClientConfig() {
function initClientConfig() {
...
@@ -63189,7 +63189,7 @@ function initClientConfig() {
...
@@ -63189,7 +63189,7 @@ function initClientConfig() {
*/
*/
_converse.emit('clientConfigInitialized');
_converse.
api.
emit('clientConfigInitialized');
}
}
_converse.initConnection = function () {
_converse.initConnection = function () {
...
@@ -63219,7 +63219,7 @@ _converse.initConnection = function () {
...
@@ -63219,7 +63219,7 @@ _converse.initConnection = function () {
* @event _converse#connectionInitialized
* @event _converse#connectionInitialized
*/
*/
_converse.emit('connectionInitialized');
_converse.
api.
emit('connectionInitialized');
};
};
function setUpXMLLogging() {
function setUpXMLLogging() {
...
@@ -63253,7 +63253,7 @@ function finishInitialization() {
...
@@ -63253,7 +63253,7 @@ function finishInitialization() {
}
}
if (_converse.idle_presence_timeout > 0) {
if (_converse.idle_presence_timeout > 0) {
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
_converse.api.disco.own.features.add(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].NS.IDLE);
_converse.api.disco.own.features.add(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].NS.IDLE);
});
});
}
}
...
@@ -63262,7 +63262,7 @@ function finishInitialization() {
...
@@ -63262,7 +63262,7 @@ function finishInitialization() {
function unregisterGlobalEventHandlers() {
function unregisterGlobalEventHandlers() {
document.removeEventListener("visibilitychange", _converse.saveWindowState);
document.removeEventListener("visibilitychange", _converse.saveWindowState);
_converse.emit('unregisteredGlobalEventHandlers');
_converse.
api.
emit('unregisteredGlobalEventHandlers');
}
}
function cleanup() {
function cleanup() {
...
@@ -63536,7 +63536,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63536,7 +63536,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('disconnected');
_converse.
api.
emit('disconnected');
};
};
this.onDisconnected = function () {
this.onDisconnected = function () {
...
@@ -63551,7 +63551,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63551,7 +63551,7 @@ _converse.initialize = async function (settings, callback) {
/* In this case, we reconnect, because we might be receiving
/* In this case, we reconnect, because we might be receiving
* expirable tokens from the credentials_url.
* expirable tokens from the credentials_url.
*/
*/
_converse.emit('will-reconnect');
_converse.
api.
emit('will-reconnect');
return _converse.reconnect();
return _converse.reconnect();
} else {
} else {
...
@@ -63568,7 +63568,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63568,7 +63568,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('will-reconnect');
_converse.
api.
emit('will-reconnect');
_converse.reconnect();
_converse.reconnect();
};
};
...
@@ -63721,7 +63721,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63721,7 +63721,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('sessionInitialized');
_converse.
api.
emit('sessionInitialized');
};
};
this.clearSession = function () {
this.clearSession = function () {
...
@@ -63740,7 +63740,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63740,7 +63740,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('clearSession');
_converse.
api.
emit('clearSession');
};
};
this.logOut = function () {
this.logOut = function () {
...
@@ -63763,7 +63763,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63763,7 +63763,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('logout');
_converse.
api.
emit('logout');
};
};
this.saveWindowState = function (ev) {
this.saveWindowState = function (ev) {
...
@@ -63793,7 +63793,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63793,7 +63793,7 @@ _converse.initialize = async function (settings, callback) {
_converse.windowState = state;
_converse.windowState = state;
_converse.emit('windowStateChanged', {
_converse.
api.
emit('windowStateChanged', {
state
state
});
});
};
};
...
@@ -63806,7 +63806,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63806,7 +63806,7 @@ _converse.initialize = async function (settings, callback) {
}); // Set initial state
}); // Set initial state
_converse.emit('registeredGlobalEventHandlers');
_converse.
api.
emit('registeredGlobalEventHandlers');
};
};
this.enableCarbons = function () {
this.enableCarbons = function () {
...
@@ -63856,10 +63856,10 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63856,10 +63856,10 @@ _converse.initialize = async function (settings, callback) {
* // As an ES2015 Promise
* // As an ES2015 Promise
* _converse.api.waitUntil('statusInitialized').then(() => { ... });
* _converse.api.waitUntil('statusInitialized').then(() => { ... });
*/
*/
_converse.emit('statusInitialized', reconnecting);
_converse.
api.
emit('statusInitialized', reconnecting);
if (reconnecting) {
if (reconnecting) {
_converse.emit('reconnected');
_converse.
api.
emit('reconnected');
} else {
} else {
init_promise.resolve();
init_promise.resolve();
/**
/**
...
@@ -63869,7 +63869,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63869,7 +63869,7 @@ _converse.initialize = async function (settings, callback) {
* @event _converse#initialized
* @event _converse#initialized
*/
*/
_converse.emit('initialized');
_converse.
api.
emit('initialized');
/**
/**
* Emitted after the connection has been established and Converse
* Emitted after the connection has been established and Converse
* has got all its ducks in a row.
* has got all its ducks in a row.
...
@@ -63878,7 +63878,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63878,7 +63878,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('connected');
_converse.
api.
emit('connected');
}
}
};
};
...
@@ -63888,7 +63888,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63888,7 +63888,7 @@ _converse.initialize = async function (settings, callback) {
_converse.resource = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getResourceFromJid(_converse.connection.jid);
_converse.resource = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getResourceFromJid(_converse.connection.jid);
_converse.domain = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getDomainFromJid(_converse.connection.jid);
_converse.domain = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getDomainFromJid(_converse.connection.jid);
_converse.emit('setUserJID');
_converse.
api.
emit('setUserJID');
};
};
this.onConnected = function (reconnecting) {
this.onConnected = function (reconnecting) {
...
@@ -63914,7 +63914,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63914,7 +63914,7 @@ _converse.initialize = async function (settings, callback) {
},
},
initialize() {
initialize() {
this.on('change', () => _converse.emit('connfeedback', _converse.connfeedback));
this.on('change', () => _converse.
api.
emit('connfeedback', _converse.connfeedback));
}
}
});
});
...
@@ -63942,13 +63942,13 @@ _converse.initialize = async function (settings, callback) {
...
@@ -63942,13 +63942,13 @@ _converse.initialize = async function (settings, callback) {
const status = this.get('status');
const status = this.get('status');
this.sendPresence(status);
this.sendPresence(status);
_converse.emit('statusChanged', status);
_converse.
api.
emit('statusChanged', status);
});
});
this.on('change:status_message', () => {
this.on('change:status_message', () => {
const status_message = this.get('status_message');
const status_message = this.get('status_message');
this.sendPresence(this.get('status'), status_message);
this.sendPresence(this.get('status'), status_message);
_converse.emit('statusMessageChanged', status_message);
_converse.
api.
emit('statusMessageChanged', status_message);
});
});
},
},
...
@@ -64016,7 +64016,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -64016,7 +64016,7 @@ _converse.initialize = async function (settings, callback) {
xhr.onerror = function () {
xhr.onerror = function () {
delete _converse.connection;
delete _converse.connection;
_converse.emit('noResumeableSession', this);
_converse.
api.
emit('noResumeableSession', this);
reject(xhr.responseText);
reject(xhr.responseText);
};
};
...
@@ -64042,7 +64042,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -64042,7 +64042,7 @@ _converse.initialize = async function (settings, callback) {
xhr.onerror = function () {
xhr.onerror = function () {
delete _converse.connection;
delete _converse.connection;
_converse.emit('noResumeableSession', this);
_converse.
api.
emit('noResumeableSession', this);
};
};
xhr.send();
xhr.send();
...
@@ -64181,7 +64181,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -64181,7 +64181,7 @@ _converse.initialize = async function (settings, callback) {
};
};
this.tearDown = function () {
this.tearDown = function () {
_converse.emit('beforeTearDown');
_converse.
api.
emit('beforeTearDown');
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.session)) {
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.session)) {
_converse.session.destroy();
_converse.session.destroy();
...
@@ -64194,7 +64194,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -64194,7 +64194,7 @@ _converse.initialize = async function (settings, callback) {
window.removeEventListener(_converse.unloadevent, _converse.onUserActivity);
window.removeEventListener(_converse.unloadevent, _converse.onUserActivity);
window.clearInterval(_converse.everySecondTrigger);
window.clearInterval(_converse.everySecondTrigger);
_converse.emit('afterTearDown');
_converse.
api.
emit('afterTearDown');
return _converse;
return _converse;
}; // Initialization
}; // Initialization
...
@@ -64674,7 +64674,7 @@ _converse.api = {
...
@@ -64674,7 +64674,7 @@ _converse.api = {
}).up().cnode(stanza.tree()));
}).up().cnode(stanza.tree()));
}
}
_converse.emit('send', stanza);
_converse.
api.
emit('send', stanza);
},
},
/**
/**
...
@@ -64688,7 +64688,7 @@ _converse.api = {
...
@@ -64688,7 +64688,7 @@ _converse.api = {
return new es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_3___default.a((resolve, reject) => {
return new es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_3___default.a((resolve, reject) => {
_converse.connection.sendIQ(stanza, resolve, reject, timeout || _converse.IQ_TIMEOUT);
_converse.connection.sendIQ(stanza, resolve, reject, timeout || _converse.IQ_TIMEOUT);
_converse.emit('send', stanza);
_converse.
api.
emit('send', stanza);
});
});
}
}
...
@@ -64928,13 +64928,13 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -64928,13 +64928,13 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
onFeatureAdded(feature) {
onFeatureAdded(feature) {
feature.entity = this;
feature.entity = this;
_converse.emit('serviceDiscovered', feature);
_converse.
api.
emit('serviceDiscovered', feature);
},
},
onFieldAdded(field) {
onFieldAdded(field) {
field.entity = this;
field.entity = this;
_converse.emit('discoExtensionFieldDiscovered', field);
_converse.
api.
emit('discoExtensionFieldDiscovered', field);
},
},
fetchFeatures() {
fetchFeatures() {
...
@@ -65085,7 +65085,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -65085,7 +65085,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
_converse.api.disco.own.features.add(Strophe.NS.CARBONS);
_converse.api.disco.own.features.add(Strophe.NS.CARBONS);
}
}
_converse.emit('addClientFeatures');
_converse.
api.
emit('addClientFeatures');
return this;
return this;
}
}
...
@@ -65108,7 +65108,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -65108,7 +65108,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
});
});
_converse.emit('streamFeaturesAdded');
_converse.
api.
emit('streamFeaturesAdded');
}
}
async function initializeDisco() {
async function initializeDisco() {
...
@@ -65128,7 +65128,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -65128,7 +65128,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
});
});
}
}
_converse.emit('discoInitialized');
_converse.
api.
emit('discoInitialized');
}
}
_converse.api.listen.on('sessionInitialized', initStreamFeatures);
_converse.api.listen.on('sessionInitialized', initStreamFeatures);
...
@@ -65856,7 +65856,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
...
@@ -65856,7 +65856,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse.on('serviceDiscovered', feature => {
_converse.
api.listen.
on('serviceDiscovered', feature => {
const prefs = feature.get('preferences') || {};
const prefs = feature.get('preferences') || {};
if (feature.get('var') === Strophe.NS.MAM && prefs['default'] !== _converse.message_archiving && // eslint-disable-line dot-notation
if (feature.get('var') === Strophe.NS.MAM && prefs['default'] !== _converse.message_archiving && // eslint-disable-line dot-notation
...
@@ -65870,7 +65870,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
...
@@ -65870,7 +65870,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
}
}
});
});
_converse.on('addClientFeatures', () => _converse.api.disco.own.features.add(Strophe.NS.MAM));
_converse.
api.listen.
on('addClientFeatures', () => _converse.api.disco.own.features.add(Strophe.NS.MAM));
/************************ END Event Handlers ************************/
/************************ END Event Handlers ************************/
/************************ BEGIN API ************************/
/************************ BEGIN API ************************/
...
@@ -67270,7 +67270,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -67270,7 +67270,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
if (message || this.handleMessageCorrection(stanza) || this.isReceipt(stanza) || this.isChatMarker(stanza)) {
if (message || this.handleMessageCorrection(stanza) || this.isReceipt(stanza) || this.isChatMarker(stanza)) {
return _converse.emit('message', {
return _converse.
api.
emit('message', {
'stanza': original_stanza
'stanza': original_stanza
});
});
}
}
...
@@ -67288,7 +67288,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -67288,7 +67288,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
}
}
_converse.emit('message', {
_converse.
api.
emit('message', {
'stanza': original_stanza,
'stanza': original_stanza,
'chatbox': this
'chatbox': this
});
});
...
@@ -67607,9 +67607,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -67607,9 +67607,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}, 'jabber:x:conference', 'message');
}, 'jabber:x:conference', 'message');
};
};
_converse.on('connected', registerDirectInvitationHandler);
_converse.
api.listen.
on('connected', registerDirectInvitationHandler);
_converse.on('reconnected', registerDirectInvitationHandler);
_converse.
api.listen.
on('reconnected', registerDirectInvitationHandler);
}
}
const getChatRoom = function getChatRoom(jid, attrs, create) {
const getChatRoom = function getChatRoom(jid, attrs, create) {
...
@@ -67650,7 +67650,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -67650,7 +67650,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
});
});
_converse.emit('roomsAutoJoined');
_converse.
api.
emit('roomsAutoJoined');
}
}
function disconnectChatRooms() {
function disconnectChatRooms() {
...
@@ -67683,7 +67683,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -67683,7 +67683,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
if (_converse.allow_muc) {
if (_converse.allow_muc) {
_converse.api.disco.own.features.add(Strophe.NS.MUC);
_converse.api.disco.own.features.add(Strophe.NS.MUC);
}
}
...
@@ -68021,9 +68021,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins.add('converse-pin
...
@@ -68021,9 +68021,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins.add('converse-pin
_converse.registerPingHandler();
_converse.registerPingHandler();
};
};
_converse.on('connected', onConnected);
_converse.
api.listen.
on('connected', onConnected);
_converse.on('reconnected', onConnected);
_converse.
api.listen.
on('reconnected', onConnected);
}
}
});
});
...
@@ -68226,7 +68226,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68226,7 +68226,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.rostergroups = new _converse.RosterGroups();
_converse.rostergroups = new _converse.RosterGroups();
_converse.rostergroups.browserStorage = new Backbone.BrowserStorage[storage](`converse.roster.groups${_converse.bare_jid}`);
_converse.rostergroups.browserStorage = new Backbone.BrowserStorage[storage](`converse.roster.groups${_converse.bare_jid}`);
_converse.emit('rosterInitialized');
_converse.
api.
emit('rosterInitialized');
};
};
_converse.populateRoster = async function () {
_converse.populateRoster = async function () {
...
@@ -68246,7 +68246,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68246,7 +68246,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
try {
try {
await _converse.roster.fetchFromServer();
await _converse.roster.fetchFromServer();
_converse.emit('rosterContactsFetched');
_converse.
api.
emit('rosterContactsFetched');
} catch (reason) {
} catch (reason) {
_converse.log(reason, Strophe.LogLevel.ERROR);
_converse.log(reason, Strophe.LogLevel.ERROR);
} finally {
} finally {
...
@@ -68256,11 +68256,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68256,11 +68256,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
try {
try {
await _converse.rostergroups.fetchRosterGroups();
await _converse.rostergroups.fetchRosterGroups();
_converse.emit('rosterGroupsFetched');
_converse.
api.
emit('rosterGroupsFetched');
await _converse.roster.fetchRosterContacts();
await _converse.roster.fetchRosterContacts();
_converse.emit('rosterContactsFetched');
_converse.
api.
emit('rosterContactsFetched');
} catch (reason) {
} catch (reason) {
_converse.log(reason, Strophe.LogLevel.ERROR);
_converse.log(reason, Strophe.LogLevel.ERROR);
} finally {
} finally {
...
@@ -68399,7 +68399,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68399,7 +68399,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'user_id': Strophe.getNodeFromJid(jid)
'user_id': Strophe.getNodeFromJid(jid)
}, attributes));
}, attributes));
this.setChatBox();
this.setChatBox();
this.presence.on('change:show', () => _converse.emit('contactPresenceChanged', this));
this.presence.on('change:show', () => _converse.
api.
emit('contactPresenceChanged', this));
this.presence.on('change:show', () => this.trigger('presenceChanged'));
this.presence.on('change:show', () => this.trigger('presenceChanged'));
},
},
...
@@ -68609,7 +68609,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68609,7 +68609,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.send_initial_presence = true;
_converse.send_initial_presence = true;
return _converse.roster.fetchFromServer();
return _converse.roster.fetchFromServer();
} else {
} else {
_converse.emit('cachedRoster', collection);
_converse.
api.
emit('cachedRoster', collection);
}
}
},
},
...
@@ -68784,7 +68784,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68784,7 +68784,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
this.updateContact(items.pop());
this.updateContact(items.pop());
_converse.emit('rosterPush', iq);
_converse.
api.
emit('rosterPush', iq);
return;
return;
},
},
...
@@ -68837,7 +68837,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68837,7 +68837,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.session.save('roster_fetched', true);
_converse.session.save('roster_fetched', true);
}
}
_converse.emit('roster', iq);
_converse.
api.
emit('roster', iq);
},
},
updateContact(item) {
updateContact(item) {
...
@@ -68900,7 +68900,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -68900,7 +68900,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'nickname': nickname
'nickname': nickname
};
};
_converse.emit('contactRequest', this.create(user_data));
_converse.
api.
emit('contactRequest', this.create(user_data));
},
},
handleIncomingSubscription(presence) {
handleIncomingSubscription(presence) {
...
@@ -69140,7 +69140,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -69140,7 +69140,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.presences.fetch();
_converse.presences.fetch();
_converse.emit('presencesInitialized', reconnecting);
_converse.
api.
emit('presencesInitialized', reconnecting);
});
});
_converse.api.listen.on('presencesInitialized', reconnecting => {
_converse.api.listen.on('presencesInitialized', reconnecting => {
...
@@ -69149,7 +69149,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -69149,7 +69149,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
// cached data. However we still emit an event, to give
// cached data. However we still emit an event, to give
// event handlers a chance to register views for the
// event handlers a chance to register views for the
// roster and its groups, before we start populating.
// roster and its groups, before we start populating.
_converse.emit('rosterReadyAfterReconnection');
_converse.
api.
emit('rosterReadyAfterReconnection');
} else {
} else {
_converse.registerIntervalHandler();
_converse.registerIntervalHandler();
...
@@ -69409,7 +69409,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca
...
@@ -69409,7 +69409,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca
_converse.api.listen.on('sessionInitialized', _converse.initVCardCollection);
_converse.api.listen.on('sessionInitialized', _converse.initVCardCollection);
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
});
});
docs/source/developer_api.rst
View file @
d41a7a14
...
@@ -141,7 +141,7 @@ For example:
...
@@ -141,7 +141,7 @@ For example:
.. code-block:: javascript
.. code-block:: javascript
_converse.emit('foo-completed');
_converse.
api.
emit('foo-completed');
Additionally, if a promise has been registered under the same name
Additionally, if a promise has been registered under the same name
(via ``_converse.api.promises.add``), then that promise will also be resolved
(via ``_converse.api.promises.add``), then that promise will also be resolved
...
...
docs/source/plugin_development.rst
View file @
d41a7a14
...
@@ -298,7 +298,7 @@ In this case, you should first listen for the ``connection`` event, and then do
...
@@ -298,7 +298,7 @@ In this case, you should first listen for the ``connection`` event, and then do
initialize: function () {
initialize: function () {
var _converse = this._converse;
var _converse = this._converse;
_converse.on('connected', function () {
_converse.
api.listen.
on('connected', function () {
_converse.api.archive.query({'with': 'admin2@localhost'});
_converse.api.archive.query({'with': 'admin2@localhost'});
});
});
}
}
...
@@ -332,7 +332,7 @@ method of the plugin:
...
@@ -332,7 +332,7 @@ method of the plugin:
.. code-block:: javascript
.. code-block:: javascript
_converse.on('chatBoxOpened', function renderMinimizeButton (view) {
_converse.
api.listen.
on('chatBoxOpened', function renderMinimizeButton (view) {
// Inserts a "minimize" button in the chatview's header
// Inserts a "minimize" button in the chatview's header
// Implementation code removed for brevity
// Implementation code removed for brevity
...
...
src/converse-bookmarks.js
View file @
d41a7a14
...
@@ -545,19 +545,19 @@ converse.plugins.add('converse-bookmarks', {
...
@@ -545,19 +545,19 @@ converse.plugins.add('converse-bookmarks', {
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
({
'
model
'
:
_converse
.
bookmarks
});
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
({
'
model
'
:
_converse
.
bookmarks
});
await
_converse
.
bookmarks
.
fetchBookmarks
();
await
_converse
.
bookmarks
.
fetchBookmarks
();
}
}
_converse
.
emit
(
'
bookmarksInitialized
'
);
_converse
.
api
.
emit
(
'
bookmarksInitialized
'
);
}
}
_converse
.
on
(
'
clearSession
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
{
if
(
!
_
.
isUndefined
(
_converse
.
bookmarks
))
{
if
(
!
_
.
isUndefined
(
_converse
.
bookmarks
))
{
_converse
.
bookmarks
.
browserStorage
.
_clear
();
_converse
.
bookmarks
.
browserStorage
.
_clear
();
window
.
sessionStorage
.
removeItem
(
_converse
.
bookmarks
.
fetched_flag
);
window
.
sessionStorage
.
removeItem
(
_converse
.
bookmarks
.
fetched_flag
);
}
}
});
});
_converse
.
on
(
'
reconnected
'
,
initBookmarks
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
initBookmarks
);
_converse
.
on
(
'
connected
'
,
async
()
=>
{
_converse
.
api
.
listen
.
on
(
'
connected
'
,
async
()
=>
{
// Add a handler for bookmarks pushed from other connected clients
// Add a handler for bookmarks pushed from other connected clients
// (from the same user obviously)
// (from the same user obviously)
_converse
.
connection
.
addHandler
(
message
=>
{
_converse
.
connection
.
addHandler
(
message
=>
{
...
...
src/converse-chatboxviews.js
View file @
d41a7a14
...
@@ -168,7 +168,7 @@ converse.plugins.add('converse-chatboxviews', {
...
@@ -168,7 +168,7 @@ converse.plugins.add('converse-chatboxviews', {
_converse
.
chatboxviews
=
new
_converse
.
ChatBoxViews
({
_converse
.
chatboxviews
=
new
_converse
.
ChatBoxViews
({
'
model
'
:
_converse
.
chatboxes
'
model
'
:
_converse
.
chatboxes
});
});
_converse
.
emit
(
'
chatBoxViewsInitialized
'
);
_converse
.
api
.
emit
(
'
chatBoxViewsInitialized
'
);
});
});
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
_converse
.
chatboxviews
.
closeAllChatBoxes
());
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
_converse
.
chatboxviews
.
closeAllChatBoxes
());
...
...
src/converse-chatview.js
View file @
d41a7a14
...
@@ -180,7 +180,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -180,7 +180,7 @@ converse.plugins.add('converse-chatview', {
onStatusMessageChanged
(
item
)
{
onStatusMessageChanged
(
item
)
{
this
.
render
();
this
.
render
();
_converse
.
emit
(
'
contactStatusMessageChanged
'
,
{
_converse
.
api
.
emit
(
'
contactStatusMessageChanged
'
,
{
'
contact
'
:
item
.
attributes
,
'
contact
'
:
item
.
attributes
,
'
message
'
:
item
.
get
(
'
status
'
)
'
message
'
:
item
.
get
(
'
status
'
)
});
});
...
@@ -201,7 +201,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -201,7 +201,7 @@ converse.plugins.add('converse-chatview', {
this
.
model
.
on
(
'
contactAdded
'
,
this
.
registerContactEventHandlers
,
this
);
this
.
model
.
on
(
'
contactAdded
'
,
this
.
registerContactEventHandlers
,
this
);
this
.
model
.
on
(
'
change
'
,
this
.
render
,
this
);
this
.
model
.
on
(
'
change
'
,
this
.
render
,
this
);
this
.
registerContactEventHandlers
();
this
.
registerContactEventHandlers
();
_converse
.
emit
(
'
userDetailsModalInitialized
'
,
this
.
model
);
_converse
.
api
.
emit
(
'
userDetailsModalInitialized
'
,
this
.
model
);
},
},
toHTML
()
{
toHTML
()
{
...
@@ -315,8 +315,8 @@ converse.plugins.add('converse-chatview', {
...
@@ -315,8 +315,8 @@ converse.plugins.add('converse-chatview', {
this
.
render
();
this
.
render
();
this
.
fetchMessages
();
this
.
fetchMessages
();
_converse
.
emit
(
'
chatBoxOpened
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxOpened
'
,
this
);
_converse
.
emit
(
'
chatBoxInitialized
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxInitialized
'
,
this
);
},
},
initDebounced
()
{
initDebounced
()
{
...
@@ -351,7 +351,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -351,7 +351,7 @@ converse.plugins.add('converse-chatview', {
this
.
el
.
querySelector
(
'
.chat-toolbar
'
).
innerHTML
=
toolbar
(
options
);
this
.
el
.
querySelector
(
'
.chat-toolbar
'
).
innerHTML
=
toolbar
(
options
);
this
.
addSpoilerButton
(
options
);
this
.
addSpoilerButton
(
options
);
this
.
addFileUploadButton
();
this
.
addFileUploadButton
();
_converse
.
emit
(
'
renderToolbar
'
,
this
);
_converse
.
api
.
emit
(
'
renderToolbar
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -485,7 +485,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -485,7 +485,7 @@ converse.plugins.add('converse-chatview', {
this
.
insertIntoDOM
();
this
.
insertIntoDOM
();
this
.
scrollDown
();
this
.
scrollDown
();
this
.
content
.
addEventListener
(
'
scroll
'
,
this
.
markScrolled
.
bind
(
this
));
this
.
content
.
addEventListener
(
'
scroll
'
,
this
.
markScrolled
.
bind
(
this
));
_converse
.
emit
(
'
afterMessagesFetched
'
,
this
);
_converse
.
api
.
emit
(
'
afterMessagesFetched
'
,
this
);
},
},
fetchMessages
()
{
fetchMessages
()
{
...
@@ -792,7 +792,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -792,7 +792,7 @@ converse.plugins.add('converse-chatview', {
if
(
message
.
get
(
'
correcting
'
))
{
if
(
message
.
get
(
'
correcting
'
))
{
this
.
insertIntoTextArea
(
message
.
get
(
'
message
'
),
true
,
true
);
this
.
insertIntoTextArea
(
message
.
get
(
'
message
'
),
true
,
true
);
}
}
_converse
.
emit
(
'
messageAdded
'
,
{
_converse
.
api
.
emit
(
'
messageAdded
'
,
{
'
message
'
:
message
,
'
message
'
:
message
,
'
chatbox
'
:
this
.
model
'
chatbox
'
:
this
.
model
});
});
...
@@ -878,7 +878,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -878,7 +878,7 @@ converse.plugins.add('converse-chatview', {
textarea
.
value
=
''
;
textarea
.
value
=
''
;
u
.
removeClass
(
'
correcting
'
,
textarea
);
u
.
removeClass
(
'
correcting
'
,
textarea
);
textarea
.
style
.
height
=
'
auto
'
;
// Fixes weirdness
textarea
.
style
.
height
=
'
auto
'
;
// Fixes weirdness
_converse
.
emit
(
'
messageSend
'
,
message
);
_converse
.
api
.
emit
(
'
messageSend
'
,
message
);
}
}
textarea
.
removeAttribute
(
'
disabled
'
);
textarea
.
removeAttribute
(
'
disabled
'
);
u
.
removeClass
(
'
disabled
'
,
textarea
);
u
.
removeClass
(
'
disabled
'
,
textarea
);
...
@@ -1081,7 +1081,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1081,7 +1081,7 @@ converse.plugins.add('converse-chatview', {
toggleCall
(
ev
)
{
toggleCall
(
ev
)
{
ev
.
stopPropagation
();
ev
.
stopPropagation
();
_converse
.
emit
(
'
callButtonClicked
'
,
{
_converse
.
api
.
emit
(
'
callButtonClicked
'
,
{
connection
:
_converse
.
connection
,
connection
:
_converse
.
connection
,
model
:
this
.
model
model
:
this
.
model
});
});
...
@@ -1162,7 +1162,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1162,7 +1162,7 @@ converse.plugins.add('converse-chatview', {
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
}
}
this
.
remove
();
this
.
remove
();
_converse
.
emit
(
'
chatBoxClosed
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxClosed
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -1182,7 +1182,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1182,7 +1182,7 @@ converse.plugins.add('converse-chatview', {
const
textarea_el
=
this
.
el
.
querySelector
(
'
.chat-textarea
'
);
const
textarea_el
=
this
.
el
.
querySelector
(
'
.chat-textarea
'
);
if
(
!
_
.
isNull
(
textarea_el
))
{
if
(
!
_
.
isNull
(
textarea_el
))
{
textarea_el
.
focus
();
textarea_el
.
focus
();
_converse
.
emit
(
'
chatBoxFocused
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxFocused
'
,
this
);
}
}
return
this
;
return
this
;
},
},
...
@@ -1265,7 +1265,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1265,7 +1265,7 @@ converse.plugins.add('converse-chatview', {
if
(
_converse
.
windowState
!==
'
hidden
'
)
{
if
(
_converse
.
windowState
!==
'
hidden
'
)
{
this
.
model
.
clearUnreadMsgCounter
();
this
.
model
.
clearUnreadMsgCounter
();
}
}
_converse
.
emit
(
'
chatBoxScrolledDown
'
,
{
'
chatbox
'
:
this
.
model
});
_converse
.
api
.
emit
(
'
chatBoxScrolledDown
'
,
{
'
chatbox
'
:
this
.
model
});
},
},
onWindowStateChanged
(
state
)
{
onWindowStateChanged
(
state
)
{
...
@@ -1283,7 +1283,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1283,7 +1283,7 @@ converse.plugins.add('converse-chatview', {
}
}
});
});
_converse
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
const
that
=
_converse
.
chatboxviews
;
const
that
=
_converse
.
chatboxviews
;
_converse
.
chatboxes
.
on
(
'
add
'
,
item
=>
{
_converse
.
chatboxes
.
on
(
'
add
'
,
item
=>
{
if
(
!
that
.
get
(
item
.
get
(
'
id
'
))
&&
item
.
get
(
'
type
'
)
===
_converse
.
PRIVATE_CHAT_TYPE
)
{
if
(
!
that
.
get
(
item
.
get
(
'
id
'
))
&&
item
.
get
(
'
type
'
)
===
_converse
.
PRIVATE_CHAT_TYPE
)
{
...
@@ -1292,7 +1292,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1292,7 +1292,7 @@ converse.plugins.add('converse-chatview', {
});
});
});
});
_converse
.
on
(
'
connected
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
connected
'
,
()
=>
{
// Advertise that we support XEP-0382 Message Spoilers
// Advertise that we support XEP-0382 Message Spoilers
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
SPOILER
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
SPOILER
);
});
});
...
...
src/converse-controlbox.js
View file @
d41a7a14
...
@@ -224,7 +224,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -224,7 +224,7 @@ converse.plugins.add('converse-controlbox', {
if
(
this
.
model
.
get
(
'
connected
'
))
{
if
(
this
.
model
.
get
(
'
connected
'
))
{
this
.
insertRoster
();
this
.
insertRoster
();
}
}
_converse
.
emit
(
'
controlboxInitialized
'
,
this
);
_converse
.
api
.
emit
(
'
controlboxInitialized
'
,
this
);
},
},
render
()
{
render
()
{
...
@@ -331,7 +331,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -331,7 +331,7 @@ converse.plugins.add('converse-controlbox', {
}
else
{
}
else
{
this
.
model
.
trigger
(
'
hide
'
);
this
.
model
.
trigger
(
'
hide
'
);
}
}
_converse
.
emit
(
'
controlBoxClosed
'
,
this
);
_converse
.
api
.
emit
(
'
controlBoxClosed
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -348,7 +348,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -348,7 +348,7 @@ converse.plugins.add('converse-controlbox', {
return
;
return
;
}
}
u
.
addClass
(
'
hidden
'
,
this
.
el
);
u
.
addClass
(
'
hidden
'
,
this
.
el
);
_converse
.
emit
(
'
chatBoxClosed
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxClosed
'
,
this
);
if
(
!
_converse
.
connection
.
connected
)
{
if
(
!
_converse
.
connection
.
connected
)
{
_converse
.
controlboxtoggle
.
render
();
_converse
.
controlboxtoggle
.
render
();
}
}
...
@@ -359,7 +359,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -359,7 +359,7 @@ converse.plugins.add('converse-controlbox', {
onControlBoxToggleHidden
()
{
onControlBoxToggleHidden
()
{
this
.
model
.
set
(
'
closed
'
,
false
);
this
.
model
.
set
(
'
closed
'
,
false
);
this
.
el
.
classList
.
remove
(
'
hidden
'
);
this
.
el
.
classList
.
remove
(
'
hidden
'
);
_converse
.
emit
(
'
controlBoxOpened
'
,
this
);
_converse
.
api
.
emit
(
'
controlBoxOpened
'
,
this
);
},
},
show
()
{
show
()
{
...
@@ -591,7 +591,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -591,7 +591,7 @@ converse.plugins.add('converse-controlbox', {
}
}
});
});
_converse
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
const
that
=
_converse
.
chatboxviews
;
const
that
=
_converse
.
chatboxviews
;
_converse
.
chatboxes
.
on
(
'
add
'
,
item
=>
{
_converse
.
chatboxes
.
on
(
'
add
'
,
item
=>
{
if
(
item
.
get
(
'
type
'
)
===
_converse
.
CONTROLBOX_TYPE
)
{
if
(
item
.
get
(
'
type
'
)
===
_converse
.
CONTROLBOX_TYPE
)
{
...
@@ -606,7 +606,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -606,7 +606,7 @@ converse.plugins.add('converse-controlbox', {
});
});
});
});
_converse
.
on
(
'
clearSession
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
{
if
(
_converse
.
config
.
get
(
'
trusted
'
))
{
if
(
_converse
.
config
.
get
(
'
trusted
'
))
{
const
chatboxes
=
_
.
get
(
_converse
,
'
chatboxes
'
,
null
);
const
chatboxes
=
_
.
get
(
_converse
,
'
chatboxes
'
,
null
);
if
(
!
_
.
isNil
(
chatboxes
))
{
if
(
!
_
.
isNil
(
chatboxes
))
{
...
@@ -625,7 +625,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -625,7 +625,7 @@ converse.plugins.add('converse-controlbox', {
_converse
.
api
.
waitUntil
(
'
chatBoxViewsInitialized
'
)
_converse
.
api
.
waitUntil
(
'
chatBoxViewsInitialized
'
)
]).
then
(
addControlBox
).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
]).
then
(
addControlBox
).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
_converse
.
on
(
'
chatBoxesFetched
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
chatBoxesFetched
'
,
()
=>
{
const
controlbox
=
_converse
.
chatboxes
.
get
(
'
controlbox
'
)
||
addControlBox
();
const
controlbox
=
_converse
.
chatboxes
.
get
(
'
controlbox
'
)
||
addControlBox
();
controlbox
.
save
({
connected
:
true
});
controlbox
.
save
({
connected
:
true
});
});
});
...
...
src/converse-headline.js
View file @
d41a7a14
...
@@ -81,8 +81,8 @@ converse.plugins.add('converse-headline', {
...
@@ -81,8 +81,8 @@ converse.plugins.add('converse-headline', {
this
.
model
.
on
(
'
change:minimized
'
,
this
.
onMinimizedChanged
,
this
);
this
.
model
.
on
(
'
change:minimized
'
,
this
.
onMinimizedChanged
,
this
);
this
.
render
().
insertHeading
().
fetchMessages
().
insertIntoDOM
().
hide
();
this
.
render
().
insertHeading
().
fetchMessages
().
insertIntoDOM
().
hide
();
_converse
.
emit
(
'
chatBoxOpened
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxOpened
'
,
this
);
_converse
.
emit
(
'
chatBoxInitialized
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxInitialized
'
,
this
);
},
},
render
()
{
render
()
{
...
@@ -127,7 +127,7 @@ converse.plugins.add('converse-headline', {
...
@@ -127,7 +127,7 @@ converse.plugins.add('converse-headline', {
});
});
const
attrs
=
await
chatbox
.
getMessageAttributesFromStanza
(
message
,
message
);
const
attrs
=
await
chatbox
.
getMessageAttributesFromStanza
(
message
,
message
);
await
chatbox
.
messages
.
create
(
attrs
);
await
chatbox
.
messages
.
create
(
attrs
);
_converse
.
emit
(
'
message
'
,
{
'
chatbox
'
:
chatbox
,
'
stanza
'
:
message
});
_converse
.
api
.
emit
(
'
message
'
,
{
'
chatbox
'
:
chatbox
,
'
stanza
'
:
message
});
}
}
}
}
...
@@ -137,11 +137,11 @@ converse.plugins.add('converse-headline', {
...
@@ -137,11 +137,11 @@ converse.plugins.add('converse-headline', {
return
true
return
true
},
null
,
'
message
'
);
},
null
,
'
message
'
);
}
}
_converse
.
on
(
'
connected
'
,
registerHeadlineHandler
);
_converse
.
api
.
listen
.
on
(
'
connected
'
,
registerHeadlineHandler
);
_converse
.
on
(
'
reconnected
'
,
registerHeadlineHandler
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
registerHeadlineHandler
);
_converse
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
const
that
=
_converse
.
chatboxviews
;
const
that
=
_converse
.
chatboxviews
;
_converse
.
chatboxes
.
on
(
'
add
'
,
item
=>
{
_converse
.
chatboxes
.
on
(
'
add
'
,
item
=>
{
if
(
!
that
.
get
(
item
.
get
(
'
id
'
))
&&
item
.
get
(
'
type
'
)
===
_converse
.
HEADLINES_TYPE
)
{
if
(
!
that
.
get
(
item
.
get
(
'
id
'
))
&&
item
.
get
(
'
type
'
)
===
_converse
.
HEADLINES_TYPE
)
{
...
...
src/converse-mam-views.js
View file @
d41a7a14
...
@@ -176,9 +176,9 @@ converse.plugins.add('converse-mam-views', {
...
@@ -176,9 +176,9 @@ converse.plugins.add('converse-mam-views', {
const
{
_converse
}
=
this
;
const
{
_converse
}
=
this
;
/* Event handlers */
/* Event handlers */
_converse
.
on
(
'
afterMessagesFetched
'
,
view
=>
view
.
fetchNewestMessages
());
_converse
.
api
.
listen
.
on
(
'
afterMessagesFetched
'
,
view
=>
view
.
fetchNewestMessages
());
_converse
.
on
(
'
reconnected
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
()
=>
{
const
private_chats
=
_converse
.
chatboxviews
.
filter
(
const
private_chats
=
_converse
.
chatboxviews
.
filter
(
view
=>
_
.
at
(
view
,
'
model.attributes.type
'
)[
0
]
===
'
chatbox
'
view
=>
_
.
at
(
view
,
'
model.attributes.type
'
)[
0
]
===
'
chatbox
'
);
);
...
...
src/converse-minimize.js
View file @
d41a7a14
...
@@ -131,7 +131,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -131,7 +131,7 @@ converse.plugins.add('converse-minimize', {
this
.
model
.
clearUnreadMsgCounter
();
this
.
model
.
clearUnreadMsgCounter
();
}
}
this
.
show
();
this
.
show
();
this
.
__super__
.
_converse
.
emit
(
'
chatBoxMaximized
'
,
this
);
this
.
__super__
.
_converse
.
api
.
emit
(
'
chatBoxMaximized
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -146,7 +146,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -146,7 +146,7 @@ converse.plugins.add('converse-minimize', {
}
}
this
.
setChatState
(
_converse
.
INACTIVE
).
model
.
minimize
();
this
.
setChatState
(
_converse
.
INACTIVE
).
model
.
minimize
();
this
.
hide
();
this
.
hide
();
_converse
.
emit
(
'
chatBoxMinimized
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxMinimized
'
,
this
);
},
},
},
},
...
@@ -358,7 +358,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -358,7 +358,7 @@ converse.plugins.add('converse-minimize', {
view
.
close
();
view
.
close
();
}
else
{
}
else
{
this
.
model
.
destroy
();
this
.
model
.
destroy
();
_converse
.
emit
(
'
chatBoxClosed
'
,
this
);
_converse
.
api
.
emit
(
'
chatBoxClosed
'
,
this
);
}
}
return
this
;
return
this
;
},
},
...
@@ -515,7 +515,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -515,7 +515,7 @@ converse.plugins.add('converse-minimize', {
_converse
.
minimized_chats
=
new
_converse
.
MinimizedChats
({
_converse
.
minimized_chats
=
new
_converse
.
MinimizedChats
({
model
:
_converse
.
chatboxes
model
:
_converse
.
chatboxes
});
});
_converse
.
emit
(
'
minimizedChatsInitialized
'
);
_converse
.
api
.
emit
(
'
minimizedChatsInitialized
'
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
...
...
src/converse-muc-views.js
View file @
d41a7a14
...
@@ -76,7 +76,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -76,7 +76,7 @@ converse.plugins.add('converse-muc-views', {
this
.
el
.
querySelector
(
'
.controlbox-pane
'
).
insertAdjacentElement
(
this
.
el
.
querySelector
(
'
.controlbox-pane
'
).
insertAdjacentElement
(
'
beforeEnd
'
,
this
.
roomspanel
.
render
().
el
);
'
beforeEnd
'
,
this
.
roomspanel
.
render
().
el
);
_converse
.
emit
(
'
roomsPanelRendered
'
);
_converse
.
api
.
emit
(
'
roomsPanelRendered
'
);
},
},
renderControlBoxPane
()
{
renderControlBoxPane
()
{
...
@@ -561,7 +561,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -561,7 +561,7 @@ converse.plugins.add('converse-muc-views', {
}
else
{
}
else
{
this
.
fetchMessages
();
this
.
fetchMessages
();
}
}
_converse
.
emit
(
'
chatRoomOpened
'
,
this
);
_converse
.
api
.
emit
(
'
chatRoomOpened
'
,
this
);
},
},
render
()
{
render
()
{
...
@@ -2063,7 +2063,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -2063,7 +2063,7 @@ converse.plugins.add('converse-muc-views', {
}
}
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
chatBoxViewsInitialized
'
,
()
=>
{
function
openChatRoomFromURIClicked
(
ev
)
{
function
openChatRoomFromURIClicked
(
ev
)
{
ev
.
preventDefault
();
ev
.
preventDefault
();
...
@@ -2107,7 +2107,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -2107,7 +2107,7 @@ converse.plugins.add('converse-muc-views', {
}
}
});
});
}
}
_converse
.
on
(
'
reconnected
'
,
reconnectToChatRooms
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
reconnectToChatRooms
);
/************************ END Event Handlers ************************/
/************************ END Event Handlers ************************/
...
...
src/converse-notification.js
View file @
d41a7a14
...
@@ -285,15 +285,15 @@ converse.plugins.add('converse-notification', {
...
@@ -285,15 +285,15 @@ converse.plugins.add('converse-notification', {
}
}
};
};
_converse
.
on
(
'
pluginsInitialized
'
,
function
()
{
_converse
.
api
.
listen
.
on
(
'
pluginsInitialized
'
,
function
()
{
// We only register event handlers after all plugins are
// We only register event handlers after all plugins are
// registered, because other plugins might override some of our
// registered, because other plugins might override some of our
// handlers.
// handlers.
_converse
.
on
(
'
contactRequest
'
,
_converse
.
handleContactRequestNotification
);
_converse
.
api
.
listen
.
on
(
'
contactRequest
'
,
_converse
.
handleContactRequestNotification
);
_converse
.
on
(
'
contactPresenceChanged
'
,
_converse
.
handleChatStateNotification
);
_converse
.
api
.
listen
.
on
(
'
contactPresenceChanged
'
,
_converse
.
handleChatStateNotification
);
_converse
.
on
(
'
message
'
,
_converse
.
handleMessageNotification
);
_converse
.
api
.
listen
.
on
(
'
message
'
,
_converse
.
handleMessageNotification
);
_converse
.
on
(
'
feedback
'
,
_converse
.
handleFeedback
);
_converse
.
api
.
listen
.
on
(
'
feedback
'
,
_converse
.
handleFeedback
);
_converse
.
on
(
'
connected
'
,
_converse
.
requestPermission
);
_converse
.
api
.
listen
.
on
(
'
connected
'
,
_converse
.
requestPermission
);
});
});
}
}
});
});
...
...
src/converse-omemo.js
View file @
d41a7a14
...
@@ -1132,7 +1132,7 @@ converse.plugins.add('converse-omemo', {
...
@@ -1132,7 +1132,7 @@ converse.plugins.add('converse-omemo', {
await
fetchOwnDevices
();
await
fetchOwnDevices
();
await
restoreOMEMOSession
();
await
restoreOMEMOSession
();
await
_converse
.
omemo_store
.
publishBundle
();
await
_converse
.
omemo_store
.
publishBundle
();
_converse
.
emit
(
'
OMEMOInitialized
'
);
_converse
.
api
.
emit
(
'
OMEMOInitialized
'
);
}
}
async
function
onOccupantAdded
(
chatroom
,
occupant
)
{
async
function
onOccupantAdded
(
chatroom
,
occupant
)
{
...
...
src/converse-profile.js
View file @
d41a7a14
...
@@ -48,7 +48,7 @@ converse.plugins.add('converse-profile', {
...
@@ -48,7 +48,7 @@ converse.plugins.add('converse-profile', {
initialize
()
{
initialize
()
{
this
.
model
.
on
(
'
change
'
,
this
.
render
,
this
);
this
.
model
.
on
(
'
change
'
,
this
.
render
,
this
);
_converse
.
BootstrapModal
.
prototype
.
initialize
.
apply
(
this
,
arguments
);
_converse
.
BootstrapModal
.
prototype
.
initialize
.
apply
(
this
,
arguments
);
_converse
.
emit
(
'
profileModalInitialized
'
,
this
.
model
);
_converse
.
api
.
emit
(
'
profileModalInitialized
'
,
this
.
model
);
},
},
toHTML
()
{
toHTML
()
{
...
...
src/converse-roomslist.js
View file @
d41a7a14
...
@@ -273,7 +273,7 @@ converse.plugins.add('converse-roomslist', {
...
@@ -273,7 +273,7 @@ converse.plugins.add('converse-roomslist', {
_converse
.
api
.
emit
(
'
roomsListInitialized
'
);
_converse
.
api
.
emit
(
'
roomsListInitialized
'
);
};
};
_converse
.
on
(
'
connected
'
,
async
()
=>
{
_converse
.
api
.
listen
.
on
(
'
connected
'
,
async
()
=>
{
if
(
_converse
.
allow_bookmarks
)
{
if
(
_converse
.
allow_bookmarks
)
{
await
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
);
await
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
);
}
else
{
}
else
{
...
...
src/converse-rosterview.js
View file @
d41a7a14
...
@@ -815,9 +815,9 @@ converse.plugins.add('converse-rosterview', {
...
@@ -815,9 +815,9 @@ converse.plugins.add('converse-rosterview', {
// just this group's) have been fetched from browser
// just this group's) have been fetched from browser
// storage or the XMPP server and once they've been
// storage or the XMPP server and once they've been
// assigned to their various groups.
// assigned to their various groups.
_converse
.
on
(
'
rosterGroupsFetched
'
,
this
.
sortAndPositionAllItems
.
bind
(
this
));
_converse
.
api
.
listen
.
on
(
'
rosterGroupsFetched
'
,
this
.
sortAndPositionAllItems
.
bind
(
this
));
_converse
.
on
(
'
rosterContactsFetched
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
rosterContactsFetched
'
,
()
=>
{
_converse
.
roster
.
each
((
contact
)
=>
this
.
addRosterContact
(
contact
,
{
'
silent
'
:
true
}));
_converse
.
roster
.
each
((
contact
)
=>
this
.
addRosterContact
(
contact
,
{
'
silent
'
:
true
}));
this
.
update
();
this
.
update
();
this
.
updateFilter
();
this
.
updateFilter
();
...
@@ -1032,7 +1032,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -1032,7 +1032,7 @@ converse.plugins.add('converse-rosterview', {
'
model
'
:
_converse
.
rostergroups
'
model
'
:
_converse
.
rostergroups
});
});
_converse
.
rosterview
.
render
();
_converse
.
rosterview
.
render
();
_converse
.
emit
(
'
rosterViewInitialized
'
);
_converse
.
api
.
emit
(
'
rosterViewInitialized
'
);
}
}
_converse
.
api
.
listen
.
on
(
'
rosterInitialized
'
,
initRoster
);
_converse
.
api
.
listen
.
on
(
'
rosterInitialized
'
,
initRoster
);
_converse
.
api
.
listen
.
on
(
'
rosterReadyAfterReconnection
'
,
initRoster
);
_converse
.
api
.
listen
.
on
(
'
rosterReadyAfterReconnection
'
,
initRoster
);
...
...
src/headless/converse-chatboxes.js
View file @
d41a7a14
...
@@ -796,7 +796,7 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -796,7 +796,7 @@ converse.plugins.add('converse-chatboxes', {
chatbox
.
trigger
(
'
show
'
);
chatbox
.
trigger
(
'
show
'
);
}
}
});
});
_converse
.
emit
(
'
chatBoxesFetched
'
);
_converse
.
api
.
emit
(
'
chatBoxesFetched
'
);
},
},
onConnected
()
{
onConnected
()
{
...
@@ -949,7 +949,7 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -949,7 +949,7 @@ converse.plugins.add('converse-chatboxes', {
}
}
}
}
}
}
_converse
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
chatbox
});
_converse
.
api
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
chatbox
});
},
},
getChatBox
(
jid
,
attrs
=
{},
create
)
{
getChatBox
(
jid
,
attrs
=
{},
create
)
{
...
@@ -998,15 +998,15 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -998,15 +998,15 @@ converse.plugins.add('converse-chatboxes', {
Strophe
.
LogLevel
.
ERROR
);
Strophe
.
LogLevel
.
ERROR
);
}
}
});
});
_converse
.
emit
(
'
privateChatsAutoJoined
'
);
_converse
.
api
.
emit
(
'
privateChatsAutoJoined
'
);
}
}
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse
.
on
(
'
chatBoxesFetched
'
,
autoJoinChats
);
_converse
.
api
.
listen
.
on
(
'
chatBoxesFetched
'
,
autoJoinChats
);
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
MESSAGE_CORRECT
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
MESSAGE_CORRECT
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
HTTPUPLOAD
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
HTTPUPLOAD
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
OUTOFBAND
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
OUTOFBAND
);
...
@@ -1014,7 +1014,7 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -1014,7 +1014,7 @@ converse.plugins.add('converse-chatboxes', {
_converse
.
api
.
listen
.
on
(
'
pluginsInitialized
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
pluginsInitialized
'
,
()
=>
{
_converse
.
chatboxes
=
new
_converse
.
ChatBoxes
();
_converse
.
chatboxes
=
new
_converse
.
ChatBoxes
();
_converse
.
emit
(
'
chatBoxesInitialized
'
);
_converse
.
api
.
emit
(
'
chatBoxesInitialized
'
);
});
});
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
()
=>
_converse
.
chatboxes
.
onConnected
());
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
()
=>
_converse
.
chatboxes
.
onConnected
());
...
...
src/headless/converse-core.js
View file @
d41a7a14
...
@@ -380,7 +380,7 @@ function initPlugins() {
...
@@ -380,7 +380,7 @@ function initPlugins() {
* // Your code here...
* // Your code here...
* });
* });
*/
*/
_converse
.
emit
(
'
pluginsInitialized
'
);
_converse
.
api
.
emit
(
'
pluginsInitialized
'
);
}
}
function
initClientConfig
()
{
function
initClientConfig
()
{
...
@@ -406,7 +406,7 @@ function initClientConfig () {
...
@@ -406,7 +406,7 @@ function initClientConfig () {
* @example
* @example
* _converse.api.listen.on('clientConfigInitialized', () => { ... });
* _converse.api.listen.on('clientConfigInitialized', () => { ... });
*/
*/
_converse
.
emit
(
'
clientConfigInitialized
'
);
_converse
.
api
.
emit
(
'
clientConfigInitialized
'
);
}
}
_converse
.
initConnection
=
function
()
{
_converse
.
initConnection
=
function
()
{
...
@@ -434,7 +434,7 @@ _converse.initConnection = function () {
...
@@ -434,7 +434,7 @@ _converse.initConnection = function () {
*
*
* @event _converse#connectionInitialized
* @event _converse#connectionInitialized
*/
*/
_converse
.
emit
(
'
connectionInitialized
'
);
_converse
.
api
.
emit
(
'
connectionInitialized
'
);
}
}
...
@@ -463,7 +463,7 @@ function finishInitialization () {
...
@@ -463,7 +463,7 @@ function finishInitialization () {
Backbone
.
history
.
start
();
Backbone
.
history
.
start
();
}
}
if
(
_converse
.
idle_presence_timeout
>
0
)
{
if
(
_converse
.
idle_presence_timeout
>
0
)
{
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
IDLE
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
IDLE
);
});
});
}
}
...
@@ -472,7 +472,7 @@ function finishInitialization () {
...
@@ -472,7 +472,7 @@ function finishInitialization () {
function
unregisterGlobalEventHandlers
()
{
function
unregisterGlobalEventHandlers
()
{
document
.
removeEventListener
(
"
visibilitychange
"
,
_converse
.
saveWindowState
);
document
.
removeEventListener
(
"
visibilitychange
"
,
_converse
.
saveWindowState
);
_converse
.
emit
(
'
unregisteredGlobalEventHandlers
'
);
_converse
.
api
.
emit
(
'
unregisteredGlobalEventHandlers
'
);
}
}
function
cleanup
()
{
function
cleanup
()
{
...
@@ -706,7 +706,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -706,7 +706,7 @@ _converse.initialize = async function (settings, callback) {
* @example
* @example
* _converse.api.listen.on('disconnected', () => { ... });
* _converse.api.listen.on('disconnected', () => { ... });
*/
*/
_converse
.
emit
(
'
disconnected
'
);
_converse
.
api
.
emit
(
'
disconnected
'
);
};
};
this
.
onDisconnected
=
function
()
{
this
.
onDisconnected
=
function
()
{
...
@@ -721,7 +721,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -721,7 +721,7 @@ _converse.initialize = async function (settings, callback) {
/* In this case, we reconnect, because we might be receiving
/* In this case, we reconnect, because we might be receiving
* expirable tokens from the credentials_url.
* expirable tokens from the credentials_url.
*/
*/
_converse
.
emit
(
'
will-reconnect
'
);
_converse
.
api
.
emit
(
'
will-reconnect
'
);
return
_converse
.
reconnect
();
return
_converse
.
reconnect
();
}
else
{
}
else
{
return
_converse
.
disconnect
();
return
_converse
.
disconnect
();
...
@@ -739,7 +739,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -739,7 +739,7 @@ _converse.initialize = async function (settings, callback) {
*
*
* @event _converse#will-reconnect
* @event _converse#will-reconnect
*/
*/
_converse
.
emit
(
'
will-reconnect
'
);
_converse
.
api
.
emit
(
'
will-reconnect
'
);
_converse
.
reconnect
();
_converse
.
reconnect
();
};
};
...
@@ -869,7 +869,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -869,7 +869,7 @@ _converse.initialize = async function (settings, callback) {
* @event _converse#sessionInitialized
* @event _converse#sessionInitialized
* @memberOf _converse
* @memberOf _converse
*/
*/
_converse
.
emit
(
'
sessionInitialized
'
);
_converse
.
api
.
emit
(
'
sessionInitialized
'
);
};
};
this
.
clearSession
=
function
()
{
this
.
clearSession
=
function
()
{
...
@@ -886,7 +886,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -886,7 +886,7 @@ _converse.initialize = async function (settings, callback) {
*
*
* @event _converse#clearSession
* @event _converse#clearSession
*/
*/
_converse
.
emit
(
'
clearSession
'
);
_converse
.
api
.
emit
(
'
clearSession
'
);
};
};
this
.
logOut
=
function
()
{
this
.
logOut
=
function
()
{
...
@@ -904,7 +904,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -904,7 +904,7 @@ _converse.initialize = async function (settings, callback) {
*
*
* @event _converse#logout
* @event _converse#logout
*/
*/
_converse
.
emit
(
'
logout
'
);
_converse
.
api
.
emit
(
'
logout
'
);
};
};
this
.
saveWindowState
=
function
(
ev
)
{
this
.
saveWindowState
=
function
(
ev
)
{
...
@@ -930,13 +930,13 @@ _converse.initialize = async function (settings, callback) {
...
@@ -930,13 +930,13 @@ _converse.initialize = async function (settings, callback) {
_converse
.
clearMsgCounter
();
_converse
.
clearMsgCounter
();
}
}
_converse
.
windowState
=
state
;
_converse
.
windowState
=
state
;
_converse
.
emit
(
'
windowStateChanged
'
,
{
state
});
_converse
.
api
.
emit
(
'
windowStateChanged
'
,
{
state
});
};
};
this
.
registerGlobalEventHandlers
=
function
()
{
this
.
registerGlobalEventHandlers
=
function
()
{
document
.
addEventListener
(
"
visibilitychange
"
,
_converse
.
saveWindowState
);
document
.
addEventListener
(
"
visibilitychange
"
,
_converse
.
saveWindowState
);
_converse
.
saveWindowState
({
'
type
'
:
document
.
hidden
?
"
blur
"
:
"
focus
"
});
// Set initial state
_converse
.
saveWindowState
({
'
type
'
:
document
.
hidden
?
"
blur
"
:
"
focus
"
});
// Set initial state
_converse
.
emit
(
'
registeredGlobalEventHandlers
'
);
_converse
.
api
.
emit
(
'
registeredGlobalEventHandlers
'
);
};
};
this
.
enableCarbons
=
function
()
{
this
.
enableCarbons
=
function
()
{
...
@@ -984,9 +984,9 @@ _converse.initialize = async function (settings, callback) {
...
@@ -984,9 +984,9 @@ _converse.initialize = async function (settings, callback) {
* // As an ES2015 Promise
* // As an ES2015 Promise
* _converse.api.waitUntil('statusInitialized').then(() => { ... });
* _converse.api.waitUntil('statusInitialized').then(() => { ... });
*/
*/
_converse
.
emit
(
'
statusInitialized
'
,
reconnecting
);
_converse
.
api
.
emit
(
'
statusInitialized
'
,
reconnecting
);
if
(
reconnecting
)
{
if
(
reconnecting
)
{
_converse
.
emit
(
'
reconnected
'
);
_converse
.
api
.
emit
(
'
reconnected
'
);
}
else
{
}
else
{
init_promise
.
resolve
();
init_promise
.
resolve
();
/**
/**
...
@@ -995,14 +995,14 @@ _converse.initialize = async function (settings, callback) {
...
@@ -995,14 +995,14 @@ _converse.initialize = async function (settings, callback) {
*
*
* @event _converse#initialized
* @event _converse#initialized
*/
*/
_converse
.
emit
(
'
initialized
'
);
_converse
.
api
.
emit
(
'
initialized
'
);
/**
/**
* Emitted after the connection has been established and Converse
* Emitted after the connection has been established and Converse
* has got all its ducks in a row.
* has got all its ducks in a row.
*
*
* @event _converse#initialized
* @event _converse#initialized
*/
*/
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
emit
(
'
connected
'
);
}
}
};
};
...
@@ -1011,7 +1011,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1011,7 +1011,7 @@ _converse.initialize = async function (settings, callback) {
_converse
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
_converse
.
connection
.
jid
);
_converse
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
_converse
.
connection
.
jid
);
_converse
.
resource
=
Strophe
.
getResourceFromJid
(
_converse
.
connection
.
jid
);
_converse
.
resource
=
Strophe
.
getResourceFromJid
(
_converse
.
connection
.
jid
);
_converse
.
domain
=
Strophe
.
getDomainFromJid
(
_converse
.
connection
.
jid
);
_converse
.
domain
=
Strophe
.
getDomainFromJid
(
_converse
.
connection
.
jid
);
_converse
.
emit
(
'
setUserJID
'
);
_converse
.
api
.
emit
(
'
setUserJID
'
);
};
};
this
.
onConnected
=
function
(
reconnecting
)
{
this
.
onConnected
=
function
(
reconnecting
)
{
...
@@ -1033,7 +1033,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1033,7 +1033,7 @@ _converse.initialize = async function (settings, callback) {
},
},
initialize
()
{
initialize
()
{
this
.
on
(
'
change
'
,
()
=>
_converse
.
emit
(
'
connfeedback
'
,
_converse
.
connfeedback
));
this
.
on
(
'
change
'
,
()
=>
_converse
.
api
.
emit
(
'
connfeedback
'
,
_converse
.
connfeedback
));
}
}
});
});
this
.
connfeedback
=
new
this
.
ConnectionFeedback
();
this
.
connfeedback
=
new
this
.
ConnectionFeedback
();
...
@@ -1057,13 +1057,13 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1057,13 +1057,13 @@ _converse.initialize = async function (settings, callback) {
this
.
on
(
'
change:status
'
,
(
item
)
=>
{
this
.
on
(
'
change:status
'
,
(
item
)
=>
{
const
status
=
this
.
get
(
'
status
'
);
const
status
=
this
.
get
(
'
status
'
);
this
.
sendPresence
(
status
);
this
.
sendPresence
(
status
);
_converse
.
emit
(
'
statusChanged
'
,
status
);
_converse
.
api
.
emit
(
'
statusChanged
'
,
status
);
});
});
this
.
on
(
'
change:status_message
'
,
()
=>
{
this
.
on
(
'
change:status_message
'
,
()
=>
{
const
status_message
=
this
.
get
(
'
status_message
'
);
const
status_message
=
this
.
get
(
'
status_message
'
);
this
.
sendPresence
(
this
.
get
(
'
status
'
),
status_message
);
this
.
sendPresence
(
this
.
get
(
'
status
'
),
status_message
);
_converse
.
emit
(
'
statusMessageChanged
'
,
status_message
);
_converse
.
api
.
emit
(
'
statusMessageChanged
'
,
status_message
);
});
});
},
},
...
@@ -1126,7 +1126,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1126,7 +1126,7 @@ _converse.initialize = async function (settings, callback) {
};
};
xhr
.
onerror
=
function
()
{
xhr
.
onerror
=
function
()
{
delete
_converse
.
connection
;
delete
_converse
.
connection
;
_converse
.
emit
(
'
noResumeableSession
'
,
this
);
_converse
.
api
.
emit
(
'
noResumeableSession
'
,
this
);
reject
(
xhr
.
responseText
);
reject
(
xhr
.
responseText
);
};
};
xhr
.
send
();
xhr
.
send
();
...
@@ -1148,7 +1148,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1148,7 +1148,7 @@ _converse.initialize = async function (settings, callback) {
};
};
xhr
.
onerror
=
function
()
{
xhr
.
onerror
=
function
()
{
delete
_converse
.
connection
;
delete
_converse
.
connection
;
_converse
.
emit
(
'
noResumeableSession
'
,
this
);
_converse
.
api
.
emit
(
'
noResumeableSession
'
,
this
);
};
};
xhr
.
send
();
xhr
.
send
();
};
};
...
@@ -1290,7 +1290,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1290,7 +1290,7 @@ _converse.initialize = async function (settings, callback) {
};
};
this
.
tearDown
=
function
()
{
this
.
tearDown
=
function
()
{
_converse
.
emit
(
'
beforeTearDown
'
);
_converse
.
api
.
emit
(
'
beforeTearDown
'
);
if
(
!
_
.
isUndefined
(
_converse
.
session
))
{
if
(
!
_
.
isUndefined
(
_converse
.
session
))
{
_converse
.
session
.
destroy
();
_converse
.
session
.
destroy
();
}
}
...
@@ -1300,7 +1300,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1300,7 +1300,7 @@ _converse.initialize = async function (settings, callback) {
window
.
removeEventListener
(
'
mousemove
'
,
_converse
.
onUserActivity
);
window
.
removeEventListener
(
'
mousemove
'
,
_converse
.
onUserActivity
);
window
.
removeEventListener
(
_converse
.
unloadevent
,
_converse
.
onUserActivity
);
window
.
removeEventListener
(
_converse
.
unloadevent
,
_converse
.
onUserActivity
);
window
.
clearInterval
(
_converse
.
everySecondTrigger
);
window
.
clearInterval
(
_converse
.
everySecondTrigger
);
_converse
.
emit
(
'
afterTearDown
'
);
_converse
.
api
.
emit
(
'
afterTearDown
'
);
return
_converse
;
return
_converse
;
};
};
...
@@ -1755,7 +1755,7 @@ _converse.api = {
...
@@ -1755,7 +1755,7 @@ _converse.api = {
.
cnode
(
stanza
.
tree
())
.
cnode
(
stanza
.
tree
())
);
);
}
}
_converse
.
emit
(
'
send
'
,
stanza
);
_converse
.
api
.
emit
(
'
send
'
,
stanza
);
},
},
/**
/**
...
@@ -1768,7 +1768,7 @@ _converse.api = {
...
@@ -1768,7 +1768,7 @@ _converse.api = {
'
sendIQ
'
(
stanza
,
timeout
)
{
'
sendIQ
'
(
stanza
,
timeout
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
_converse
.
connection
.
sendIQ
(
stanza
,
resolve
,
reject
,
timeout
||
_converse
.
IQ_TIMEOUT
);
_converse
.
connection
.
sendIQ
(
stanza
,
resolve
,
reject
,
timeout
||
_converse
.
IQ_TIMEOUT
);
_converse
.
emit
(
'
send
'
,
stanza
);
_converse
.
api
.
emit
(
'
send
'
,
stanza
);
});
});
}
}
};
};
...
...
src/headless/converse-disco.js
View file @
d41a7a14
...
@@ -94,12 +94,12 @@ converse.plugins.add('converse-disco', {
...
@@ -94,12 +94,12 @@ converse.plugins.add('converse-disco', {
onFeatureAdded
(
feature
)
{
onFeatureAdded
(
feature
)
{
feature
.
entity
=
this
;
feature
.
entity
=
this
;
_converse
.
emit
(
'
serviceDiscovered
'
,
feature
);
_converse
.
api
.
emit
(
'
serviceDiscovered
'
,
feature
);
},
},
onFieldAdded
(
field
)
{
onFieldAdded
(
field
)
{
field
.
entity
=
this
;
field
.
entity
=
this
;
_converse
.
emit
(
'
discoExtensionFieldDiscovered
'
,
field
);
_converse
.
api
.
emit
(
'
discoExtensionFieldDiscovered
'
,
field
);
},
},
fetchFeatures
()
{
fetchFeatures
()
{
...
@@ -227,7 +227,7 @@ converse.plugins.add('converse-disco', {
...
@@ -227,7 +227,7 @@ converse.plugins.add('converse-disco', {
if
(
_converse
.
message_carbons
)
{
if
(
_converse
.
message_carbons
)
{
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
CARBONS
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
CARBONS
);
}
}
_converse
.
emit
(
'
addClientFeatures
'
);
_converse
.
api
.
emit
(
'
addClientFeatures
'
);
return
this
;
return
this
;
}
}
...
@@ -250,7 +250,7 @@ converse.plugins.add('converse-disco', {
...
@@ -250,7 +250,7 @@ converse.plugins.add('converse-disco', {
}
}
}
}
});
});
_converse
.
emit
(
'
streamFeaturesAdded
'
);
_converse
.
api
.
emit
(
'
streamFeaturesAdded
'
);
}
}
async
function
initializeDisco
()
{
async
function
initializeDisco
()
{
...
@@ -268,7 +268,7 @@ converse.plugins.add('converse-disco', {
...
@@ -268,7 +268,7 @@ converse.plugins.add('converse-disco', {
// create one.
// create one.
_converse
.
disco_entities
.
create
({
'
jid
'
:
_converse
.
domain
});
_converse
.
disco_entities
.
create
({
'
jid
'
:
_converse
.
domain
});
}
}
_converse
.
emit
(
'
discoInitialized
'
);
_converse
.
api
.
emit
(
'
discoInitialized
'
);
}
}
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
initStreamFeatures
);
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
initStreamFeatures
);
...
...
src/headless/converse-mam.js
View file @
d41a7a14
...
@@ -209,7 +209,7 @@ converse.plugins.add('converse-mam', {
...
@@ -209,7 +209,7 @@ converse.plugins.add('converse-mam', {
};
};
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse
.
on
(
'
serviceDiscovered
'
,
(
feature
)
=>
{
_converse
.
api
.
listen
.
on
(
'
serviceDiscovered
'
,
(
feature
)
=>
{
const
prefs
=
feature
.
get
(
'
preferences
'
)
||
{};
const
prefs
=
feature
.
get
(
'
preferences
'
)
||
{};
if
(
feature
.
get
(
'
var
'
)
===
Strophe
.
NS
.
MAM
&&
if
(
feature
.
get
(
'
var
'
)
===
Strophe
.
NS
.
MAM
&&
prefs
[
'
default
'
]
!==
_converse
.
message_archiving
&&
// eslint-disable-line dot-notation
prefs
[
'
default
'
]
!==
_converse
.
message_archiving
&&
// eslint-disable-line dot-notation
...
@@ -221,7 +221,7 @@ converse.plugins.add('converse-mam', {
...
@@ -221,7 +221,7 @@ converse.plugins.add('converse-mam', {
}
}
});
});
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
MAM
));
_converse
.
api
.
listen
.
on
(
'
addClientFeatures
'
,
()
=>
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
MAM
));
/************************ END Event Handlers ************************/
/************************ END Event Handlers ************************/
...
...
src/headless/converse-muc.js
View file @
d41a7a14
...
@@ -1043,7 +1043,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1043,7 +1043,7 @@ converse.plugins.add('converse-muc', {
this
.
handleMessageCorrection
(
stanza
)
||
this
.
handleMessageCorrection
(
stanza
)
||
this
.
isReceipt
(
stanza
)
||
this
.
isReceipt
(
stanza
)
||
this
.
isChatMarker
(
stanza
))
{
this
.
isChatMarker
(
stanza
))
{
return
_converse
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
});
return
_converse
.
api
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
});
}
}
const
attrs
=
await
this
.
getMessageAttributesFromStanza
(
stanza
,
original_stanza
);
const
attrs
=
await
this
.
getMessageAttributesFromStanza
(
stanza
,
original_stanza
);
if
(
attrs
.
nick
&&
if
(
attrs
.
nick
&&
...
@@ -1057,7 +1057,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1057,7 +1057,7 @@ converse.plugins.add('converse-muc', {
msg
.
save
({
'
received
'
:
moment
().
format
()});
msg
.
save
({
'
received
'
:
moment
().
format
()});
}
}
}
}
_converse
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
this
});
_converse
.
api
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
this
});
},
},
onPresence
(
pres
)
{
onPresence
(
pres
)
{
...
@@ -1341,8 +1341,8 @@ converse.plugins.add('converse-muc', {
...
@@ -1341,8 +1341,8 @@ converse.plugins.add('converse-muc', {
return
true
;
return
true
;
},
'
jabber:x:conference
'
,
'
message
'
);
},
'
jabber:x:conference
'
,
'
message
'
);
};
};
_converse
.
on
(
'
connected
'
,
registerDirectInvitationHandler
);
_converse
.
api
.
listen
.
on
(
'
connected
'
,
registerDirectInvitationHandler
);
_converse
.
on
(
'
reconnected
'
,
registerDirectInvitationHandler
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
registerDirectInvitationHandler
);
}
}
const
getChatRoom
=
function
(
jid
,
attrs
,
create
)
{
const
getChatRoom
=
function
(
jid
,
attrs
,
create
)
{
...
@@ -1380,7 +1380,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1380,7 +1380,7 @@ converse.plugins.add('converse-muc', {
Strophe
.
LogLevel
.
ERROR
);
Strophe
.
LogLevel
.
ERROR
);
}
}
});
});
_converse
.
emit
(
'
roomsAutoJoined
'
);
_converse
.
api
.
emit
(
'
roomsAutoJoined
'
);
}
}
function
disconnectChatRooms
()
{
function
disconnectChatRooms
()
{
...
@@ -1415,7 +1415,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1415,7 +1415,7 @@ converse.plugins.add('converse-muc', {
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
addClientFeatures
'
,
()
=>
{
if
(
_converse
.
allow_muc
)
{
if
(
_converse
.
allow_muc
)
{
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
MUC
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
MUC
);
}
}
...
...
src/headless/converse-ping.js
View file @
d41a7a14
...
@@ -87,7 +87,7 @@ converse.plugins.add('converse-ping', {
...
@@ -87,7 +87,7 @@ converse.plugins.add('converse-ping', {
// Wrapper so that we can spy on registerPingHandler in tests
// Wrapper so that we can spy on registerPingHandler in tests
_converse
.
registerPingHandler
();
_converse
.
registerPingHandler
();
};
};
_converse
.
on
(
'
connected
'
,
onConnected
);
_converse
.
api
.
listen
.
on
(
'
connected
'
,
onConnected
);
_converse
.
on
(
'
reconnected
'
,
onConnected
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
onConnected
);
}
}
});
});
src/headless/converse-roster.js
View file @
d41a7a14
...
@@ -63,7 +63,7 @@ converse.plugins.add('converse-roster', {
...
@@ -63,7 +63,7 @@ converse.plugins.add('converse-roster', {
_converse
.
rostergroups
=
new
_converse
.
RosterGroups
();
_converse
.
rostergroups
=
new
_converse
.
RosterGroups
();
_converse
.
rostergroups
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
_converse
.
rostergroups
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
`converse.roster.groups
${
_converse
.
bare_jid
}
`
);
`converse.roster.groups
${
_converse
.
bare_jid
}
`
);
_converse
.
emit
(
'
rosterInitialized
'
);
_converse
.
api
.
emit
(
'
rosterInitialized
'
);
};
};
...
@@ -80,7 +80,7 @@ converse.plugins.add('converse-roster', {
...
@@ -80,7 +80,7 @@ converse.plugins.add('converse-roster', {
_converse
.
send_initial_presence
=
true
;
_converse
.
send_initial_presence
=
true
;
try
{
try
{
await
_converse
.
roster
.
fetchFromServer
();
await
_converse
.
roster
.
fetchFromServer
();
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
emit
(
'
rosterContactsFetched
'
);
}
catch
(
reason
)
{
}
catch
(
reason
)
{
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
}
finally
{
}
finally
{
...
@@ -89,9 +89,9 @@ converse.plugins.add('converse-roster', {
...
@@ -89,9 +89,9 @@ converse.plugins.add('converse-roster', {
}
else
{
}
else
{
try
{
try
{
await
_converse
.
rostergroups
.
fetchRosterGroups
();
await
_converse
.
rostergroups
.
fetchRosterGroups
();
_converse
.
emit
(
'
rosterGroupsFetched
'
);
_converse
.
api
.
emit
(
'
rosterGroupsFetched
'
);
await
_converse
.
roster
.
fetchRosterContacts
();
await
_converse
.
roster
.
fetchRosterContacts
();
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
emit
(
'
rosterContactsFetched
'
);
}
catch
(
reason
)
{
}
catch
(
reason
)
{
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
}
finally
{
}
finally
{
...
@@ -223,7 +223,7 @@ converse.plugins.add('converse-roster', {
...
@@ -223,7 +223,7 @@ converse.plugins.add('converse-roster', {
this
.
setChatBox
();
this
.
setChatBox
();
this
.
presence
.
on
(
'
change:show
'
,
()
=>
_converse
.
emit
(
'
contactPresenceChanged
'
,
this
));
this
.
presence
.
on
(
'
change:show
'
,
()
=>
_converse
.
api
.
emit
(
'
contactPresenceChanged
'
,
this
));
this
.
presence
.
on
(
'
change:show
'
,
()
=>
this
.
trigger
(
'
presenceChanged
'
));
this
.
presence
.
on
(
'
change:show
'
,
()
=>
this
.
trigger
(
'
presenceChanged
'
));
},
},
...
@@ -404,7 +404,7 @@ converse.plugins.add('converse-roster', {
...
@@ -404,7 +404,7 @@ converse.plugins.add('converse-roster', {
_converse
.
send_initial_presence
=
true
;
_converse
.
send_initial_presence
=
true
;
return
_converse
.
roster
.
fetchFromServer
();
return
_converse
.
roster
.
fetchFromServer
();
}
else
{
}
else
{
_converse
.
emit
(
'
cachedRoster
'
,
collection
);
_converse
.
api
.
emit
(
'
cachedRoster
'
,
collection
);
}
}
},
},
...
@@ -549,7 +549,7 @@ converse.plugins.add('converse-roster', {
...
@@ -549,7 +549,7 @@ converse.plugins.add('converse-roster', {
return
;
return
;
}
}
this
.
updateContact
(
items
.
pop
());
this
.
updateContact
(
items
.
pop
());
_converse
.
emit
(
'
rosterPush
'
,
iq
);
_converse
.
api
.
emit
(
'
rosterPush
'
,
iq
);
return
;
return
;
},
},
...
@@ -590,7 +590,7 @@ converse.plugins.add('converse-roster', {
...
@@ -590,7 +590,7 @@ converse.plugins.add('converse-roster', {
this
.
data
.
save
(
'
version
'
,
query
.
getAttribute
(
'
ver
'
));
this
.
data
.
save
(
'
version
'
,
query
.
getAttribute
(
'
ver
'
));
_converse
.
session
.
save
(
'
roster_fetched
'
,
true
);
_converse
.
session
.
save
(
'
roster_fetched
'
,
true
);
}
}
_converse
.
emit
(
'
roster
'
,
iq
);
_converse
.
api
.
emit
(
'
roster
'
,
iq
);
},
},
updateContact
(
item
)
{
updateContact
(
item
)
{
...
@@ -644,7 +644,7 @@ converse.plugins.add('converse-roster', {
...
@@ -644,7 +644,7 @@ converse.plugins.add('converse-roster', {
'
requesting
'
:
true
,
'
requesting
'
:
true
,
'
nickname
'
:
nickname
'
nickname
'
:
nickname
};
};
_converse
.
emit
(
'
contactRequest
'
,
this
.
create
(
user_data
));
_converse
.
api
.
emit
(
'
contactRequest
'
,
this
.
create
(
user_data
));
},
},
handleIncomingSubscription
(
presence
)
{
handleIncomingSubscription
(
presence
)
{
...
@@ -856,7 +856,7 @@ converse.plugins.add('converse-roster', {
...
@@ -856,7 +856,7 @@ converse.plugins.add('converse-roster', {
_converse
.
presences
.
browserStorage
=
_converse
.
presences
.
browserStorage
=
new
Backbone
.
BrowserStorage
.
session
(
`converse.presences-
${
_converse
.
bare_jid
}
`
);
new
Backbone
.
BrowserStorage
.
session
(
`converse.presences-
${
_converse
.
bare_jid
}
`
);
_converse
.
presences
.
fetch
();
_converse
.
presences
.
fetch
();
_converse
.
emit
(
'
presencesInitialized
'
,
reconnecting
);
_converse
.
api
.
emit
(
'
presencesInitialized
'
,
reconnecting
);
});
});
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
(
reconnecting
)
=>
{
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
(
reconnecting
)
=>
{
...
@@ -865,7 +865,7 @@ converse.plugins.add('converse-roster', {
...
@@ -865,7 +865,7 @@ converse.plugins.add('converse-roster', {
// cached data. However we still emit an event, to give
// cached data. However we still emit an event, to give
// event handlers a chance to register views for the
// event handlers a chance to register views for the
// roster and its groups, before we start populating.
// roster and its groups, before we start populating.
_converse
.
emit
(
'
rosterReadyAfterReconnection
'
);
_converse
.
api
.
emit
(
'
rosterReadyAfterReconnection
'
);
}
else
{
}
else
{
_converse
.
registerIntervalHandler
();
_converse
.
registerIntervalHandler
();
_converse
.
initRoster
();
_converse
.
initRoster
();
...
...
src/headless/converse-vcard.js
View file @
d41a7a14
...
@@ -130,7 +130,7 @@ converse.plugins.add('converse-vcard', {
...
@@ -130,7 +130,7 @@ converse.plugins.add('converse-vcard', {
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
_converse
.
initVCardCollection
);
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
_converse
.
initVCardCollection
);
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
VCARD
);
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
VCARD
);
});
});
...
...
src/headless/dist/converse-headless.js
View file @
d41a7a14
...
@@ -41075,7 +41075,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -41075,7 +41075,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
}
}
});
});
_converse.emit('chatBoxesFetched');
_converse.
api.
emit('chatBoxesFetched');
},
},
onConnected() {
onConnected() {
...
@@ -41235,7 +41235,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -41235,7 +41235,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
}
}
}
}
_converse.emit('message', {
_converse.
api.
emit('message', {
'stanza': original_stanza,
'stanza': original_stanza,
'chatbox': chatbox
'chatbox': chatbox
});
});
...
@@ -41299,14 +41299,14 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -41299,14 +41299,14 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
}
}
});
});
_converse.emit('privateChatsAutoJoined');
_converse.
api.
emit('privateChatsAutoJoined');
}
}
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse.on('chatBoxesFetched', autoJoinChats);
_converse.
api.listen.
on('chatBoxesFetched', autoJoinChats);
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
_converse.api.disco.own.features.add(Strophe.NS.MESSAGE_CORRECT);
_converse.api.disco.own.features.add(Strophe.NS.MESSAGE_CORRECT);
_converse.api.disco.own.features.add(Strophe.NS.HTTPUPLOAD);
_converse.api.disco.own.features.add(Strophe.NS.HTTPUPLOAD);
...
@@ -41317,7 +41317,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -41317,7 +41317,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
_converse.api.listen.on('pluginsInitialized', () => {
_converse.api.listen.on('pluginsInitialized', () => {
_converse.chatboxes = new _converse.ChatBoxes();
_converse.chatboxes = new _converse.ChatBoxes();
_converse.emit('chatBoxesInitialized');
_converse.
api.
emit('chatBoxesInitialized');
});
});
_converse.api.listen.on('presencesInitialized', () => _converse.chatboxes.onConnected());
_converse.api.listen.on('presencesInitialized', () => _converse.chatboxes.onConnected());
...
@@ -41861,7 +41861,7 @@ function initPlugins() {
...
@@ -41861,7 +41861,7 @@ function initPlugins() {
*/
*/
_converse.emit('pluginsInitialized');
_converse.
api.
emit('pluginsInitialized');
}
}
function initClientConfig() {
function initClientConfig() {
...
@@ -41890,7 +41890,7 @@ function initClientConfig() {
...
@@ -41890,7 +41890,7 @@ function initClientConfig() {
*/
*/
_converse.emit('clientConfigInitialized');
_converse.
api.
emit('clientConfigInitialized');
}
}
_converse.initConnection = function () {
_converse.initConnection = function () {
...
@@ -41920,7 +41920,7 @@ _converse.initConnection = function () {
...
@@ -41920,7 +41920,7 @@ _converse.initConnection = function () {
* @event _converse#connectionInitialized
* @event _converse#connectionInitialized
*/
*/
_converse.emit('connectionInitialized');
_converse.
api.
emit('connectionInitialized');
};
};
function setUpXMLLogging() {
function setUpXMLLogging() {
...
@@ -41954,7 +41954,7 @@ function finishInitialization() {
...
@@ -41954,7 +41954,7 @@ function finishInitialization() {
}
}
if (_converse.idle_presence_timeout > 0) {
if (_converse.idle_presence_timeout > 0) {
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
_converse.api.disco.own.features.add(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].NS.IDLE);
_converse.api.disco.own.features.add(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].NS.IDLE);
});
});
}
}
...
@@ -41963,7 +41963,7 @@ function finishInitialization() {
...
@@ -41963,7 +41963,7 @@ function finishInitialization() {
function unregisterGlobalEventHandlers() {
function unregisterGlobalEventHandlers() {
document.removeEventListener("visibilitychange", _converse.saveWindowState);
document.removeEventListener("visibilitychange", _converse.saveWindowState);
_converse.emit('unregisteredGlobalEventHandlers');
_converse.
api.
emit('unregisteredGlobalEventHandlers');
}
}
function cleanup() {
function cleanup() {
...
@@ -42237,7 +42237,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42237,7 +42237,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('disconnected');
_converse.
api.
emit('disconnected');
};
};
this.onDisconnected = function () {
this.onDisconnected = function () {
...
@@ -42252,7 +42252,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42252,7 +42252,7 @@ _converse.initialize = async function (settings, callback) {
/* In this case, we reconnect, because we might be receiving
/* In this case, we reconnect, because we might be receiving
* expirable tokens from the credentials_url.
* expirable tokens from the credentials_url.
*/
*/
_converse.emit('will-reconnect');
_converse.
api.
emit('will-reconnect');
return _converse.reconnect();
return _converse.reconnect();
} else {
} else {
...
@@ -42269,7 +42269,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42269,7 +42269,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('will-reconnect');
_converse.
api.
emit('will-reconnect');
_converse.reconnect();
_converse.reconnect();
};
};
...
@@ -42422,7 +42422,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42422,7 +42422,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('sessionInitialized');
_converse.
api.
emit('sessionInitialized');
};
};
this.clearSession = function () {
this.clearSession = function () {
...
@@ -42441,7 +42441,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42441,7 +42441,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('clearSession');
_converse.
api.
emit('clearSession');
};
};
this.logOut = function () {
this.logOut = function () {
...
@@ -42464,7 +42464,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42464,7 +42464,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('logout');
_converse.
api.
emit('logout');
};
};
this.saveWindowState = function (ev) {
this.saveWindowState = function (ev) {
...
@@ -42494,7 +42494,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42494,7 +42494,7 @@ _converse.initialize = async function (settings, callback) {
_converse.windowState = state;
_converse.windowState = state;
_converse.emit('windowStateChanged', {
_converse.
api.
emit('windowStateChanged', {
state
state
});
});
};
};
...
@@ -42507,7 +42507,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42507,7 +42507,7 @@ _converse.initialize = async function (settings, callback) {
}); // Set initial state
}); // Set initial state
_converse.emit('registeredGlobalEventHandlers');
_converse.
api.
emit('registeredGlobalEventHandlers');
};
};
this.enableCarbons = function () {
this.enableCarbons = function () {
...
@@ -42557,10 +42557,10 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42557,10 +42557,10 @@ _converse.initialize = async function (settings, callback) {
* // As an ES2015 Promise
* // As an ES2015 Promise
* _converse.api.waitUntil('statusInitialized').then(() => { ... });
* _converse.api.waitUntil('statusInitialized').then(() => { ... });
*/
*/
_converse.emit('statusInitialized', reconnecting);
_converse.
api.
emit('statusInitialized', reconnecting);
if (reconnecting) {
if (reconnecting) {
_converse.emit('reconnected');
_converse.
api.
emit('reconnected');
} else {
} else {
init_promise.resolve();
init_promise.resolve();
/**
/**
...
@@ -42570,7 +42570,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42570,7 +42570,7 @@ _converse.initialize = async function (settings, callback) {
* @event _converse#initialized
* @event _converse#initialized
*/
*/
_converse.emit('initialized');
_converse.
api.
emit('initialized');
/**
/**
* Emitted after the connection has been established and Converse
* Emitted after the connection has been established and Converse
* has got all its ducks in a row.
* has got all its ducks in a row.
...
@@ -42579,7 +42579,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42579,7 +42579,7 @@ _converse.initialize = async function (settings, callback) {
*/
*/
_converse.emit('connected');
_converse.
api.
emit('connected');
}
}
};
};
...
@@ -42589,7 +42589,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42589,7 +42589,7 @@ _converse.initialize = async function (settings, callback) {
_converse.resource = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getResourceFromJid(_converse.connection.jid);
_converse.resource = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getResourceFromJid(_converse.connection.jid);
_converse.domain = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getDomainFromJid(_converse.connection.jid);
_converse.domain = strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].getDomainFromJid(_converse.connection.jid);
_converse.emit('setUserJID');
_converse.
api.
emit('setUserJID');
};
};
this.onConnected = function (reconnecting) {
this.onConnected = function (reconnecting) {
...
@@ -42615,7 +42615,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42615,7 +42615,7 @@ _converse.initialize = async function (settings, callback) {
},
},
initialize() {
initialize() {
this.on('change', () => _converse.emit('connfeedback', _converse.connfeedback));
this.on('change', () => _converse.
api.
emit('connfeedback', _converse.connfeedback));
}
}
});
});
...
@@ -42643,13 +42643,13 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42643,13 +42643,13 @@ _converse.initialize = async function (settings, callback) {
const status = this.get('status');
const status = this.get('status');
this.sendPresence(status);
this.sendPresence(status);
_converse.emit('statusChanged', status);
_converse.
api.
emit('statusChanged', status);
});
});
this.on('change:status_message', () => {
this.on('change:status_message', () => {
const status_message = this.get('status_message');
const status_message = this.get('status_message');
this.sendPresence(this.get('status'), status_message);
this.sendPresence(this.get('status'), status_message);
_converse.emit('statusMessageChanged', status_message);
_converse.
api.
emit('statusMessageChanged', status_message);
});
});
},
},
...
@@ -42717,7 +42717,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42717,7 +42717,7 @@ _converse.initialize = async function (settings, callback) {
xhr.onerror = function () {
xhr.onerror = function () {
delete _converse.connection;
delete _converse.connection;
_converse.emit('noResumeableSession', this);
_converse.
api.
emit('noResumeableSession', this);
reject(xhr.responseText);
reject(xhr.responseText);
};
};
...
@@ -42743,7 +42743,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42743,7 +42743,7 @@ _converse.initialize = async function (settings, callback) {
xhr.onerror = function () {
xhr.onerror = function () {
delete _converse.connection;
delete _converse.connection;
_converse.emit('noResumeableSession', this);
_converse.
api.
emit('noResumeableSession', this);
};
};
xhr.send();
xhr.send();
...
@@ -42882,7 +42882,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42882,7 +42882,7 @@ _converse.initialize = async function (settings, callback) {
};
};
this.tearDown = function () {
this.tearDown = function () {
_converse.emit('beforeTearDown');
_converse.
api.
emit('beforeTearDown');
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.session)) {
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.session)) {
_converse.session.destroy();
_converse.session.destroy();
...
@@ -42895,7 +42895,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -42895,7 +42895,7 @@ _converse.initialize = async function (settings, callback) {
window.removeEventListener(_converse.unloadevent, _converse.onUserActivity);
window.removeEventListener(_converse.unloadevent, _converse.onUserActivity);
window.clearInterval(_converse.everySecondTrigger);
window.clearInterval(_converse.everySecondTrigger);
_converse.emit('afterTearDown');
_converse.
api.
emit('afterTearDown');
return _converse;
return _converse;
}; // Initialization
}; // Initialization
...
@@ -43375,7 +43375,7 @@ _converse.api = {
...
@@ -43375,7 +43375,7 @@ _converse.api = {
}).up().cnode(stanza.tree()));
}).up().cnode(stanza.tree()));
}
}
_converse.emit('send', stanza);
_converse.
api.
emit('send', stanza);
},
},
/**
/**
...
@@ -43389,7 +43389,7 @@ _converse.api = {
...
@@ -43389,7 +43389,7 @@ _converse.api = {
return new es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_3___default.a((resolve, reject) => {
return new es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_3___default.a((resolve, reject) => {
_converse.connection.sendIQ(stanza, resolve, reject, timeout || _converse.IQ_TIMEOUT);
_converse.connection.sendIQ(stanza, resolve, reject, timeout || _converse.IQ_TIMEOUT);
_converse.emit('send', stanza);
_converse.
api.
emit('send', stanza);
});
});
}
}
...
@@ -43629,13 +43629,13 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -43629,13 +43629,13 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
onFeatureAdded(feature) {
onFeatureAdded(feature) {
feature.entity = this;
feature.entity = this;
_converse.emit('serviceDiscovered', feature);
_converse.
api.
emit('serviceDiscovered', feature);
},
},
onFieldAdded(field) {
onFieldAdded(field) {
field.entity = this;
field.entity = this;
_converse.emit('discoExtensionFieldDiscovered', field);
_converse.
api.
emit('discoExtensionFieldDiscovered', field);
},
},
fetchFeatures() {
fetchFeatures() {
...
@@ -43786,7 +43786,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -43786,7 +43786,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
_converse.api.disco.own.features.add(Strophe.NS.CARBONS);
_converse.api.disco.own.features.add(Strophe.NS.CARBONS);
}
}
_converse.emit('addClientFeatures');
_converse.
api.
emit('addClientFeatures');
return this;
return this;
}
}
...
@@ -43809,7 +43809,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -43809,7 +43809,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
});
});
_converse.emit('streamFeaturesAdded');
_converse.
api.
emit('streamFeaturesAdded');
}
}
async function initializeDisco() {
async function initializeDisco() {
...
@@ -43829,7 +43829,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -43829,7 +43829,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
});
});
}
}
_converse.emit('discoInitialized');
_converse.
api.
emit('discoInitialized');
}
}
_converse.api.listen.on('sessionInitialized', initStreamFeatures);
_converse.api.listen.on('sessionInitialized', initStreamFeatures);
...
@@ -44557,7 +44557,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
...
@@ -44557,7 +44557,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse.on('serviceDiscovered', feature => {
_converse.
api.listen.
on('serviceDiscovered', feature => {
const prefs = feature.get('preferences') || {};
const prefs = feature.get('preferences') || {};
if (feature.get('var') === Strophe.NS.MAM && prefs['default'] !== _converse.message_archiving && // eslint-disable-line dot-notation
if (feature.get('var') === Strophe.NS.MAM && prefs['default'] !== _converse.message_archiving && // eslint-disable-line dot-notation
...
@@ -44571,7 +44571,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
...
@@ -44571,7 +44571,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
}
}
});
});
_converse.on('addClientFeatures', () => _converse.api.disco.own.features.add(Strophe.NS.MAM));
_converse.
api.listen.
on('addClientFeatures', () => _converse.api.disco.own.features.add(Strophe.NS.MAM));
/************************ END Event Handlers ************************/
/************************ END Event Handlers ************************/
/************************ BEGIN API ************************/
/************************ BEGIN API ************************/
...
@@ -45971,7 +45971,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -45971,7 +45971,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
if (message || this.handleMessageCorrection(stanza) || this.isReceipt(stanza) || this.isChatMarker(stanza)) {
if (message || this.handleMessageCorrection(stanza) || this.isReceipt(stanza) || this.isChatMarker(stanza)) {
return _converse.emit('message', {
return _converse.
api.
emit('message', {
'stanza': original_stanza
'stanza': original_stanza
});
});
}
}
...
@@ -45989,7 +45989,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -45989,7 +45989,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
}
}
_converse.emit('message', {
_converse.
api.
emit('message', {
'stanza': original_stanza,
'stanza': original_stanza,
'chatbox': this
'chatbox': this
});
});
...
@@ -46308,9 +46308,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -46308,9 +46308,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}, 'jabber:x:conference', 'message');
}, 'jabber:x:conference', 'message');
};
};
_converse.on('connected', registerDirectInvitationHandler);
_converse.
api.listen.
on('connected', registerDirectInvitationHandler);
_converse.on('reconnected', registerDirectInvitationHandler);
_converse.
api.listen.
on('reconnected', registerDirectInvitationHandler);
}
}
const getChatRoom = function getChatRoom(jid, attrs, create) {
const getChatRoom = function getChatRoom(jid, attrs, create) {
...
@@ -46351,7 +46351,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -46351,7 +46351,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
});
});
_converse.emit('roomsAutoJoined');
_converse.
api.
emit('roomsAutoJoined');
}
}
function disconnectChatRooms() {
function disconnectChatRooms() {
...
@@ -46384,7 +46384,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
...
@@ -46384,7 +46384,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
if (_converse.allow_muc) {
if (_converse.allow_muc) {
_converse.api.disco.own.features.add(Strophe.NS.MUC);
_converse.api.disco.own.features.add(Strophe.NS.MUC);
}
}
...
@@ -46722,9 +46722,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins.add('converse-pin
...
@@ -46722,9 +46722,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins.add('converse-pin
_converse.registerPingHandler();
_converse.registerPingHandler();
};
};
_converse.on('connected', onConnected);
_converse.
api.listen.
on('connected', onConnected);
_converse.on('reconnected', onConnected);
_converse.
api.listen.
on('reconnected', onConnected);
}
}
});
});
...
@@ -46927,7 +46927,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -46927,7 +46927,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.rostergroups = new _converse.RosterGroups();
_converse.rostergroups = new _converse.RosterGroups();
_converse.rostergroups.browserStorage = new Backbone.BrowserStorage[storage](`converse.roster.groups${_converse.bare_jid}`);
_converse.rostergroups.browserStorage = new Backbone.BrowserStorage[storage](`converse.roster.groups${_converse.bare_jid}`);
_converse.emit('rosterInitialized');
_converse.
api.
emit('rosterInitialized');
};
};
_converse.populateRoster = async function () {
_converse.populateRoster = async function () {
...
@@ -46947,7 +46947,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -46947,7 +46947,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
try {
try {
await _converse.roster.fetchFromServer();
await _converse.roster.fetchFromServer();
_converse.emit('rosterContactsFetched');
_converse.
api.
emit('rosterContactsFetched');
} catch (reason) {
} catch (reason) {
_converse.log(reason, Strophe.LogLevel.ERROR);
_converse.log(reason, Strophe.LogLevel.ERROR);
} finally {
} finally {
...
@@ -46957,11 +46957,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -46957,11 +46957,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
try {
try {
await _converse.rostergroups.fetchRosterGroups();
await _converse.rostergroups.fetchRosterGroups();
_converse.emit('rosterGroupsFetched');
_converse.
api.
emit('rosterGroupsFetched');
await _converse.roster.fetchRosterContacts();
await _converse.roster.fetchRosterContacts();
_converse.emit('rosterContactsFetched');
_converse.
api.
emit('rosterContactsFetched');
} catch (reason) {
} catch (reason) {
_converse.log(reason, Strophe.LogLevel.ERROR);
_converse.log(reason, Strophe.LogLevel.ERROR);
} finally {
} finally {
...
@@ -47100,7 +47100,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -47100,7 +47100,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'user_id': Strophe.getNodeFromJid(jid)
'user_id': Strophe.getNodeFromJid(jid)
}, attributes));
}, attributes));
this.setChatBox();
this.setChatBox();
this.presence.on('change:show', () => _converse.emit('contactPresenceChanged', this));
this.presence.on('change:show', () => _converse.
api.
emit('contactPresenceChanged', this));
this.presence.on('change:show', () => this.trigger('presenceChanged'));
this.presence.on('change:show', () => this.trigger('presenceChanged'));
},
},
...
@@ -47310,7 +47310,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -47310,7 +47310,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.send_initial_presence = true;
_converse.send_initial_presence = true;
return _converse.roster.fetchFromServer();
return _converse.roster.fetchFromServer();
} else {
} else {
_converse.emit('cachedRoster', collection);
_converse.
api.
emit('cachedRoster', collection);
}
}
},
},
...
@@ -47485,7 +47485,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -47485,7 +47485,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
this.updateContact(items.pop());
this.updateContact(items.pop());
_converse.emit('rosterPush', iq);
_converse.
api.
emit('rosterPush', iq);
return;
return;
},
},
...
@@ -47538,7 +47538,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -47538,7 +47538,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.session.save('roster_fetched', true);
_converse.session.save('roster_fetched', true);
}
}
_converse.emit('roster', iq);
_converse.
api.
emit('roster', iq);
},
},
updateContact(item) {
updateContact(item) {
...
@@ -47601,7 +47601,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -47601,7 +47601,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'nickname': nickname
'nickname': nickname
};
};
_converse.emit('contactRequest', this.create(user_data));
_converse.
api.
emit('contactRequest', this.create(user_data));
},
},
handleIncomingSubscription(presence) {
handleIncomingSubscription(presence) {
...
@@ -47841,7 +47841,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -47841,7 +47841,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.presences.fetch();
_converse.presences.fetch();
_converse.emit('presencesInitialized', reconnecting);
_converse.
api.
emit('presencesInitialized', reconnecting);
});
});
_converse.api.listen.on('presencesInitialized', reconnecting => {
_converse.api.listen.on('presencesInitialized', reconnecting => {
...
@@ -47850,7 +47850,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -47850,7 +47850,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
// cached data. However we still emit an event, to give
// cached data. However we still emit an event, to give
// event handlers a chance to register views for the
// event handlers a chance to register views for the
// roster and its groups, before we start populating.
// roster and its groups, before we start populating.
_converse.emit('rosterReadyAfterReconnection');
_converse.
api.
emit('rosterReadyAfterReconnection');
} else {
} else {
_converse.registerIntervalHandler();
_converse.registerIntervalHandler();
...
@@ -48110,7 +48110,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca
...
@@ -48110,7 +48110,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca
_converse.api.listen.on('sessionInitialized', _converse.initVCardCollection);
_converse.api.listen.on('sessionInitialized', _converse.initVCardCollection);
_converse.on('addClientFeatures', () => {
_converse.
api.listen.
on('addClientFeatures', () => {
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
});
});
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