pEpForiOS/UI/EmailDisplay/EmailListViewController.swift
author Xavier Algarra <xavier@pep-project.org>
Mon, 24 Apr 2017 13:35:36 +0200
changeset 2132 4289912d9366
parent 2067 a4fb0b2e9cd9
child 2181 d8d820586163
permissions -rw-r--r--
IOS-328 Fixed Error Title Incorrect After Selecting Folder
dirk@30
     1
//
dirk@30
     2
//  EmailListViewController.swift
dirk@30
     3
//  pEpForiOS
dirk@30
     4
//
dirk@30
     5
//  Created by Dirk Zimmermann on 16/04/16.
dirk@30
     6
//  Copyright © 2016 p≡p Security S.A. All rights reserved.
dirk@30
     7
//
dirk@30
     8
dirk@30
     9
import Foundation
dirk@30
    10
import UIKit
dirk@31
    11
import CoreData
dirk@810
    12
import MessageModel
dirk@810
    13
igor@1260
    14
struct EmailListConfig {
igor@1338
    15
    var appConfig: AppConfig?
dirk@1333
    16
igor@1260
    17
    /** The folder to display, if it exists */
igor@1260
    18
    var folder: Folder?
dirk@1906
    19
dirk@1906
    20
    let imageProvider = IdentityImageProvider()
igor@1260
    21
}
dirk@30
    22
xavier@1865
    23
class EmailListViewController: UITableViewController, FilterUpdateProtocol {
dirk@583
    24
    struct UIState {
dirk@583
    25
        var isSynching: Bool = false
dirk@583
    26
    }
dirk@30
    27
dirk@1344
    28
    var config: EmailListConfig?
dirk@275
    29
    var state = UIState()
igor@1301
    30
    let searchController = UISearchController(searchResultsController: nil)
dirk@1737
    31
    let cellsInUse = NSCache<NSString, EmailListViewCell>()
dirk@719
    32
dirk@1724
    33
    /**
dirk@1724
    34
     After trustwords have been invoked, this will be the partner identity that
dirk@1724
    35
     was either confirmed or mistrusted.
dirk@1724
    36
     */
dirk@1724
    37
    var partnerIdentity: Identity?
dirk@1724
    38
dirk@2067
    39
    @IBOutlet weak var enableFilterButton: UIBarButtonItem!
dirk@2067
    40
    @IBOutlet weak var textFilterButton: UIBarButtonItem!
dirk@2067
    41
dirk@2067
    42
    private var filterEnabled = false
dirk@2067
    43
dirk@275
    44
    override func viewDidLoad() {
ylandert@935
    45
        super.viewDidLoad()
xavier@1623
    46
igor@1408
    47
        title = "EmailList.title".localized
igor@1284
    48
        UIHelper.emailListTableHeight(self.tableView)
igor@1301
    49
        addSearchBar()
dirk@275
    50
    }
dirk@31
    51
dirk@784
    52
    override func viewWillAppear(_ animated: Bool) {
igor@1301
    53
        super.viewWillAppear(animated)
xavier@1623
    54
dirk@1344
    55
        if MiscUtil.isUnitTest() {
dirk@1344
    56
            return
dirk@1344
    57
        }
dirk@1344
    58
xavier@1832
    59
        self.textFilterButton.isEnabled = filterEnabled
xavier@1832
    60
dirk@1826
    61
        setDefaultColors()
dirk@1344
    62
        initialConfig()
dirk@854
    63
        updateModel()
dirk@1348
    64
dirk@1348
    65
        MessageModelConfig.messageFolderDelegate = self
dirk@1348
    66
    }
dirk@1348
    67
xavier@1948
    68
dirk@1348
    69
    override func viewWillDisappear(_ animated: Bool) {
dirk@1348
    70
        super.viewWillDisappear(animated)
dirk@1348
    71
        MessageModelConfig.messageFolderDelegate = nil
igor@1301
    72
    }
xavier@1623
    73
igor@1338
    74
    func initialConfig() {
dirk@1344
    75
        guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
igor@1338
    76
            return
igor@1338
    77
        }
dirk@1348
    78
        if Account.all().isEmpty {
igor@1338
    79
            performSegue(withIdentifier:.segueAddNewAccount, sender: self)
igor@1338
    80
        }
xavier@2132
    81
        if config == nil {
xavier@2132
    82
            config = EmailListConfig(appConfig: appDelegate.appConfig, folder: Folder.unifiedInbox())
xavier@2132
    83
        }
xavier@2132
    84
        self.title = config?.folder?.realName
igor@1338
    85
    }
