Use ruma_event for ignored_user_list
This commit is contained in:
parent
24f519ba29
commit
23204d7948
@ -1,68 +1,18 @@
|
|||||||
//! Types for the *m.ignored_user_list* event.
|
//! Types for the *m.ignored_user_list* event.
|
||||||
|
|
||||||
|
use ruma_events_macros::ruma_event;
|
||||||
use ruma_identifiers::UserId;
|
use ruma_identifiers::UserId;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use crate::{EventType, FromRaw};
|
ruma_event! {
|
||||||
|
|
||||||
/// A list of users to ignore.
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
|
||||||
#[serde(rename = "m.ignored_user_list", tag = "type")]
|
|
||||||
pub struct IgnoredUserListEvent {
|
|
||||||
/// The event's content.
|
|
||||||
pub content: IgnoredUserListEventContent,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromRaw for IgnoredUserListEvent {
|
|
||||||
type Raw = raw::IgnoredUserListEvent;
|
|
||||||
|
|
||||||
fn from_raw(raw: raw::IgnoredUserListEvent) -> Self {
|
|
||||||
Self {
|
|
||||||
content: FromRaw::from_raw(raw.content),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The payload for `IgnoredUserListEvent`.
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
|
||||||
pub struct IgnoredUserListEventContent {
|
|
||||||
/// A list of users to ignore.
|
/// A list of users to ignore.
|
||||||
#[serde(with = "ruma_serde::vec_as_map_of_empty")]
|
IgnoredUserListEvent {
|
||||||
pub ignored_users: Vec<UserId>,
|
kind: Event,
|
||||||
}
|
event_type: "m.ignored_user_list",
|
||||||
|
content: {
|
||||||
impl FromRaw for IgnoredUserListEventContent {
|
/// A list of users to ignore.
|
||||||
type Raw = raw::IgnoredUserListEventContent;
|
#[serde(with = "ruma_serde::vec_as_map_of_empty")]
|
||||||
|
pub ignored_users: Vec<UserId>,
|
||||||
fn from_raw(raw: raw::IgnoredUserListEventContent) -> Self {
|
},
|
||||||
Self {
|
|
||||||
ignored_users: raw.ignored_users,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_event!(
|
|
||||||
IgnoredUserListEvent,
|
|
||||||
IgnoredUserListEventContent,
|
|
||||||
EventType::IgnoredUserList
|
|
||||||
);
|
|
||||||
|
|
||||||
pub(crate) mod raw {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
/// A list of users to ignore.
|
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
|
||||||
pub struct IgnoredUserListEvent {
|
|
||||||
/// The event's content.
|
|
||||||
pub content: IgnoredUserListEventContent,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The payload for `IgnoredUserListEvent`.
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
||||||
pub struct IgnoredUserListEventContent {
|
|
||||||
/// A list of users to ignore.
|
|
||||||
#[serde(with = "ruma_serde::vec_as_map_of_empty")]
|
|
||||||
pub ignored_users: Vec<UserId>,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user