aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomcreateevent.cpp
blob: 3d9ec4a373e8df36ccf38cb5a38be3f08c682f35 (plain)
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
/******************************************************************************
 * SPDX-FileCopyrightText: 2019 QMatrixClient project
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "roomcreateevent.h"

using namespace Quotient;

bool RoomCreateEvent::isFederated() const
{
    return fromJson<bool>(contentJson()["m.federate"_ls]);
}

QString RoomCreateEvent::version() const
{
    return fromJson<QString>(contentJson()["room_version"_ls]);
}

RoomCreateEvent::Predecessor RoomCreateEvent::predecessor() const
{
    const auto predJson = contentJson()["predecessor"_ls].toObject();
    return { fromJson<QString>(predJson[RoomIdKeyL]),
             fromJson<QString>(predJson[EventIdKeyL]) };
}

bool RoomCreateEvent::isUpgrade() const
{
    return contentJson().contains("predecessor"_ls);
}