handle private messages

This commit is contained in:
Green Sky 2023-12-05 20:53:15 +01:00
parent 92cf42ead5
commit c74ccbaff1
No known key found for this signature in database

View File

@ -251,11 +251,18 @@ bool MessageCommandDispatcher::onEvent(const Message::Events::MessageConstruct&
// TODO: skip unrelyable synced // TODO: skip unrelyable synced
// TODO: is private const bool is_private = _cr.any_of<Contact::Components::TagSelfWeak, Contact::Components::TagSelfStrong>(e.e.get<Message::Components::ContactTo>().c);
// TODO: has the permissions if (is_private) {
// check for command prefix
if (false) { // is private if (
message_text.at(0) == '!' ||
message_text.at(0) == '/'
) {
// starts with command prefix
// remove c prefix
message_text = message_text.substr(1);
}
} else { } else {
// check for command prefix // check for command prefix
if ( if (
@ -325,8 +332,7 @@ bool MessageCommandDispatcher::onEvent(const Message::Events::MessageConstruct&
return false; return false;
} }
command_it->second.fn(params, e.e); return command_it->second.fn(params, e.e);
return true;
} }
} }
@ -338,8 +344,7 @@ bool MessageCommandDispatcher::onEvent(const Message::Events::MessageConstruct&
} }
params = std::string{second_word} + " " + params; params = std::string{second_word} + " " + params;
command_it->second.fn(params, e.e); return command_it->second.fn(params, e.e);
return true;
} }
return false; return false;