File: thread.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 (24 lines) | stat: -rw-r--r-- 703 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
// SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: LGPL-2.1-or-later

#include "thread.h"

#include "events/roommessageevent.h"

using namespace Quotient;

bool Thread::addEvent(const RoomMessageEvent* event, bool isLatest, bool isLocalUser)
{
    // Note: the root event may not have the thread aggregation in its unsigned on creation
    // hence checking the event id.
    if (event->threadRootEventId() != threadRootId && event->id() != threadRootId) {
        return false;
    }
    if (isLatest || latestEventId.isEmpty()) {
        latestEventId = event->id();
    }
    ++size;
    localUserParticipated |= isLocalUser;

    return true;
}