Commit 0c6bea65 authored by Oliver Wiese's avatar Oliver Wiese
Browse files

update folder flags

parent a9e1582b
......@@ -192,7 +192,7 @@
return
}
// Create folder on local
let folderProperty = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: folder)
let folderProperty = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: folder, flags: 0)
dataProvider.importNewData(from: [folderProperty], completionHandler: { error in
guard error == nil else {
// TODO: Error handling
......@@ -634,7 +634,7 @@
if let folders = array {
var properities = [FolderProperties]()
for folder in folders {
let property = FolderProperties(delimiter: String(Character(UnicodeScalar(UInt8(folder.delimiter)))), uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: folder.path, parent: nil, children: nil)
let property = FolderProperties(delimiter: String(Character(UnicodeScalar(UInt8(folder.delimiter)))), uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: folder.path, parent: nil, children: nil, flags: Int16(folder.flags.rawValue))
properities.append(property)
}
self.dataProvider.importNewData(from: properities, completionHandler: completion)
......
......@@ -107,7 +107,7 @@ class Mailbot {
maxUID: nil,
minUID: nil,
path: UserManager.backendInboxFolderPath,
parent: nil, children: nil),
parent: nil, children: nil, flags: 0),
body: body,
attachments: [],
signatureState: SignatureState.ValidSignature.rawValue,
......
......@@ -9,7 +9,7 @@
import Foundation
class OutgoingMail {
static var OutgoingFolder = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "OutgoingMails", parent: nil, children: nil)
static var OutgoingFolder = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "OutgoingMails", parent: nil, children: nil, flags: Int16(MCOIMAPFolderFlag.sentMail.rawValue))
private var encAddresses: [MCOAddress] = []
var encReceivers: [MCOAddress] {
......
......@@ -264,7 +264,7 @@ class IncomingMail {
let ccProperties = cc.map{$0.export()}
let bccProperties = bcc.map{$0.export()}
let folder = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: self.folderPath)
let folder = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: self.folderPath, flags: 0)
let from = self.from?.export() ?? nil
let sigState = self.cryptoObj?.signatureState.rawValue ?? 0
var sigKey: PublicKeyProperties? = nil
......
......@@ -37,6 +37,7 @@ extension FolderRecord {
if let minUID = properties.minUID {
self.minUID = minUID
}
self.flags = properties.flags
path = properties.path
}
......@@ -55,6 +56,10 @@ extension FolderRecord {
var type: FolderType {
let flags = MCOIMAPFolderFlag(rawValue: Int(self.flags))
print(flags.isEmpty)
print(self.flags)
// TODO: IS EMPTY! WHY? Do we add this information?
print(flags)
if flags.contains(MCOIMAPFolderFlag.drafts) {
return .Draft
}
......@@ -95,6 +100,7 @@ extension FolderRecord: DisplayFolder {
}
var icon: Image {
print(self.path)
var label = "folder"
switch type {
case .Archive:
......
......@@ -64,7 +64,7 @@ class PersistentDataProvider {
let addr1 = AddressProperties(email: "vic@example.com")
let addr2 = AddressProperties(email: "alex@example.com")
let addrs = [addr1, addr2]
let folder = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "Inbox")
let folder = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "Inbox", flags: 0)
var msgs = [MailProperties]()
for i in 1...10 {
......@@ -76,8 +76,8 @@ class PersistentDataProvider {
}
private static var proxyFolders: [FolderProperties] {
let f1 = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "Folder1")
let f2 = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "Folder2")
let f1 = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "Folder1", flags: 0)
let f2 = FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: "Folder2", flags: 0)
return [f1,f2]
}
......@@ -489,7 +489,7 @@ class PersistentDataProvider {
return
}
guard let toFolder = generateFetchedFolderResultsController(folderpath: to, moc: rfc.managedObjectContext).fetchedObjects?.first else {
importNewData(from: [FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: to, parent: nil, children: nil)], completionHandler: {_ in self.moveMails(with: uids, from: from, to: to)})
importNewData(from: [FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: to, parent: nil, children: nil, flags: 0)], completionHandler: {_ in self.moveMails(with: uids, from: from, to: to)})
moveMails(with: uids, from: from, to: to)
return
}
......
......@@ -87,7 +87,8 @@ struct FolderProperties: DataPropertyProtocol{
let path: String
var parent: [FolderProperties]?
var children: [FolderProperties]?
var children: [FolderProperties]?
var flags: Int16
func update(m: Any) -> Bool {
if let folder = m as? FolderRecord {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment