diff --git a/src/message_command_dispatcher.cpp b/src/message_command_dispatcher.cpp index 66f2948..338e43a 100644 --- a/src/message_command_dispatcher.cpp +++ b/src/message_command_dispatcher.cpp @@ -3,6 +3,7 @@ #include #include #include +#include // TODO: move SyncedBy to global #include #include @@ -249,7 +250,26 @@ bool MessageCommandDispatcher::onEvent(const Message::Events::MessageConstruct& return false; } - // TODO: skip unrelyable synced + // skip unrelyable synced + if (e.e.all_of()) { + const auto& list = e.e.get().list; + if ( + std::find_if( + list.cbegin(), list.cend(), + [this](const auto& it) { + // TODO: add weak self + return _cr.all_of< + Contact::Components::TagSelfStrong, + Contact::Components::TagSelfWeak // trust weak self + >(it); + } + ) == list.cend() + ) { + // self not found + // TODO: config for self only + return false; + } + } const bool is_private = _cr.any_of(e.e.get().c); @@ -285,7 +305,6 @@ bool MessageCommandDispatcher::onEvent(const Message::Events::MessageConstruct& std::cout << "MCD: got command '" << message_text << "'\n"; - std::string_view first_word; std::string_view second_word; std::string_view::size_type pos_next = 0;