threadMessages method

Future<SequenceNode> threadMessages({
  1. String method = 'ORDEREDSUBJECT',
  2. String charset = 'UTF-8',
  3. required DateTime since,
  4. bool threadUids = false,
})

Requests the IDs of message threads starting on since using the given method (defaults to ORDEREDSUBJECT) and charset (defaults to UTF-8).

Optionally set threadUids to true when you want to receive UIDs rather than sequence IDs. You can use this method when the server announces the THREAD capability, in which it also announces the supported methods, e.g. THREAD=ORDEREDSUBJECT THREAD=REFERENCES. Compare ServerInfo.supportsThreading and ServerInfo.supportedThreadingMethods.

Implementation

Future<SequenceNode> threadMessages(
    {String method = 'ORDEREDSUBJECT',
    String charset = 'UTF-8',
    required DateTime since,
    bool threadUids = false}) {
  final buffer = StringBuffer();
  if (threadUids) {
    buffer.write('UID ');
  }
  buffer
    ..write('THREAD ')
    ..write(method)
    ..write(' ')
    ..write(charset)
    ..write(' SINCE ')
    ..write(DateCodec.encodeSearchDate(since));
  return sendCommand(
      Command(buffer.toString()), ThreadParser(isUidSequence: threadUids));
}