aboutsummaryrefslogtreecommitdiff
path: root/chat.cpp
blob: ffb8624e242220d936a3cee3aeba00fed02d186d (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "chat.h"

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

DcChat::DcChat(dc_chat_t *chat)
    : QObject{nullptr}
    , m_chat{chat}
{
}

DcChat::~DcChat()
{
    dc_chat_unref(m_chat);
}

uint32_t
DcChat::getId()
{
    return dc_chat_get_id(m_chat);
}

int
DcChat::getType()
{
    return dc_chat_get_type(m_chat);
}

QString
DcChat::getName()
{
    char *name = dc_chat_get_name(m_chat);
    QString result{name};
    dc_str_unref(name);
    return result;
}

/*
QString
DcChat::getProfileImage()
{
  char *profileImage = dc_chat_get_profile_image(m_chat);
}
*/

QColor
DcChat::getColor()
{
    uint32_t color = dc_chat_get_color(m_chat);
    return QColor{int(color >> 16) & 0xff, int(color >> 8) & 0xff, int(color) & 0xff};
}

bool
DcChat::canSend()
{
    return dc_chat_can_send(m_chat);
}

bool
DcChat::isMuted()
{
    return dc_chat_is_muted(m_chat);
}