mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
jingle: Implement From for String on all special attributes.
This commit is contained in:
parent
90f1792ebc
commit
fa10ab4ebc
1 changed files with 42 additions and 0 deletions
|
@ -52,6 +52,28 @@ impl FromStr for Action {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Action> for String {
|
||||
fn from(action: Action) -> String {
|
||||
String::from(match action {
|
||||
Action::ContentAccept => "content-accept",
|
||||
Action::ContentAdd => "content-add",
|
||||
Action::ContentModify => "content-modify",
|
||||
Action::ContentReject => "content-reject",
|
||||
Action::ContentRemove => "content-remove",
|
||||
Action::DescriptionInfo => "description-info",
|
||||
Action::SecurityInfo => "security-info",
|
||||
Action::SessionAccept => "session-accept",
|
||||
Action::SessionInfo => "session-info",
|
||||
Action::SessionInitiate => "session-initiate",
|
||||
Action::SessionTerminate => "session-terminate",
|
||||
Action::TransportAccept => "transport-accept",
|
||||
Action::TransportInfo => "transport-info",
|
||||
Action::TransportReject => "transport-reject",
|
||||
Action::TransportReplace => "transport-replace",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use a real JID type.
|
||||
type Jid = String;
|
||||
|
||||
|
@ -74,6 +96,15 @@ impl FromStr for Creator {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Creator> for String {
|
||||
fn from(creator: Creator) -> String {
|
||||
String::from(match creator {
|
||||
Creator::Initiator => "initiator",
|
||||
Creator::Responder => "responder",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Senders {
|
||||
Both,
|
||||
|
@ -97,6 +128,17 @@ impl FromStr for Senders {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Senders> for String {
|
||||
fn from(senders: Senders) -> String {
|
||||
String::from(match senders {
|
||||
Senders::Both => "both",
|
||||
Senders::Initiator => "initiator",
|
||||
Senders::None_ => "none",
|
||||
Senders::Responder => "responder",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Content {
|
||||
pub creator: Creator,
|
||||
|
|
Loading…
Reference in a new issue