xavier@1623
    86
igor@1301
    87
    func addSearchBar() {
igor@1301
    88
        searchController.searchResultsUpdater = self
igor@1301
    89
        searchController.dimsBackgroundDuringPresentation = false
igor@1301
    90
        searchController.delegate = self
igor@1301
    91
        definesPresentationContext = true
igor@1301
    92
        tableView.tableHeaderView = searchController.searchBar
igor@1301
    93
        tableView.setContentOffset(CGPoint(x: 0.0, y: 40.0), animated: false)
igor@1301
    94
    }
dirk@705
    95
dirk@854
    96
    func updateModel() {
igor@1318
    97
        tableView.reloadData()
dirk@31
    98
    }
dirk@31
    99
xavier@1832
   100
xavier@1832
   101
    @IBAction func showUnreadButtonTapped(_ sender: UIBarButtonItem) {
xavier@1832
   102
        if filterEnabled {
xavier@1832
   103
            filterEnabled = false
xavier@1832
   104
            textFilterButton.title = ""
xavier@1832
   105
            enableFilterButton.image = UIImage(named: "unread-icon")
xavier@1865
   106
            updateFilter(filter: Filter.unified())
xavier@1832
   107
        } else {
xavier@1832
   108
            filterEnabled = true
xavier@1832
   109
            textFilterButton.title = "Filter by: unread"
xavier@1832
   110
            enableFilterButton.image = UIImage(named: "unread-icon-active")
xavier@1832
   111
            if config != nil {
xavier@1865
   112
                updateFilter(filter: Filter.unread())
xavier@1832
   113
            }
xavier@1832
   114
        }
xavier@1832
   115
        self.textFilterButton.isEnabled = filterEnabled
xavier@1832
   116
xavier@1832
   117
    }
xavier@1832
   118
xavier@1865
   119
    func updateFilter(filter: Filter) {
xavier@1865
   120
        config?.folder?.updateFilter(filter: filter)
xavier@1865
   121
        self.tableView.reloadData()
xavier@1865
   122
    }
xavier@1865
   123
dirk@58
   124
    // MARK: - UI State
dirk@58
   125
dirk@58
   126
    func updateUI() {
dirk@784
   127
        UIApplication.shared.isNetworkActivityIndicatorVisible = state.isSynching
dirk@748
   128
        if !state.isSynching {
igor@1260
   129
            refreshControl?.endRefreshing()
dirk@58
   130
        }
dirk@58
   131
    }
dirk@58
   132
dirk@31
   133
    // MARK: - UITableViewDataSource
dirk@31
   134
dirk@784
   135
    override func numberOfSections(in tableView: UITableView) -> Int {
dirk@1344
   136
        if let _ = config?.folder {
dirk@854
   137
            return 1
dirk@209
   138
        }
dirk@854
   139
        return 0
dirk@31
   140
    }
dirk@31
   141
dirk@784
   142
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
dirk@1344
   143
        if let fol = config?.folder  {
dirk@854
   144
            return fol.messageCount()
dirk@31
   145
        }
dirk@31
   146
        return 0
dirk@31
   147
    }
dirk@31
   148
dirk@784
   149
    override func tableView(_ tableView: UITableView,
dirk@784
   150
                            cellForRowAt indexPath: IndexPath) -> UITableViewCell {
dirk@784
   151
        let cell = tableView.dequeueReusableCell(
dirk@784
   152
            withIdentifier: "EmailListViewCell", for: indexPath) as! EmailListViewCell
dirk@1737
   153
        if let message = cell.configureCell(config: config, indexPath: indexPath) {
dirk@1737
   154
            associate(message: message, toCell: cell)
dirk@1542
   155
        }
dirk@31
   156
        return cell
dirk@31
   157
    }
dirk@31
   158
dirk@719
   159
    // MARK: - UITableViewDelegate
dirk@719
   160
dirk@784
   161
    override func tableView(_ tableView: UITableView, editActionsForRowAt
dirk@784
   162
        indexPath: IndexPath)-> [UITableViewRowAction]? {
xavier@1623
   163
dirk@784
   164
        let cell = tableView.cellForRow(at: indexPath) as! EmailListViewCell
igor@1260
   165
        if let email = cell.messageAt(indexPath: indexPath, config: config) {
igor@1576
   166
            let flagAction = createFlagAction(message: email, cell: cell)
dirk@1507
   167
            let deleteAction = createDeleteAction(message: email, cell: cell)
igor@1242
   168
            let moreAction = createMoreAction(message: email, cell: cell)
igor@1576
   169
            return [deleteAction, flagAction, moreAction]
dirk@855
   170
        }
dirk@855
   171
        return nil
dirk@744
   172
    }
dirk@744
   173
dirk@719
   174
    // MARK: - Misc
dirk@719
   175
dirk@1507
   176
    func createRowAction(cell: EmailListViewCell,
xavier@1623
   177
                         image: UIImage?, action: @escaping (UITableViewRowAction, IndexPath) -> Void,
xavier@1623
   178
                         title: String) -> UITableViewRowAction {
dirk@1510
   179
        let rowAction = UITableViewRowAction(
dirk@1510
   180
            style: .normal, title: title, handler: action)
dirk@1507
   181
dirk@1507
   182
        if let theImage = image {
dirk@1507
   183
            let iconColor = UIColor(patternImage: theImage)
dirk@1507
   184
            rowAction.backgroundColor = iconColor
dirk@744
   185
        }
dirk@744
   186
dirk@1507
   187
        return rowAction
dirk@744
   188
    }
dirk@744
   189
dirk@1507
   190
    func createFlagAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
dirk@1507
   191
        func action(action: UITableViewRowAction, indexPath: IndexPath) -> Void {
dirk@1522
   192
            if message.imapFlags == nil {
dirk@1522
   193
                Log.warn(component: #function, content: "message.imapFlags == nil")
dirk@1522
   194
            }
dirk@1605
   195
            if cell.isFlagged(message: message) {
dirk@1507
   196
                message.imapFlags?.flagged = false
dirk@1507
   197
            } else {
dirk@1507
   198
                message.imapFlags?.flagged = true
dirk@1507
   199
            }
dirk@1507
   200
            message.save()
dirk@1507
   201
            self.tableView.reloadRows(at: [indexPath], with: .none)
dirk@1507
   202
        }
dirk@1510
   203
igor@1523
   204
        var title = "\n\nFlag".localized
dirk@1605
   205
        if message.imapFlags?.flagged ?? true {
igor@1530
   206
            title = "\n\nUnFlag".localized
dirk@744
   207
        }
dirk@744
   208
dirk@1510
   209
        return createRowAction(
dirk@1510
   210
            cell: cell, image: UIImage(named: "swipe-flag"), action: action, title: title)
dirk@744
   211
    }
dirk@744
   212
dirk@1507
   213
    func createDeleteAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
dirk@1507
   214
        func action(action: UITableViewRowAction, indexPath: IndexPath) -> Void {
dirk@1507
   215
            guard let message = cell.messageAt(indexPath: indexPath, config: self.config) else {
dirk@1507
   216
                return
dirk@1507
   217
            }
xavier@1623
   218
dirk@1650
   219
            message.delete() // mark for deletion/trash
dirk@1507
   220
            message.save()
igor@1576
   221
            self.tableView.reloadData()
dirk@1507
   222
        }
dirk@744
   223
dirk@1510
   224
        return createRowAction(
dirk@1510
   225
            cell: cell, image: UIImage(named: "swipe-trash"), action: action,
igor@1523
   226
            title: "\n\nDelete".localized)
dirk@1507
   227
    }
dirk@1507
   228
dirk@1507
   229
    func createMarkAsReadAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
dirk@1507
   230
        func action(action: UITableViewRowAction, indexPath: IndexPath) -> Void {
dirk@1605
   231
            if cell.haveSeen(message: message) {
dirk@1507
   232
                message.imapFlags?.seen = false
dirk@1507
   233
            } else {
dirk@1507
   234
                message.imapFlags?.seen = true
dirk@1507
   235
            }
dirk@1507
   236
            self.tableView.reloadRows(at: [indexPath], with: .none)
dirk@744
   237
        }
dirk@1510
   238
dirk@1510
   239
        var title = NSLocalizedString(
dirk@1510
   240
            "Unread", comment: "Unread button title in swipe action on EmailListViewController")
dirk@1605
   241
        if !cell.haveSeen(message: message) {
dirk@1510
   242
            title = NSLocalizedString(
dirk@1510
   243
                "Read", comment: "Read button title in swipe action on EmailListViewController")
dirk@1507
   244
        }
dirk@1507
   245
dirk@1507
   246
        let isReadAction = createRowAction(cell: cell, image: nil, action: action,
dirk@1510
   247
                                           title: title)
dirk@784
   248
        isReadAction.backgroundColor = UIColor.blue
dirk@744
   249
dirk@744
   250
        return isReadAction
dirk@744
   251
    }
xavier@1623
   252
igor@1242
   253
    func createMoreAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
dirk@1510
   254
        func action(action: UITableViewRowAction, indexPath: IndexPath) -> Void {
igor@1242
   255
            self.showMoreActionSheet(cell: cell)
igor@1242
   256
        }
dirk@1510
   257
dirk@1510
   258
        return createRowAction(
dirk@1510
   259
            cell: cell, image: UIImage(named: "swipe-more"), action: action,
igor@1523
   260
            title: "\n\nMore".localized)
igor@1242
   261
    }
xavier@1623
   262
igor@1242
   263
    // MARK: - Action Sheet
xavier@1623
   264
igor@1242
   265
    func showMoreActionSheet(cell: EmailListViewCell) {
igor@1242
   266
        let alertControler = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
igor@1438
   267
        alertControler.view.tintColor = .pEpGreen
igor@1242
   268
        let cancelAction = createCancelAction()
igor@1242
   269
        let replyAction = createReplyAction(cell: cell)
xavier@1623
   270
        let replyAllAction = createReplyAllAction(cell: cell)
igor@1242
   271
        let forwardAction = createForwardAction(cell: cell)
igor@1242
   272
        let markAction = createMarkAction()
igor@1242
   273
        alertControler.addAction(cancelAction)
igor@1242
   274
        alertControler.addAction(replyAction)
xavier@1620
   275
        alertControler.addAction(replyAllAction)
igor@1242
   276
        alertControler.addAction(forwardAction)
igor@1242
   277
        alertControler.addAction(markAction)
igor@1414
   278
        if let popoverPresentationController = alertControler.popoverPresentationController {
igor@1414
   279
            popoverPresentationController.sourceView = cell
igor@1414
   280
        }
igor@1242
   281
        present(alertControler, animated: true, completion: nil)
igor@1242
   282
    }
xavier@1623
   283
igor@1242
   284
    // MARK: - Action Sheet Actions
igor@1242
   285
igor@1242
   286
    func createCancelAction() -> UIAlertAction {
xavier@1623
   287
        return  UIAlertAction(title: "Cancel", style: .cancel) { (action) in}
igor@1242
   288
    }
xavier@1623
   289
igor@1242
   290
    func createReplyAction(cell: EmailListViewCell) ->  UIAlertAction {
igor@1242
   291
        return UIAlertAction(title: "Reply", style: .default) { (action) in
xavier@1623
   292
            // self.performSegue(withIdentifier: self.segueCompose, sender: cell)
igor@1338
   293
            self.performSegue(withIdentifier: .segueCompose, sender: cell)
igor@1242
   294
        }
igor@1242
   295
    }
xavier@1620
   296
xavier@1620
   297
    func createReplyAllAction(cell: EmailListViewCell) ->  UIAlertAction {
xavier@1623
   298
        return UIAlertAction(title: "Reply All", style: .default) { (action) in
xavier@1623
   299
            self.performSegue(withIdentifier: .segueReplyAll, sender: cell)
xavier@1620
   300
        }
xavier@1620
   301
    }
xavier@1620
   302
igor@1242
   303
    func createForwardAction(cell: EmailListViewCell) -> UIAlertAction {
igor@1242
   304
        return UIAlertAction(title: "Forward", style: .default) { (action) in
igor@1338
   305
            //self.performSegue(withIdentifier: self.segueCompose, sender: cell)
xavier@1664
   306
            self.performSegue(withIdentifier: .segueForward, sender: cell)
igor@1242
   307
        }
igor@1242
   308
    }
xavier@1623
   309
igor@1242
   310
    func createMarkAction() -> UIAlertAction {
igor@1242
   311
        return UIAlertAction(title: "Mark", style: .default) { (action) in
igor@1242
   312
        }
igor@1242
   313
    }
xavier@1623
   314
igor@1301
   315
    // MARK: - Content Search
xavier@1623
   316
igor@1301
   317
    func filterContentForSearchText(searchText: String) {
xavier@1623
   318
igor@1301
   319
    }
xavier@1623
   320
dirk@784
   321
}
igor@1301
   322
igor@1301
   323
extension EmailListViewController: UISearchResultsUpdating, UISearchControllerDelegate {
igor@1301
   324
    public func updateSearchResults(for searchController: UISearchController) {
igor@1301
   325
        filterContentForSearchText(searchText: searchController.searchBar.text!)
igor@1301
   326
    }
xavier@1623
   327
igor@1301
   328
    func didDismissSearchController(_ searchController: UISearchController) {
igor@1301
   329
    }
igor@1301
   330
}
igor@1338
   331
igor@1338
   332
// MARK: - Navigation
igor@1338
   333
igor@1338
   334
extension EmailListViewController: SegueHandlerType {
xavier@1623
   335
igor@1338
   336
    // MARK: - SegueHandlerType
xavier@1623
   337
igor@1338
   338
    enum SegueIdentifier: String {
igor@1338
   339
        case segueAddNewAccount
igor@1338
   340
        case segueEditAccounts
igor@1338
   341
        case segueShowEmail
igor@1338
   342
        case segueCompose
xavier@1623
   343
        case segueReplyAll
xavier@1664
   344
        case segueForward
xavier@1865
   345
        case segueFilter
igor@1338
   346
        case noSegue
igor@1338
   347
    }
xavier@1623
   348
igor@1338
   349
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
igor@1338
   350
        switch segueIdentifier(for: segue) {
xavier@1623
   351
        case .segueReplyAll:
xavier@1623
   352
            if let nav = segue.destination as? UINavigationController,
xavier@1623
   353
                let destination = nav.topViewController as? ComposeTableViewController,
xavier@1623
   354
                let cell = sender as? EmailListViewCell,
xavier@1623
   355
                let indexPath = self.tableView.indexPath(for: cell),
xavier@1623
   356
                let email = cell.messageAt(indexPath: indexPath, config: config) {
xavier@1623
   357
                destination.composeMode = .replyAll
xavier@1623
   358
                destination.appConfig = config?.appConfig
xavier@1623
   359
                destination.originalMessage = email
xavier@1623
   360
            }
igor@1338
   361
            break
igor@1338
   362
        case .segueShowEmail:
dirk@1594
   363
            if let vc = segue.destination as? EmailViewController,
igor@1338
   364
                let cell = sender as? EmailListViewCell,
igor@1338
   365
                let indexPath = self.tableView.indexPath(for: cell),
dirk@1594
   366
                let email = cell.messageAt(indexPath: indexPath, config: config) {
xavier@1623
   367
                vc.appConfig = config?.appConfig
xavier@1623
   368
                vc.message = email
igor@1338
   369
            }
igor@1338
   370
            break
xavier@1664
   371
        case .segueForward:
xavier@1664
   372
            if let nav = segue.destination as? UINavigationController,
xavier@1664
   373
                let destination = nav.topViewController as? ComposeTableViewController,
xavier@1664
   374
                let cell = sender as? EmailListViewCell,
xavier@1664
   375
                let indexPath = self.tableView.indexPath(for: cell),
xavier@1664
   376
                let email = cell.messageAt(indexPath: indexPath, config: config) {
xavier@1664
   377
                destination.composeMode = .forward
xavier@1664
   378
                destination.appConfig = config?.appConfig
xavier@1664
   379
                destination.originalMessage = email
xavier@1664
   380
            }
xavier@1664
   381
            break
xavier@1865
   382
        case .segueFilter:
xavier@1865
   383
            if let destiny = segue.destination as? FilterTableViewController {
xavier@1865
   384
                destiny.filterDelegate = self
xavier@1865
   385
                destiny.inFolder = false
xavier@1876
   386
                destiny.filterEnabled = self.config?.folder?.filter as! Filter?
xavier@1865
   387
            }
xavier@1865
   388
            break
dirk@1694
   389
        case .segueAddNewAccount, .segueEditAccounts, .segueCompose, .noSegue:
dirk@1694
   390
            break
igor@1338
   391
        }
xavier@1865
   392
igor@1338
   393
    }
dirk@1350
   394
dirk@1350
   395
    func didChangeInternal(messageFolder: MessageFolder) {
dirk@1350
   396
        if let folder = config?.folder,
dirk@1350
   397
            let message = messageFolder as? Message,
dirk@1558
   398
            folder.contains(message: message, deletedMessagesAreContained: true) {
dirk@1350
   399
            if let msg = messageFolder as? Message {
dirk@1350
   400
                if msg.isOriginal {
dirk@1535
   401
                    // new message has arrived
dirk@1675
   402
                    if let index = folder.indexOf(message: msg) {
dirk@1675
   403
                        let ip = IndexPath(row: index, section: 0)
dirk@1737
   404
                        Log.info(
dirk@1737
   405
                            component: #function,
dirk@1737
   406
                            content: "insert message at \(index), \(folder.messageCount()) messages")
dirk@1675
   407
                        tableView.insertRows(at: [ip], with: .automatic)
dirk@1675
   408
                    } else {
dirk@1675
   409
                        tableView.reloadData()
dirk@1675
   410
                    }
dirk@1558
   411
                } else if msg.isGhost {
dirk@1737
   412
                    if let cell = cellFor(message: msg), let ip = tableView.indexPath(for: cell) {
dirk@1737
   413
                        Log.info(
dirk@1737
   414
                            component: #function,
dirk@1737
   415
                            content: "delete message at \(index), \(folder.messageCount()) messages")
dirk@1737
   416
                        tableView.deleteRows(at: [ip], with: .automatic)
dirk@1737
   417
                    } else {
dirk@1737
   418
                        tableView.reloadData()
dirk@1558
   419
                    }
dirk@1535
   420
                } else {
dirk@1558
   421
                    // other flags than delete must have been changed
dirk@1737
   422
                    if let cell = cellFor(message: msg) {
dirk@1542
   423
                        cell.updateFlags(message: message)
dirk@1737
   424
                    } else {
dirk@1737
   425
                        tableView.reloadData()
dirk@1542
   426
                    }
dirk@1350
   427
                }
dirk@1350
   428
            }
dirk@1350
   429
        }
dirk@1350
   430
    }
dirk@1737
   431
dirk@1737
   432
    // MARK: - Message -> Cell association
dirk@1737
   433
dirk@1737
   434
    func keyFor(message: Message) -> NSString {
dirk@1737
   435
        let parentName = message.parent?.name ?? "unknown"
dirk@1737
   436
        return "\(message.uuid) \(parentName) \(message.uuid)" as NSString
dirk@1737
   437
    }
dirk@1737
   438
dirk@1737
   439
    func associate(message: Message, toCell: EmailListViewCell) {
dirk@1737
   440
        cellsInUse.setObject(toCell, forKey: keyFor(message: message))
dirk@1737
   441
    }
dirk@1737
   442
dirk@1737
   443
    func cellFor(message: Message) -> EmailListViewCell? {
dirk@1737
   444
        return cellsInUse.object(forKey: keyFor(message: message))
dirk@1737
   445
    }
igor@1338
   446
}
dirk@1348
   447
dirk@1348
   448
// MARK: - MessageFolderDelegate
dirk@1348
   449
dirk@1348
   450
extension EmailListViewController: MessageFolderDelegate {
dirk@1348
   451
    func didChange(messageFolder: MessageFolder) {
dirk@1675
   452
        GCD.onMainWait {
dirk@1350
   453
            self.didChangeInternal(messageFolder: messageFolder)
dirk@1348
   454
        }
dirk@1348
   455
    }
dirk@1348
   456
}