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 }
Definition: event.hpp:21
Definition: push-rules-desc.hpp:38
bool valid() const
Check whether this PushRulesDesc is valid.
Definition: push-rules-desc.cpp:323
PushRulesDesc()
Construct an invalid PushRulesDesc.
Definition: push-rules-desc.cpp:309
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
#define KAZV_DECLARE_COPYABLE(typeName)
Definition: copy-helper.hpp:10
Definition: location.hpp:10
Describe what actions are to be taken for a specific event.
Definition: push-rules-desc.hpp:26
std::optional< std::string > sound
The sound of the notification as defined in the spec.
Definition: push-rules-desc.hpp:32
bool shouldNotify
Whether the client should notify about this event.
Definition: push-rules-desc.hpp:28
bool shouldHighlight
Whether the client should highlight the event.
Definition: push-rules-desc.hpp:34
Definition: room-model.hpp:217