Make all fields public.

This commit is contained in:
Jimmy Cuadra 2016-06-04 02:57:24 -07:00
parent fd03a1e162
commit d525766c99
24 changed files with 184 additions and 184 deletions

View File

@ -5,19 +5,19 @@ use super::SessionDescription;
/// This event is sent by the callee when they wish to answer the call.
pub struct AnswerEvent {
content: AnswerEventContent,
event_id: String,
event_type: EventType,
room_id: String,
user_id: String,
pub content: AnswerEventContent,
pub event_id: String,
pub event_type: EventType,
pub room_id: String,
pub user_id: String,
}
/// The payload of an `AnswerEvent`.
pub struct AnswerEventContent {
/// The VoIP session description.
answer: SessionDescription,
pub answer: SessionDescription,
/// The ID of the call this event relates to.
call_id: String,
pub call_id: String,
/// The version of the VoIP specification this messages adheres to.
version: u64,
pub version: u64,
}

View File

@ -5,29 +5,29 @@ use core::EventType;
/// This event is sent by callers after sending an invite and by the callee after answering.
/// Its purpose is to give the other party additional ICE candidates to try using to communicate.
pub struct CandidatesEvent {
content: CandidatesEventContent,
event_id: String,
event_type: EventType,
room_id: String,
user_id: String,
pub content: CandidatesEventContent,
pub event_id: String,
pub event_type: EventType,
pub room_id: String,
pub user_id: String,
}
/// The payload of a `CandidatesEvent`.
pub struct CandidatesEventContent {
/// The ID of the call this event relates to.
call_id: String,
pub call_id: String,
/// A list of candidates.
candidates: Vec<Candidate>,
pub candidates: Vec<Candidate>,
/// The version of the VoIP specification this messages adheres to.
version: u64,
pub version: u64,
}
/// An ICE (Interactive Connectivity Establishment) candidate.
pub struct Candidate {
/// The SDP "a" line of the candidate.
candidate: String,
pub candidate: String,
/// The SDP media type this candidate is intended for.
sdp_mid: String,
pub sdp_mid: String,
/// The index of the SDP "m" line this candidate is intended for.
sdp_m_line_index: u64,
pub sdp_m_line_index: u64,
}

View File

@ -5,17 +5,17 @@ use core::EventType;
/// Sent by either party to signal their termination of the call. This can be sent either once the
/// call has has been established or before to abort the call.
pub struct HangupEvent {
content: HangupEventContent,
event_id: String,
event_type: EventType,
room_id: String,
user_id: String,
pub content: HangupEventContent,
pub event_id: String,
pub event_type: EventType,
pub room_id: String,
pub user_id: String,
}
/// The payload of a `HangupEvent`.
pub struct HangupEventContent {
/// The ID of the call this event relates to.
call_id: String,
pub call_id: String,
/// The version of the VoIP specification this messages adheres to.
version: u64,
pub version: u64,
}

View File

@ -5,23 +5,23 @@ use super::SessionDescription;
/// This event is sent by the caller when they wish to establish a call.
pub struct InviteEvent {
content: InviteEventContent,
event_id: String,
event_type: EventType,
room_id: String,
user_id: String,
pub content: InviteEventContent,
pub event_id: String,
pub event_type: EventType,
pub room_id: String,
pub user_id: String,
}
/// The payload of an `InviteEvent`.
pub struct InviteEventContent {
/// A unique identifer for the call.
call_id: String,
pub call_id: String,
/// The time in milliseconds that the invite is valid for. Once the invite age exceeds this
/// value, clients should discard it. They should also no longer show the call as awaiting an
/// answer in the UI.
lifetime: u64,
pub lifetime: u64,
/// The session description object.
offer: SessionDescription,
pub offer: SessionDescription,
/// The version of the VoIP specification this messages adheres to.
version: u64,
pub version: u64,
}

View File

@ -10,9 +10,9 @@ pub mod invite;
/// A VoIP session description.
pub struct SessionDescription {
/// The type of session description.
session_type: SessionDescriptionType,
pub session_type: SessionDescriptionType,
/// The SDP text of the session description.
sdp: String,
pub sdp: String,
}
/// The type of VoIP session description.

View File

