File: knocking.h

package info (click to toggle)
libquotient 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,588 kB
  • sloc: xml: 39,103; cpp: 25,226; sh: 97; makefile: 10
file content (53 lines) | stat: -rw-r--r-- 2,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN

#pragma once

#include <Quotient/jobs/basejob.h>

namespace Quotient {

//! \brief Knock on a room, requesting permission to join.
//!
//! *Note that this API takes either a room ID or alias, unlike other membership APIs.*
//!
//! This API "knocks" on the room to ask for permission to join, if the user
//! is allowed to knock on the room. Acceptance of the knock happens out of
//! band from this API, meaning that the client will have to watch for updates
//! regarding the acceptance/rejection of the knock.
//!
//! If the room history settings allow, the user will still be able to see
//! history of the room while being in the "knock" state. The user will have
//! to accept the invitation to join the room (acceptance of knock) to see
//! messages reliably. See the `/join` endpoints for more information about
//! history visibility to the user.
//!
//! The knock will appear as an entry in the response of the
//! [`/sync`](/client-server-api/#get_matrixclientv3sync) API.
class QUOTIENT_API KnockRoomJob : public BaseJob {
public:
    //! \param roomIdOrAlias
    //!   The room identifier or alias to knock upon.
    //!
    //! \param serverName
    //!   The servers to attempt to knock on the room through. One of the servers
    //!   must be participating in the room.
    //!
    //! \param via
    //!   The servers to attempt to knock on the room through. One of the servers
    //!   must be participating in the room.
    //!
    //! \param reason
    //!   Optional reason to be included as the `reason` on the subsequent
    //!   membership event.
    explicit KnockRoomJob(const QString& roomIdOrAlias, const QStringList& serverName = {},
                          const QStringList& via = {}, const QString& reason = {});

    // Result properties

    //! The knocked room ID.
    QString roomId() const { return loadFromJson<QString>("room_id"_L1); }
};

inline auto collectResponse(const KnockRoomJob* job) { return job->roomId(); }

} // namespace Quotient