-
-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upon nickname change, set new nick on the MUC bookmark
- Adds a new bookmarks API
- Loading branch information
Showing
25 changed files
with
537 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import _converse from '../../shared/_converse.js'; | ||
import promise_api from '../../shared/api/promise.js'; | ||
|
||
const { waitUntil } = promise_api; | ||
|
||
/** | ||
* Groups methods relevant to XEP-0402 MUC bookmarks. | ||
* | ||
* @namespace api.bookmarks | ||
* @memberOf api | ||
*/ | ||
const bookmarks = { | ||
/** | ||
* Calling this function will result in an IQ stanza being sent out to set | ||
* the bookmark on the server. | ||
* | ||
* @method api.bookmarks.set | ||
* @param {import('./types').BookmarkAttrs} attrs - The room attributes | ||
* @param {boolean} create=true - Whether the bookmark should be created if it doesn't exist | ||
* @returns {Promise<import('./model').default>} | ||
*/ | ||
async set(attrs, create = true) { | ||
const bookmarks = await waitUntil('bookmarksInitialized'); | ||
return bookmarks.setBookmark(attrs, create); | ||
}, | ||
|
||
/** | ||
* @method api.bookmarks.get | ||
* @param {string} jid - The JID of the bookmark to return. | ||
* @returns {Promise<import('./model').default>} | ||
*/ | ||
async get(jid) { | ||
const bookmarks = await waitUntil('bookmarksInitialized'); | ||
return bookmarks.get(jid); | ||
}, | ||
}; | ||
|
||
const bookmarks_api = { bookmarks }; | ||
|
||
export default bookmarks_api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.