@ -42,9 +42,9 @@ pub enum StrippedState {
/// The general form of a `StrippedState`.
pub struct StrippedStateContent<T> {
content: T,
event_type: EventType,
state_key: String,
pub content: T,
pub event_type: EventType,
pub state_key: String,
}
pub type StrippedRoomAvatar = StrippedStateContent<AvatarEventContent>;

View File

@ -4,21 +4,21 @@ use core::EventType;
/// Informs the client of a user's presence state change.
pub struct PresenceEvent {
content: PresenceEventContent,
event_id: String,
event_type: EventType,
pub content: PresenceEventContent,
pub event_id: String,
pub event_type: EventType,
}
/// The payload of a `PresenceEvent`.
pub struct PresenceEventContent {
/// The current avatar URL for this user.
avatar_url: Option<String>,
pub avatar_url: Option<String>,
/// The current display name for this user.
displayname: Option<String>,
pub displayname: Option<String>,
/// The last time since this used performed some action, in milliseconds.
last_active_ago: Option<u64>,
pub last_active_ago: Option<u64>,
/// The presence state for this user.
presence: PresenceState,
pub presence: PresenceState,
}
/// A description of a user's connectivity and availability for chat.

View File

@ -6,9 +6,9 @@ use core::EventType;
/// Informs the client of new receipts.
pub struct ReceiptEvent {
content: ReceiptEventContent,
event_type: EventType,
room_id: String,
pub content: ReceiptEventContent,
pub event_type: EventType,
pub room_id: String,
}
/// The payload of a `ReceiptEvent`.
@ -20,7 +20,7 @@ pub type ReceiptEventContent = HashMap<String, Receipts>;
/// A collection of receipts.
pub struct Receipts {
/// A collection of users who have sent *m.read* receipts for this event.
m_read: UserReceipts,
pub m_read: UserReceipts,
}
/// A mapping of user ID to receipt.
@ -31,5 +31,5 @@ pub type UserReceipts = HashMap<String, Receipt>;
/// An acknowledgement of an event.
pub struct Receipt {
/// The timestamp the receipt was sent at.
ts: u64,
pub ts: u64,
}

View File

@ -4,18 +4,18 @@ use core::EventType;
/// Informs the room about what room aliases it has been given.
pub struct AliasesEvent {
content: AliasesEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<AliasesEventContent>,
room_id: String,
pub content: AliasesEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<AliasesEventContent>,
pub room_id: String,
/// The homeserver domain which owns these room aliases.
state_key: String,
user_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of an `AliasesEvent`.
pub struct AliasesEventContent {
/// A list of room aliases.
aliases: Vec<String>,
pub aliases: Vec<String>,
}

View File

@ -7,19 +7,19 @@ use super::ImageInfo;
///
/// This can be displayed alongside the room information.
pub struct AvatarEvent {
content: AvatarEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<AvatarEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: AvatarEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<AvatarEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of an `AvatarEvent`.
pub struct AvatarEventContent {
info: ImageInfo,
thumbnail_info: ImageInfo,
thumbnail_url: String,
url: String,
pub info: ImageInfo,
pub thumbnail_info: ImageInfo,
pub thumbnail_url: String,
pub url: String,
}

View File

@ -4,17 +4,17 @@ use core::EventType;
/// Informs the room as to which alias is the canonical one.
pub struct CanonicalAliasEvent {
content: CanonicalAliasEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<CanonicalAliasEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: CanonicalAliasEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<CanonicalAliasEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `CanonicalAliasEvent`.
pub struct CanonicalAliasEventContent {
/// The canonical alias.
alias: String,
pub alias: String,
}

View File

@ -5,17 +5,17 @@ use core::EventType;
/// This is the first event in a room and cannot be changed. It acts as the root of all other
/// events.
pub struct CreateEvent {
content: CreateEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<CreateEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: CreateEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<CreateEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `CreateEvent`.
pub struct CreateEventContent {
/// The `user_id` of the room creator. This is set by the homeserver.
creator: String,
pub creator: String,
}

View File

@ -7,18 +7,18 @@ use core::EventType;
/// This event controls whether guest users are allowed to join rooms. If this event is absent,
/// servers should act as if it is present and has the value `GuestAccess::Forbidden`.
pub struct GuestAccessEvent {
content: GuestAccessEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<GuestAccessEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: GuestAccessEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<GuestAccessEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `GuestAccessEvent`.
pub struct GuestAccessEventContent {
guest_access: GuestAccess,
pub guest_access: GuestAccess,
}
/// A policy for guest user access to a room.

View File

@ -5,19 +5,19 @@ use core::EventType;
/// This event controls whether a member of a room can see the events that happened in a room from
/// before they joined.
pub struct HistoryVisibilityEvent {
content: HistoryVisibilityEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<HistoryVisibilityEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: HistoryVisibilityEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<HistoryVisibilityEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `HistoryVisibilityEvent`.
pub struct HistoryVisibilityEventContent {
/// Who can see the room history.
history_visibility: HistoryVisibility,
pub history_visibility: HistoryVisibility,
}
/// Who can see a room's history.

View File

@ -4,19 +4,19 @@ use core::EventType;
/// Describes how users are allowed to join the room.
pub struct JoinRulesEvent {
content: JoinRulesEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<JoinRulesEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: JoinRulesEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<JoinRulesEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `JoinRulesEvent`.
pub struct JoinRulesEventContent {
/// The type of rules used for users wishing to join this room.
join_rule: JoinRule,
pub join_rule: JoinRule,
}
/// The rule used for users wishing to join this room.

View File

@ -1,7 +1,5 @@
//! Types for the *m.room.member* event.
use std::collections::HashMap;
use core::{EventType, StrippedState};
/// The current membership state of a user in the room.
@ -18,22 +16,23 @@ use core::{EventType, StrippedState};
/// this contains an array of `StrippedState` events. These events provide information on a few
/// select state events such as the room name.
pub struct MemberEvent {
content: MemberEventContent,
event_id: String,
event_type: EventType,
invite_room_state: Option<Vec<StrippedState>>,
prev_content: Option<MemberEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: MemberEventContent,
pub event_id: String,
pub event_type: EventType,
pub invite_room_state: Option<Vec<StrippedState>>,
pub prev_content: Option<MemberEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `MemberEvent`.
pub struct MemberEventContent {
avatar_url: Option<String>,
displayname: Option<String>,
membership: MembershipState,
third_party_invite: (), // TODO
pub avatar_url: Option<String>,
pub displayname: Option<String>,
pub membership: MembershipState,
/// Warning: This field is not implemented yet and its type will change!
pub third_party_invite: (), // TODO
}
/// The membership state of a user.

View File

@ -19,8 +19,8 @@ pub mod topic;
/// Metadata about an image.
pub struct ImageInfo {
height: u64,
mimetype: String,
size: u64,
width: u64,
pub height: u64,
pub mimetype: String,
pub size: u64,
pub width: u64,
}

View File

@ -4,17 +4,17 @@ use core::EventType;
/// A human-friendly room name designed to be displayed to the end-user.
pub struct NameEvent {
content: NameEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<NameEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: NameEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<NameEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `NameEvent`.
pub struct NameEventContent {
/// The name of the room. This MUST NOT exceed 255 bytes.
name: String,
pub name: String,
}

View File

@ -6,23 +6,23 @@ use core::EventType;
/// Defines the power levels (privileges) of users in the room.
pub struct PowerLevelsEvent {
content: PowerLevelsEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<PowerLevelsEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: PowerLevelsEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<PowerLevelsEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `PowerLevelsEvent`.
pub struct PowerLevelsEventContent {
ban: u64,
events: HashMap<String, u64>,
events_default: u64,
kick: u64,
redact: u64,
state_default: u64,
users: HashMap<String, u64>,
users_default: u64,
pub ban: u64,
pub events: HashMap<String, u64>,
pub events_default: u64,
pub kick: u64,
pub redact: u64,
pub state_default: u64,
pub users: HashMap<String, u64>,
pub users_default: u64,
}

View File

@ -4,17 +4,17 @@ use core::EventType;
/// A redaction of an event.
pub struct RedactionEvent {
content: RedactionEventContent,
event_id: String,
event_type: EventType,
pub content: RedactionEventContent,
pub event_id: String,
pub event_type: EventType,
/// The ID of the event that was redacted.
redacts: String,
room_id: String,
user_id: String,
pub redacts: String,
pub room_id: String,
pub user_id: String,
}
/// The payload of a `RedactionEvent`.
pub struct RedactionEventContent {
/// The reason for the redaction, if any.
reason: Option<String>,
pub reason: Option<String>,
}

View File

@ -8,18 +8,18 @@ use core::EventType;
/// event contains a token and a public key whose private key must be used to sign the token. Any
/// user who can present that signature may use this invitation to join the target room.
pub struct ThirdPartyInviteEvent {
content: ThirdPartyInviteEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<ThirdPartyInviteEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: ThirdPartyInviteEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<ThirdPartyInviteEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `ThirdPartyInviteEvent`.
pub struct ThirdPartyInviteEventContent {
display_name: String,
key_validity_url: String,
public_key: String,
pub display_name: String,
pub key_validity_url: String,
pub public_key: String,
}

View File

@ -4,17 +4,17 @@ use core::EventType;
/// A topic is a short message detailing what is currently being discussed in the room.
pub struct TopicEvent {
content: TopicEventContent,
event_id: String,
event_type: EventType,
prev_content: Option<TopicEventContent>,
room_id: String,
state_key: String,
user_id: String,
pub content: TopicEventContent,
pub event_id: String,
pub event_type: EventType,
pub prev_content: Option<TopicEventContent>,
pub room_id: String,
pub state_key: String,
pub user_id: String,
}
/// The payload of a `TopicEvent`.
pub struct TopicEventContent {
/// The topic text.
topic: String,
pub topic: String,
}

View File

@ -7,16 +7,17 @@ use core::EventType;
/// Informs the client of tags on a room.
pub struct TagEvent {
/// The payload.
content: TagEventContent,
pub content: TagEventContent,
pub event_type: EventType,
}
/// The payload of a `TagEvent`.
pub struct TagEventContent {
/// A map of tag names to tag info.
tags: HashMap<String, TagInfo>,
pub tags: HashMap<String, TagInfo>,
}
/// Information about a tag.
pub struct TagInfo {
order: Option<u64>,
pub order: Option<u64>,
}

View File

@ -5,14 +5,14 @@ use core::EventType;
/// Informs the client of the list of users currently typing.
pub struct TypingEvent {
/// The payload.
content: TypingEventContent,
event_type: EventType,
pub content: TypingEventContent,
pub event_type: EventType,
/// The ID of the room associated with this event.
room_id: String,
pub room_id: String,
}
/// The payload of a `TypingEvent`.
pub struct TypingEventContent {
/// The list of user IDs typing in this room, if any.
user_ids: Vec<String>,
pub user_ids: Vec<String>,
}