From d8b23f789d826b17aed2aa04501704ffac94bf0e Mon Sep 17 00:00:00 2001 From: Johannes Becker Date: Tue, 8 Jun 2021 07:17:56 +0200 Subject: [PATCH] appservice: Expand set_event_handler docs --- matrix_sdk_appservice/src/lib.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/matrix_sdk_appservice/src/lib.rs b/matrix_sdk_appservice/src/lib.rs index 40c429f5..3a445460 100644 --- a/matrix_sdk_appservice/src/lib.rs +++ b/matrix_sdk_appservice/src/lib.rs @@ -350,9 +350,22 @@ impl Appservice { Ok(entry.value().clone()) } - /// Convenience wrapper around [`Client::set_event_handler()`] + /// Convenience wrapper around [`Client::set_event_handler()`] that attaches + /// the event handler to the [`MainUser`]'s [`Client`] /// - /// Attaches the event handler to the [`MainUser`]'s [`Client`] + /// Note that the event handler in the [`Appservice`] context only triggers + /// [`join` room `timeline` events], so no state events or events from the + /// `invite`, `knock` or `leave` scope. The rationale behind that is + /// that incoming Appservice transactions from the homeserver are not + /// necessarily bound to a specific user but can cover a multitude of + /// namespaces, and as such the Appservice basically only "observes + /// joined rooms". Also currently homeservers only push PDUs to appservices, + /// no EDUs. There's the open [MSC2409] regarding supporting EDUs in the + /// future, though it seems to be planned to put EDUs into a different + /// JSON key than `events` to stay backwards compatible. + /// + /// [`join` room `timeline` events]: https://spec.matrix.org/unstable/client-server-api/#get_matrixclientr0sync + /// [MSC2409]: https://github.com/matrix-org/matrix-doc/pull/2409 pub async fn set_event_handler(&mut self, handler: Box) -> Result<()> { let client = self.get_cached_client(None)?;