aboutsummaryrefslogtreecommitdiff
path: root/message.cpp
blob: 7eb601958e9c417efa17aad6a4e1c30884cffd2a (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "message.h"

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

DcMessage::DcMessage(dc_msg_t *message)
    : QObject{nullptr}
    , m_message{message}
{
}

DcMessage::~DcMessage()
{
    dc_msg_unref(m_message);
}

uint32_t
DcMessage::getId()
{
    return dc_msg_get_id(m_message);
}

uint32_t
DcMessage::getFromId()
{
    return dc_msg_get_from_id(m_message);
}

uint32_t
DcMessage::getChatId()
{
    return dc_msg_get_chat_id(m_message);
}

int
DcMessage::getViewtype()
{
    return dc_msg_get_viewtype(m_message);
}

int
DcMessage::getState()
{
    return dc_msg_get_state(m_message);
}

QString
DcMessage::getText()
{
    char *text = dc_msg_get_text(m_message);
    QString result{text};
    dc_str_unref(text);
    return result;
}

QString
DcMessage::getFile()
{
    char *file = dc_msg_get_file(m_message);
    QString result{file};
    dc_str_unref(file);
    return result;
}

QString
DcMessage::getFilename()
{
    char *filename = dc_msg_get_filename(m_message);
    QString result{filename};
    dc_str_unref(filename);
    return result;
}

int
DcMessage::getWidth()
{
    return dc_msg_get_width(m_message);
}

int
DcMessage::getHeight()
{
    return dc_msg_get_height(m_message);
}

bool
DcMessage::isInfo()
{
    return dc_msg_is_info(m_message);
}