aboutsummaryrefslogblamecommitdiffstats
path: root/stanza/src/xep_0199.rs
blob: 17e9fd484eaf5b572d15bbafffa6b5d73a9e13b1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12



                                                      
                                                 






                                        
                                                                                    









                                        
                                                  


                                             
// SPDX-FileCopyrightText: 2025 cel <cel@bunny.garden>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

use peanuts::{Element, FromElement, IntoElement};

pub const XMLNS: &str = "urn:xmpp:ping";

#[derive(Clone, Copy, Debug)]
pub struct Ping;

impl FromElement for Ping {
    fn from_element(element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
        element.check_name("ping")?;
        element.check_namespace(XMLNS)?;

        element.no_more_content()?;

        Ok(Ping)
    }
}

impl IntoElement for Ping {
    fn builder(&self) -> peanuts::ElementBuilder {
        Element::builder("ping", Some(XMLNS))
    }
}