1 | /* ***** BEGIN LICENSE BLOCK ***** |
---|
2 | This program is free software; you can redistribute it and/or modify |
---|
3 | it under the terms of the GNU General Public License as published by |
---|
4 | the Free Software Foundation; either version 2 of the License, or |
---|
5 | (at your option) any later version. |
---|
6 | |
---|
7 | This program is distributed in the hope that it will be useful, |
---|
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | GNU General Public License for more details. |
---|
11 | |
---|
12 | You should have received a copy of the GNU General Public License |
---|
13 | along with this program; if not, write to the Free Software |
---|
14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
15 | |
---|
16 | The Original Code is the Virtual Identity Extension. |
---|
17 | |
---|
18 | The Initial Developer of the Original Code is Rene Ejury. |
---|
19 | Portions created by the Initial Developer are Copyright (C) 2007 |
---|
20 | the Initial Developer. All Rights Reserved. |
---|
21 | |
---|
22 | Contributor(s): |
---|
23 | * ***** END LICENSE BLOCK ***** */ |
---|
24 | |
---|
25 | /* this is now used as a module - there is no required reference to any other interface-elements in this code */ |
---|
26 | |
---|
27 | virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) { |
---|
28 | function prepareSendMsg(vid, msgType, identityData, baseIdentity, recipients) { |
---|
29 | var stringBundle = Services.strings.createBundle("chrome://v_identity/locale/v_identity.properties"); |
---|
30 | |
---|
31 | var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] |
---|
32 | .getService(Components.interfaces.nsIPromptService); |
---|
33 | |
---|
34 | var prefs = Components.classes["@mozilla.org/preferences-service;1"] |
---|
35 | .getService(Components.interfaces.nsIPrefService) |
---|
36 | .getBranch("extensions.virtualIdentity."); |
---|
37 | |
---|
38 | var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"] |
---|
39 | .getService(Components.interfaces.nsIMsgAccountManager); |
---|
40 | |
---|
41 | if (vI.notificationBar) vI.notificationBar.dump("\n## prepareSendMsg " + msgType + " " + Components.interfaces.nsIMsgCompDeliverMode.Now + "\n"); |
---|
42 | |
---|
43 | returnValue = {}; |
---|
44 | |
---|
45 | if (msgType == Components.interfaces.nsIMsgCompDeliverMode.Now) { |
---|
46 | if ( (vid && prefs.getBoolPref("warn_virtual") && |
---|
47 | !(promptService.confirm(window,"Warning", |
---|
48 | stringBundle.GetStringFromName("vident.sendVirtual.warning")))) || |
---|
49 | (!vid && prefs.getBoolPref("warn_nonvirtual") && |
---|
50 | !(promptService.confirm(window,"Warning", |
---|
51 | stringBundle.GetStringFromName("vident.sendNonvirtual.warning")))) ) { |
---|
52 | return { update : "abort", storedIdentity : null }; // completely abort sending |
---|
53 | } |
---|
54 | if (prefs.getBoolPref("storage") && |
---|
55 | (!vI.statusmenu || vI.statusmenu.objStorageSaveMenuItem.getAttribute("checked") == "true")) { |
---|
56 | var localeDatasourceAccess = new vI.rdfDatasourceAccess(); |
---|
57 | var returnValue = localeDatasourceAccess.storeVIdentityToAllRecipients(identityData, recipients) |
---|
58 | if ( returnValue.update == "abort" || returnValue.update == "takeover" ) { |
---|
59 | if (vI.notificationBar) vI.notificationBar.dump("## prepareSendMsg: sending aborted\n"); |
---|
60 | return returnValue; |
---|
61 | } |
---|
62 | } |
---|
63 | else if (vI.notificationBar) vI.notificationBar.dump("## prepareSendMsg: storage deactivated\n"); |
---|
64 | } |
---|
65 | if (vid) { |
---|
66 | vI.account.removeUsedVIAccount(); |
---|
67 | vI.account.createAccount(identityData, baseIdentity); |
---|
68 | } |
---|
69 | return { update : "accept", storedIdentity : null }; |
---|
70 | }; |
---|
71 | |
---|
72 | function finalCheck(virtualIdentityData, currentIdentity) { |
---|
73 | var stringBundle = Services.strings.createBundle("chrome://v_identity/locale/v_identity.properties"); |
---|
74 | |
---|
75 | // vI.identityData(email, fullName, id, smtp, extras, sideDescription, existingID) |
---|
76 | var currentIdentityData = new vI.identityData(currentIdentity.email, currentIdentity.fullName, null, currentIdentity.smtpServerKey, null, null, null); |
---|
77 | |
---|
78 | if (vI.notificationBar) vI.notificationBar.dump("\n## vI.identityData SendMessage Final Check\n"); |
---|
79 | if (vI.notificationBar) vI.notificationBar.dump("## vI.identityData currentIdentity: fullName='" + currentIdentityData.fullName + "' email='" + currentIdentityData.email + "' smtp='" + currentIdentityData.smtp.key + "'\n"); |
---|
80 | if (vI.notificationBar) vI.notificationBar.dump("## vI.identityData virtualIdentityData: fullName='" + virtualIdentityData.fullName + "' email='" + virtualIdentityData.email + "' smtp='" + virtualIdentityData.smtp.key + "'\n"); |
---|
81 | |
---|
82 | if (currentIdentityData.fullName.toLowerCase() == virtualIdentityData.fullName.toLowerCase() && |
---|
83 | currentIdentityData.email.toLowerCase() == virtualIdentityData.email.toLowerCase() && |
---|
84 | virtualIdentityData.smtp.equal(currentIdentityData.smtp) ) { |
---|
85 | return true |
---|
86 | } |
---|
87 | else { |
---|
88 | if (!(currentIdentityData.fullName.toLowerCase() == virtualIdentityData.fullName.toLowerCase())) vI.notificationBar.dump("\n## vI.identityData failed check for fullName.\n"); |
---|
89 | if (!(currentIdentityData.email.toLowerCase() == virtualIdentityData.email.toLowerCase())) vI.notificationBar.dump("\n## vI.identityData failed check for email.\n"); |
---|
90 | if (!(virtualIdentityData.smtp.equal(currentIdentityData.smtp))) vI.notificationBar.dump("\n## vI.identityData failed check for SMTP.\n"); |
---|
91 | alert(stringBundle.getStringFromName("vident.genericSendMessage.error")); |
---|
92 | return false |
---|
93 | } |
---|
94 | }; |
---|
95 | |
---|
96 | var account = { |
---|
97 | _account : null, |
---|
98 | |
---|
99 | _baseIdentity : null, |
---|
100 | |
---|
101 | _AccountManager : Components.classes["@mozilla.org/messenger/account-manager;1"] |
---|
102 | .getService(Components.interfaces.nsIMsgAccountManager), |
---|
103 | |
---|
104 | _prefroot : Components.classes["@mozilla.org/preferences-service;1"] |
---|
105 | .getService(Components.interfaces.nsIPrefService) |
---|
106 | .getBranch(null), |
---|
107 | |
---|
108 | _pref : Components.classes["@mozilla.org/preferences-service;1"] |
---|
109 | .getService(Components.interfaces.nsIPrefService) |
---|
110 | .getBranch("extensions.virtualIdentity."), |
---|
111 | |
---|
112 | _unicodeConverter : Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] |
---|
113 | .createInstance(Components.interfaces.nsIScriptableUnicodeConverter), |
---|
114 | |
---|
115 | _copyBoolAttribute : function(name) { |
---|
116 | account._account.defaultIdentity.setBoolAttribute(name, |
---|
117 | account._baseIdentity.getBoolAttribute(name)); |
---|
118 | }, |
---|
119 | |
---|
120 | _copyIntAttribute : function(name) { |
---|
121 | account._account.defaultIdentity.setIntAttribute(name, |
---|
122 | account._baseIdentity.getIntAttribute(name)); |
---|
123 | }, |
---|
124 | |
---|
125 | _copyCharAttribute : function(name) { |
---|
126 | account._account.defaultIdentity.setCharAttribute(name, |
---|
127 | account._baseIdentity.getCharAttribute(name)); |
---|
128 | }, |
---|
129 | |
---|
130 | _copyUnicharAttribute : function(name) { |
---|
131 | account._account.defaultIdentity.setUnicharAttribute(name, |
---|
132 | account._baseIdentity.getUnicharAttribute(name)); |
---|
133 | }, |
---|
134 | |
---|
135 | _copyPreferences : function() { |
---|
136 | if (account._pref.getBoolPref("copySMIMESettings")) { |
---|
137 | // SMIME settings |
---|
138 | vI.notificationBar.dump("## account: copy S/MIME settings\n") |
---|
139 | account._copyUnicharAttribute("signing_cert_name"); |
---|
140 | account._copyUnicharAttribute("encryption_cert_name"); |
---|
141 | account._copyIntAttribute("encryptionpolicy"); |
---|
142 | } |
---|
143 | /* seems not required, encryption happens before Virtual Identity account is created |
---|
144 | if (account._pref.getBoolPref("copyEnigmailSettings")) { |
---|
145 | // pgp/enigmail settings |
---|
146 | vI.notificationBar.dump("## account: copy PGP settings\n") |
---|
147 | account._copyBoolAttribute("pgpSignEncrypted"); |
---|
148 | account._copyBoolAttribute("pgpSignPlain"); |
---|
149 | account._copyBoolAttribute("enablePgp"); |
---|
150 | account._copyIntAttribute("pgpKeyMode"); |
---|
151 | account._copyCharAttribute("pgpkeyId"); |
---|
152 | account._copyIntAttribute("openPgpHeaderMode"); |
---|
153 | account._copyCharAttribute("openPgpUrlName"); |
---|
154 | |
---|
155 | account._copyIntAttribute("defaultEncryptionPolicy"); |
---|
156 | } */ |
---|
157 | if (account._pref.getBoolPref("copyAttachVCardSettings")) { |
---|
158 | // attach vcard |
---|
159 | vI.notificationBar.dump("## account: copy VCard settings\n") |
---|
160 | account._copyBoolAttribute("attachVCard"); |
---|
161 | account._copyCharAttribute("escapedVCard"); |
---|
162 | } |
---|
163 | }, |
---|
164 | |
---|
165 | // checks if directory is empty, not really used |
---|
166 | // ignores files ending with *.msf, else reports if a non-zero file is found. |
---|
167 | __dirEmpty : function(directory) { |
---|
168 | var dirEnumerator = directory.directoryEntries; |
---|
169 | while (dirEnumerator.hasMoreElements()) { |
---|
170 | var maildir = dirEnumerator.getNext(); |
---|
171 | maildir.QueryInterface(Components.interfaces.nsIFile); |
---|
172 | // recurse into all subdirectories |
---|
173 | if (maildir.isDirectory() && |
---|
174 | !account.__dirEmpty(maildir)) return false; |
---|
175 | // ignore files with ending "*.msf" |
---|
176 | if (!maildir.path.match(new RegExp(".*\.msf$","i")) && |
---|
177 | maildir.fileSize != 0) return false; |
---|
178 | } |
---|
179 | return true; |
---|
180 | }, |
---|
181 | |
---|
182 | __cleanupDirectories : function() { |
---|
183 | vI.notificationBar.dump("## account: checking for leftover VirtualIdentity directories ") |
---|
184 | |
---|
185 | var file = Components.classes["@mozilla.org/file/directory_service;1"] |
---|
186 | .getService(Components.interfaces.nsIProperties) |
---|
187 | .get("ProfD", Components.interfaces.nsIFile); |
---|
188 | |
---|
189 | var fileEnumerator = file.directoryEntries |
---|
190 | while (fileEnumerator.hasMoreElements()) { |
---|
191 | var dir = fileEnumerator.getNext() |
---|
192 | dir.QueryInterface(Components.interfaces.nsIFile); |
---|
193 | if (dir.path.match(new RegExp("[/\\\\]Mail$","i"))) { // match Windows and Linux/Mac separators |
---|
194 | var dirEnumerator = dir.directoryEntries |
---|
195 | while (dirEnumerator.hasMoreElements()) { |
---|
196 | var maildir = dirEnumerator.getNext() |
---|
197 | maildir.QueryInterface(Components.interfaces.nsIFile); |
---|
198 | // match Windows and Linux/Mac separators |
---|
199 | if (maildir.path.match(new RegExp("[/\\\\]virtualIdentity.*$","i"))) { |
---|
200 | // should be empty, VirtualIdentity never uses those directories |
---|
201 | if (account.__dirEmpty(maildir)) { |
---|
202 | try {maildir.remove(true)} catch(e) { } |
---|
203 | vI.notificationBar.dump("x"); |
---|
204 | } |
---|
205 | else vI.notificationBar.dump("."); |
---|
206 | |
---|
207 | } |
---|
208 | } |
---|
209 | } |
---|
210 | } |
---|
211 | vI.notificationBar.dump(" - done\n") |
---|
212 | }, |
---|
213 | |
---|
214 | cleanupSystem : function() { |
---|
215 | vI.notificationBar.dump("## account: checking for leftover VirtualIdentity accounts ") |
---|
216 | for (var i=0; i < account._AccountManager.accounts.Count(); i++) { |
---|
217 | var checkAccount = account._AccountManager.accounts.QueryElementAt(i, Components.interfaces.nsIMsgAccount); |
---|
218 | if (account.__isVIdentityAccount(checkAccount)) { |
---|
219 | vI.notificationBar.dump(".") |
---|
220 | account.__removeAccount(checkAccount); |
---|
221 | } |
---|
222 | } |
---|
223 | vI.notificationBar.dump(" - done\n") |
---|
224 | account.__cleanupDirectories(); |
---|
225 | }, |
---|
226 | |
---|
227 | __isVIdentityAccount : function(checkAccount) { |
---|
228 | // check for new (post0.5.0) accounts, |
---|
229 | try { account._prefroot.getBoolPref("mail.account." + checkAccount.key + ".vIdentity"); |
---|
230 | return true; |
---|
231 | } catch (e) { }; |
---|
232 | // check for old (pre 0.5.0) accounts |
---|
233 | if (checkAccount.incomingServer && checkAccount.incomingServer.hostName == "virtualIdentity") return true; |
---|
234 | return false; |
---|
235 | }, |
---|
236 | |
---|
237 | __removeAccount : function(checkAccount) { |
---|
238 | vI.notificationBar.dump("## account: __removeAccount\n") |
---|
239 | // in new (post 0.5.0) Virtual Identity accounts the incomingServer of the account |
---|
240 | // points to an incoming server of a different account. Cause the internal |
---|
241 | // removeAccount function tries to removes the incomingServer ether, create |
---|
242 | // a real one before calling this function. |
---|
243 | if (!checkAccount.incomingServer || checkAccount.incomingServer.hostName != "virtualIdentity") { |
---|
244 | // if not some of the 'old' accounts |
---|
245 | checkAccount.incomingServer = account._AccountManager. |
---|
246 | createIncomingServer("toRemove","virtualIdentity","pop3"); |
---|
247 | } |
---|
248 | |
---|
249 | // remove the rootFolder of the account |
---|
250 | try { checkAccount.incomingServer.rootFolder.Delete(); } |
---|
251 | catch (e) { }; |
---|
252 | |
---|
253 | var key = checkAccount.key; |
---|
254 | vI.notificationBar.dump("## account: removing account " + key + ".\n") |
---|
255 | // remove the account |
---|
256 | account._AccountManager.removeAccount(checkAccount); |
---|
257 | // remove the additional tagging-pref |
---|
258 | try { account._prefroot.clearUserPref("mail.account." + key + ".vIdentity"); } |
---|
259 | catch (e) { }; |
---|
260 | }, |
---|
261 | |
---|
262 | removeUsedVIAccount : function() { |
---|
263 | var mailWindow = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService() |
---|
264 | .QueryInterface(Components.interfaces.nsIWindowMediator) |
---|
265 | .getMostRecentWindow("mail:3pane"); |
---|
266 | if (mailWindow) { // it's not sure that we have an open 3-pane-window |
---|
267 | var selectedFolder = (mailWindow.gFolderTreeView)?mailWindow.gFolderTreeView.getSelectedFolders()[0]:null; |
---|
268 | var selectedMessages = (mailWindow.gFolderDisplay)?mailWindow.gFolderDisplay.selectedMessages:null; |
---|
269 | } |
---|
270 | if (account._account) { |
---|
271 | account.__removeAccount(account._account); |
---|
272 | account._account = null; |
---|
273 | } |
---|
274 | try { |
---|
275 | if (selectedFolder) mailWindow.gFolderTreeView.selectFolder(selectedFolder); |
---|
276 | if (selectedMessages) mailWindow.gFolderDisplay.selectMessages(selectedMessages, false, false); |
---|
277 | } catch (e) { }; |
---|
278 | }, |
---|
279 | |
---|
280 | createAccount : function(identityData, baseIdentity) |
---|
281 | { |
---|
282 | if (account._account) { // if the Account is still created, then leave all like it is |
---|
283 | alert("account still created, shouldn't happen"); |
---|
284 | return; |
---|
285 | } |
---|
286 | account._baseIdentity = baseIdentity; |
---|
287 | /* |
---|
288 | // the easiest way would be to get all requiered Attributes might be to duplicate the default account like this |
---|
289 | var recentAccount = account._AccountManager.getAccount(vI.main.elements.Obj_MsgIdentity.selectedItem.getAttribute("accountkey")); |
---|
290 | vI.main.VIdent_Account = account._AccountManager.duplicateAccount(recentAccount); |
---|
291 | // but this ends up in the following exception: |
---|
292 | // "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIMsg_AccountManager.duplicateAccount]" |
---|
293 | // so I have to do this by hand ;( |
---|
294 | */ |
---|
295 | |
---|
296 | account._account = account._AccountManager.createAccount(); |
---|
297 | account._prefroot.setBoolPref("mail.account." + account._account.key + ".vIdentity", true) |
---|
298 | account._account.addIdentity(account._AccountManager.createIdentity()); |
---|
299 | // the new account uses the same incomingServer than the base one, |
---|
300 | // it's especially required for NNTP cause incomingServer is used for sending newsposts. |
---|
301 | // by pointing to the same incomingServer stored passwords can be reused |
---|
302 | // the incomingServer has to be replaced before the account is removed, else it get removed ether |
---|
303 | var servers = account._AccountManager.GetServersForIdentity(baseIdentity); |
---|
304 | var server = servers.QueryElementAt(0, Components.interfaces.nsIMsgIncomingServer); |
---|
305 | // we mark the server as invalid so that the account manager won't |
---|
306 | // tell RDF about the new server - we don't need this server for long |
---|
307 | // but we should restore it, because it's actually the same server as the one of the base identity |
---|
308 | server.valid = false; |
---|
309 | account._account.incomingServer = server; |
---|
310 | server.valid = true; |
---|
311 | account._copyIdentityData(identityData, baseIdentity); |
---|
312 | account._copyPreferences(); |
---|
313 | account._unicodeConverter.charset = "UTF-8"; |
---|
314 | account._setupFcc(); |
---|
315 | account._setupDraft(); |
---|
316 | account._setupTemplates(); |
---|
317 | }, |
---|
318 | |
---|
319 | _copyIdentityData : function(identityData, baseIdentity) { |
---|
320 | account._account.defaultIdentity.setCharAttribute("useremail", identityData.email); |
---|
321 | account._account.defaultIdentity.setUnicharAttribute("fullName", identityData.fullName); |
---|
322 | |
---|
323 | account._account.defaultIdentity.smtpServerKey = identityData.smtp.keyNice; // key with "" for vI.DEFAULT_SMTP_TAG |
---|
324 | if (account._account.defaultIdentity.smtpServerKey == virtualIdentityExtension.NO_SMTP_TAG) |
---|
325 | account._account.defaultIdentity.smtpServerKey = baseIdentity.smtpServerKey; |
---|
326 | |
---|
327 | vI.notificationBar.dump("## account: Stored virtualIdentity (name " |
---|
328 | + account._account.defaultIdentity.fullName + " email " |
---|
329 | + account._account.defaultIdentity.email + " smtp " |
---|
330 | + account._account.defaultIdentity.smtpServerKey +")\n"); |
---|
331 | }, |
---|
332 | |
---|
333 | _setupFcc : function() |
---|
334 | { |
---|
335 | // fcc_switch is only available in modified ComposeDialog. |
---|
336 | // XXXXX get rid of this Elem reference |
---|
337 | var doFcc = true; |
---|
338 | try { doFcc = document.getElementById("fcc_switch").getAttribute("checked") } catch(e) { } |
---|
339 | if (doFcc) { |
---|
340 | switch (account._pref.getCharPref("fccFolderPickerMode")) |
---|
341 | { |
---|
342 | case "2" : |
---|
343 | vI.notificationBar.dump ("## account: preparing Fcc --- use Settings of Default Account\n"); |
---|
344 | account._account.defaultIdentity.doFcc = account._AccountManager.defaultAccount.defaultIdentity.doFcc; |
---|
345 | account._account.defaultIdentity.fccFolder = account._AccountManager.defaultAccount.defaultIdentity.fccFolder; |
---|
346 | account._account.defaultIdentity.fccFolderPickerMode = account._AccountManager.defaultAccount.defaultIdentity.fccFolderPickerMode; |
---|
347 | account._account.defaultIdentity.fccReplyFollowsParent = account._AccountManager.defaultAccount.defaultIdentity.fccReplyFollowsParent; |
---|
348 | break; |
---|
349 | case "3" : |
---|
350 | vI.notificationBar.dump ("## account: preparing Fcc --- use Settings of Modified Account\n"); |
---|
351 | account._account.defaultIdentity.doFcc = account._baseIdentity.doFcc; |
---|
352 | account._account.defaultIdentity.fccFolder = account._baseIdentity.fccFolder; |
---|
353 | account._account.defaultIdentity.fccFolderPickerMode = account._baseIdentity.fccFolderPickerMode; |
---|
354 | account._account.defaultIdentity.fccReplyFollowsParent = account._baseIdentity.fccReplyFollowsParent; |
---|
355 | break; |
---|
356 | default : |
---|
357 | vI.notificationBar.dump ("## account: preparing Fcc --- use Virtual Identity Settings\n"); |
---|
358 | account._account.defaultIdentity.doFcc |
---|
359 | = account._pref.getBoolPref("doFcc"); |
---|
360 | account._account.defaultIdentity.fccFolder |
---|
361 | = account._unicodeConverter.ConvertToUnicode(account._pref.getCharPref("fccFolder")); |
---|
362 | account._account.defaultIdentity.fccFolderPickerMode |
---|
363 | = account._pref.getCharPref("fccFolderPickerMode"); |
---|
364 | account._account.defaultIdentity.fccReplyFollowsParent = account._pref.getBoolPref("fccReplyFollowsParent"); |
---|
365 | |
---|
366 | break; |
---|
367 | } |
---|
368 | } |
---|
369 | else { |
---|
370 | dump ("## account: dont performing Fcc\n"); |
---|
371 | account._account.defaultIdentity.doFcc = false; |
---|
372 | } |
---|
373 | vI.notificationBar.dump("## account: Stored (doFcc " + account._account.defaultIdentity.doFcc + " fccFolder " + |
---|
374 | account._account.defaultIdentity.fccFolder + " fccFolderPickerMode " + |
---|
375 | account._account.defaultIdentity.fccFolderPickerMode + "(" + |
---|
376 | account._pref.getCharPref("fccFolderPickerMode") + "))\n"); |
---|
377 | }, |
---|
378 | |
---|
379 | _setupDraft : function() { |
---|
380 | switch (account._pref.getCharPref("draftFolderPickerMode")) |
---|
381 | { |
---|
382 | case "2" : |
---|
383 | vI.notificationBar.dump ("## account: preparing Draft --- use Settings of Default Account\n"); |
---|
384 | account._account.defaultIdentity.draftFolder = account._AccountManager.defaultAccount.defaultIdentity.draftFolder; |
---|
385 | account._account.defaultIdentity.draftsFolderPickerMode = account._AccountManager.defaultAccount.defaultIdentity.draftsFolderPickerMode; |
---|
386 | break; |
---|
387 | case "3" : |
---|
388 | vI.notificationBar.dump ("## account: preparing Draft --- use Settings of Modified Account\n"); |
---|
389 | account._account.defaultIdentity.draftFolder = account._baseIdentity.draftFolder; |
---|
390 | account._account.defaultIdentity.draftsFolderPickerMode = account._baseIdentity.draftsFolderPickerMode; |
---|
391 | break; |
---|
392 | default : |
---|
393 | vI.notificationBar.dump ("## account: preparing Draft --- use Virtual Identity Settings\n"); |
---|
394 | account._account.defaultIdentity.draftFolder |
---|
395 | = account._unicodeConverter.ConvertToUnicode(account._pref.getCharPref("draftFolder")); |
---|
396 | account._account.defaultIdentity.draftsFolderPickerMode |
---|
397 | = account._pref.getCharPref("draftFolderPickerMode"); |
---|
398 | break; |
---|
399 | } |
---|
400 | vI.notificationBar.dump("## account: Stored (draftFolder " + |
---|
401 | account._account.defaultIdentity.draftFolder + " draftsFolderPickerMode " + |
---|
402 | account._account.defaultIdentity.draftsFolderPickerMode + "(" + |
---|
403 | account._pref.getCharPref("draftFolderPickerMode") + "))\n"); |
---|
404 | }, |
---|
405 | |
---|
406 | _setupTemplates : function() { |
---|
407 | switch (account._pref.getCharPref("stationeryFolderPickerMode")) |
---|
408 | { |
---|
409 | case "2" : |
---|
410 | vI.notificationBar.dump ("## account: preparing Templates --- use Settings of Default Account\n"); |
---|
411 | account._account.defaultIdentity.stationeryFolder = account._AccountManager.defaultAccount.defaultIdentity.stationeryFolder; |
---|
412 | account._account.defaultIdentity.tmplFolderPickerMode = account._AccountManager.defaultAccount.defaultIdentity.tmplFolderPickerMode; |
---|
413 | break; |
---|
414 | case "3" : |
---|
415 | vI.notificationBar.dump ("## account: preparing Templates --- use Settings of Modified Account\n"); |
---|
416 | account._account.defaultIdentity.stationeryFolder = account._baseIdentity.stationeryFolder; |
---|
417 | account._account.defaultIdentity.tmplFolderPickerMode = account._baseIdentity.tmplFolderPickerMode; |
---|
418 | break; |
---|
419 | default : |
---|
420 | vI.notificationBar.dump ("## account: preparing Templates --- use Virtual Identity Settings\n"); |
---|
421 | account._account.defaultIdentity.stationeryFolder |
---|
422 | = account._unicodeConverter.ConvertToUnicode(account._pref.getCharPref("stationeryFolder")); |
---|
423 | account._account.defaultIdentity.tmplFolderPickerMode |
---|
424 | = account._pref.getCharPref("stationeryFolderPickerMode"); |
---|
425 | break; |
---|
426 | } |
---|
427 | vI.notificationBar.dump("## account: Stored (stationeryFolder " + |
---|
428 | account._account.defaultIdentity.stationeryFolder + " tmplFolderPickerMode " + |
---|
429 | account._account.defaultIdentity.tmplFolderPickerMode + "(" + |
---|
430 | account._pref.getCharPref("stationeryFolderPickerMode") + "))\n"); |
---|
431 | } |
---|
432 | } |
---|
433 | vI.account = account; |
---|
434 | vI.prepareSendMsg = prepareSendMsg; |
---|
435 | vI.finalCheck = finalCheck; |
---|
436 | }}); |
---|