aboutsummaryrefslogtreecommitdiff
path: root/chat.cpp
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2020-09-12 14:10:13 +0300
committerlink2xt <link2xt@testrun.org>2020-10-03 00:20:03 +0300
commitb8762ddb38dd975b0acb217b793594dfed83a824 (patch)
tree23ccefbba703fed6c07acce82ff72e32ba77c9ba /chat.cpp
downloadkdeltachat-b8762ddb38dd975b0acb217b793594dfed83a824.tar.gz
kdeltachat-b8762ddb38dd975b0acb217b793594dfed83a824.zip
Initial commit
Diffstat (limited to 'chat.cpp')
-rw-r--r--chat.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/chat.cpp b/chat.cpp
new file mode 100644
index 0000000..ffb8624
--- /dev/null
+++ b/chat.cpp
@@ -0,0 +1,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);
+}