mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
ecaps2: Implement serialise.
This commit is contained in:
parent
20949c2832
commit
429abb996d
1 changed files with 12 additions and 0 deletions
|
@ -4,6 +4,7 @@ extern crate blake2;
|
|||
|
||||
use disco::{Feature, Identity, Disco};
|
||||
use data_forms::DataForm;
|
||||
use hashes;
|
||||
use hashes::{Hash, parse_hash};
|
||||
|
||||
use minidom::Element;
|
||||
|
@ -38,6 +39,17 @@ pub fn parse_ecaps2(root: &Element) -> Result<ECaps2, Error> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn serialise(ecaps2: &ECaps2) -> Element {
|
||||
let mut c = Element::builder("c")
|
||||
.ns(ns::ECAPS2)
|
||||
.build();
|
||||
for hash in ecaps2.hashes.clone() {
|
||||
let hash_elem = hashes::serialise(&hash);
|
||||
c.append_child(hash_elem);
|
||||
}
|
||||
c
|
||||
}
|
||||
|
||||
fn compute_item(field: &str) -> Vec<u8> {
|
||||
let mut bytes = field.as_bytes().to_vec();
|
||||
bytes.push(0x1f);
|
||||
|
|
Loading…
Reference in a new issue