macros: Remove use requirement on ns.
This commit is contained in:
parent
d9aaa3e9ce
commit
93b018e5ac
41 changed files with 112 additions and 141 deletions
|
|
@ -4,9 +4,7 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
generate_empty_element!(Attention, "attention", ATTENTION);
|
||||||
|
|
||||||
generate_empty_element!(Attention, "attention", ns::ATTENTION);
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ impl TryFrom<Element> for Bind {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Bind, Error> {
|
fn try_from(elem: Element) -> Result<Bind, Error> {
|
||||||
check_self!(elem, "bind", ns::BIND);
|
check_self!(elem, "bind", BIND);
|
||||||
check_no_attributes!(elem, "bind");
|
check_no_attributes!(elem, "bind");
|
||||||
|
|
||||||
let mut bind = Bind::None;
|
let mut bind = Bind::None;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use error::Error;
|
||||||
|
|
||||||
use ns;
|
use ns;
|
||||||
|
|
||||||
generate_empty_element!(BlocklistRequest, "blocklist", ns::BLOCKING);
|
generate_empty_element!(BlocklistRequest, "blocklist", BLOCKING);
|
||||||
|
|
||||||
macro_rules! generate_blocking_element {
|
macro_rules! generate_blocking_element {
|
||||||
($elem:ident, $name:tt) => (
|
($elem:ident, $name:tt) => (
|
||||||
|
|
@ -26,11 +26,11 @@ macro_rules! generate_blocking_element {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||||
check_self!(elem, $name, ns::BLOCKING);
|
check_self!(elem, $name, BLOCKING);
|
||||||
check_no_attributes!(elem, $name);
|
check_no_attributes!(elem, $name);
|
||||||
let mut items = vec!();
|
let mut items = vec!();
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
check_self!(child, "item", ns::BLOCKING);
|
check_self!(child, "item", BLOCKING);
|
||||||
check_no_unknown_attributes!(child, "item", ["jid"]);
|
check_no_unknown_attributes!(child, "item", ["jid"]);
|
||||||
check_no_children!(child, "item");
|
check_no_children!(child, "item");
|
||||||
items.push(get_attr!(child, "jid", required));
|
items.push(get_attr!(child, "jid", required));
|
||||||
|
|
@ -59,7 +59,7 @@ generate_blocking_element!(BlocklistResult, "blocklist");
|
||||||
generate_blocking_element!(Block, "block");
|
generate_blocking_element!(Block, "block");
|
||||||
generate_blocking_element!(Unblock, "unblock");
|
generate_blocking_element!(Unblock, "unblock");
|
||||||
|
|
||||||
generate_empty_element!(Blocked, "blocked", ns::BLOCKING_ERRORS);
|
generate_empty_element!(Blocked, "blocked", BLOCKING_ERRORS);
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ impl TryFrom<Element> for Caps {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Caps, Error> {
|
fn try_from(elem: Element) -> Result<Caps, Error> {
|
||||||
check_self!(elem, "c", ns::CAPS, "caps");
|
check_self!(elem, "c", CAPS, "caps");
|
||||||
check_no_children!(elem, "caps");
|
check_no_children!(elem, "caps");
|
||||||
check_no_unknown_attributes!(elem, "caps", ["hash", "ver", "ext", "node"]);
|
check_no_unknown_attributes!(elem, "caps", ["hash", "ver", "ext", "node"]);
|
||||||
let ver: String = get_attr!(elem, "ver", required);
|
let ver: String = get_attr!(elem, "ver", required);
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,10 @@
|
||||||
|
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use ns;
|
|
||||||
|
|
||||||
generate_element_enum!(
|
generate_element_enum!(
|
||||||
/// Enum representing chatstate elements part of the
|
/// Enum representing chatstate elements part of the
|
||||||
/// `http://jabber.org/protocol/chatstates` namespace.
|
/// `http://jabber.org/protocol/chatstates` namespace.
|
||||||
ChatState, "chatstate", ns::CHATSTATES, {
|
ChatState, "chatstate", CHATSTATES, {
|
||||||
/// `<active xmlns='http://jabber.org/protocol/chatstates'/>`
|
/// `<active xmlns='http://jabber.org/protocol/chatstates'/>`
|
||||||
Active => "active",
|
Active => "active",
|
||||||
|
|
||||||
|
|
@ -35,6 +33,7 @@ mod tests {
|
||||||
use try_from::TryFrom;
|
use try_from::TryFrom;
|
||||||
use minidom::Element;
|
use minidom::Element;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
|
use ns;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple() {
|
fn test_simple() {
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use helpers::PlainText;
|
use helpers::PlainText;
|
||||||
use ns;
|
|
||||||
|
|
||||||
use sha1::Sha1;
|
use sha1::Sha1;
|
||||||
use digest::Digest;
|
use digest::Digest;
|
||||||
|
|
||||||
generate_element_with_text!(Handshake, "handshake", ns::COMPONENT,
|
generate_element_with_text!(Handshake, "handshake", COMPONENT,
|
||||||
data: PlainText<Option<String>>
|
data: PlainText<Option<String>>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl TryFrom<Element> for Option_ {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Option_, Error> {
|
fn try_from(elem: Element) -> Result<Option_, Error> {
|
||||||
check_self!(elem, "option", ns::DATA_FORMS);
|
check_self!(elem, "option", DATA_FORMS);
|
||||||
check_no_unknown_attributes!(elem, "option", ["label"]);
|
check_no_unknown_attributes!(elem, "option", ["label"]);
|
||||||
let mut value = None;
|
let mut value = None;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
@ -90,7 +90,7 @@ impl TryFrom<Element> for Field {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Field, Error> {
|
fn try_from(elem: Element) -> Result<Field, Error> {
|
||||||
check_self!(elem, "field", ns::DATA_FORMS);
|
check_self!(elem, "field", DATA_FORMS);
|
||||||
check_no_unknown_attributes!(elem, "field", ["label", "type", "var"]);
|
check_no_unknown_attributes!(elem, "field", ["label", "type", "var"]);
|
||||||
let mut field = Field {
|
let mut field = Field {
|
||||||
var: get_attr!(elem, "var", required),
|
var: get_attr!(elem, "var", required),
|
||||||
|
|
@ -167,7 +167,7 @@ impl TryFrom<Element> for DataForm {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<DataForm, Error> {
|
fn try_from(elem: Element) -> Result<DataForm, Error> {
|
||||||
check_self!(elem, "x", ns::DATA_FORMS);
|
check_self!(elem, "x", DATA_FORMS);
|
||||||
check_no_unknown_attributes!(elem, "x", ["type"]);
|
check_no_unknown_attributes!(elem, "x", ["type"]);
|
||||||
let type_ = get_attr!(elem, "type", required);
|
let type_ = get_attr!(elem, "type", required);
|
||||||
let mut form = DataForm {
|
let mut form = DataForm {
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,9 @@ use date::DateTime;
|
||||||
|
|
||||||
use jid::Jid;
|
use jid::Jid;
|
||||||
|
|
||||||
use ns;
|
|
||||||
use helpers::PlainText;
|
use helpers::PlainText;
|
||||||
|
|
||||||
generate_element_with_text!(Delay, "delay", ns::DELAY,
|
generate_element_with_text!(Delay, "delay", DELAY,
|
||||||
[
|
[
|
||||||
from: Option<Jid> = "from" => optional,
|
from: Option<Jid> = "from" => optional,
|
||||||
stamp: DateTime = "stamp" => required
|
stamp: DateTime = "stamp" => required
|
||||||
|
|
|
||||||
16
src/disco.rs
16
src/disco.rs
|
|
@ -21,7 +21,7 @@ generate_element_with_only_attributes!(
|
||||||
///
|
///
|
||||||
/// It should only be used in an `<iq type='get'/>`, as it can only represent
|
/// It should only be used in an `<iq type='get'/>`, as it can only represent
|
||||||
/// the request, and not a result.
|
/// the request, and not a result.
|
||||||
DiscoInfoQuery, "query", ns::DISCO_INFO, [
|
DiscoInfoQuery, "query", DISCO_INFO, [
|
||||||
/// Node on which we are doing the discovery.
|
/// Node on which we are doing the discovery.
|
||||||
node: Option<String> = "node" => optional,
|
node: Option<String> = "node" => optional,
|
||||||
]);
|
]);
|
||||||
|
|
@ -29,7 +29,7 @@ DiscoInfoQuery, "query", ns::DISCO_INFO, [
|
||||||
generate_element_with_only_attributes!(
|
generate_element_with_only_attributes!(
|
||||||
/// Structure representing a `<feature xmlns='http://jabber.org/protocol/disco#info'/>` element.
|
/// Structure representing a `<feature xmlns='http://jabber.org/protocol/disco#info'/>` element.
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
Feature, "feature", ns::DISCO_INFO, [
|
Feature, "feature", DISCO_INFO, [
|
||||||
/// Namespace of the feature we want to represent.
|
/// Namespace of the feature we want to represent.
|
||||||
var: String = "var" => required,
|
var: String = "var" => required,
|
||||||
]);
|
]);
|
||||||
|
|
@ -54,7 +54,7 @@ impl TryFrom<Element> for Identity {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Identity, Error> {
|
fn try_from(elem: Element) -> Result<Identity, Error> {
|
||||||
check_self!(elem, "identity", ns::DISCO_INFO, "disco#info identity");
|
check_self!(elem, "identity", DISCO_INFO, "disco#info identity");
|
||||||
check_no_children!(elem, "disco#info identity");
|
check_no_children!(elem, "disco#info identity");
|
||||||
check_no_unknown_attributes!(elem, "disco#info identity", ["category", "type", "xml:lang", "name"]);
|
check_no_unknown_attributes!(elem, "disco#info identity", ["category", "type", "xml:lang", "name"]);
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ impl TryFrom<Element> for DiscoInfoResult {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<DiscoInfoResult, Error> {
|
fn try_from(elem: Element) -> Result<DiscoInfoResult, Error> {
|
||||||
check_self!(elem, "query", ns::DISCO_INFO, "disco#info result");
|
check_self!(elem, "query", DISCO_INFO, "disco#info result");
|
||||||
check_no_unknown_attributes!(elem, "disco#info result", ["node"]);
|
check_no_unknown_attributes!(elem, "disco#info result", ["node"]);
|
||||||
|
|
||||||
let mut result = DiscoInfoResult {
|
let mut result = DiscoInfoResult {
|
||||||
|
|
@ -185,14 +185,14 @@ generate_element_with_only_attributes!(
|
||||||
///
|
///
|
||||||
/// It should only be used in an `<iq type='get'/>`, as it can only represent
|
/// It should only be used in an `<iq type='get'/>`, as it can only represent
|
||||||
/// the request, and not a result.
|
/// the request, and not a result.
|
||||||
DiscoItemsQuery, "query", ns::DISCO_ITEMS, [
|
DiscoItemsQuery, "query", DISCO_ITEMS, [
|
||||||
/// Node on which we are doing the discovery.
|
/// Node on which we are doing the discovery.
|
||||||
node: Option<String> = "node" => optional,
|
node: Option<String> = "node" => optional,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
generate_element_with_only_attributes!(
|
generate_element_with_only_attributes!(
|
||||||
/// Structure representing an `<item xmlns='http://jabber.org/protocol/disco#items'/>` element.
|
/// Structure representing an `<item xmlns='http://jabber.org/protocol/disco#items'/>` element.
|
||||||
Item, "item", ns::DISCO_ITEMS, [
|
Item, "item", DISCO_ITEMS, [
|
||||||
/// JID of the entity pointed by this item.
|
/// JID of the entity pointed by this item.
|
||||||
jid: Jid = "jid" => required,
|
jid: Jid = "jid" => required,
|
||||||
/// Node of the entity pointed by this item.
|
/// Node of the entity pointed by this item.
|
||||||
|
|
@ -207,14 +207,14 @@ generate_element_with_children!(
|
||||||
///
|
///
|
||||||
/// It should only be used in an `<iq type='result'/>`, as it can only
|
/// It should only be used in an `<iq type='result'/>`, as it can only
|
||||||
/// represent the result, and not a request.
|
/// represent the result, and not a request.
|
||||||
DiscoItemsResult, "query", ns::DISCO_ITEMS,
|
DiscoItemsResult, "query", DISCO_ITEMS,
|
||||||
attributes: [
|
attributes: [
|
||||||
/// Node on which we have done this discovery.
|
/// Node on which we have done this discovery.
|
||||||
node: Option<String> = "node" => optional
|
node: Option<String> = "node" => optional
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
/// List of items pointed by this entity.
|
/// List of items pointed by this entity.
|
||||||
items: Vec<Item> = ("item", ns::DISCO_ITEMS) => Item
|
items: Vec<Item> = ("item", DISCO_ITEMS) => Item
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ impl TryFrom<Element> for ECaps2 {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<ECaps2, Error> {
|
fn try_from(elem: Element) -> Result<ECaps2, Error> {
|
||||||
check_self!(elem, "c", ns::ECAPS2, "ecaps2");
|
check_self!(elem, "c", ECAPS2, "ecaps2");
|
||||||
check_no_attributes!(elem, "ecaps2");
|
check_no_attributes!(elem, "ecaps2");
|
||||||
let mut hashes = vec!();
|
let mut hashes = vec!();
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,9 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
|
||||||
|
|
||||||
generate_element_with_only_attributes!(
|
generate_element_with_only_attributes!(
|
||||||
/// Structure representing an `<encryption xmlns='urn:xmpp:eme:0'/>` element.
|
/// Structure representing an `<encryption xmlns='urn:xmpp:eme:0'/>` element.
|
||||||
ExplicitMessageEncryption, "encryption", ns::EME, [
|
ExplicitMessageEncryption, "encryption", EME, [
|
||||||
/// Namespace of the encryption scheme used.
|
/// Namespace of the encryption scheme used.
|
||||||
namespace: String = "namespace" => required,
|
namespace: String = "namespace" => required,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ impl TryFrom<Element> for Forwarded {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Forwarded, Error> {
|
fn try_from(elem: Element) -> Result<Forwarded, Error> {
|
||||||
check_self!(elem, "forwarded", ns::FORWARD);
|
check_self!(elem, "forwarded", FORWARD);
|
||||||
let mut delay = None;
|
let mut delay = None;
|
||||||
let mut stanza = None;
|
let mut stanza = None;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ use minidom::IntoAttributeValue;
|
||||||
|
|
||||||
use error::Error;
|
use error::Error;
|
||||||
|
|
||||||
use ns;
|
|
||||||
use helpers::Base64;
|
use helpers::Base64;
|
||||||
use base64;
|
use base64;
|
||||||
|
|
||||||
|
|
@ -69,7 +68,7 @@ impl IntoAttributeValue for Algo {
|
||||||
|
|
||||||
generate_element_with_text!(
|
generate_element_with_text!(
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
Hash, "hash", ns::HASHES,
|
Hash, "hash", HASHES,
|
||||||
[
|
[
|
||||||
algo: Algo = "algo" => required
|
algo: Algo = "algo" => required
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
|
||||||
use helpers::Base64;
|
use helpers::Base64;
|
||||||
|
|
||||||
generate_attribute!(Stanza, "stanza", {
|
generate_attribute!(Stanza, "stanza", {
|
||||||
|
|
@ -12,13 +11,13 @@ generate_attribute!(Stanza, "stanza", {
|
||||||
Message => "message",
|
Message => "message",
|
||||||
}, Default = Iq);
|
}, Default = Iq);
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Open, "open", ns::IBB, [
|
generate_element_with_only_attributes!(Open, "open", IBB, [
|
||||||
block_size: u16 = "block-size" => required,
|
block_size: u16 = "block-size" => required,
|
||||||
sid: String = "sid" => required,
|
sid: String = "sid" => required,
|
||||||
stanza: Stanza = "stanza" => default,
|
stanza: Stanza = "stanza" => default,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
generate_element_with_text!(Data, "data", ns::IBB,
|
generate_element_with_text!(Data, "data", IBB,
|
||||||
[
|
[
|
||||||
seq: u16 = "seq" => required,
|
seq: u16 = "seq" => required,
|
||||||
sid: String = "sid" => required
|
sid: String = "sid" => required
|
||||||
|
|
@ -26,7 +25,7 @@ generate_element_with_text!(Data, "data", ns::IBB,
|
||||||
data: Base64<Vec<u8>>
|
data: Base64<Vec<u8>>
|
||||||
);
|
);
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Close, "close", ns::IBB, [
|
generate_element_with_only_attributes!(Close, "close", IBB, [
|
||||||
sid: String = "sid" => required,
|
sid: String = "sid" => required,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ impl TryFrom<Element> for Query {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Query, Error> {
|
fn try_from(elem: Element) -> Result<Query, Error> {
|
||||||
check_self!(elem, "query", ns::REGISTER, "IBR query");
|
check_self!(elem, "query", REGISTER, "IBR query");
|
||||||
let mut query = Query {
|
let mut query = Query {
|
||||||
registered: false,
|
registered: false,
|
||||||
fields: HashMap::new(),
|
fields: HashMap::new(),
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@
|
||||||
|
|
||||||
use date::DateTime;
|
use date::DateTime;
|
||||||
|
|
||||||
use ns;
|
generate_element_with_only_attributes!(Idle, "idle", IDLE, [
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Idle, "idle", ns::IDLE, [
|
|
||||||
since: DateTime = "since" => required,
|
since: DateTime = "since" => required,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ impl TryFrom<Element> for Iq {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(root: Element) -> Result<Iq, Error> {
|
fn try_from(root: Element) -> Result<Iq, Error> {
|
||||||
check_self!(root, "iq", ns::DEFAULT_NS);
|
check_self!(root, "iq", DEFAULT_NS);
|
||||||
let from = get_attr!(root, "from", optional);
|
let from = get_attr!(root, "from", optional);
|
||||||
let to = get_attr!(root, "to", optional);
|
let to = get_attr!(root, "to", optional);
|
||||||
let id = get_attr!(root, "id", optional);
|
let id = get_attr!(root, "id", optional);
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ impl TryFrom<Element> for Content {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Content, Error> {
|
fn try_from(elem: Element) -> Result<Content, Error> {
|
||||||
check_self!(elem, "content", ns::JINGLE);
|
check_self!(elem, "content", JINGLE);
|
||||||
|
|
||||||
let mut content = Content {
|
let mut content = Content {
|
||||||
creator: get_attr!(elem, "creator", required),
|
creator: get_attr!(elem, "creator", required),
|
||||||
|
|
@ -250,7 +250,7 @@ impl TryFrom<Element> for ReasonElement {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<ReasonElement, Error> {
|
fn try_from(elem: Element) -> Result<ReasonElement, Error> {
|
||||||
check_self!(elem, "reason", ns::JINGLE);
|
check_self!(elem, "reason", JINGLE);
|
||||||
let mut reason = None;
|
let mut reason = None;
|
||||||
let mut text = None;
|
let mut text = None;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
@ -340,7 +340,7 @@ impl TryFrom<Element> for Jingle {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(root: Element) -> Result<Jingle, Error> {
|
fn try_from(root: Element) -> Result<Jingle, Error> {
|
||||||
check_self!(root, "jingle", ns::JINGLE, "Jingle");
|
check_self!(root, "jingle", JINGLE, "Jingle");
|
||||||
|
|
||||||
let mut jingle = Jingle {
|
let mut jingle = Jingle {
|
||||||
action: get_attr!(root, "action", required),
|
action: get_attr!(root, "action", required),
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@ use ns;
|
||||||
|
|
||||||
generate_element_with_children!(
|
generate_element_with_children!(
|
||||||
#[derive(PartialEq, Default)]
|
#[derive(PartialEq, Default)]
|
||||||
Range, "range", ns::JINGLE_FT,
|
Range, "range", JINGLE_FT,
|
||||||
attributes: [
|
attributes: [
|
||||||
offset: u64 = "offset" => default,
|
offset: u64 = "offset" => default,
|
||||||
length: Option<u64> = "length" => optional
|
length: Option<u64> = "length" => optional
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
hashes: Vec<Hash> = ("hash", ns::HASHES) => Hash
|
hashes: Vec<Hash> = ("hash", HASHES) => Hash
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -109,7 +109,7 @@ impl TryFrom<Element> for File {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<File, Error> {
|
fn try_from(elem: Element) -> Result<File, Error> {
|
||||||
check_self!(elem, "file", ns::JINGLE_FT);
|
check_self!(elem, "file", JINGLE_FT);
|
||||||
check_no_attributes!(elem, "file");
|
check_no_attributes!(elem, "file");
|
||||||
|
|
||||||
let mut file = File {
|
let mut file = File {
|
||||||
|
|
@ -218,7 +218,7 @@ impl TryFrom<Element> for Description {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Description, Error> {
|
fn try_from(elem: Element) -> Result<Description, Error> {
|
||||||
check_self!(elem, "description", ns::JINGLE_FT, "JingleFT description");
|
check_self!(elem, "description", JINGLE_FT, "JingleFT description");
|
||||||
check_no_attributes!(elem, "JingleFT description");
|
check_no_attributes!(elem, "JingleFT description");
|
||||||
let mut file = None;
|
let mut file = None;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
@ -256,7 +256,7 @@ impl TryFrom<Element> for Checksum {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Checksum, Error> {
|
fn try_from(elem: Element) -> Result<Checksum, Error> {
|
||||||
check_self!(elem, "checksum", ns::JINGLE_FT);
|
check_self!(elem, "checksum", JINGLE_FT);
|
||||||
check_no_unknown_attributes!(elem, "checksum", ["name", "creator"]);
|
check_no_unknown_attributes!(elem, "checksum", ["name", "creator"]);
|
||||||
let mut file = None;
|
let mut file = None;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
@ -287,7 +287,7 @@ impl From<Checksum> for Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Received, "received", ns::JINGLE_FT, [
|
generate_element_with_only_attributes!(Received, "received", JINGLE_FT, [
|
||||||
name: ContentId = "name" => required,
|
name: ContentId = "name" => required,
|
||||||
creator: Creator = "creator" => required,
|
creator: Creator = "creator" => required,
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,11 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
|
||||||
|
|
||||||
use ibb::Stanza;
|
use ibb::Stanza;
|
||||||
|
|
||||||
generate_id!(StreamId);
|
generate_id!(StreamId);
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Transport, "transport", ns::JINGLE_IBB, [
|
generate_element_with_only_attributes!(Transport, "transport", JINGLE_IBB, [
|
||||||
block_size: u16 = "block-size" => required,
|
block_size: u16 = "block-size" => required,
|
||||||
sid: StreamId = "sid" => required,
|
sid: StreamId = "sid" => required,
|
||||||
stanza: Stanza = "stanza" => default,
|
stanza: Stanza = "stanza" => default,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ generate_id!(CandidateId);
|
||||||
|
|
||||||
generate_id!(StreamId);
|
generate_id!(StreamId);
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Candidate, "candidate", ns::JINGLE_S5B, [
|
generate_element_with_only_attributes!(Candidate, "candidate", JINGLE_S5B, [
|
||||||
cid: CandidateId = "cid" => required,
|
cid: CandidateId = "cid" => required,
|
||||||
host: IpAddr = "host" => required,
|
host: IpAddr = "host" => required,
|
||||||
jid: Jid = "jid" => required,
|
jid: Jid = "jid" => required,
|
||||||
|
|
@ -110,7 +110,7 @@ impl TryFrom<Element> for Transport {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Transport, Error> {
|
fn try_from(elem: Element) -> Result<Transport, Error> {
|
||||||
check_self!(elem, "transport", ns::JINGLE_S5B);
|
check_self!(elem, "transport", JINGLE_S5B);
|
||||||
let sid = get_attr!(elem, "sid", required);
|
let sid = get_attr!(elem, "sid", required);
|
||||||
let dstaddr = get_attr!(elem, "dstaddr", optional);
|
let dstaddr = get_attr!(elem, "dstaddr", optional);
|
||||||
let mode = get_attr!(elem, "mode", default);
|
let mode = get_attr!(elem, "mode", default);
|
||||||
|
|
|
||||||
|
|
@ -104,10 +104,10 @@ macro_rules! generate_attribute {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_element_enum {
|
macro_rules! generate_element_enum {
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+,}) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+,}) => (
|
||||||
generate_element_enum!($(#[$meta])* $elem, $name, $ns, {$($(#[$enum_meta])* $enum => $enum_name),+});
|
generate_element_enum!($(#[$meta])* $elem, $name, $ns, {$($(#[$enum_meta])* $enum => $enum_name),+});
|
||||||
);
|
);
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+}) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+}) => (
|
||||||
$(#[$meta])*
|
$(#[$meta])*
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum $elem {
|
pub enum $elem {
|
||||||
|
|
@ -132,7 +132,7 @@ macro_rules! generate_element_enum {
|
||||||
fn from(elem: $elem) -> ::minidom::Element {
|
fn from(elem: $elem) -> ::minidom::Element {
|
||||||
::minidom::Element::builder(match elem {
|
::minidom::Element::builder(match elem {
|
||||||
$($elem::$enum => $enum_name,)+
|
$($elem::$enum => $enum_name,)+
|
||||||
}).ns($ns)
|
}).ns(::ns::$ns)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -140,10 +140,10 @@ macro_rules! generate_element_enum {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_attribute_enum {
|
macro_rules! generate_attribute_enum {
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, $attr:tt, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+,}) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, $attr:tt, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+,}) => (
|
||||||
generate_attribute_enum!($(#[$meta])* $elem, $name, $ns, $attr, {$($(#[$enum_meta])* $enum => $enum_name),+});
|
generate_attribute_enum!($(#[$meta])* $elem, $name, $ns, $attr, {$($(#[$enum_meta])* $enum => $enum_name),+});
|
||||||
);
|
);
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, $attr:tt, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+}) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, $attr:tt, {$($(#[$enum_meta:meta])* $enum:ident => $enum_name:tt),+}) => (
|
||||||
$(#[$meta])*
|
$(#[$meta])*
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum $elem {
|
pub enum $elem {
|
||||||
|
|
@ -167,7 +167,7 @@ macro_rules! generate_attribute_enum {
|
||||||
impl From<$elem> for ::minidom::Element {
|
impl From<$elem> for ::minidom::Element {
|
||||||
fn from(elem: $elem) -> ::minidom::Element {
|
fn from(elem: $elem) -> ::minidom::Element {
|
||||||
::minidom::Element::builder($name)
|
::minidom::Element::builder($name)
|
||||||
.ns($ns)
|
.ns(::ns::$ns)
|
||||||
.attr($attr, match elem {
|
.attr($attr, match elem {
|
||||||
$($elem::$enum => $enum_name,)+
|
$($elem::$enum => $enum_name,)+
|
||||||
})
|
})
|
||||||
|
|
@ -178,19 +178,19 @@ macro_rules! generate_attribute_enum {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! check_self {
|
macro_rules! check_self {
|
||||||
($elem:ident, $name:tt, $ns:expr) => (
|
($elem:ident, $name:tt, $ns:ident) => (
|
||||||
check_self!($elem, $name, $ns, $name);
|
check_self!($elem, $name, $ns, $name);
|
||||||
);
|
);
|
||||||
($elem:ident, $name:tt, $ns:expr, $pretty_name:tt) => (
|
($elem:ident, $name:tt, $ns:ident, $pretty_name:tt) => (
|
||||||
if !$elem.is($name, $ns) {
|
if !$elem.is($name, ::ns::$ns) {
|
||||||
return Err(::error::Error::ParseError(concat!("This is not a ", $pretty_name, " element.")));
|
return Err(::error::Error::ParseError(concat!("This is not a ", $pretty_name, " element.")));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! check_ns_only {
|
macro_rules! check_ns_only {
|
||||||
($elem:ident, $name:tt, $ns:expr) => (
|
($elem:ident, $name:tt, $ns:ident) => (
|
||||||
if !$elem.has_ns($ns) {
|
if !$elem.has_ns(::ns::$ns) {
|
||||||
return Err(::error::Error::ParseError(concat!("This is not a ", $name, " element.")));
|
return Err(::error::Error::ParseError(concat!("This is not a ", $name, " element.")));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -226,7 +226,7 @@ macro_rules! check_no_unknown_attributes {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_empty_element {
|
macro_rules! generate_empty_element {
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident) => (
|
||||||
$(#[$meta])*
|
$(#[$meta])*
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct $elem;
|
pub struct $elem;
|
||||||
|
|
@ -245,7 +245,7 @@ macro_rules! generate_empty_element {
|
||||||
impl From<$elem> for ::minidom::Element {
|
impl From<$elem> for ::minidom::Element {
|
||||||
fn from(_: $elem) -> ::minidom::Element {
|
fn from(_: $elem) -> ::minidom::Element {
|
||||||
::minidom::Element::builder($name)
|
::minidom::Element::builder($name)
|
||||||
.ns($ns)
|
.ns(::ns::$ns)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -253,10 +253,10 @@ macro_rules! generate_empty_element {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_element_with_only_attributes {
|
macro_rules! generate_element_with_only_attributes {
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),+,]) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),+,]) => (
|
||||||
generate_element_with_only_attributes!($(#[$meta])* $elem, $name, $ns, [$($(#[$attr_meta])* $attr: $attr_type = $attr_name => $attr_action),*]);
|
generate_element_with_only_attributes!($(#[$meta])* $elem, $name, $ns, [$($(#[$attr_meta])* $attr: $attr_type = $attr_name => $attr_action),*]);
|
||||||
);
|
);
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),+]) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),+]) => (
|
||||||
$(#[$meta])*
|
$(#[$meta])*
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct $elem {
|
pub struct $elem {
|
||||||
|
|
@ -284,7 +284,7 @@ macro_rules! generate_element_with_only_attributes {
|
||||||
impl From<$elem> for ::minidom::Element {
|
impl From<$elem> for ::minidom::Element {
|
||||||
fn from(elem: $elem) -> ::minidom::Element {
|
fn from(elem: $elem) -> ::minidom::Element {
|
||||||
::minidom::Element::builder($name)
|
::minidom::Element::builder($name)
|
||||||
.ns($ns)
|
.ns(::ns::$ns)
|
||||||
$(
|
$(
|
||||||
.attr($attr_name, elem.$attr)
|
.attr($attr_name, elem.$attr)
|
||||||
)*
|
)*
|
||||||
|
|
@ -314,7 +314,7 @@ macro_rules! generate_id {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_elem_id {
|
macro_rules! generate_elem_id {
|
||||||
($elem:ident, $name:tt, $ns:expr) => (
|
($elem:ident, $name:tt, $ns:ident) => (
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct $elem(pub String);
|
pub struct $elem(pub String);
|
||||||
impl ::std::str::FromStr for $elem {
|
impl ::std::str::FromStr for $elem {
|
||||||
|
|
@ -337,7 +337,7 @@ macro_rules! generate_elem_id {
|
||||||
impl From<$elem> for ::minidom::Element {
|
impl From<$elem> for ::minidom::Element {
|
||||||
fn from(elem: $elem) -> ::minidom::Element {
|
fn from(elem: $elem) -> ::minidom::Element {
|
||||||
::minidom::Element::builder($name)
|
::minidom::Element::builder($name)
|
||||||
.ns($ns)
|
.ns(::ns::$ns)
|
||||||
.append(elem.0)
|
.append(elem.0)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
@ -346,10 +346,10 @@ macro_rules! generate_elem_id {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_element_with_text {
|
macro_rules! generate_element_with_text {
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, $text_ident:ident: $codec:ident < $text_type:ty >) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, $text_ident:ident: $codec:ident < $text_type:ty >) => (
|
||||||
generate_element_with_text!($(#[$meta])* $elem, $name, $ns, [], $text_ident: $codec<$text_type>);
|
generate_element_with_text!($(#[$meta])* $elem, $name, $ns, [], $text_ident: $codec<$text_type>);
|
||||||
);
|
);
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),*], $text_ident:ident: $codec:ident < $text_type:ty >) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),*], $text_ident:ident: $codec:ident < $text_type:ty >) => (
|
||||||
$(#[$meta])*
|
$(#[$meta])*
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct $elem {
|
pub struct $elem {
|
||||||
|
|
@ -379,7 +379,7 @@ macro_rules! generate_element_with_text {
|
||||||
impl From<$elem> for ::minidom::Element {
|
impl From<$elem> for ::minidom::Element {
|
||||||
fn from(elem: $elem) -> ::minidom::Element {
|
fn from(elem: $elem) -> ::minidom::Element {
|
||||||
::minidom::Element::builder($name)
|
::minidom::Element::builder($name)
|
||||||
.ns($ns)
|
.ns(::ns::$ns)
|
||||||
$(
|
$(
|
||||||
.attr($attr_name, elem.$attr)
|
.attr($attr_name, elem.$attr)
|
||||||
)*
|
)*
|
||||||
|
|
@ -391,7 +391,7 @@ macro_rules! generate_element_with_text {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_element_with_children {
|
macro_rules! generate_element_with_children {
|
||||||
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:expr, attributes: [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),+], children: [$($(#[$child_meta:meta])* $child_ident:ident: Vec<$child_type:ty> = ($child_name:tt, $child_ns:expr) => $child_constructor:ident),+]) => (
|
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, attributes: [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),+], children: [$($(#[$child_meta:meta])* $child_ident:ident: Vec<$child_type:ty> = ($child_name:tt, $child_ns:ident) => $child_constructor:ident),+]) => (
|
||||||
$(#[$meta])*
|
$(#[$meta])*
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct $elem {
|
pub struct $elem {
|
||||||
|
|
@ -414,7 +414,7 @@ macro_rules! generate_element_with_children {
|
||||||
let mut parsed_children = vec!();
|
let mut parsed_children = vec!();
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
$(
|
$(
|
||||||
if child.is($child_name, $child_ns) {
|
if child.is($child_name, ::ns::$child_ns) {
|
||||||
let parsed_child = $child_constructor::try_from(child.clone())?;
|
let parsed_child = $child_constructor::try_from(child.clone())?;
|
||||||
parsed_children.push(parsed_child);
|
parsed_children.push(parsed_child);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -436,7 +436,7 @@ macro_rules! generate_element_with_children {
|
||||||
impl From<$elem> for ::minidom::Element {
|
impl From<$elem> for ::minidom::Element {
|
||||||
fn from(elem: $elem) -> ::minidom::Element {
|
fn from(elem: $elem) -> ::minidom::Element {
|
||||||
::minidom::Element::builder($name)
|
::minidom::Element::builder($name)
|
||||||
.ns($ns)
|
.ns(::ns::$ns)
|
||||||
$(
|
$(
|
||||||
.attr($attr_name, elem.$attr)
|
.attr($attr_name, elem.$attr)
|
||||||
)*
|
)*
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ impl TryFrom<Element> for Query {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Query, Error> {
|
fn try_from(elem: Element) -> Result<Query, Error> {
|
||||||
check_self!(elem, "query", ns::MAM);
|
check_self!(elem, "query", MAM);
|
||||||
check_no_unknown_attributes!(elem, "query", ["queryid", "node"]);
|
check_no_unknown_attributes!(elem, "query", ["queryid", "node"]);
|
||||||
let mut form = None;
|
let mut form = None;
|
||||||
let mut set = None;
|
let mut set = None;
|
||||||
|
|
@ -78,7 +78,7 @@ impl TryFrom<Element> for Result_ {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Result_, Error> {
|
fn try_from(elem: Element) -> Result<Result_, Error> {
|
||||||
check_self!(elem, "result", ns::MAM);
|
check_self!(elem, "result", MAM);
|
||||||
check_no_unknown_attributes!(elem, "result", ["queryid", "id"]);
|
check_no_unknown_attributes!(elem, "result", ["queryid", "id"]);
|
||||||
let mut forwarded = None;
|
let mut forwarded = None;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
@ -103,7 +103,7 @@ impl TryFrom<Element> for Fin {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Fin, Error> {
|
fn try_from(elem: Element) -> Result<Fin, Error> {
|
||||||
check_self!(elem, "fin", ns::MAM);
|
check_self!(elem, "fin", MAM);
|
||||||
check_no_unknown_attributes!(elem, "fin", ["complete"]);
|
check_no_unknown_attributes!(elem, "fin", ["complete"]);
|
||||||
let mut set = None;
|
let mut set = None;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
|
|
@ -128,7 +128,7 @@ impl TryFrom<Element> for Prefs {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Prefs, Error> {
|
fn try_from(elem: Element) -> Result<Prefs, Error> {
|
||||||
check_self!(elem, "prefs", ns::MAM);
|
check_self!(elem, "prefs", MAM);
|
||||||
check_no_unknown_attributes!(elem, "prefs", ["default"]);
|
check_no_unknown_attributes!(elem, "prefs", ["default"]);
|
||||||
let mut always = vec!();
|
let mut always = vec!();
|
||||||
let mut never = vec!();
|
let mut never = vec!();
|
||||||
|
|
|
||||||
|
|
@ -4,23 +4,22 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
|
||||||
use helpers::TrimmedPlainText;
|
use helpers::TrimmedPlainText;
|
||||||
|
|
||||||
generate_element_with_text!(URI, "uri", ns::MEDIA_ELEMENT,
|
generate_element_with_text!(URI, "uri", MEDIA_ELEMENT,
|
||||||
[
|
[
|
||||||
type_: String = "type" => required
|
type_: String = "type" => required
|
||||||
],
|
],
|
||||||
uri: TrimmedPlainText<String>
|
uri: TrimmedPlainText<String>
|
||||||
);
|
);
|
||||||
|
|
||||||
generate_element_with_children!(MediaElement, "media", ns::MEDIA_ELEMENT,
|
generate_element_with_children!(MediaElement, "media", MEDIA_ELEMENT,
|
||||||
attributes: [
|
attributes: [
|
||||||
width: Option<usize> = "width" => optional,
|
width: Option<usize> = "width" => optional,
|
||||||
height: Option<usize> = "height" => optional
|
height: Option<usize> = "height" => optional
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
uris: Vec<URI> = ("uri", ns::MEDIA_ELEMENT) => URI
|
uris: Vec<URI> = ("uri", MEDIA_ELEMENT) => URI
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,9 @@ generate_attribute!(MessageType, "type", {
|
||||||
|
|
||||||
type Lang = String;
|
type Lang = String;
|
||||||
|
|
||||||
generate_elem_id!(Body, "body", ns::DEFAULT_NS);
|
generate_elem_id!(Body, "body", DEFAULT_NS);
|
||||||
generate_elem_id!(Subject, "subject", ns::DEFAULT_NS);
|
generate_elem_id!(Subject, "subject", DEFAULT_NS);
|
||||||
generate_elem_id!(Thread, "thread", ns::DEFAULT_NS);
|
generate_elem_id!(Thread, "thread", DEFAULT_NS);
|
||||||
|
|
||||||
/// The main structure representing the `<message/>` stanza.
|
/// The main structure representing the `<message/>` stanza.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
@ -188,7 +188,7 @@ impl TryFrom<Element> for Message {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(root: Element) -> Result<Message, Error> {
|
fn try_from(root: Element) -> Result<Message, Error> {
|
||||||
check_self!(root, "message", ns::DEFAULT_NS);
|
check_self!(root, "message", DEFAULT_NS);
|
||||||
let from = get_attr!(root, "from", optional);
|
let from = get_attr!(root, "from", optional);
|
||||||
let to = get_attr!(root, "to", optional);
|
let to = get_attr!(root, "to", optional);
|
||||||
let id = get_attr!(root, "id", optional);
|
let id = get_attr!(root, "id", optional);
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
generate_element_with_only_attributes!(Replace, "replace", MESSAGE_CORRECT, [
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Replace, "replace", ns::MESSAGE_CORRECT, [
|
|
||||||
id: String = "id" => required,
|
id: String = "id" => required,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,9 @@
|
||||||
|
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use ns;
|
|
||||||
|
|
||||||
generate_element_enum!(
|
generate_element_enum!(
|
||||||
/// Enum representing all of the possible values of the XEP-0107 moods.
|
/// Enum representing all of the possible values of the XEP-0107 moods.
|
||||||
MoodEnum, "mood", ns::MOOD, {
|
MoodEnum, "mood", MOOD, {
|
||||||
/// Impressed with fear or apprehension; in fear; apprehensive.
|
/// Impressed with fear or apprehension; in fear; apprehensive.
|
||||||
Afraid => "afraid",
|
Afraid => "afraid",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ impl TryFrom<Element> for Muc {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Muc, Error> {
|
fn try_from(elem: Element) -> Result<Muc, Error> {
|
||||||
check_self!(elem, "x", ns::MUC);
|
check_self!(elem, "x", MUC);
|
||||||
check_no_attributes!(elem, "x");
|
check_no_attributes!(elem, "x");
|
||||||
|
|
||||||
let mut password = None;
|
let mut password = None;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use ns;
|
||||||
|
|
||||||
generate_attribute_enum!(
|
generate_attribute_enum!(
|
||||||
/// Lists all of the possible status codes used in MUC presences.
|
/// Lists all of the possible status codes used in MUC presences.
|
||||||
Status, "status", ns::MUC_USER, "code", {
|
Status, "status", MUC_USER, "code", {
|
||||||
/// Inform user that any occupant is allowed to see the user's full JID
|
/// Inform user that any occupant is allowed to see the user's full JID
|
||||||
NonAnonymousRoom => 100,
|
NonAnonymousRoom => 100,
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ impl TryFrom<Element> for Actor {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Actor, Error> {
|
fn try_from(elem: Element) -> Result<Actor, Error> {
|
||||||
check_self!(elem, "actor", ns::MUC_USER);
|
check_self!(elem, "actor", MUC_USER);
|
||||||
check_no_unknown_attributes!(elem, "actor", ["jid", "nick"]);
|
check_no_unknown_attributes!(elem, "actor", ["jid", "nick"]);
|
||||||
for _ in elem.children() {
|
for _ in elem.children() {
|
||||||
return Err(Error::ParseError("Unknown child in actor element."));
|
return Err(Error::ParseError("Unknown child in actor element."));
|
||||||
|
|
@ -121,11 +121,11 @@ impl From<Actor> for Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Continue, "continue", ns::MUC_USER, [
|
generate_element_with_only_attributes!(Continue, "continue", MUC_USER, [
|
||||||
thread: Option<String> = "thread" => optional,
|
thread: Option<String> = "thread" => optional,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
generate_elem_id!(Reason, "reason", ns::MUC_USER);
|
generate_elem_id!(Reason, "reason", MUC_USER);
|
||||||
|
|
||||||
generate_attribute!(Affiliation, "affiliation", {
|
generate_attribute!(Affiliation, "affiliation", {
|
||||||
Owner => "owner",
|
Owner => "owner",
|
||||||
|
|
@ -157,7 +157,7 @@ impl TryFrom<Element> for Item {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Item, Error> {
|
fn try_from(elem: Element) -> Result<Item, Error> {
|
||||||
check_self!(elem, "item", ns::MUC_USER);
|
check_self!(elem, "item", MUC_USER);
|
||||||
check_no_unknown_attributes!(elem, "item", ["affiliation", "jid", "nick", "role"]);
|
check_no_unknown_attributes!(elem, "item", ["affiliation", "jid", "nick", "role"]);
|
||||||
let mut actor: Option<Actor> = None;
|
let mut actor: Option<Actor> = None;
|
||||||
let mut continue_: Option<Continue> = None;
|
let mut continue_: Option<Continue> = None;
|
||||||
|
|
@ -216,7 +216,7 @@ impl TryFrom<Element> for MucUser {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<MucUser, Error> {
|
fn try_from(elem: Element) -> Result<MucUser, Error> {
|
||||||
check_self!(elem, "x", ns::MUC_USER);
|
check_self!(elem, "x", MUC_USER);
|
||||||
check_no_attributes!(elem, "x");
|
check_no_attributes!(elem, "x");
|
||||||
let mut status = vec!();
|
let mut status = vec!();
|
||||||
let mut items = vec!();
|
let mut items = vec!();
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,7 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
generate_empty_element!(Ping, "ping", PING);
|
||||||
|
|
||||||
generate_empty_element!(Ping, "ping", ns::PING);
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ impl TryFrom<Element> for Presence {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(root: Element) -> Result<Presence, Error> {
|
fn try_from(root: Element) -> Result<Presence, Error> {
|
||||||
check_self!(root, "presence", ns::DEFAULT_NS);
|
check_self!(root, "presence", DEFAULT_NS);
|
||||||
let mut show = None;
|
let mut show = None;
|
||||||
let mut priority = None;
|
let mut priority = None;
|
||||||
let mut presence = Presence {
|
let mut presence = Presence {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ impl TryFrom<Element> for Item {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Item, Error> {
|
fn try_from(elem: Element) -> Result<Item, Error> {
|
||||||
check_self!(elem, "item", ns::PUBSUB_EVENT);
|
check_self!(elem, "item", PUBSUB_EVENT);
|
||||||
check_no_unknown_attributes!(elem, "item", ["id", "node", "publisher"]);
|
check_no_unknown_attributes!(elem, "item", ["id", "node", "publisher"]);
|
||||||
let mut payloads = elem.children().cloned().collect::<Vec<_>>();
|
let mut payloads = elem.children().cloned().collect::<Vec<_>>();
|
||||||
let payload = payloads.pop();
|
let payload = payloads.pop();
|
||||||
|
|
@ -141,7 +141,7 @@ impl TryFrom<Element> for PubSubEvent {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<PubSubEvent, Error> {
|
fn try_from(elem: Element) -> Result<PubSubEvent, Error> {
|
||||||
check_self!(elem, "event", ns::PUBSUB_EVENT);
|
check_self!(elem, "event", PUBSUB_EVENT);
|
||||||
check_no_attributes!(elem, "event");
|
check_no_attributes!(elem, "event");
|
||||||
|
|
||||||
let mut payload = None;
|
let mut payload = None;
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,9 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
generate_empty_element!(Request, "request", RECEIPTS);
|
||||||
|
|
||||||
generate_empty_element!(Request, "request", ns::RECEIPTS);
|
generate_element_with_only_attributes!(Received, "received", RECEIPTS, [
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Received, "received", ns::RECEIPTS, [
|
|
||||||
id: Option<String> = "id" => optional,
|
id: Option<String> = "id" => optional,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -17,6 +15,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use try_from::TryFrom;
|
use try_from::TryFrom;
|
||||||
use minidom::Element;
|
use minidom::Element;
|
||||||
|
use ns;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple() {
|
fn test_simple() {
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@
|
||||||
|
|
||||||
use jid::Jid;
|
use jid::Jid;
|
||||||
|
|
||||||
use ns;
|
generate_elem_id!(Group, "group", ROSTER);
|
||||||
|
|
||||||
generate_elem_id!(Group, "group", ns::ROSTER);
|
|
||||||
|
|
||||||
generate_attribute!(Subscription, "subscription", {
|
generate_attribute!(Subscription, "subscription", {
|
||||||
None => "none",
|
None => "none",
|
||||||
|
|
@ -21,7 +19,7 @@ generate_attribute!(Subscription, "subscription", {
|
||||||
generate_element_with_children!(
|
generate_element_with_children!(
|
||||||
/// Contact from the user’s contact list.
|
/// Contact from the user’s contact list.
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
Item, "item", ns::ROSTER,
|
Item, "item", ROSTER,
|
||||||
attributes: [
|
attributes: [
|
||||||
/// JID of this contact.
|
/// JID of this contact.
|
||||||
jid: Jid = "jid" => required,
|
jid: Jid = "jid" => required,
|
||||||
|
|
@ -35,13 +33,13 @@ generate_element_with_children!(
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
/// Groups this contact is part of.
|
/// Groups this contact is part of.
|
||||||
groups: Vec<Group> = ("group", ns::ROSTER) => Group
|
groups: Vec<Group> = ("group", ROSTER) => Group
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
generate_element_with_children!(
|
generate_element_with_children!(
|
||||||
/// The contact list of the user.
|
/// The contact list of the user.
|
||||||
Roster, "query", ns::ROSTER,
|
Roster, "query", ROSTER,
|
||||||
attributes: [
|
attributes: [
|
||||||
/// Version of the contact list.
|
/// Version of the contact list.
|
||||||
///
|
///
|
||||||
|
|
@ -52,7 +50,7 @@ generate_element_with_children!(
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
/// List of the contacts of the user.
|
/// List of the contacts of the user.
|
||||||
items: Vec<Item> = ("item", ns::ROSTER) => Item
|
items: Vec<Item> = ("item", ROSTER) => Item
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ impl TryFrom<Element> for Set {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Set, Error> {
|
fn try_from(elem: Element) -> Result<Set, Error> {
|
||||||
check_self!(elem, "set", ns::RSM, "RSM set");
|
check_self!(elem, "set", RSM, "RSM set");
|
||||||
let mut set = Set {
|
let mut set = Set {
|
||||||
after: None,
|
after: None,
|
||||||
before: None,
|
before: None,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
// 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/.
|
||||||
|
|
||||||
use ns;
|
|
||||||
use helpers::Base64;
|
use helpers::Base64;
|
||||||
|
|
||||||
generate_attribute!(Mechanism, "mechanism", {
|
generate_attribute!(Mechanism, "mechanism", {
|
||||||
|
|
@ -13,22 +12,22 @@ generate_attribute!(Mechanism, "mechanism", {
|
||||||
Anonymous => "ANONYMOUS",
|
Anonymous => "ANONYMOUS",
|
||||||
});
|
});
|
||||||
|
|
||||||
generate_element_with_text!(Auth, "auth", ns::SASL,
|
generate_element_with_text!(Auth, "auth", SASL,
|
||||||
[
|
[
|
||||||
mechanism: Mechanism = "mechanism" => required
|
mechanism: Mechanism = "mechanism" => required
|
||||||
],
|
],
|
||||||
data: Base64<Vec<u8>>
|
data: Base64<Vec<u8>>
|
||||||
);
|
);
|
||||||
|
|
||||||
generate_element_with_text!(Challenge, "challenge", ns::SASL,
|
generate_element_with_text!(Challenge, "challenge", SASL,
|
||||||
data: Base64<Vec<u8>>
|
data: Base64<Vec<u8>>
|
||||||
);
|
);
|
||||||
|
|
||||||
generate_element_with_text!(Response, "response", ns::SASL,
|
generate_element_with_text!(Response, "response", SASL,
|
||||||
data: Base64<Vec<u8>>
|
data: Base64<Vec<u8>>
|
||||||
);
|
);
|
||||||
|
|
||||||
generate_element_with_text!(Success, "success", ns::SASL,
|
generate_element_with_text!(Success, "success", SASL,
|
||||||
data: Base64<Vec<u8>>
|
data: Base64<Vec<u8>>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ generate_attribute!(ErrorType, "type", {
|
||||||
Wait => "wait",
|
Wait => "wait",
|
||||||
});
|
});
|
||||||
|
|
||||||
generate_element_enum!(DefinedCondition, "condition", ns::XMPP_STANZAS, {
|
generate_element_enum!(DefinedCondition, "condition", XMPP_STANZAS, {
|
||||||
BadRequest => "bad-request",
|
BadRequest => "bad-request",
|
||||||
Conflict => "conflict",
|
Conflict => "conflict",
|
||||||
FeatureNotImplemented => "feature-not-implemented",
|
FeatureNotImplemented => "feature-not-implemented",
|
||||||
|
|
@ -61,7 +61,7 @@ impl TryFrom<Element> for StanzaError {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<StanzaError, Error> {
|
fn try_from(elem: Element) -> Result<StanzaError, Error> {
|
||||||
check_self!(elem, "error", ns::DEFAULT_NS);
|
check_self!(elem, "error", DEFAULT_NS);
|
||||||
|
|
||||||
let type_ = get_attr!(elem, "type", required);
|
let type_ = get_attr!(elem, "type", required);
|
||||||
let by = get_attr!(elem, "by", optional);
|
let by = get_attr!(elem, "by", optional);
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,12 @@
|
||||||
|
|
||||||
use jid::Jid;
|
use jid::Jid;
|
||||||
|
|
||||||
use ns;
|
generate_element_with_only_attributes!(StanzaId, "stanza-id", SID, [
|
||||||
|
|
||||||
generate_element_with_only_attributes!(StanzaId, "stanza-id", ns::SID, [
|
|
||||||
id: String = "id" => required,
|
id: String = "id" => required,
|
||||||
by: Jid = "by" => required,
|
by: Jid = "by" => required,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
generate_element_with_only_attributes!(OriginId, "origin-id", ns::SID, [
|
generate_element_with_only_attributes!(OriginId, "origin-id", SID, [
|
||||||
id: String = "id" => required,
|
id: String = "id" => required,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use jid::Jid;
|
use jid::Jid;
|
||||||
use ns;
|
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Stream, "stream", ns::STREAM, [
|
generate_element_with_only_attributes!(Stream, "stream", STREAM, [
|
||||||
from: Option<Jid> = "from" => optional,
|
from: Option<Jid> = "from" => optional,
|
||||||
to: Option<Jid> = "to" => optional,
|
to: Option<Jid> = "to" => optional,
|
||||||
id: Option<String> = "id" => optional,
|
id: Option<String> = "id" => optional,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ impl TryFrom<Element> for Version {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn try_from(elem: Element) -> Result<Version, Error> {
|
fn try_from(elem: Element) -> Result<Version, Error> {
|
||||||
check_self!(elem, "query", ns::VERSION, "version");
|
check_self!(elem, "query", VERSION, "version");
|
||||||
check_no_attributes!(elem, "version");
|
check_no_attributes!(elem, "version");
|
||||||
let mut name = None;
|
let mut name = None;
|
||||||
let mut version = None;
|
let mut version = None;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use jid::Jid;
|
use jid::Jid;
|
||||||
use ns;
|
|
||||||
|
|
||||||
generate_element_with_only_attributes!(Open, "open", ns::WEBSOCKET, [
|
generate_element_with_only_attributes!(Open, "open", WEBSOCKET, [
|
||||||
from: Option<Jid> = "from" => optional,
|
from: Option<Jid> = "from" => optional,
|
||||||
to: Option<Jid> = "to" => optional,
|
to: Option<Jid> = "to" => optional,
|
||||||
id: Option<String> = "id" => optional,
|
id: Option<String> = "id" => optional,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue