summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/imap/public/nsIImapFlagAndUidState.idl
blob: a65d1a81c283f2bb75344a234bb2a0529f45e67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

[scriptable, uuid(360848be-f694-40db-80ef-793a2c43ddcb)]
interface nsIImapFlagAndUidState : nsISupports
{
  readonly attribute long numberOfMessages;
  readonly attribute long numberOfRecentMessages;

  /**
   * If a full update, the total number of deleted messages
   * in the folder; if a partial update, the number of deleted
   * messages in the partial update
   **/
  readonly attribute long numberOfDeletedMessages;

  /**
   * If this is true, instead of fetching 1:* (FLAGS), and putting all
   * UIDs and flags in the array, we only fetched the uids and flags
   * that changed since the last time we were selected on this folder.
   * This means we have a sparse array, and should not assume missing
   * UIDs have been deleted.
   **/
  readonly attribute boolean partialUIDFetch;

  /**
   * Set of flags the server supports storing per message. See nsImapCore.h
   * for the set of flags.
   */
  readonly attribute unsigned short supportedUserFlags;

  /**
   * Check if a UID is in the state.
   * @param uid - The message UID.
   * @returns True if UID is in the state.
   */
  boolean hasMessage(in unsigned long uid);

  /**
   * OR's the  passed in flags with the previous flags because we want to
   * accumulate the FLAGS and PERMANENTFLAGS response.
   *
   * @param aFlags - flags to OR with current flags.
   */
  void orSupportedUserFlags(in unsigned short aFlags);

  unsigned long getUidOfMessage(in long zeroBasedIndex);
  unsigned short getMessageFlags(in long zeroBasedIndex);
  void setMessageFlags(in long zeroBasedIndex, in unsigned short flags);
  void expungeByIndex(in unsigned long zeroBasedIndex);
  void addUidFlagPair(in unsigned long uid, in unsigned short flags, in unsigned long zeroBasedIndex);
  void addUidCustomFlagPair(in unsigned long uid, in string customFlag);
  /**
   * Get the message flags by the message UID.
   * @param uid - The message UID.
   * @returns The message flags.
   */
  unsigned short getMessageFlagsByUid(in unsigned long uid);
  string getCustomFlags(in unsigned long uid); // returns space-separated keywords
  void reset();
  void clearCustomFlags(in unsigned long uid);
  /**
   * Adds custom attributes to a hash table for the purpose of storing them
   * them.
   * @param aUid   UID of the associated msg
   * @param aCustomAttributeName   Name of the custom attribute value
   * @param aCustomAttributeValue   Value of the attribute,
   */
  void setCustomAttribute(in unsigned long aUid,
                          in ACString aCustomAttributeName,
                          in ACString aCustomAttributeValue);

  /**
   * Gets the custom attributes from the hash table where they were stored earlier
   * them.
   * @param aUid   UID of the associated msg
   * @param aCustomAttributeName   Name of the custom attribute value
   * @param aCustomAttributeValue   Value of the attribute,
   */
  ACString getCustomAttribute(in unsigned long aUid,
                              in ACString aCustomAttributeName);
};