aboutsummaryrefslogtreecommitdiff
path: root/chatlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chatlist.cpp')
-rw-r--r--chatlist.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/chatlist.cpp b/chatlist.cpp
new file mode 100644
index 0000000..0f95245
--- /dev/null
+++ b/chatlist.cpp
@@ -0,0 +1,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)};
+}