libkazv
Loading...
Searching...
No Matches
push-rules-desc-p.hpp
Go to the documentation of this file.
1/*
2 * This file is part of libkazv.
3 * SPDX-FileCopyrightText: 2020-2023 tusooa <tusooa@kazv.moe>
4 * SPDX-License-Identifier: AGPL-3.0-or-later
5 */
6
7#pragma once
8#include <libkazv-config.hpp>
9
10#include <optional>
11
12#include <event.hpp>
13
14#include "push-rules-desc.hpp"
15
16namespace Kazv
17{
18 std::vector<std::string> splitPath(std::string path);
19
20 bool matchGlob(std::string target, std::string pattern);
21
22 std::pair<bool, json> validateRule(std::string ruleSetName, const json &rule);
23
24 Event validatePushRules(const Event &e);
25
27 {
29
31
32 std::optional<std::pair<std::string, json>> matchRule(const Event &e, const RoomModel &room) const;
33
34 std::optional<std::pair<std::string, json>> matchRuleSet(std::string ruleSetName, const Event &e, const RoomModel &room) const;
35
36 bool matchP(std::string ruleSetName, const json &rule, const Event &e, const RoomModel &room) const;
37
38 PushAction handleRule(std::string ruleSetName, const json &rule, const Event &e, const RoomModel &room) const;
39 };
40}
Definition event.hpp:21
Definition location.hpp:10
std::pair< bool, json > validateRule(std::string ruleSetName, const json &rule)
Definition push-rules-desc.cpp:145
nlohmann::json json
Definition jsonwrap.hpp:20
Event validatePushRules(const Event &e)
Definition push-rules-desc.cpp:169
std::vector< std::string > splitPath(std::string path)
Definition push-rules-desc.cpp:35
bool matchGlob(std::string target, std::string pattern)
Definition push-rules-desc.cpp:46
Describe what actions are to be taken for a specific event.
Definition push-rules-desc.hpp:26
Definition push-rules-desc-p.hpp:27
Event pushRulesEvent
Definition push-rules-desc-p.hpp:30
bool matchP(std::string ruleSetName, const json &rule, const Event &e, const RoomModel &room) const
Definition push-rules-desc.cpp:228
PushAction handleRule(std::string ruleSetName, const json &rule, const Event &e, const RoomModel &room) const
Definition push-rules-desc.cpp:279
std::optional< std::pair< std::string, json > > matchRule(const Event &e, const RoomModel &room) const
Definition push-rules-desc.cpp:206
std::optional< std::pair< std::string, json > > matchRuleSet(std::string ruleSetName, const Event &e, const RoomModel &room) const
Definition push-rules-desc.cpp:217
The model to store information about a room.
Definition room-model.hpp:236