From e8b5534a713279466256e92c695a44d30d4bb883 Mon Sep 17 00:00:00 2001 From: Devin R Date: Sat, 28 Mar 2020 07:07:50 -0400 Subject: [PATCH] start handle_power_levels --- src/event_emitter/mod.rs | 43 +++++++++++++++++++++++++++++++++++++++- src/lib.rs | 1 + 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/event_emitter/mod.rs b/src/event_emitter/mod.rs index a383ea2f..7bce3fc1 100644 --- a/src/event_emitter/mod.rs +++ b/src/event_emitter/mod.rs @@ -1,3 +1,44 @@ +// Copyright 2020 Damir Jelić +// Copyright 2020 The Matrix.org Foundation C.I.C. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::collections::HashMap; +use std::sync::{Arc, RwLock}; + +use crate::api::r0 as api; +use crate::events::collections::all::{Event, RoomEvent, StateEvent}; +use crate::events::room::{ + aliases::AliasesEvent, + canonical_alias::CanonicalAliasEvent, + member::{MemberEvent, MemberEventContent, MembershipState}, + name::NameEvent, +}; +use crate::events::EventResult; +use crate::identifiers::RoomAliasId; +use crate::session::Session; +use crate::models::Room; + +use js_int::{Int, UInt}; +#[cfg(feature = "encryption")] +use tokio::sync::Mutex; + +#[cfg(feature = "encryption")] +use crate::crypto::{OlmMachine, OneTimeKeys}; +#[cfg(feature = "encryption")] +use ruma_client_api::r0::keys::{upload_keys::Response as KeysUploadResponse, DeviceKeys}; + pub trait EventEmitter { - fn on_room_name() {} + fn on_room_name(&mut self, _: &Room) {} + fn on_room_member(&mut self, _: &Room) {} } diff --git a/src/lib.rs b/src/lib.rs index 5adfc537..47053fb3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,7 @@ mod base_client; mod error; mod models; mod session; +mod event_emitter; #[cfg(feature = "encryption")] mod crypto;