libkazv
push-rules-desc.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 <memory>
11 #include <optional>
12 
13 #include <copy-helper.hpp>
14 
15 namespace Kazv
16 {
17  struct RoomModel;
18  class Event;
19 
20  struct PushRulesDescPrivate;
21 
25  struct PushAction
26  {
32  std::optional<std::string> sound;
35  };
36 
38  {
39  public:
43  PushRulesDesc();
44 
48  PushRulesDesc(const Event &pushRulesEvent);
50 
52 
53 
56  bool valid() const;
57 
65  PushAction handle(const Event &e, const RoomModel &room) const;
66 
67  private:
68  std::unique_ptr<PushRulesDescPrivate> m_d;
69  };
70 }
Kazv::PushAction::shouldNotify
bool shouldNotify
Whether the client should notify about this event.
Definition: push-rules-desc.hpp:28
copy-helper.hpp
Kazv::PushAction
Describe what actions are to be taken for a specific event.
Definition: push-rules-desc.hpp:25
Kazv
Definition: location.hpp:10
Kazv::PushAction::sound
std::optional< std::string > sound
The sound of the notification as defined in the spec.
Definition: push-rules-desc.hpp:32
KAZV_DECLARE_COPYABLE
#define KAZV_DECLARE_COPYABLE(typeName)
Definition: copy-helper.hpp:10
Kazv::RoomModel
Definition: room-model.hpp:209
Kazv::PushRulesDesc
Definition: push-rules-desc.hpp:37
Kazv::PushRulesDesc::~PushRulesDesc
~PushRulesDesc()
Kazv::PushRulesDesc::PushRulesDesc
PushRulesDesc()
Construct an invalid PushRulesDesc.
Definition: push-rules-desc.cpp:309
Kazv::PushAction::shouldHighlight
bool shouldHighlight
Whether the client should highlight the event.
Definition: push-rules-desc.hpp:34
Kazv::PushRulesDesc::valid
bool valid() const
Check whether this PushRulesDesc is valid.
Definition: push-rules-desc.cpp:323
Kazv::PushRulesDesc::handle
PushAction handle(const Event &e, const RoomModel &room) const
Check whether we should send a notification about event e.
Definition: push-rules-desc.cpp:328
Kazv::Event
Definition: event.hpp:20
libkazv-config.hpp