aboutsummaryrefslogtreecommitdiff
path: root/message.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'message.cpp')
-rw-r--r--message.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/message.cpp b/message.cpp
index 4da0fd1..6d02db1 100644
--- a/message.cpp
+++ b/message.cpp
@@ -52,6 +52,25 @@ DcMessage::getTimestamp()
return QDateTime::fromSecsSinceEpoch (dc_msg_get_timestamp(m_message), Qt::UTC);
}
+bool
+DcMessage::saveAttach(QString dest)
+{
+ if(!dest.isNull()){
+ char *file = dc_msg_get_file(m_message);
+ QString fileUrl{file};
+ dc_str_unref(file);
+ // we need to replace, so we delete file first
+ if (QFile::exists(dest)){
+ if(!QFile::remove(dest))
+ return false;
+ }
+ return QFile::copy(fileUrl, dest);
+ }
+ else{
+ return false;
+ }
+}
+
void
DcMessage::setText(QString text)
{