libkazv
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 
16 namespace 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  {
28  PushRulesDescPrivate(const Event &e);
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 }
Kazv::PushRulesDescPrivate::matchRule
std::optional< std::pair< std::string, json > > matchRule(const Event &e, const RoomModel &room) const
Definition: push-rules-desc.cpp:206
Kazv::PushRulesDescPrivate::matchRuleSet
std::optional< std::pair< std::string, json > > matchRuleSet(std::string ruleSetName, const Event &e, const RoomModel &room) const
Definition: push-rules-desc.cpp:217
Kazv::PushRulesDescPrivate::PushRulesDescPrivate
PushRulesDescPrivate(const Event &e)
Definition: push-rules-desc.cpp:202
Kazv::PushAction
Describe what actions are to be taken for a specific event.
Definition: push-rules-desc.hpp:25
event.hpp
Kazv::PushRulesDescPrivate
Definition: push-rules-desc-p.hpp:26
Kazv
Definition: location.hpp:10
Kazv::validatePushRules
Event validatePushRules(const Event &e)
Definition: push-rules-desc.cpp:169
Kazv::PushRulesDescPrivate::handleRule
PushAction handleRule(std::string ruleSetName, const json &rule, const Event &e, const RoomModel &room) const
Definition: push-rules-desc.cpp:279
Kazv::RoomModel
Definition: room-model.hpp:209
Kazv::validateRule
std::pair< bool, json > validateRule(std::string ruleSetName, const json &rule)
Definition: push-rules-desc.cpp:145
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::PushRulesDescPrivate::pushRulesEvent
Event pushRulesEvent
Definition: push-rules-desc-p.hpp:30
Kazv::splitPath
std::vector< std::string > splitPath(std::string path)
Definition: push-rules-desc.cpp:35
Kazv::PushRulesDescPrivate::matchP
bool matchP(std::string ruleSetName, const json &rule, const Event &e, const RoomModel &room) const
Definition: push-rules-desc.cpp:228
push-rules-desc.hpp
Kazv::Event
Definition: event.hpp:20
Kazv::matchGlob
bool matchGlob(std::string target, std::string pattern)
Definition: push-rules-desc.cpp:46
libkazv-config.hpp