aboutsummaryrefslogtreecommitdiff
path: root/chatlist.cpp
blob: 0f95245765d84408ac96d04b9ac56ebf714b7b61 (plain) (blame)
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
#include "chatlist.h"
#include "lot.h"

DcChatlist::DcChatlist(QObject *parent)
    : QObject{parent}
{
}

DcChatlist::DcChatlist(dc_chatlist_t *chatlist, QObject *parent)
    : QObject{parent}
    , m_chatlist{chatlist}
{
}

DcChatlist::~DcChatlist()
{
    dc_chatlist_unref(m_chatlist);
}

size_t
DcChatlist::getChatCount() const
{
    return dc_chatlist_get_cnt(m_chatlist);
}

uint32_t
DcChatlist::getChatId(size_t index) const
{
    return dc_chatlist_get_chat_id(m_chatlist, index);
}

uint32_t
DcChatlist::getMsgId(size_t index) const
{
    return dc_chatlist_get_msg_id(m_chatlist, index);
}

DcLot *
DcChatlist::getSummary(size_t index) const
{
    return new DcLot{dc_chatlist_get_summary(m_chatlist, index, NULL)};
}