1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38
39 #include "nsISupports.idl"
40 #include "nsIMsgCompose.idl"
41 #include "nsIMsgComposeParams.idl"
42
43 interface nsIURI;
44 interface nsIDOMWindowInternal;
45 interface nsIMsgWindow;
46 interface nsIMsgIdentity;
47 interface nsIMsgIncomingServer;
48 interface nsIMsgDBHdr;
49
50 [scriptable, uuid(BC1C0379-82EF-45ae-9710-DD4FA93252F7)]
51 interface nsIMsgComposeService : nsISupports {
52
53 /* we need a msg window because when we forward inline we may need progress */
54 void OpenComposeWindow(in string msgComposeWindowURL, in string originalMsgURI, in MSG_ComposeType type,
55 in MSG_ComposeFormat format,
56 in nsIMsgIdentity identity,
57 in nsIMsgWindow aMsgWindow);
58
59 /* use this method to invoke a compose window given a mailto url.
60 aMsgComposeWindowURL --> can be null in most cases. If you have your own chrome
61 url you want to use in brining up a compose window, pass it in here.
62 aURI --> the mailto url you want to use as the foundation for the data inside
63 the compose window */
64 void OpenComposeWindowWithURI(in string msgComposeWindowURL, in nsIURI aURI);
65
66 /* ... */
67 void OpenComposeWindowWithParams(in string msgComposeWindowURL, in nsIMsgComposeParams params);
68
69 /* ... */
70 nsIMsgCompose InitCompose(in nsIDOMWindowInternal aWindow, in nsIMsgComposeParams params);
71
72
73 /**
74 * defaultIdentity
75 *
76 * @return the default identity, in case no identity has been setup yet, will return null
77 */
78 readonly attribute nsIMsgIdentity defaultIdentity;
79
80 /* This function is use for debugging purpose only and may go away at anytime without warning */
81 void TimeStamp(in string label, in boolean resetTime);
82
83 /* This attribute is use for debugging purposes for determining whether to PR_LOG or not */
84 readonly attribute boolean logComposePerformance;
85
86 [noscript] boolean determineComposeHTML(in nsIMsgIdentity aIdentity, in MSG_ComposeFormat aFormat);
87 [noscript] void cacheWindow(in nsIDOMWindowInternal aWindow, in boolean aComposeHTML, in nsIMsgComposeRecyclingListener listener);
88 boolean isCachedWindow(in nsIDOMWindowInternal aWindow);
89
90 /**
91 * given a mailto url, parse the attributes and turn them into a nsIMsgComposeParams object
92 * @return nsIMsgComposeParams which corresponds to the passed in mailto url
93 */
94 nsIMsgComposeParams getParamsForMailto(in nsIURI aURI);
95
96 void forwardMessage(in AString forwardTo, in nsIMsgDBHdr aMsgHdr,
97 in nsIMsgWindow aMsgWindow, in nsIMsgIncomingServer aServer);
98
99 void replyWithTemplate(in nsIMsgDBHdr msgHdr, in string templateUri,
100 in nsIMsgWindow aMsgWindow, in nsIMsgIncomingServer server);
101
102 /**
103 * Every open compose window registers itself with the compose service
104 * This allows consumers to get the msg compose object associated with a dom window
105 *
106 * @param aWindow The DOM Window
107 * @param aMsgCompose The compose object associated with the compose window
108 *
109 */
110 void registerComposeWindow(in nsIDOMWindowInternal aWindow, in nsIMsgCompose aMsgCompose);
111
112 /**
113 * When a compose window is being closed (or recyled), it unregisters itself
114 * from the compose service.
115 *
116 * @param aWindow The DOM Window
117 *
118 */
119 void unregisterComposeWindow(in nsIDOMWindowInternal aWindow);
120
121 /**
122 * For aWindow, returns the nsIMsgCompose object associated with the window.
123 *
124 * @param aWindow The DOMWindow associated with the compose window.
125 *
126 * @return NS_ERROR_FAILURE if we could not find a nsIMsgCompose for the passed in
127 * DOM Window.
128 */
129 nsIMsgCompose getMsgComposeForWindow(in nsIDOMWindowInternal aWindow);
130 };