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::{
|
||||
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::{
|
||||
stream::{IterStream, ReadyExt},
|
||||
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 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},
|
||||
warn,
|
||||
};
|
||||
|
|
|
@ -3,10 +3,13 @@ use std::fmt::Write;
|
|||
use axum::extract::State;
|
||||
use axum_client_ip::InsecureClientIp;
|
||||
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},
|
||||
warn,
|
||||
};
|
||||
use conduwuit_service::Services;
|
||||
use futures::{FutureExt, StreamExt};
|
||||
use register::RegistrationKind;
|
||||
use ruma::{
|
||||
|
@ -30,7 +33,6 @@ use ruma::{
|
|||
},
|
||||
push,
|
||||
};
|
||||
use service::Services;
|
||||
|
||||
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH, join_room_by_id_helper};
|
||||
use crate::Ruma;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{Err, err};
|
||||
use conduwuit::{Err, Result, err};
|
||||
use conduwuit_service::Services;
|
||||
use ruma::{
|
||||
RoomId, UserId,
|
||||
api::client::config::{
|
||||
|
@ -15,7 +16,7 @@ use ruma::{
|
|||
use serde::Deserialize;
|
||||
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}`
|
||||
///
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{Err, Result, debug};
|
||||
use conduwuit_service::Services;
|
||||
use futures::StreamExt;
|
||||
use rand::seq::SliceRandom;
|
||||
use ruma::{
|
||||
OwnedServerName, RoomAliasId, RoomId,
|
||||
api::client::alias::{create_alias, delete_alias, get_alias},
|
||||
};
|
||||
use service::Services;
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::cmp::Ordering;
|
||||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{Err, err};
|
||||
use conduwuit::{Err, Result, err};
|
||||
use ruma::{
|
||||
UInt,
|
||||
api::client::backup::{
|
||||
|
@ -13,7 +13,7 @@ use ruma::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `POST /_matrix/client/r0/room_keys/version`
|
||||
///
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
Err, PduEvent, Result, at, debug_warn, err, ref_at,
|
||||
Err, Result, at, debug_warn, err,
|
||||
matrix::pdu::PduEvent,
|
||||
ref_at,
|
||||
utils::{
|
||||
IterStream,
|
||||
future::TryExtExt,
|
||||
stream::{BroadbandExt, ReadyExt, TryIgnore, WidebandExt},
|
||||
},
|
||||
};
|
||||
use conduwuit_service::rooms::{lazy_loading, lazy_loading::Options, short::ShortStateKey};
|
||||
use futures::{
|
||||
FutureExt, StreamExt, TryFutureExt, TryStreamExt,
|
||||
future::{OptionFuture, join, join3, try_join3},
|
||||
};
|
||||
use ruma::{OwnedEventId, UserId, api::client::context::get_context, events::StateEventType};
|
||||
use service::rooms::{lazy_loading, lazy_loading::Options, short::ShortStateKey};
|
||||
|
||||
use crate::{
|
||||
Ruma,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use axum::extract::State;
|
||||
use axum_client_ip::InsecureClientIp;
|
||||
use conduwuit::{Err, debug, err};
|
||||
use conduwuit::{Err, Error, Result, debug, err, utils};
|
||||
use futures::StreamExt;
|
||||
use ruma::{
|
||||
MilliSecondsSinceUnixEpoch, OwnedDeviceId,
|
||||
|
@ -12,7 +12,7 @@ use ruma::{
|
|||
};
|
||||
|
||||
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`
|
||||
///
|
||||
|
|
|
@ -9,6 +9,7 @@ use conduwuit::{
|
|||
stream::{ReadyExt, WidebandExt},
|
||||
},
|
||||
};
|
||||
use conduwuit_service::Services;
|
||||
use futures::{
|
||||
FutureExt, StreamExt, TryFutureExt,
|
||||
future::{join, join4, join5},
|
||||
|
@ -35,7 +36,6 @@ use ruma::{
|
|||
},
|
||||
uint,
|
||||
};
|
||||
use service::Services;
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::err;
|
||||
use conduwuit::{Result, err};
|
||||
use ruma::api::client::filter::{create_filter, get_filter};
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/client/r0/user/{userId}/filter/{filterId}`
|
||||
///
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};
|
|||
|
||||
use axum::extract::State;
|
||||
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 ruma::{
|
||||
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
|
||||
|
@ -23,10 +24,7 @@ use ruma::{
|
|||
use serde_json::json;
|
||||
|
||||
use super::SESSION_ID_LENGTH;
|
||||
use crate::{
|
||||
Ruma,
|
||||
service::{Services, users::parse_master_key},
|
||||
};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `POST /_matrix/client/r0/keys/upload`
|
||||
///
|
||||
|
|
|
@ -9,13 +9,25 @@ use std::{
|
|||
use axum::extract::State;
|
||||
use axum_client_ip::InsecureClientIp;
|
||||
use conduwuit::{
|
||||
Err, PduEvent, Result, StateKey, at, debug, debug_info, debug_warn, err, error, info,
|
||||
pdu::{PduBuilder, gen_event_id_canonical_json},
|
||||
Err, Result, at, debug, debug_info, debug_warn, err, error, info,
|
||||
matrix::{
|
||||
StateKey,
|
||||
pdu::{PduBuilder, PduEvent, gen_event_id, gen_event_id_canonical_json},
|
||||
state_res,
|
||||
},
|
||||
result::{FlatOk, NotFound},
|
||||
state_res, trace,
|
||||
trace,
|
||||
utils::{self, IterStream, ReadyExt, shuffle},
|
||||
warn,
|
||||
};
|
||||
use conduwuit_service::{
|
||||
Services,
|
||||
appservice::RegistrationInfo,
|
||||
rooms::{
|
||||
state::RoomMutexGuard,
|
||||
state_compressor::{CompressedState, HashSetCompressStateEvent},
|
||||
},
|
||||
};
|
||||
use futures::{FutureExt, StreamExt, TryFutureExt, future::join4, join};
|
||||
use ruma::{
|
||||
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};
|
||||
|
||||
|
|
|
@ -1,12 +1,24 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
Err, Event, PduCount, PduEvent, Result, at,
|
||||
Err, Result, at,
|
||||
matrix::{
|
||||
Event,
|
||||
pdu::{PduCount, PduEvent},
|
||||
},
|
||||
utils::{
|
||||
IterStream, ReadyExt,
|
||||
result::{FlatOk, LogErr},
|
||||
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 ruma::{
|
||||
RoomId, UserId,
|
||||
|
@ -17,14 +29,6 @@ use ruma::{
|
|||
events::{AnyStateEvent, StateEventType, TimelineEventType, TimelineEventType::*},
|
||||
serde::Raw,
|
||||
};
|
||||
use service::{
|
||||
Services,
|
||||
rooms::{
|
||||
lazy_loading,
|
||||
lazy_loading::{Options, Witness},
|
||||
timeline::PdusIterItem,
|
||||
},
|
||||
};
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use axum::extract::State;
|
||||
use conduwuit::utils;
|
||||
use conduwuit::{Error, Result, utils};
|
||||
use ruma::{
|
||||
api::client::{account, error::ErrorKind},
|
||||
authentication::TokenType,
|
||||
};
|
||||
|
||||
use super::TOKEN_LENGTH;
|
||||
use crate::{Error, Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `POST /_matrix/client/v3/user/{userId}/openid/request_token`
|
||||
///
|
||||
|
|
|
@ -3,10 +3,11 @@ use std::collections::BTreeMap;
|
|||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
Err, Error, Result,
|
||||
pdu::PduBuilder,
|
||||
matrix::pdu::PduBuilder,
|
||||
utils::{IterStream, stream::TryIgnore},
|
||||
warn,
|
||||
};
|
||||
use conduwuit_service::Services;
|
||||
use futures::{StreamExt, TryStreamExt, future::join3};
|
||||
use ruma::{
|
||||
OwnedMxcUri, OwnedRoomId, UserId,
|
||||
|
@ -22,7 +23,6 @@ use ruma::{
|
|||
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||
presence::PresenceState,
|
||||
};
|
||||
use service::Services;
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{Err, err};
|
||||
use conduwuit::{Err, Error, Result, err};
|
||||
use conduwuit_service::Services;
|
||||
use ruma::{
|
||||
CanonicalJsonObject, CanonicalJsonValue,
|
||||
api::client::{
|
||||
|
@ -19,9 +20,8 @@ use ruma::{
|
|||
RemovePushRuleError, Ruleset,
|
||||
},
|
||||
};
|
||||
use service::Services;
|
||||
|
||||
use crate::{Error, Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/client/r0/pushrules/`
|
||||
///
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{Err, PduCount, err};
|
||||
use conduwuit::{Err, PduCount, Result, err};
|
||||
use ruma::{
|
||||
MilliSecondsSinceUnixEpoch,
|
||||
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`
|
||||
///
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{Result, matrix::pdu::PduBuilder};
|
||||
use ruma::{
|
||||
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}`
|
||||
///
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
PduCount, Result, at,
|
||||
Result, at,
|
||||
matrix::pdu::PduCount,
|
||||
utils::{IterStream, ReadyExt, result::FlatOk, stream::WidebandExt},
|
||||
};
|
||||
use conduwuit_service::{Services, rooms::timeline::PdusIterItem};
|
||||
use futures::StreamExt;
|
||||
use ruma::{
|
||||
EventId, RoomId, UInt, UserId,
|
||||
|
@ -15,7 +17,6 @@ use ruma::{
|
|||
},
|
||||
events::{TimelineEventType, relation::RelationType},
|
||||
};
|
||||
use service::{Services, rooms::timeline::PdusIterItem};
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ use std::time::Duration;
|
|||
|
||||
use axum::extract::State;
|
||||
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 ruma::{
|
||||
EventId, RoomId, UserId,
|
||||
|
@ -15,10 +16,7 @@ use ruma::{
|
|||
};
|
||||
use tokio::time::sleep;
|
||||
|
||||
use crate::{
|
||||
Error, Result, Ruma, debug_info,
|
||||
service::{Services, pdu::PduEvent},
|
||||
};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `POST /_matrix/client/v3/rooms/{roomId}/report`
|
||||
///
|
||||
|
|
|
@ -2,8 +2,11 @@ use std::collections::BTreeMap;
|
|||
|
||||
use axum::extract::State;
|
||||
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 ruma::{
|
||||
CanonicalJsonObject, Int, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, RoomId, RoomVersionId,
|
||||
|
@ -29,7 +32,6 @@ use ruma::{
|
|||
serde::{JsonObject, Raw},
|
||||
};
|
||||
use serde_json::{json, value::to_raw_value};
|
||||
use service::{Services, appservice::RegistrationInfo};
|
||||
|
||||
use crate::{Ruma, client::invite_helper};
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
use std::cmp::max;
|
||||
|
||||
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 ruma::{
|
||||
CanonicalJsonObject, RoomId, RoomVersionId,
|
||||
|
|
|
@ -2,10 +2,12 @@ use std::collections::BTreeMap;
|
|||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
Err, PduEvent, Result, at, is_true,
|
||||
Err, Result, at, is_true,
|
||||
matrix::pdu::PduEvent,
|
||||
result::FlatOk,
|
||||
utils::{IterStream, stream::ReadyExt},
|
||||
};
|
||||
use conduwuit_service::{Services, rooms::search::RoomQuery};
|
||||
use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::OptionFuture};
|
||||
use ruma::{
|
||||
OwnedRoomId, RoomId, UInt, UserId,
|
||||
|
@ -17,7 +19,6 @@ use ruma::{
|
|||
serde::Raw,
|
||||
};
|
||||
use search_events::v3::{Request, Response};
|
||||
use service::{Services, rooms::search::RoomQuery};
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
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 serde_json::from_str;
|
||||
|
||||
use crate::{Result, Ruma, service::pdu::PduBuilder, utils};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}`
|
||||
///
|
||||
|
|
|
@ -2,7 +2,11 @@ use std::time::Duration;
|
|||
|
||||
use axum::extract::State;
|
||||
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 ruma::{
|
||||
UserId,
|
||||
|
@ -22,10 +26,9 @@ use ruma::{
|
|||
uiaa,
|
||||
},
|
||||
};
|
||||
use service::uiaa::SESSION_ID_LENGTH;
|
||||
|
||||
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
||||
use crate::{Error, Result, Ruma, utils, utils::hash};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/client/v3/login`
|
||||
///
|
||||
|
|
|
@ -8,16 +8,16 @@ use conduwuit::{
|
|||
Err, Result,
|
||||
utils::{future::TryExtExt, stream::IterStream},
|
||||
};
|
||||
use futures::{StreamExt, TryFutureExt, future::OptionFuture};
|
||||
use ruma::{
|
||||
OwnedRoomId, OwnedServerName, RoomId, UInt, UserId, api::client::space::get_hierarchy,
|
||||
};
|
||||
use service::{
|
||||
use conduwuit_service::{
|
||||
Services,
|
||||
rooms::spaces::{
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
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 ruma::{
|
||||
OwnedEventId, RoomId, UserId,
|
||||
|
@ -16,7 +21,6 @@ use ruma::{
|
|||
},
|
||||
serde::Raw,
|
||||
};
|
||||
use service::Services;
|
||||
|
||||
use crate::{Ruma, RumaResponse};
|
||||
|
||||
|
|
|
@ -3,12 +3,14 @@ mod v4;
|
|||
mod v5;
|
||||
|
||||
use conduwuit::{
|
||||
PduCount,
|
||||
Error, PduCount, Result,
|
||||
matrix::pdu::PduEvent,
|
||||
utils::{
|
||||
IterStream,
|
||||
stream::{BroadbandExt, ReadyExt, TryIgnore},
|
||||
},
|
||||
};
|
||||
use conduwuit_service::Services;
|
||||
use futures::{StreamExt, pin_mut};
|
||||
use ruma::{
|
||||
RoomId, UserId,
|
||||
|
@ -21,7 +23,6 @@ use ruma::{
|
|||
pub(crate) use self::{
|
||||
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] =
|
||||
&[CallInvite, PollStart, Beacon, RoomEncrypted, RoomMessage, Sticker];
|
||||
|
|
|
@ -6,9 +6,12 @@ use std::{
|
|||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
PduCount, PduEvent, Result, at, err, error, extract_variant, is_equal_to, pair_of,
|
||||
pdu::{Event, EventHash},
|
||||
ref_at,
|
||||
Result, at, err, error, extract_variant, is_equal_to,
|
||||
matrix::{
|
||||
Event,
|
||||
pdu::{EventHash, PduCount, PduEvent},
|
||||
},
|
||||
pair_of, ref_at,
|
||||
result::FlatOk,
|
||||
utils::{
|
||||
self, BoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
||||
|
|
|
@ -6,13 +6,19 @@ use std::{
|
|||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{
|
||||
Error, PduEvent, Result, TypeStateKey, debug, error, extract_variant, trace,
|
||||
Error, Result, debug, error, extract_variant,
|
||||
matrix::{
|
||||
TypeStateKey,
|
||||
pdu::{PduCount, PduEvent},
|
||||
},
|
||||
trace,
|
||||
utils::{
|
||||
BoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
||||
math::{ruma_from_usize, usize_from_ruma},
|
||||
},
|
||||
warn,
|
||||
};
|
||||
use conduwuit_service::rooms::read_receipt::pack_receipts;
|
||||
use futures::{FutureExt, StreamExt, TryFutureExt};
|
||||
use ruma::{
|
||||
DeviceId, OwnedEventId, OwnedRoomId, RoomId, UInt, UserId,
|
||||
|
@ -27,7 +33,6 @@ use ruma::{
|
|||
serde::Raw,
|
||||
uint,
|
||||
};
|
||||
use service::{PduCount, rooms::read_receipt::pack_receipts};
|
||||
|
||||
use super::{filter_rooms, share_encrypted_room};
|
||||
use crate::{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use axum::extract::State;
|
||||
use conduwuit::Result;
|
||||
use ruma::{
|
||||
api::client::tag::{create_tag, delete_tag, get_tags},
|
||||
events::{
|
||||
|
@ -9,7 +10,7 @@ use ruma::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}`
|
||||
///
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use conduwuit::Result;
|
||||
use ruma::api::client::thirdparty::get_protocols;
|
||||
|
||||
use crate::{Result, Ruma, RumaResponse};
|
||||
use crate::{Ruma, RumaResponse};
|
||||
|
||||
/// # `GET /_matrix/client/r0/thirdparty/protocols`
|
||||
///
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{PduCount, PduEvent, at};
|
||||
use conduwuit::{
|
||||
Result, at,
|
||||
matrix::pdu::{PduCount, PduEvent},
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use ruma::{api::client::threads::get_threads, uint};
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/threads`
|
||||
pub(crate) async fn get_threads_route(
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::collections::BTreeMap;
|
|||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{Error, Result};
|
||||
use conduwuit_service::sending::EduBuf;
|
||||
use futures::StreamExt;
|
||||
use ruma::{
|
||||
api::{
|
||||
|
@ -10,7 +11,6 @@ use ruma::{
|
|||
},
|
||||
to_device::DeviceIdOrAllDevices,
|
||||
};
|
||||
use service::sending::EduBuf;
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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 crate::{Result, Ruma, utils};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}`
|
||||
///
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use axum::{Json, extract::State, response::IntoResponse};
|
||||
use conduwuit::Result;
|
||||
use futures::StreamExt;
|
||||
use ruma::api::client::discovery::get_supported_versions;
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/client/versions`
|
||||
///
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::utils::TryFutureExtExt;
|
||||
use conduwuit::{Result, utils::TryFutureExtExt};
|
||||
use futures::{StreamExt, pin_mut};
|
||||
use ruma::{
|
||||
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`
|
||||
///
|
||||
|
|
|
@ -2,12 +2,12 @@ use std::time::{Duration, SystemTime};
|
|||
|
||||
use axum::extract::State;
|
||||
use base64::{Engine as _, engine::general_purpose};
|
||||
use conduwuit::{Err, utils};
|
||||
use conduwuit::{Err, Result, utils};
|
||||
use hmac::{Hmac, Mac};
|
||||
use ruma::{SecondsSinceUnixEpoch, UserId, api::client::voip::get_turn_server_info};
|
||||
use sha1::Sha1;
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
const RANDOM_USER_ID_LENGTH: usize = 10;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use axum::{Json, extract::State, response::IntoResponse};
|
||||
use conduwuit::{Error, Result};
|
||||
use ruma::api::client::{
|
||||
discovery::{
|
||||
discover_homeserver::{self, HomeserverInfo, SlidingSyncProxyInfo},
|
||||
|
@ -7,7 +8,7 @@ use ruma::api::client::{
|
|||
error::ErrorKind,
|
||||
};
|
||||
|
||||
use crate::{Error, Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /.well-known/matrix/client`
|
||||
///
|
||||
|
|
|
@ -8,8 +8,6 @@ pub mod server;
|
|||
extern crate conduwuit_core as conduwuit;
|
||||
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};
|
||||
|
||||
conduwuit::mod_ctor! {}
|
||||
|
|
|
@ -3,9 +3,11 @@ use conduwuit::{
|
|||
Err, Result,
|
||||
utils::stream::{BroadbandExt, IterStream},
|
||||
};
|
||||
use conduwuit_service::rooms::spaces::{
|
||||
Identifier, SummaryAccessibility, get_parent_children_via,
|
||||
};
|
||||
use futures::{FutureExt, StreamExt};
|
||||
use ruma::api::federation::space::get_hierarchy;
|
||||
use service::rooms::spaces::{Identifier, SummaryAccessibility, get_parent_children_via};
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
use axum::extract::State;
|
||||
use axum_client_ip::InsecureClientIp;
|
||||
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::{
|
||||
CanonicalJsonValue, OwnedUserId, UserId,
|
||||
api::{client::error::ErrorKind, federation::membership::create_invite},
|
||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||
serde::JsonObject,
|
||||
};
|
||||
use service::pdu::gen_event_id;
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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 ruma::{
|
||||
CanonicalJsonObject, OwnedUserId, RoomId, RoomVersionId, UserId,
|
||||
|
@ -14,10 +17,7 @@ use ruma::{
|
|||
};
|
||||
use serde_json::value::to_raw_value;
|
||||
|
||||
use crate::{
|
||||
Error, Result, Ruma,
|
||||
service::{Services, pdu::PduBuilder},
|
||||
};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/federation/v1/make_join/{roomId}/{userId}`
|
||||
///
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
use RoomVersionId::*;
|
||||
use axum::extract::State;
|
||||
use conduwuit::{Err, debug_warn};
|
||||
use conduwuit::{Err, Error, Result, debug_warn, matrix::pdu::PduBuilder, warn};
|
||||
use ruma::{
|
||||
RoomVersionId,
|
||||
api::{client::error::ErrorKind, federation::knock::create_knock_event_template},
|
||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||
};
|
||||
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}`
|
||||
///
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{Err, Result};
|
||||
use conduwuit::{Err, Result, matrix::pdu::PduBuilder};
|
||||
use ruma::{
|
||||
api::federation::membership::prepare_leave_event,
|
||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||
|
@ -7,7 +7,7 @@ use ruma::{
|
|||
use serde_json::value::to_raw_value;
|
||||
|
||||
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}`
|
||||
///
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::Result;
|
||||
use ruma::api::federation::openid::get_openid_userinfo;
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/federation/v1/openid/userinfo`
|
||||
///
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use axum::extract::State;
|
||||
use axum_client_ip::InsecureClientIp;
|
||||
use conduwuit::{Error, Result};
|
||||
use ruma::{
|
||||
api::{
|
||||
client::error::ErrorKind,
|
||||
|
@ -8,7 +9,7 @@ use ruma::{
|
|||
directory::Filter,
|
||||
};
|
||||
|
||||
use crate::{Error, Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `POST /_matrix/federation/v1/publicRooms`
|
||||
///
|
||||
|
|
|
@ -9,11 +9,15 @@ use conduwuit::{
|
|||
result::LogErr,
|
||||
trace,
|
||||
utils::{
|
||||
IterStream, ReadyExt,
|
||||
IterStream, ReadyExt, millis_since_unix_epoch,
|
||||
stream::{BroadbandExt, TryBroadbandExt, automatic_width},
|
||||
},
|
||||
warn,
|
||||
};
|
||||
use conduwuit_service::{
|
||||
Services,
|
||||
sending::{EDU_LIMIT, PDU_LIMIT},
|
||||
};
|
||||
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt};
|
||||
use itertools::Itertools;
|
||||
use ruma::{
|
||||
|
@ -33,16 +37,8 @@ use ruma::{
|
|||
serde::Raw,
|
||||
to_device::DeviceIdOrAllDevices,
|
||||
};
|
||||
use service::{
|
||||
Services,
|
||||
sending::{EDU_LIMIT, PDU_LIMIT},
|
||||
};
|
||||
use utils::millis_since_unix_epoch;
|
||||
|
||||
use crate::{
|
||||
Ruma,
|
||||
utils::{self},
|
||||
};
|
||||
use crate::Ruma;
|
||||
|
||||
type ResolvedMap = BTreeMap<OwnedEventId, Result>;
|
||||
type Pdu = (OwnedRoomId, OwnedEventId, CanonicalJsonObject);
|
||||
|
|
|
@ -9,6 +9,7 @@ use conduwuit::{
|
|||
utils::stream::{IterStream, TryBroadbandExt},
|
||||
warn,
|
||||
};
|
||||
use conduwuit_service::Services;
|
||||
use futures::{FutureExt, StreamExt, TryStreamExt};
|
||||
use ruma::{
|
||||
CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedUserId, RoomId,
|
||||
|
@ -20,7 +21,6 @@ use ruma::{
|
|||
},
|
||||
};
|
||||
use serde_json::value::{RawValue as RawJsonValue, to_raw_value};
|
||||
use service::Services;
|
||||
|
||||
use crate::Ruma;
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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 ruma::{
|
||||
OwnedServerName, OwnedUserId,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#![allow(deprecated)]
|
||||
|
||||
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 ruma::{
|
||||
OwnedRoomId, OwnedUserId, RoomId, ServerName,
|
||||
|
@ -13,10 +14,7 @@ use ruma::{
|
|||
};
|
||||
use serde_json::value::RawValue as RawJsonValue;
|
||||
|
||||
use crate::{
|
||||
Ruma,
|
||||
service::{Services, pdu::gen_event_id_canonical_json},
|
||||
};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `PUT /_matrix/federation/v1/send_leave/{roomId}/{eventId}`
|
||||
///
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use conduwuit::Result;
|
||||
use ruma::api::federation::discovery::get_server_version;
|
||||
|
||||
use crate::{Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `GET /_matrix/federation/v1/version`
|
||||
///
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use axum::extract::State;
|
||||
use conduwuit::{Error, Result};
|
||||
use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver};
|
||||
|
||||
use crate::{Error, Result, Ruma};
|
||||
use crate::Ruma;
|
||||
|
||||
/// # `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 content;
|
||||
mod count;
|
||||
mod event;
|
||||
mod event_id;
|
||||
mod filter;
|
||||
mod id;
|
||||
|
@ -17,8 +16,8 @@ mod unsigned;
|
|||
use std::cmp::Ordering;
|
||||
|
||||
use ruma::{
|
||||
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId, OwnedServerName,
|
||||
OwnedUserId, UInt, events::TimelineEventType,
|
||||
CanonicalJsonObject, CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch, OwnedEventId,
|
||||
OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, UInt, UserId, events::TimelineEventType,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
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,
|
||||
builder::{Builder, Builder as PduBuilder},
|
||||
count::Count,
|
||||
event::Event,
|
||||
event_id::*,
|
||||
id::*,
|
||||
raw_id::*,
|
||||
state_key::{ShortStateKey, StateKey},
|
||||
};
|
||||
use super::Event;
|
||||
use crate::Result;
|
||||
|
||||
/// 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
|
||||
impl Eq for Pdu {}
|
||||
|
||||
|
@ -87,12 +116,12 @@ impl PartialEq for Pdu {
|
|||
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.
|
||||
impl Ord for Pdu {
|
||||
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;
|
||||
mod power_levels;
|
||||
mod room_version;
|
||||
mod state_event;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_utils;
|
||||
|
@ -36,9 +35,12 @@ use self::power_levels::PowerLevelsContentFields;
|
|||
pub use self::{
|
||||
event_auth::{auth_check, auth_types_for_event},
|
||||
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
|
||||
/// `EventId`.
|
|
@ -11,9 +11,9 @@ use ruma::{
|
|||
};
|
||||
use serde::Deserialize;
|
||||
use serde_json::{Error, from_str as from_json_str};
|
||||
use tracing::error;
|
||||
|
||||
use super::{Result, RoomVersion};
|
||||
use crate::error;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct IntRoomPowerLevelsEventContent {
|
|
@ -28,7 +28,10 @@ use serde_json::{
|
|||
|
||||
pub(crate) use self::event::PduEvent;
|
||||
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);
|
||||
|
|
@ -6,11 +6,10 @@ pub mod debug;
|
|||
pub mod error;
|
||||
pub mod info;
|
||||
pub mod log;
|
||||
pub mod matrix;
|
||||
pub mod metrics;
|
||||
pub mod mods;
|
||||
pub mod pdu;
|
||||
pub mod server;
|
||||
pub mod state_res;
|
||||
pub mod utils;
|
||||
|
||||
pub use ::arrayvec;
|
||||
|
@ -23,9 +22,8 @@ pub use ::tracing;
|
|||
pub use config::Config;
|
||||
pub use error::Error;
|
||||
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 state_res::{EventTypeExt, RoomVersion, StateMap, TypeStateKey};
|
||||
pub use utils::{ctor, dtor, implement, result, result::Result};
|
||||
|
||||
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 conduwuit::{Err, Result, debug_info, debug_warn, error, implement};
|
||||
use conduwuit::{Err, Result, debug_info, debug_warn, error, implement, matrix::pdu::PduBuilder};
|
||||
use ruma::{
|
||||
RoomId, UserId,
|
||||
events::{
|
||||
|
@ -14,8 +14,6 @@ use ruma::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::pdu::PduBuilder;
|
||||
|
||||
/// Invite the user to the conduwuit admin room.
|
||||
///
|
||||
/// This is equivalent to granting server admin privileges.
|
||||
|
|
|
@ -31,7 +31,6 @@ pub mod users;
|
|||
extern crate conduwuit_core as conduwuit;
|
||||
extern crate conduwuit_database as database;
|
||||
|
||||
pub use conduwuit::{PduBuilder, PduCount, PduEvent, pdu};
|
||||
pub(crate) use service::{Args, Dep, Service};
|
||||
|
||||
pub use crate::services::Services;
|
||||
|
|
|
@ -5,7 +5,9 @@ use std::{
|
|||
};
|
||||
|
||||
use conduwuit::{
|
||||
PduEvent, Result, StateMap, debug, err, implement, trace,
|
||||
Result, debug, err, implement,
|
||||
matrix::{PduEvent, StateMap},
|
||||
trace,
|
||||
utils::stream::{BroadbandExt, IterStream, ReadyExt, TryBroadbandExt, TryWidebandExt},
|
||||
};
|
||||
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 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,
|
||||
utils::stream::{BroadbandExt, ReadyExt},
|
||||
warn,
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use conduwuit::{Result, implement};
|
||||
use database::{Deserialized, Json, Map};
|
||||
use conduwuit::{Result, implement, matrix::pdu::PduEvent};
|
||||
use conduwuit_database::{Deserialized, Json, Map};
|
||||
use ruma::{CanonicalJsonObject, EventId};
|
||||
|
||||
use crate::PduEvent;
|
||||
|
||||
pub struct Service {
|
||||
db: Data,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,11 @@ mod data;
|
|||
|
||||
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 ruma::{
|
||||
OwnedEventId, OwnedUserId, RoomId, UserId,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::{borrow::Borrow, fmt::Debug, mem::size_of_val, sync::Arc};
|
||||
|
||||
pub use conduwuit::pdu::{ShortEventId, ShortId, ShortRoomId, ShortStateKey};
|
||||
use conduwuit::{Result, StateKey, err, implement, utils, utils::IterStream};
|
||||
pub use conduwuit::matrix::pdu::{ShortEventId, ShortId, ShortRoomId, ShortStateKey};
|
||||
use conduwuit::{Result, err, implement, matrix::StateKey, utils, utils::IterStream};
|
||||
use database::{Deserialized, Get, Map, Qry};
|
||||
use futures::{Stream, StreamExt};
|
||||
use ruma::{EventId, RoomId, events::StateEventType};
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
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 ruma::{EventId, RoomId, events::StateEventType};
|
||||
use serde::Deserialize;
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
use std::{borrow::Borrow, ops::Deref, sync::Arc};
|
||||
|
||||
use conduwuit::{
|
||||
PduEvent, Result, StateKey, at, err, implement, pair_of,
|
||||
Result, at, err, implement,
|
||||
matrix::{PduEvent, StateKey},
|
||||
pair_of,
|
||||
utils::{
|
||||
result::FlatOk,
|
||||
stream::{BroadbandExt, IterStream, ReadyExt, TryIgnore},
|
||||
},
|
||||
};
|
||||
use database::Deserialized;
|
||||
use conduwuit_database::Deserialized;
|
||||
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, future::try_join, pin_mut};
|
||||
use ruma::{
|
||||
EventId, OwnedEventId, UserId,
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
use std::{collections::BTreeMap, sync::Arc};
|
||||
|
||||
use conduwuit::{
|
||||
PduCount, PduEvent, PduId, RawPduId, Result, err,
|
||||
Result, err,
|
||||
matrix::pdu::{PduCount, PduEvent, PduId, RawPduId},
|
||||
utils::{
|
||||
ReadyExt,
|
||||
stream::{TryIgnore, WidebandExt},
|
||||
},
|
||||
};
|
||||
use database::{Deserialized, Map};
|
||||
use conduwuit_database::{Deserialized, Map};
|
||||
use futures::{Stream, StreamExt};
|
||||
use ruma::{
|
||||
CanonicalJsonValue, EventId, OwnedUserId, RoomId, UserId,
|
||||
|
|
|
@ -10,16 +10,19 @@ use std::{
|
|||
};
|
||||
|
||||
use async_trait::async_trait;
|
||||
pub use conduwuit::matrix::pdu::{PduId, RawPduId};
|
||||
use conduwuit::{
|
||||
Err, Error, Result, Server, at, debug, debug_warn, err, error, implement, info,
|
||||
pdu::{EventHash, PduBuilder, PduCount, PduEvent, gen_event_id},
|
||||
state_res::{self, Event, RoomVersion},
|
||||
matrix::{
|
||||
Event,
|
||||
pdu::{EventHash, PduBuilder, PduCount, PduEvent, gen_event_id},
|
||||
state_res::{self, RoomVersion},
|
||||
},
|
||||
utils::{
|
||||
self, IterStream, MutexMap, MutexMapGuard, ReadyExt, future::TryExtExt, stream::TryIgnore,
|
||||
},
|
||||
validated, warn,
|
||||
};
|
||||
pub use conduwuit::{PduId, RawPduId};
|
||||
use futures::{
|
||||
Future, FutureExt, Stream, StreamExt, TryStreamExt, future, future::ready, pin_mut,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue