Add method to convert bookmarks::Conference to bookmarks2::Conference
Autojoin is now same struct in both modules
This commit is contained in:
parent
119c04801c
commit
d1b63a52a5
1 changed files with 28 additions and 6 deletions
|
|
@ -4,14 +4,19 @@
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
//!
|
||||||
|
//! Chatroom bookmarks from [XEP-0048 v1.0](https://xmpp.org/extensions/attic/xep-0048-1.0.html). Only use on older servers
|
||||||
|
//! which do not advertise `urn:xmpp:bookmarks:1#compat` on the user's BareJID in a disco info request.
|
||||||
|
//! On modern compliant servers, use the [`crate::bookmarks2`] module instead.
|
||||||
|
//!
|
||||||
|
//! See [ModernXMPP docs](https://docs.modernxmpp.org/client/groupchat/#bookmarks) on how to handle all historic
|
||||||
|
//! and newer specifications for your clients.
|
||||||
|
//!
|
||||||
|
//! This module exposes the [`Autojoin`][crate::bookmarks::Autojoin] boolean flag, the [`Conference`][crate::bookmarks::Conference] chatroom element, and the [`crate::ns::BOOKMARKS`] XML namespace.
|
||||||
|
|
||||||
use jid::BareJid;
|
use jid::BareJid;
|
||||||
|
|
||||||
generate_attribute!(
|
pub use crate::bookmarks2::Autojoin;
|
||||||
/// Whether a conference bookmark should be joined automatically.
|
|
||||||
Autojoin,
|
|
||||||
"autojoin",
|
|
||||||
bool
|
|
||||||
);
|
|
||||||
|
|
||||||
generate_element!(
|
generate_element!(
|
||||||
/// A conference bookmark.
|
/// A conference bookmark.
|
||||||
|
|
@ -35,6 +40,23 @@ generate_element!(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
impl Conference {
|
||||||
|
/// Turns a XEP-0048 Conference element into a XEP-0402 "Bookmarks2" Conference element, in a
|
||||||
|
/// tuple with the room JID.
|
||||||
|
pub fn into_bookmarks2(self) -> (BareJid, crate::bookmarks2::Conference) {
|
||||||
|
(
|
||||||
|
self.jid,
|
||||||
|
crate::bookmarks2::Conference {
|
||||||
|
autojoin: self.autojoin,
|
||||||
|
name: self.name,
|
||||||
|
nick: self.nick,
|
||||||
|
password: self.password,
|
||||||
|
extensions: vec![],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
generate_element!(
|
generate_element!(
|
||||||
/// An URL bookmark.
|
/// An URL bookmark.
|
||||||
Url, "url", BOOKMARKS,
|
Url, "url", BOOKMARKS,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue