selectMailboxByPath method

Future<Mailbox> selectMailboxByPath(
  1. String path, {
  2. bool enableCondStore = false,
  3. QResyncParameters? qresync,
})

Selects the specified mailbox.

This allows future search and fetch calls. path the path or name of the mailbox that should be selected. Set enableCondStore to true if you want to force-enable CONDSTORE. This is only possible when the CONDSTORE or QRESYNC capability is supported. Specify qresync parameter in case the server supports the QRESYNC capability and you have known values from the last session. Note that you need to ENABLE QRESYNC first.

Implementation

Future<Mailbox> selectMailboxByPath(String path,
    {bool enableCondStore = false, QResyncParameters? qresync}) async {
  if (serverInfo.pathSeparator == null) {
    await listMailboxes();
  }
  final nameSplitIndex = path.lastIndexOf(serverInfo.pathSeparator!);
  final name =
      nameSplitIndex == -1 ? path : path.substring(nameSplitIndex + 1);
  final box = Mailbox()
    ..path = path
    ..name = name;
  return selectMailbox(box,
      enableCondStore: enableCondStore, qresync: qresync);
}