diff --git a/src/jingle.rs b/src/jingle.rs index 9cea6cf8..c8a2dfc0 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -52,6 +52,28 @@ impl FromStr for Action { } } +impl From 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 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 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,