|
@@ -880,6 +880,32 @@ class DcMsg: MessageType {
|
|
|
func sendInChat(id: Int) {
|
|
|
dc_send_msg(mailboxPointer, UInt32(id), messagePointer)
|
|
|
}
|
|
|
+
|
|
|
+ func previousMediaURLs() -> [URL] {
|
|
|
+ var urls: [URL] = []
|
|
|
+ var prev: Int = Int(dc_get_next_media(mailboxPointer, UInt32(id), -1, Int32(type), 0, 0))
|
|
|
+ while prev != 0 {
|
|
|
+ let prevMessage = DcMsg(id: prev)
|
|
|
+ if let url = prevMessage.fileURL {
|
|
|
+ urls.insert(url, at: 0)
|
|
|
+ }
|
|
|
+ prev = Int(dc_get_next_media(mailboxPointer, UInt32(prevMessage.id), -1, Int32(prevMessage.type), 0, 0))
|
|
|
+ }
|
|
|
+ return urls
|
|
|
+ }
|
|
|
+
|
|
|
+ func nextMediaURLs() -> [URL] {
|
|
|
+ let urls: [URL] = []
|
|
|
+ var next: Int = Int(dc_get_next_media(mailboxPointer, UInt32(message.id), 1, Int32(message.type), 0, 0))
|
|
|
+ while next != 0 {
|
|
|
+ let nextMessage = DcMsg(id: next)
|
|
|
+ if let url = nextMessage.fileURL {
|
|
|
+ urls.append(url)
|
|
|
+ }
|
|
|
+ next = Int(dc_get_next_media(mailboxPointer, UInt32(nextMessage.id), 1, Int32(nextMessage.type), 0, 0))
|
|
|
+ }
|
|
|
+ return urls
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class DcContact {
|