move core::pdu and core::state_res into core::matrix::
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
4e5b87d0cd
commit
532dfd004d
91 changed files with 266 additions and 205 deletions
|
@ -6,7 +6,9 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Error, PduEvent, PduId, RawPduId, Result, debug_error, err, info, trace, utils,
|
Error, Result, debug_error, err, info,
|
||||||
|
matrix::pdu::{PduEvent, PduId, RawPduId},
|
||||||
|
trace, utils,
|
||||||
utils::{
|
utils::{
|
||||||
stream::{IterStream, ReadyExt},
|
stream::{IterStream, ReadyExt},
|
||||||
string::EMPTY,
|
string::EMPTY,
|
||||||
|
|
|
@ -2,7 +2,8 @@ use std::{collections::BTreeMap, fmt::Write as _};
|
||||||
|
|
||||||
use api::client::{full_user_deactivate, join_room_by_id_helper, leave_room};
|
use api::client::{full_user_deactivate, join_room_by_id_helper, leave_room};
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
PduBuilder, Result, debug, debug_warn, error, info, is_equal_to,
|
Result, debug, debug_warn, error, info, is_equal_to,
|
||||||
|
matrix::pdu::PduBuilder,
|
||||||
utils::{self, ReadyExt},
|
utils::{self, ReadyExt},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,10 +3,13 @@ use std::fmt::Write;
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Error, PduBuilder, Result, debug_info, err, error, info, is_equal_to, utils,
|
Err, Error, Result, debug_info, err, error, info, is_equal_to,
|
||||||
|
matrix::pdu::PduBuilder,
|
||||||
|
utils,
|
||||||
utils::{ReadyExt, stream::BroadbandExt},
|
utils::{ReadyExt, stream::BroadbandExt},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
use register::RegistrationKind;
|
use register::RegistrationKind;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
|
@ -30,7 +33,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
push,
|
push,
|
||||||
};
|
};
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH, join_room_by_id_helper};
|
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH, join_room_by_id_helper};
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, err};
|
use conduwuit::{Err, Result, err};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomId, UserId,
|
RoomId, UserId,
|
||||||
api::client::config::{
|
api::client::config::{
|
||||||
|
@ -15,7 +16,7 @@ use ruma::{
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::{json, value::RawValue as RawJsonValue};
|
use serde_json::{json, value::RawValue as RawJsonValue};
|
||||||
|
|
||||||
use crate::{Result, Ruma, service::Services};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/user/{userId}/account_data/{type}`
|
/// # `PUT /_matrix/client/r0/user/{userId}/account_data/{type}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result, debug};
|
use conduwuit::{Err, Result, debug};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedServerName, RoomAliasId, RoomId,
|
OwnedServerName, RoomAliasId, RoomId,
|
||||||
api::client::alias::{create_alias, delete_alias, get_alias},
|
api::client::alias::{create_alias, delete_alias, get_alias},
|
||||||
};
|
};
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, err};
|
use conduwuit::{Err, Result, err};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
UInt,
|
UInt,
|
||||||
api::client::backup::{
|
api::client::backup::{
|
||||||
|
@ -13,7 +13,7 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/room_keys/version`
|
/// # `POST /_matrix/client/r0/room_keys/version`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, PduEvent, Result, at, debug_warn, err, ref_at,
|
Err, Result, at, debug_warn, err,
|
||||||
|
matrix::pdu::PduEvent,
|
||||||
|
ref_at,
|
||||||
utils::{
|
utils::{
|
||||||
IterStream,
|
IterStream,
|
||||||
future::TryExtExt,
|
future::TryExtExt,
|
||||||
stream::{BroadbandExt, ReadyExt, TryIgnore, WidebandExt},
|
stream::{BroadbandExt, ReadyExt, TryIgnore, WidebandExt},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::rooms::{lazy_loading, lazy_loading::Options, short::ShortStateKey};
|
||||||
use futures::{
|
use futures::{
|
||||||
FutureExt, StreamExt, TryFutureExt, TryStreamExt,
|
FutureExt, StreamExt, TryFutureExt, TryStreamExt,
|
||||||
future::{OptionFuture, join, join3, try_join3},
|
future::{OptionFuture, join, join3, try_join3},
|
||||||
};
|
};
|
||||||
use ruma::{OwnedEventId, UserId, api::client::context::get_context, events::StateEventType};
|
use ruma::{OwnedEventId, UserId, api::client::context::get_context, events::StateEventType};
|
||||||
use service::rooms::{lazy_loading, lazy_loading::Options, short::ShortStateKey};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Ruma,
|
Ruma,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
use conduwuit::{Err, debug, err};
|
use conduwuit::{Err, Error, Result, debug, err, utils};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
MilliSecondsSinceUnixEpoch, OwnedDeviceId,
|
MilliSecondsSinceUnixEpoch, OwnedDeviceId,
|
||||||
|
@ -12,7 +12,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::SESSION_ID_LENGTH;
|
use super::SESSION_ID_LENGTH;
|
||||||
use crate::{Error, Result, Ruma, client::DEVICE_ID_LENGTH, utils};
|
use crate::{Ruma, client::DEVICE_ID_LENGTH};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/devices`
|
/// # `GET /_matrix/client/r0/devices`
|
||||||
///
|
///
|
||||||
|
|
|
@ -9,6 +9,7 @@ use conduwuit::{
|
||||||
stream::{ReadyExt, WidebandExt},
|
stream::{ReadyExt, WidebandExt},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::{
|
use futures::{
|
||||||
FutureExt, StreamExt, TryFutureExt,
|
FutureExt, StreamExt, TryFutureExt,
|
||||||
future::{join, join4, join5},
|
future::{join, join4, join5},
|
||||||
|
@ -35,7 +36,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
uint,
|
uint,
|
||||||
};
|
};
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::err;
|
use conduwuit::{Result, err};
|
||||||
use ruma::api::client::filter::{create_filter, get_filter};
|
use ruma::api::client::filter::{create_filter, get_filter};
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/user/{userId}/filter/{filterId}`
|
/// # `GET /_matrix/client/r0/user/{userId}/filter/{filterId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -2,6 +2,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Error, Result, debug, debug_warn, err, info, result::NotFound, utils};
|
use conduwuit::{Err, Error, Result, debug, debug_warn, err, info, result::NotFound, utils};
|
||||||
|
use conduwuit_service::{Services, users::parse_master_key};
|
||||||
use futures::{StreamExt, stream::FuturesUnordered};
|
use futures::{StreamExt, stream::FuturesUnordered};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
|
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
|
||||||
|
@ -23,10 +24,7 @@ use ruma::{
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
use super::SESSION_ID_LENGTH;
|
use super::SESSION_ID_LENGTH;
|
||||||
use crate::{
|
use crate::Ruma;
|
||||||
Ruma,
|
|
||||||
service::{Services, users::parse_master_key},
|
|
||||||
};
|
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/keys/upload`
|
/// # `POST /_matrix/client/r0/keys/upload`
|
||||||
///
|
///
|
||||||
|
|
|
@ -9,13 +9,25 @@ use std::{
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, PduEvent, Result, StateKey, at, debug, debug_info, debug_warn, err, error, info,
|
Err, Result, at, debug, debug_info, debug_warn, err, error, info,
|
||||||
pdu::{PduBuilder, gen_event_id_canonical_json},
|
matrix::{
|
||||||
|
StateKey,
|
||||||
|
pdu::{PduBuilder, PduEvent, gen_event_id, gen_event_id_canonical_json},
|
||||||
|
state_res,
|
||||||
|
},
|
||||||
result::{FlatOk, NotFound},
|
result::{FlatOk, NotFound},
|
||||||
state_res, trace,
|
trace,
|
||||||
utils::{self, IterStream, ReadyExt, shuffle},
|
utils::{self, IterStream, ReadyExt, shuffle},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::{
|
||||||
|
Services,
|
||||||
|
appservice::RegistrationInfo,
|
||||||
|
rooms::{
|
||||||
|
state::RoomMutexGuard,
|
||||||
|
state_compressor::{CompressedState, HashSetCompressStateEvent},
|
||||||
|
},
|
||||||
|
};
|
||||||
use futures::{FutureExt, StreamExt, TryFutureExt, future::join4, join};
|
use futures::{FutureExt, StreamExt, TryFutureExt, future::join4, join};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName,
|
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName,
|
||||||
|
@ -44,15 +56,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use service::{
|
|
||||||
Services,
|
|
||||||
appservice::RegistrationInfo,
|
|
||||||
pdu::gen_event_id,
|
|
||||||
rooms::{
|
|
||||||
state::RoomMutexGuard,
|
|
||||||
state_compressor::{CompressedState, HashSetCompressStateEvent},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{Ruma, client::full_user_deactivate};
|
use crate::{Ruma, client::full_user_deactivate};
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,24 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Event, PduCount, PduEvent, Result, at,
|
Err, Result, at,
|
||||||
|
matrix::{
|
||||||
|
Event,
|
||||||
|
pdu::{PduCount, PduEvent},
|
||||||
|
},
|
||||||
utils::{
|
utils::{
|
||||||
IterStream, ReadyExt,
|
IterStream, ReadyExt,
|
||||||
result::{FlatOk, LogErr},
|
result::{FlatOk, LogErr},
|
||||||
stream::{BroadbandExt, TryIgnore, WidebandExt},
|
stream::{BroadbandExt, TryIgnore, WidebandExt},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::{
|
||||||
|
Services,
|
||||||
|
rooms::{
|
||||||
|
lazy_loading,
|
||||||
|
lazy_loading::{Options, Witness},
|
||||||
|
timeline::PdusIterItem,
|
||||||
|
},
|
||||||
|
};
|
||||||
use futures::{FutureExt, StreamExt, TryFutureExt, future::OptionFuture, pin_mut};
|
use futures::{FutureExt, StreamExt, TryFutureExt, future::OptionFuture, pin_mut};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomId, UserId,
|
RoomId, UserId,
|
||||||
|
@ -17,14 +29,6 @@ use ruma::{
|
||||||
events::{AnyStateEvent, StateEventType, TimelineEventType, TimelineEventType::*},
|
events::{AnyStateEvent, StateEventType, TimelineEventType, TimelineEventType::*},
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
};
|
};
|
||||||
use service::{
|
|
||||||
Services,
|
|
||||||
rooms::{
|
|
||||||
lazy_loading,
|
|
||||||
lazy_loading::{Options, Witness},
|
|
||||||
timeline::PdusIterItem,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::utils;
|
use conduwuit::{Error, Result, utils};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::{account, error::ErrorKind},
|
api::client::{account, error::ErrorKind},
|
||||||
authentication::TokenType,
|
authentication::TokenType,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::TOKEN_LENGTH;
|
use super::TOKEN_LENGTH;
|
||||||
use crate::{Error, Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `POST /_matrix/client/v3/user/{userId}/openid/request_token`
|
/// # `POST /_matrix/client/v3/user/{userId}/openid/request_token`
|
||||||
///
|
///
|
||||||
|
|
|
@ -3,10 +3,11 @@ use std::collections::BTreeMap;
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Error, Result,
|
Err, Error, Result,
|
||||||
pdu::PduBuilder,
|
matrix::pdu::PduBuilder,
|
||||||
utils::{IterStream, stream::TryIgnore},
|
utils::{IterStream, stream::TryIgnore},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::{StreamExt, TryStreamExt, future::join3};
|
use futures::{StreamExt, TryStreamExt, future::join3};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedMxcUri, OwnedRoomId, UserId,
|
OwnedMxcUri, OwnedRoomId, UserId,
|
||||||
|
@ -22,7 +23,6 @@ use ruma::{
|
||||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||||
presence::PresenceState,
|
presence::PresenceState,
|
||||||
};
|
};
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, err};
|
use conduwuit::{Err, Error, Result, err};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, CanonicalJsonValue,
|
CanonicalJsonObject, CanonicalJsonValue,
|
||||||
api::client::{
|
api::client::{
|
||||||
|
@ -19,9 +20,8 @@ use ruma::{
|
||||||
RemovePushRuleError, Ruleset,
|
RemovePushRuleError, Ruleset,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::{Error, Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/pushrules/`
|
/// # `GET /_matrix/client/r0/pushrules/`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, PduCount, err};
|
use conduwuit::{Err, PduCount, Result, err};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
MilliSecondsSinceUnixEpoch,
|
MilliSecondsSinceUnixEpoch,
|
||||||
api::client::{read_marker::set_read_marker, receipt::create_receipt},
|
api::client::{read_marker::set_read_marker, receipt::create_receipt},
|
||||||
|
@ -11,7 +11,7 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/rooms/{roomId}/read_markers`
|
/// # `POST /_matrix/client/r0/rooms/{roomId}/read_markers`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
|
use conduwuit::{Result, matrix::pdu::PduBuilder};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::redact::redact_event, events::room::redaction::RoomRedactionEventContent,
|
api::client::redact::redact_event, events::room::redaction::RoomRedactionEventContent,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Result, Ruma, service::pdu::PduBuilder};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/redact/{eventId}/{txnId}`
|
/// # `PUT /_matrix/client/r0/rooms/{roomId}/redact/{eventId}/{txnId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
PduCount, Result, at,
|
Result, at,
|
||||||
|
matrix::pdu::PduCount,
|
||||||
utils::{IterStream, ReadyExt, result::FlatOk, stream::WidebandExt},
|
utils::{IterStream, ReadyExt, result::FlatOk, stream::WidebandExt},
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::{Services, rooms::timeline::PdusIterItem};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
EventId, RoomId, UInt, UserId,
|
EventId, RoomId, UInt, UserId,
|
||||||
|
@ -15,7 +17,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
events::{TimelineEventType, relation::RelationType},
|
events::{TimelineEventType, relation::RelationType},
|
||||||
};
|
};
|
||||||
use service::{Services, rooms::timeline::PdusIterItem};
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ use std::time::Duration;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
use conduwuit::{Err, info, utils::ReadyExt};
|
use conduwuit::{Err, Error, Result, debug_info, info, matrix::pdu::PduEvent, utils::ReadyExt};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
EventId, RoomId, UserId,
|
EventId, RoomId, UserId,
|
||||||
|
@ -15,10 +16,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
use crate::{
|
use crate::Ruma;
|
||||||
Error, Result, Ruma, debug_info,
|
|
||||||
service::{Services, pdu::PduEvent},
|
|
||||||
};
|
|
||||||
|
|
||||||
/// # `POST /_matrix/client/v3/rooms/{roomId}/report`
|
/// # `POST /_matrix/client/v3/rooms/{roomId}/report`
|
||||||
///
|
///
|
||||||
|
|
|
@ -2,8 +2,11 @@ use std::collections::BTreeMap;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Error, Result, StateKey, debug_info, debug_warn, err, error, info, pdu::PduBuilder, warn,
|
Err, Error, Result, debug_info, debug_warn, err, error, info,
|
||||||
|
matrix::{StateKey, pdu::PduBuilder},
|
||||||
|
warn,
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::{Services, appservice::RegistrationInfo};
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, Int, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, RoomId, RoomVersionId,
|
CanonicalJsonObject, Int, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, RoomId, RoomVersionId,
|
||||||
|
@ -29,7 +32,6 @@ use ruma::{
|
||||||
serde::{JsonObject, Raw},
|
serde::{JsonObject, Raw},
|
||||||
};
|
};
|
||||||
use serde_json::{json, value::to_raw_value};
|
use serde_json::{json, value::to_raw_value};
|
||||||
use service::{Services, appservice::RegistrationInfo};
|
|
||||||
|
|
||||||
use crate::{Ruma, client::invite_helper};
|
use crate::{Ruma, client::invite_helper};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Error, Result, StateKey, err, info, pdu::PduBuilder};
|
use conduwuit::{
|
||||||
|
Error, Result, err, info,
|
||||||
|
matrix::{StateKey, pdu::PduBuilder},
|
||||||
|
};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, RoomId, RoomVersionId,
|
CanonicalJsonObject, RoomId, RoomVersionId,
|
||||||
|
|
|
@ -2,10 +2,12 @@ use std::collections::BTreeMap;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, PduEvent, Result, at, is_true,
|
Err, Result, at, is_true,
|
||||||
|
matrix::pdu::PduEvent,
|
||||||
result::FlatOk,
|
result::FlatOk,
|
||||||
utils::{IterStream, stream::ReadyExt},
|
utils::{IterStream, stream::ReadyExt},
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::{Services, rooms::search::RoomQuery};
|
||||||
use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::OptionFuture};
|
use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::OptionFuture};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedRoomId, RoomId, UInt, UserId,
|
OwnedRoomId, RoomId, UInt, UserId,
|
||||||
|
@ -17,7 +19,6 @@ use ruma::{
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
};
|
};
|
||||||
use search_events::v3::{Request, Response};
|
use search_events::v3::{Request, Response};
|
||||||
use service::{Services, rooms::search::RoomQuery};
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, err};
|
use conduwuit::{Err, Result, err, matrix::pdu::PduBuilder, utils};
|
||||||
use ruma::{api::client::message::send_message_event, events::MessageLikeEventType};
|
use ruma::{api::client::message::send_message_event, events::MessageLikeEventType};
|
||||||
use serde_json::from_str;
|
use serde_json::from_str;
|
||||||
|
|
||||||
use crate::{Result, Ruma, service::pdu::PduBuilder, utils};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}`
|
/// # `PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -2,7 +2,11 @@ use std::time::Duration;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
use conduwuit::{Err, debug, err, info, utils::ReadyExt};
|
use conduwuit::{
|
||||||
|
Err, Error, Result, debug, err, info, utils,
|
||||||
|
utils::{ReadyExt, hash},
|
||||||
|
};
|
||||||
|
use conduwuit_service::uiaa::SESSION_ID_LENGTH;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
UserId,
|
UserId,
|
||||||
|
@ -22,10 +26,9 @@ use ruma::{
|
||||||
uiaa,
|
uiaa,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use service::uiaa::SESSION_ID_LENGTH;
|
|
||||||
|
|
||||||
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
||||||
use crate::{Error, Result, Ruma, utils, utils::hash};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/client/v3/login`
|
/// # `GET /_matrix/client/v3/login`
|
||||||
///
|
///
|
||||||
|
|
|
@ -8,16 +8,16 @@ use conduwuit::{
|
||||||
Err, Result,
|
Err, Result,
|
||||||
utils::{future::TryExtExt, stream::IterStream},
|
utils::{future::TryExtExt, stream::IterStream},
|
||||||
};
|
};
|
||||||
use futures::{StreamExt, TryFutureExt, future::OptionFuture};
|
use conduwuit_service::{
|
||||||
use ruma::{
|
|
||||||
OwnedRoomId, OwnedServerName, RoomId, UInt, UserId, api::client::space::get_hierarchy,
|
|
||||||
};
|
|
||||||
use service::{
|
|
||||||
Services,
|
Services,
|
||||||
rooms::spaces::{
|
rooms::spaces::{
|
||||||
PaginationToken, SummaryAccessibility, get_parent_children_via, summary_to_chunk,
|
PaginationToken, SummaryAccessibility, get_parent_children_via, summary_to_chunk,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use futures::{StreamExt, TryFutureExt, future::OptionFuture};
|
||||||
|
use ruma::{
|
||||||
|
OwnedRoomId, OwnedServerName, RoomId, UInt, UserId, api::client::space::get_hierarchy,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, PduEvent, Result, err, pdu::PduBuilder, utils::BoolExt};
|
use conduwuit::{
|
||||||
|
Err, Result, err,
|
||||||
|
matrix::pdu::{PduBuilder, PduEvent},
|
||||||
|
utils::BoolExt,
|
||||||
|
};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::TryStreamExt;
|
use futures::TryStreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedEventId, RoomId, UserId,
|
OwnedEventId, RoomId, UserId,
|
||||||
|
@ -16,7 +21,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
};
|
};
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::{Ruma, RumaResponse};
|
use crate::{Ruma, RumaResponse};
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,14 @@ mod v4;
|
||||||
mod v5;
|
mod v5;
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
PduCount,
|
Error, PduCount, Result,
|
||||||
|
matrix::pdu::PduEvent,
|
||||||
utils::{
|
utils::{
|
||||||
IterStream,
|
IterStream,
|
||||||
stream::{BroadbandExt, ReadyExt, TryIgnore},
|
stream::{BroadbandExt, ReadyExt, TryIgnore},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::{StreamExt, pin_mut};
|
use futures::{StreamExt, pin_mut};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomId, UserId,
|
RoomId, UserId,
|
||||||
|
@ -21,7 +23,6 @@ use ruma::{
|
||||||
pub(crate) use self::{
|
pub(crate) use self::{
|
||||||
v3::sync_events_route, v4::sync_events_v4_route, v5::sync_events_v5_route,
|
v3::sync_events_route, v4::sync_events_v4_route, v5::sync_events_v5_route,
|
||||||
};
|
};
|
||||||
use crate::{Error, PduEvent, Result, service::Services};
|
|
||||||
|
|
||||||
pub(crate) const DEFAULT_BUMP_TYPES: &[TimelineEventType; 6] =
|
pub(crate) const DEFAULT_BUMP_TYPES: &[TimelineEventType; 6] =
|
||||||
&[CallInvite, PollStart, Beacon, RoomEncrypted, RoomMessage, Sticker];
|
&[CallInvite, PollStart, Beacon, RoomEncrypted, RoomMessage, Sticker];
|
||||||
|
|
|
@ -6,9 +6,12 @@ use std::{
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
PduCount, PduEvent, Result, at, err, error, extract_variant, is_equal_to, pair_of,
|
Result, at, err, error, extract_variant, is_equal_to,
|
||||||
pdu::{Event, EventHash},
|
matrix::{
|
||||||
ref_at,
|
Event,
|
||||||
|
pdu::{EventHash, PduCount, PduEvent},
|
||||||
|
},
|
||||||
|
pair_of, ref_at,
|
||||||
result::FlatOk,
|
result::FlatOk,
|
||||||
utils::{
|
utils::{
|
||||||
self, BoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
self, BoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
||||||
|
|
|
@ -6,13 +6,19 @@ use std::{
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Error, PduEvent, Result, TypeStateKey, debug, error, extract_variant, trace,
|
Error, Result, debug, error, extract_variant,
|
||||||
|
matrix::{
|
||||||
|
TypeStateKey,
|
||||||
|
pdu::{PduCount, PduEvent},
|
||||||
|
},
|
||||||
|
trace,
|
||||||
utils::{
|
utils::{
|
||||||
BoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
BoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
||||||
math::{ruma_from_usize, usize_from_ruma},
|
math::{ruma_from_usize, usize_from_ruma},
|
||||||
},
|
},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::rooms::read_receipt::pack_receipts;
|
||||||
use futures::{FutureExt, StreamExt, TryFutureExt};
|
use futures::{FutureExt, StreamExt, TryFutureExt};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
DeviceId, OwnedEventId, OwnedRoomId, RoomId, UInt, UserId,
|
DeviceId, OwnedEventId, OwnedRoomId, RoomId, UInt, UserId,
|
||||||
|
@ -27,7 +33,6 @@ use ruma::{
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
uint,
|
uint,
|
||||||
};
|
};
|
||||||
use service::{PduCount, rooms::read_receipt::pack_receipts};
|
|
||||||
|
|
||||||
use super::{filter_rooms, share_encrypted_room};
|
use super::{filter_rooms, share_encrypted_room};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
|
use conduwuit::Result;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::tag::{create_tag, delete_tag, get_tags},
|
api::client::tag::{create_tag, delete_tag, get_tags},
|
||||||
events::{
|
events::{
|
||||||
|
@ -9,7 +10,7 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}`
|
/// # `PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
use conduwuit::Result;
|
||||||
use ruma::api::client::thirdparty::get_protocols;
|
use ruma::api::client::thirdparty::get_protocols;
|
||||||
|
|
||||||
use crate::{Result, Ruma, RumaResponse};
|
use crate::{Ruma, RumaResponse};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/thirdparty/protocols`
|
/// # `GET /_matrix/client/r0/thirdparty/protocols`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{PduCount, PduEvent, at};
|
use conduwuit::{
|
||||||
|
Result, at,
|
||||||
|
matrix::pdu::{PduCount, PduEvent},
|
||||||
|
};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{api::client::threads::get_threads, uint};
|
use ruma::{api::client::threads::get_threads, uint};
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/threads`
|
/// # `GET /_matrix/client/r0/rooms/{roomId}/threads`
|
||||||
pub(crate) async fn get_threads_route(
|
pub(crate) async fn get_threads_route(
|
||||||
|
|
|
@ -2,6 +2,7 @@ use std::collections::BTreeMap;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Error, Result};
|
use conduwuit::{Error, Result};
|
||||||
|
use conduwuit_service::sending::EduBuf;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{
|
api::{
|
||||||
|
@ -10,7 +11,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
to_device::DeviceIdOrAllDevices,
|
to_device::DeviceIdOrAllDevices,
|
||||||
};
|
};
|
||||||
use service::sending::EduBuf;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, utils::math::Tried};
|
use conduwuit::{Err, Result, utils, utils::math::Tried};
|
||||||
use ruma::api::client::typing::create_typing_event;
|
use ruma::api::client::typing::create_typing_event;
|
||||||
|
|
||||||
use crate::{Result, Ruma, utils};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}`
|
/// # `PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use axum::{Json, extract::State, response::IntoResponse};
|
use axum::{Json, extract::State, response::IntoResponse};
|
||||||
|
use conduwuit::Result;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::api::client::discovery::get_supported_versions;
|
use ruma::api::client::discovery::get_supported_versions;
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/client/versions`
|
/// # `GET /_matrix/client/versions`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::utils::TryFutureExtExt;
|
use conduwuit::{Result, utils::TryFutureExtExt};
|
||||||
use futures::{StreamExt, pin_mut};
|
use futures::{StreamExt, pin_mut};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::user_directory::search_users,
|
api::client::user_directory::search_users,
|
||||||
|
@ -9,7 +9,7 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `POST /_matrix/client/r0/user_directory/search`
|
/// # `POST /_matrix/client/r0/user_directory/search`
|
||||||
///
|
///
|
||||||
|
|
|
@ -2,12 +2,12 @@ use std::time::{Duration, SystemTime};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use base64::{Engine as _, engine::general_purpose};
|
use base64::{Engine as _, engine::general_purpose};
|
||||||
use conduwuit::{Err, utils};
|
use conduwuit::{Err, Result, utils};
|
||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
use ruma::{SecondsSinceUnixEpoch, UserId, api::client::voip::get_turn_server_info};
|
use ruma::{SecondsSinceUnixEpoch, UserId, api::client::voip::get_turn_server_info};
|
||||||
use sha1::Sha1;
|
use sha1::Sha1;
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
const RANDOM_USER_ID_LENGTH: usize = 10;
|
const RANDOM_USER_ID_LENGTH: usize = 10;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use axum::{Json, extract::State, response::IntoResponse};
|
use axum::{Json, extract::State, response::IntoResponse};
|
||||||
|
use conduwuit::{Error, Result};
|
||||||
use ruma::api::client::{
|
use ruma::api::client::{
|
||||||
discovery::{
|
discovery::{
|
||||||
discover_homeserver::{self, HomeserverInfo, SlidingSyncProxyInfo},
|
discover_homeserver::{self, HomeserverInfo, SlidingSyncProxyInfo},
|
||||||
|
@ -7,7 +8,7 @@ use ruma::api::client::{
|
||||||
error::ErrorKind,
|
error::ErrorKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Error, Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /.well-known/matrix/client`
|
/// # `GET /.well-known/matrix/client`
|
||||||
///
|
///
|
||||||
|
|
|
@ -8,8 +8,6 @@ pub mod server;
|
||||||
extern crate conduwuit_core as conduwuit;
|
extern crate conduwuit_core as conduwuit;
|
||||||
extern crate conduwuit_service as service;
|
extern crate conduwuit_service as service;
|
||||||
|
|
||||||
pub(crate) use conduwuit::{Error, Result, debug_info, pdu::PduEvent, utils};
|
|
||||||
|
|
||||||
pub(crate) use self::router::{Ruma, RumaResponse, State};
|
pub(crate) use self::router::{Ruma, RumaResponse, State};
|
||||||
|
|
||||||
conduwuit::mod_ctor! {}
|
conduwuit::mod_ctor! {}
|
||||||
|
|
|
@ -3,9 +3,11 @@ use conduwuit::{
|
||||||
Err, Result,
|
Err, Result,
|
||||||
utils::stream::{BroadbandExt, IterStream},
|
utils::stream::{BroadbandExt, IterStream},
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::rooms::spaces::{
|
||||||
|
Identifier, SummaryAccessibility, get_parent_children_via,
|
||||||
|
};
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
use ruma::api::federation::space::get_hierarchy;
|
use ruma::api::federation::space::get_hierarchy;
|
||||||
use service::rooms::spaces::{Identifier, SummaryAccessibility, get_parent_children_via};
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
use base64::{Engine as _, engine::general_purpose};
|
use base64::{Engine as _, engine::general_purpose};
|
||||||
use conduwuit::{Err, Error, PduEvent, Result, err, utils, utils::hash::sha256, warn};
|
use conduwuit::{
|
||||||
|
Err, Error, PduEvent, Result, err, pdu::gen_event_id, utils, utils::hash::sha256, warn,
|
||||||
|
};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonValue, OwnedUserId, UserId,
|
CanonicalJsonValue, OwnedUserId, UserId,
|
||||||
api::{client::error::ErrorKind, federation::membership::create_invite},
|
api::{client::error::ErrorKind, federation::membership::create_invite},
|
||||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||||
serde::JsonObject,
|
serde::JsonObject,
|
||||||
};
|
};
|
||||||
use service::pdu::gen_event_id;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, debug_info, utils::IterStream, warn};
|
use conduwuit::{
|
||||||
|
Err, Error, Result, debug_info, matrix::pdu::PduBuilder, utils::IterStream, warn,
|
||||||
|
};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, OwnedUserId, RoomId, RoomVersionId, UserId,
|
CanonicalJsonObject, OwnedUserId, RoomId, RoomVersionId, UserId,
|
||||||
|
@ -14,10 +17,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
|
|
||||||
use crate::{
|
use crate::Ruma;
|
||||||
Error, Result, Ruma,
|
|
||||||
service::{Services, pdu::PduBuilder},
|
|
||||||
};
|
|
||||||
|
|
||||||
/// # `GET /_matrix/federation/v1/make_join/{roomId}/{userId}`
|
/// # `GET /_matrix/federation/v1/make_join/{roomId}/{userId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
use RoomVersionId::*;
|
use RoomVersionId::*;
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, debug_warn};
|
use conduwuit::{Err, Error, Result, debug_warn, matrix::pdu::PduBuilder, warn};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomVersionId,
|
RoomVersionId,
|
||||||
api::{client::error::ErrorKind, federation::knock::create_knock_event_template},
|
api::{client::error::ErrorKind, federation::knock::create_knock_event_template},
|
||||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||||
};
|
};
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
use tracing::warn;
|
|
||||||
|
|
||||||
use crate::{Error, Result, Ruma, service::pdu::PduBuilder};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/federation/v1/make_knock/{roomId}/{userId}`
|
/// # `GET /_matrix/federation/v1/make_knock/{roomId}/{userId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result};
|
use conduwuit::{Err, Result, matrix::pdu::PduBuilder};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::federation::membership::prepare_leave_event,
|
api::federation::membership::prepare_leave_event,
|
||||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||||
|
@ -7,7 +7,7 @@ use ruma::{
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
|
|
||||||
use super::make_join::maybe_strip_event_id;
|
use super::make_join::maybe_strip_event_id;
|
||||||
use crate::{Ruma, service::pdu::PduBuilder};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/federation/v1/make_leave/{roomId}/{eventId}`
|
/// # `GET /_matrix/federation/v1/make_leave/{roomId}/{eventId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
|
use conduwuit::Result;
|
||||||
use ruma::api::federation::openid::get_openid_userinfo;
|
use ruma::api::federation::openid::get_openid_userinfo;
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/federation/v1/openid/userinfo`
|
/// # `GET /_matrix/federation/v1/openid/userinfo`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use axum_client_ip::InsecureClientIp;
|
use axum_client_ip::InsecureClientIp;
|
||||||
|
use conduwuit::{Error, Result};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{
|
api::{
|
||||||
client::error::ErrorKind,
|
client::error::ErrorKind,
|
||||||
|
@ -8,7 +9,7 @@ use ruma::{
|
||||||
directory::Filter,
|
directory::Filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Error, Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `POST /_matrix/federation/v1/publicRooms`
|
/// # `POST /_matrix/federation/v1/publicRooms`
|
||||||
///
|
///
|
||||||
|
|
|
@ -9,11 +9,15 @@ use conduwuit::{
|
||||||
result::LogErr,
|
result::LogErr,
|
||||||
trace,
|
trace,
|
||||||
utils::{
|
utils::{
|
||||||
IterStream, ReadyExt,
|
IterStream, ReadyExt, millis_since_unix_epoch,
|
||||||
stream::{BroadbandExt, TryBroadbandExt, automatic_width},
|
stream::{BroadbandExt, TryBroadbandExt, automatic_width},
|
||||||
},
|
},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::{
|
||||||
|
Services,
|
||||||
|
sending::{EDU_LIMIT, PDU_LIMIT},
|
||||||
|
};
|
||||||
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt};
|
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
|
@ -33,16 +37,8 @@ use ruma::{
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
to_device::DeviceIdOrAllDevices,
|
to_device::DeviceIdOrAllDevices,
|
||||||
};
|
};
|
||||||
use service::{
|
|
||||||
Services,
|
|
||||||
sending::{EDU_LIMIT, PDU_LIMIT},
|
|
||||||
};
|
|
||||||
use utils::millis_since_unix_epoch;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::Ruma;
|
||||||
Ruma,
|
|
||||||
utils::{self},
|
|
||||||
};
|
|
||||||
|
|
||||||
type ResolvedMap = BTreeMap<OwnedEventId, Result>;
|
type ResolvedMap = BTreeMap<OwnedEventId, Result>;
|
||||||
type Pdu = (OwnedRoomId, OwnedEventId, CanonicalJsonObject);
|
type Pdu = (OwnedRoomId, OwnedEventId, CanonicalJsonObject);
|
||||||
|
|
|
@ -9,6 +9,7 @@ use conduwuit::{
|
||||||
utils::stream::{IterStream, TryBroadbandExt},
|
utils::stream::{IterStream, TryBroadbandExt},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::{FutureExt, StreamExt, TryStreamExt};
|
use futures::{FutureExt, StreamExt, TryStreamExt};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedUserId, RoomId,
|
CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedUserId, RoomId,
|
||||||
|
@ -20,7 +21,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use serde_json::value::{RawValue as RawJsonValue, to_raw_value};
|
use serde_json::value::{RawValue as RawJsonValue, to_raw_value};
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, PduEvent, Result, err, pdu::gen_event_id_canonical_json, warn};
|
use conduwuit::{
|
||||||
|
Err, Result, err,
|
||||||
|
matrix::pdu::{PduEvent, gen_event_id_canonical_json},
|
||||||
|
warn,
|
||||||
|
};
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedServerName, OwnedUserId,
|
OwnedServerName, OwnedUserId,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result, err};
|
use conduwuit::{Err, Result, err, matrix::pdu::gen_event_id_canonical_json};
|
||||||
|
use conduwuit_service::Services;
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedRoomId, OwnedUserId, RoomId, ServerName,
|
OwnedRoomId, OwnedUserId, RoomId, ServerName,
|
||||||
|
@ -13,10 +14,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use serde_json::value::RawValue as RawJsonValue;
|
use serde_json::value::RawValue as RawJsonValue;
|
||||||
|
|
||||||
use crate::{
|
use crate::Ruma;
|
||||||
Ruma,
|
|
||||||
service::{Services, pdu::gen_event_id_canonical_json},
|
|
||||||
};
|
|
||||||
|
|
||||||
/// # `PUT /_matrix/federation/v1/send_leave/{roomId}/{eventId}`
|
/// # `PUT /_matrix/federation/v1/send_leave/{roomId}/{eventId}`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
use conduwuit::Result;
|
||||||
use ruma::api::federation::discovery::get_server_version;
|
use ruma::api::federation::discovery::get_server_version;
|
||||||
|
|
||||||
use crate::{Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /_matrix/federation/v1/version`
|
/// # `GET /_matrix/federation/v1/version`
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
|
use conduwuit::{Error, Result};
|
||||||
use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver};
|
use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver};
|
||||||
|
|
||||||
use crate::{Error, Result, Ruma};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `GET /.well-known/matrix/server`
|
/// # `GET /.well-known/matrix/server`
|
||||||
///
|
///
|
||||||
|
|
9
src/core/matrix/mod.rs
Normal file
9
src/core/matrix/mod.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
//! Core Matrix Library
|
||||||
|
|
||||||
|
pub mod event;
|
||||||
|
pub mod pdu;
|
||||||
|
pub mod state_res;
|
||||||
|
|
||||||
|
pub use event::Event;
|
||||||
|
pub use pdu::{PduBuilder, PduCount, PduEvent, PduId, RawPduId, StateKey};
|
||||||
|
pub use state_res::{EventTypeExt, RoomVersion, StateMap, TypeStateKey};
|
|
@ -1,7 +1,6 @@
|
||||||
mod builder;
|
mod builder;
|
||||||
mod content;
|
mod content;
|
||||||
mod count;
|
mod count;
|
||||||
mod event;
|
|
||||||
mod event_id;
|
mod event_id;
|
||||||
mod filter;
|
mod filter;
|
||||||
mod id;
|
mod id;
|
||||||
|
@ -17,8 +16,8 @@ mod unsigned;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId, OwnedServerName,
|
CanonicalJsonObject, CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch, OwnedEventId,
|
||||||
OwnedUserId, UInt, events::TimelineEventType,
|
OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, UInt, UserId, events::TimelineEventType,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::value::RawValue as RawJsonValue;
|
use serde_json::value::RawValue as RawJsonValue;
|
||||||
|
@ -27,12 +26,12 @@ pub use self::{
|
||||||
Count as PduCount, Id as PduId, Pdu as PduEvent, RawId as RawPduId,
|
Count as PduCount, Id as PduId, Pdu as PduEvent, RawId as RawPduId,
|
||||||
builder::{Builder, Builder as PduBuilder},
|
builder::{Builder, Builder as PduBuilder},
|
||||||
count::Count,
|
count::Count,
|
||||||
event::Event,
|
|
||||||
event_id::*,
|
event_id::*,
|
||||||
id::*,
|
id::*,
|
||||||
raw_id::*,
|
raw_id::*,
|
||||||
state_key::{ShortStateKey, StateKey},
|
state_key::{ShortStateKey, StateKey},
|
||||||
};
|
};
|
||||||
|
use super::Event;
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
|
||||||
/// Persistent Data Unit (Event)
|
/// Persistent Data Unit (Event)
|
||||||
|
@ -79,6 +78,36 @@ impl Pdu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Event for Pdu {
|
||||||
|
type Id = OwnedEventId;
|
||||||
|
|
||||||
|
fn event_id(&self) -> &Self::Id { &self.event_id }
|
||||||
|
|
||||||
|
fn room_id(&self) -> &RoomId { &self.room_id }
|
||||||
|
|
||||||
|
fn sender(&self) -> &UserId { &self.sender }
|
||||||
|
|
||||||
|
fn event_type(&self) -> &TimelineEventType { &self.kind }
|
||||||
|
|
||||||
|
fn content(&self) -> &RawJsonValue { &self.content }
|
||||||
|
|
||||||
|
fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch {
|
||||||
|
MilliSecondsSinceUnixEpoch(self.origin_server_ts)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn state_key(&self) -> Option<&str> { self.state_key.as_deref() }
|
||||||
|
|
||||||
|
fn prev_events(&self) -> impl DoubleEndedIterator<Item = &Self::Id> + Send + '_ {
|
||||||
|
self.prev_events.iter()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn auth_events(&self) -> impl DoubleEndedIterator<Item = &Self::Id> + Send + '_ {
|
||||||
|
self.auth_events.iter()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn redacts(&self) -> Option<&Self::Id> { self.redacts.as_ref() }
|
||||||
|
}
|
||||||
|
|
||||||
/// Prevent derived equality which wouldn't limit itself to event_id
|
/// Prevent derived equality which wouldn't limit itself to event_id
|
||||||
impl Eq for Pdu {}
|
impl Eq for Pdu {}
|
||||||
|
|
||||||
|
@ -87,12 +116,12 @@ impl PartialEq for Pdu {
|
||||||
fn eq(&self, other: &Self) -> bool { self.event_id == other.event_id }
|
fn eq(&self, other: &Self) -> bool { self.event_id == other.event_id }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ordering determined by the Pdu's ID, not the memory representations.
|
|
||||||
impl PartialOrd for Pdu {
|
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Ordering determined by the Pdu's ID, not the memory representations.
|
/// Ordering determined by the Pdu's ID, not the memory representations.
|
||||||
impl Ord for Pdu {
|
impl Ord for Pdu {
|
||||||
fn cmp(&self, other: &Self) -> Ordering { self.event_id.cmp(&other.event_id) }
|
fn cmp(&self, other: &Self) -> Ordering { self.event_id.cmp(&other.event_id) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ordering determined by the Pdu's ID, not the memory representations.
|
||||||
|
impl PartialOrd for Pdu {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
|
||||||
|
}
|
|
@ -4,7 +4,6 @@ pub(crate) mod error;
|
||||||
pub mod event_auth;
|
pub mod event_auth;
|
||||||
mod power_levels;
|
mod power_levels;
|
||||||
mod room_version;
|
mod room_version;
|
||||||
mod state_event;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_utils;
|
mod test_utils;
|
||||||
|
@ -36,9 +35,12 @@ use self::power_levels::PowerLevelsContentFields;
|
||||||
pub use self::{
|
pub use self::{
|
||||||
event_auth::{auth_check, auth_types_for_event},
|
event_auth::{auth_check, auth_types_for_event},
|
||||||
room_version::RoomVersion,
|
room_version::RoomVersion,
|
||||||
state_event::Event,
|
|
||||||
};
|
};
|
||||||
use crate::{debug, pdu::StateKey, trace, warn};
|
use crate::{
|
||||||
|
debug,
|
||||||
|
matrix::{event::Event, pdu::StateKey},
|
||||||
|
trace, warn,
|
||||||
|
};
|
||||||
|
|
||||||
/// A mapping of event type and state_key to some value `T`, usually an
|
/// A mapping of event type and state_key to some value `T`, usually an
|
||||||
/// `EventId`.
|
/// `EventId`.
|
|
@ -11,9 +11,9 @@ use ruma::{
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::{Error, from_str as from_json_str};
|
use serde_json::{Error, from_str as from_json_str};
|
||||||
use tracing::error;
|
|
||||||
|
|
||||||
use super::{Result, RoomVersion};
|
use super::{Result, RoomVersion};
|
||||||
|
use crate::error;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct IntRoomPowerLevelsEventContent {
|
struct IntRoomPowerLevelsEventContent {
|
|
@ -28,7 +28,10 @@ use serde_json::{
|
||||||
|
|
||||||
pub(crate) use self::event::PduEvent;
|
pub(crate) use self::event::PduEvent;
|
||||||
use super::auth_types_for_event;
|
use super::auth_types_for_event;
|
||||||
use crate::{Event, EventTypeExt, Result, StateMap, info};
|
use crate::{
|
||||||
|
Result, info,
|
||||||
|
matrix::{Event, EventTypeExt, StateMap},
|
||||||
|
};
|
||||||
|
|
||||||
static SERVER_TIMESTAMP: AtomicU64 = AtomicU64::new(0);
|
static SERVER_TIMESTAMP: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
|
@ -6,11 +6,10 @@ pub mod debug;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod info;
|
pub mod info;
|
||||||
pub mod log;
|
pub mod log;
|
||||||
|
pub mod matrix;
|
||||||
pub mod metrics;
|
pub mod metrics;
|
||||||
pub mod mods;
|
pub mod mods;
|
||||||
pub mod pdu;
|
|
||||||
pub mod server;
|
pub mod server;
|
||||||
pub mod state_res;
|
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
pub use ::arrayvec;
|
pub use ::arrayvec;
|
||||||
|
@ -23,9 +22,8 @@ pub use ::tracing;
|
||||||
pub use config::Config;
|
pub use config::Config;
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
pub use info::{rustc_flags_capture, version, version::version};
|
pub use info::{rustc_flags_capture, version, version::version};
|
||||||
pub use pdu::{Event, PduBuilder, PduCount, PduEvent, PduId, RawPduId, StateKey};
|
pub use matrix::{Event, EventTypeExt, PduCount, PduEvent, PduId, RoomVersion, pdu, state_res};
|
||||||
pub use server::Server;
|
pub use server::Server;
|
||||||
pub use state_res::{EventTypeExt, RoomVersion, StateMap, TypeStateKey};
|
|
||||||
pub use utils::{ctor, dtor, implement, result, result::Result};
|
pub use utils::{ctor, dtor, implement, result, result::Result};
|
||||||
|
|
||||||
pub use crate as conduwuit_core;
|
pub use crate as conduwuit_core;
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
use ruma::{MilliSecondsSinceUnixEpoch, OwnedEventId, RoomId, UserId, events::TimelineEventType};
|
|
||||||
use serde_json::value::RawValue as RawJsonValue;
|
|
||||||
|
|
||||||
use super::Pdu;
|
|
||||||
pub use crate::state_res::Event;
|
|
||||||
|
|
||||||
impl Event for Pdu {
|
|
||||||
type Id = OwnedEventId;
|
|
||||||
|
|
||||||
fn event_id(&self) -> &Self::Id { &self.event_id }
|
|
||||||
|
|
||||||
fn room_id(&self) -> &RoomId { &self.room_id }
|
|
||||||
|
|
||||||
fn sender(&self) -> &UserId { &self.sender }
|
|
||||||
|
|
||||||
fn event_type(&self) -> &TimelineEventType { &self.kind }
|
|
||||||
|
|
||||||
fn content(&self) -> &RawJsonValue { &self.content }
|
|
||||||
|
|
||||||
fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch {
|
|
||||||
MilliSecondsSinceUnixEpoch(self.origin_server_ts)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn state_key(&self) -> Option<&str> { self.state_key.as_deref() }
|
|
||||||
|
|
||||||
fn prev_events(&self) -> impl DoubleEndedIterator<Item = &Self::Id> + Send + '_ {
|
|
||||||
self.prev_events.iter()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn auth_events(&self) -> impl DoubleEndedIterator<Item = &Self::Id> + Send + '_ {
|
|
||||||
self.auth_events.iter()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn redacts(&self) -> Option<&Self::Id> { self.redacts.as_ref() }
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use conduwuit::{Err, Result, debug_info, debug_warn, error, implement};
|
use conduwuit::{Err, Result, debug_info, debug_warn, error, implement, matrix::pdu::PduBuilder};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomId, UserId,
|
RoomId, UserId,
|
||||||
events::{
|
events::{
|
||||||
|
@ -14,8 +14,6 @@ use ruma::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::pdu::PduBuilder;
|
|
||||||
|
|
||||||
/// Invite the user to the conduwuit admin room.
|
/// Invite the user to the conduwuit admin room.
|
||||||
///
|
///
|
||||||
/// This is equivalent to granting server admin privileges.
|
/// This is equivalent to granting server admin privileges.
|
||||||
|
|
|
@ -31,7 +31,6 @@ pub mod users;
|
||||||
extern crate conduwuit_core as conduwuit;
|
extern crate conduwuit_core as conduwuit;
|
||||||
extern crate conduwuit_database as database;
|
extern crate conduwuit_database as database;
|
||||||
|
|
||||||
pub use conduwuit::{PduBuilder, PduCount, PduEvent, pdu};
|
|
||||||
pub(crate) use service::{Args, Dep, Service};
|
pub(crate) use service::{Args, Dep, Service};
|
||||||
|
|
||||||
pub use crate::services::Services;
|
pub use crate::services::Services;
|
||||||
|
|
|
@ -5,7 +5,9 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
PduEvent, Result, StateMap, debug, err, implement, trace,
|
Result, debug, err, implement,
|
||||||
|
matrix::{PduEvent, StateMap},
|
||||||
|
trace,
|
||||||
utils::stream::{BroadbandExt, IterStream, ReadyExt, TryBroadbandExt, TryWidebandExt},
|
utils::stream::{BroadbandExt, IterStream, ReadyExt, TryBroadbandExt, TryWidebandExt},
|
||||||
};
|
};
|
||||||
use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join};
|
use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join};
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use std::{borrow::Borrow, collections::BTreeMap, iter::once, sync::Arc, time::Instant};
|
use std::{borrow::Borrow, collections::BTreeMap, iter::once, sync::Arc, time::Instant};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, EventTypeExt, PduEvent, Result, StateKey, debug, debug_info, err, implement, state_res,
|
Err, Result, debug, debug_info, err, implement,
|
||||||
|
matrix::{EventTypeExt, PduEvent, StateKey, state_res},
|
||||||
trace,
|
trace,
|
||||||
utils::stream::{BroadbandExt, ReadyExt},
|
utils::stream::{BroadbandExt, ReadyExt},
|
||||||
warn,
|
warn,
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use conduwuit::{Result, implement};
|
use conduwuit::{Result, implement, matrix::pdu::PduEvent};
|
||||||
use database::{Deserialized, Json, Map};
|
use conduwuit_database::{Deserialized, Json, Map};
|
||||||
use ruma::{CanonicalJsonObject, EventId};
|
use ruma::{CanonicalJsonObject, EventId};
|
||||||
|
|
||||||
use crate::PduEvent;
|
|
||||||
|
|
||||||
pub struct Service {
|
pub struct Service {
|
||||||
db: Data,
|
db: Data,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,11 @@ mod data;
|
||||||
|
|
||||||
use std::{collections::BTreeMap, sync::Arc};
|
use std::{collections::BTreeMap, sync::Arc};
|
||||||
|
|
||||||
use conduwuit::{PduCount, PduId, RawPduId, Result, debug, err, warn};
|
use conduwuit::{
|
||||||
|
Result, debug, err,
|
||||||
|
matrix::pdu::{PduCount, PduId, RawPduId},
|
||||||
|
warn,
|
||||||
|
};
|
||||||
use futures::{Stream, TryFutureExt, try_join};
|
use futures::{Stream, TryFutureExt, try_join};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedEventId, OwnedUserId, RoomId, UserId,
|
OwnedEventId, OwnedUserId, RoomId, UserId,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::{borrow::Borrow, fmt::Debug, mem::size_of_val, sync::Arc};
|
use std::{borrow::Borrow, fmt::Debug, mem::size_of_val, sync::Arc};
|
||||||
|
|
||||||
pub use conduwuit::pdu::{ShortEventId, ShortId, ShortRoomId, ShortStateKey};
|
pub use conduwuit::matrix::pdu::{ShortEventId, ShortId, ShortRoomId, ShortStateKey};
|
||||||
use conduwuit::{Result, StateKey, err, implement, utils, utils::IterStream};
|
use conduwuit::{Result, err, implement, matrix::StateKey, utils, utils::IterStream};
|
||||||
use database::{Deserialized, Get, Map, Qry};
|
use database::{Deserialized, Get, Map, Qry};
|
||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use ruma::{EventId, RoomId, events::StateEventType};
|
use ruma::{EventId, RoomId, events::StateEventType};
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
|
||||||
use conduwuit::{PduEvent, Result, StateKey, err, implement};
|
use conduwuit::{
|
||||||
|
Result, err, implement,
|
||||||
|
matrix::{PduEvent, StateKey},
|
||||||
|
};
|
||||||
use futures::{Stream, StreamExt, TryFutureExt};
|
use futures::{Stream, StreamExt, TryFutureExt};
|
||||||
use ruma::{EventId, RoomId, events::StateEventType};
|
use ruma::{EventId, RoomId, events::StateEventType};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
use std::{borrow::Borrow, ops::Deref, sync::Arc};
|
use std::{borrow::Borrow, ops::Deref, sync::Arc};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
PduEvent, Result, StateKey, at, err, implement, pair_of,
|
Result, at, err, implement,
|
||||||
|
matrix::{PduEvent, StateKey},
|
||||||
|
pair_of,
|
||||||
utils::{
|
utils::{
|
||||||
result::FlatOk,
|
result::FlatOk,
|
||||||
stream::{BroadbandExt, IterStream, ReadyExt, TryIgnore},
|
stream::{BroadbandExt, IterStream, ReadyExt, TryIgnore},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use database::Deserialized;
|
use conduwuit_database::Deserialized;
|
||||||
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, future::try_join, pin_mut};
|
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, future::try_join, pin_mut};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
EventId, OwnedEventId, UserId,
|
EventId, OwnedEventId, UserId,
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
use std::{collections::BTreeMap, sync::Arc};
|
use std::{collections::BTreeMap, sync::Arc};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
PduCount, PduEvent, PduId, RawPduId, Result, err,
|
Result, err,
|
||||||
|
matrix::pdu::{PduCount, PduEvent, PduId, RawPduId},
|
||||||
utils::{
|
utils::{
|
||||||
ReadyExt,
|
ReadyExt,
|
||||||
stream::{TryIgnore, WidebandExt},
|
stream::{TryIgnore, WidebandExt},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use database::{Deserialized, Map};
|
use conduwuit_database::{Deserialized, Map};
|
||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonValue, EventId, OwnedUserId, RoomId, UserId,
|
CanonicalJsonValue, EventId, OwnedUserId, RoomId, UserId,
|
||||||
|
|
|
@ -10,16 +10,19 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
pub use conduwuit::matrix::pdu::{PduId, RawPduId};
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Error, Result, Server, at, debug, debug_warn, err, error, implement, info,
|
Err, Error, Result, Server, at, debug, debug_warn, err, error, implement, info,
|
||||||
|
matrix::{
|
||||||
|
Event,
|
||||||
pdu::{EventHash, PduBuilder, PduCount, PduEvent, gen_event_id},
|
pdu::{EventHash, PduBuilder, PduCount, PduEvent, gen_event_id},
|
||||||
state_res::{self, Event, RoomVersion},
|
state_res::{self, RoomVersion},
|
||||||
|
},
|
||||||
utils::{
|
utils::{
|
||||||
self, IterStream, MutexMap, MutexMapGuard, ReadyExt, future::TryExtExt, stream::TryIgnore,
|
self, IterStream, MutexMap, MutexMapGuard, ReadyExt, future::TryExtExt, stream::TryIgnore,
|
||||||
},
|
},
|
||||||
validated, warn,
|
validated, warn,
|
||||||
};
|
};
|
||||||
pub use conduwuit::{PduId, RawPduId};
|
|
||||||
use futures::{
|
use futures::{
|
||||||
Future, FutureExt, Stream, StreamExt, TryStreamExt, future, future::ready, pin_mut,
|
Future, FutureExt, Stream, StreamExt, TryStreamExt, future, future::ready, pin_mut,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue