From f55a86dd669b4a2104567a4ce1b740df0590bea1 Mon Sep 17 00:00:00 2001 From: Johannes Becker Date: Wed, 13 Jul 2022 17:16:12 +0200 Subject: [PATCH] feat(appservice): Add method to get virtual user map --- crates/matrix-sdk-appservice/src/lib.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk-appservice/src/lib.rs b/crates/matrix-sdk-appservice/src/lib.rs index f84e9ce70..51592ec34 100644 --- a/crates/matrix-sdk-appservice/src/lib.rs +++ b/crates/matrix-sdk-appservice/src/lib.rs @@ -85,7 +85,7 @@ //! //! [Application Service]: https://matrix.org/docs/spec/application_service/r0.1.2 //! [matrix-org/matrix-rust-sdk#228]: https://github.com/matrix-org/matrix-rust-sdk/issues/228 -//! [examples directory]: https://github.com/matrix-org/matrix-rust-sdk/tree/master/matrix_sdk_appservice/examples +//! [examples directory]: https://github.com/matrix-org/matrix-rust-sdk/tree/main/crates/matrix-sdk-appservice/examples use std::{convert::TryInto, sync::Arc}; @@ -216,8 +216,8 @@ impl AppService { /// /// # Arguments /// - /// * `localpart` - Used for constructing the accordingly. If `None` is - /// given it uses the `sender_localpart` from the registration. + /// * `localpart` - Used for constructing the virtual user accordingly. If + /// `None` is given it uses the `sender_localpart` from the registration. /// /// [registration]: https://matrix.org/docs/spec/application_service/r0.1.2#registration /// [assert the identity]: https://matrix.org/docs/spec/application_service/r0.1.2#identity-assertion @@ -245,6 +245,11 @@ impl AppService { VirtualUserBuilder::new(self, localpart) } + /// Get the map containing all constructed virtual user clients. + pub fn virtual_users(&self) -> Arc> { + self.clients.clone() + } + /// Register a responder for queries about the existence of a user with a /// given mxid. /// @@ -491,8 +496,7 @@ impl AppService { Ok(()) } - /// Convenience method that runs an http server depending on the selected - /// server feature. + /// Convenience method that runs an http server. /// /// This is a blocking call that tries to listen on the provided host and /// port.