File: eventitem.cpp

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 (26 lines) | stat: -rw-r--r-- 856 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
// SPDX-FileCopyrightText: 2018 Kitsune Ral <kitsune-ral@users.sf.net>
// SPDX-License-Identifier: LGPL-2.1-or-later

#include "eventitem.h"

#include "events/roomavatarevent.h"
#include "events/roommessageevent.h"

using namespace Quotient;

void PendingEventItem::setFileUploaded(const FileSourceInfo& uploadedFileData)
{
    if (auto* rme = getAs<RoomMessageEvent>())
        rme->updateFileSourceInfo(uploadedFileData);

    if (auto* rae = getAs<RoomAvatarEvent>()) {
        rae->editContent([&uploadedFileData](EventContent::FileInfo& fi) {
            fi.source = uploadedFileData;
        });
    }
    setStatus(EventStatus::FileUploaded);
}

// Not exactly sure why but this helps with the linker not finding
// Quotient::EventStatus::staticMetaObject when building Quaternion
#include "moc_eventitem.cpp" // NOLINT(bugprone-suspicious-include)