summaryrefslogtreecommitdiffstats
path: root/mailnews/imap/public/nsIImapMessageSink.idl
blob: 420ea76423830f29096f839a6959bdd1e7fbd385 (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
/* -*- Mode: C++; 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"
#include "MailNewsTypes2.idl"
#include "nsIImapUrl.idl"

interface nsIMsgMailNewsUrl;

[scriptable, uuid(6ffb6a92-e43a-405f-92ea-92cf81a5e17b)]

interface nsIImapMessageSink : nsISupports {
  // set up messge download output stream
  void setupMsgWriteStream(in nsIFile aFile, in boolean aAppendDummyEnvelope);

  /**
   * Used by the imap protocol code to notify the core backend code about
   * downloaded imap messages.
   *
   * @param aAdoptedMsgLine  a string with a lot of message lines,
   *                         separated by native line terminators.
   * @param aUidOfMsg        IMAP UID of the fetched message.
   * @param aImapUrl         IMAP Url used to fetch the message.
   */
  void parseAdoptedMsgLine(in string aAdoptedMsgLine, in nsMsgKey aUidOfMsg,
                           in nsIImapUrl aImapUrl);

  /**
   * Notify the backend that the imap protocol is done downloading a message
   *
   * @param aUidOfMsg           IMAP UID of the fetched message.
   * @param aMarkMsgRead        Set the SEEN flag on the message.
   * @param aImapUrl            IMAP Url used to fetch the message.
   * @param aUpdatedMessageSize if this parameter is not -1, the stored size of the message
   *                            should be set to this value to reflect the actual size of
   *                            the downloaded message.
   */
  void normalEndMsgWriteStream(in nsMsgKey aUidOfMessage,
                               in boolean aMarkMsgRead, in nsIImapUrl aImapUrl,
                               in long aUpdatedMessageSize);

  void abortMsgWriteStream();

  void beginMessageUpload();

  /**
   *  Notify the message sink that one or more flags have changed
   *  For Condstore servers, also update the highestMod Sequence
   *  @param   aFlags         - The new flags for the message
   *  @param   aKeywords        keywords for the message
   *  @param   aMessageKey    - The UID of the message that changed
   *  @param   aHighestModSeq - The highest mod seq the parser has seen
   *                            for this folder
  **/
  void notifyMessageFlags(in unsigned long aFlags, in ACString aKeywords,
                          in nsMsgKey aMessageKey,
                          in unsigned long long aHighestModSeq);

  void notifyMessageDeleted(in string aOnlineFolderName,in boolean aDeleteAllMsgs,in string aMsgIdString);

  void getMessageSizeFromDB(in string aId, out unsigned long aSize);

  void setContentModified(in nsIImapUrl aImapUrl, in nsImapContentModifiedType aModified);
  
  /**
   * For a message stored in a file, get the message metadata needed to copy
   * that message to an imap folder
   *
   * @param aRunningUrl  message URL
   * @param aDate        message date
   * @param aKeywords    message custom keywords (if supported by the server),
   *                     including messages tags and junk status
   *
   * @return             message flags
   */
  unsigned long getCurMoveCopyMessageInfo(in nsIImapUrl aRunningUrl, 
                                          out PRTime aDate, out ACString aKeywords);
};