This is just some static backup of the original site, don't expect every link to work!

source: modules/vI_replyToSelf.js @ f29419

ng_0.9
Last change on this file since f29419 was f29419, checked in by rene <rene@…>, 11 years ago

tons of changes, mostly namespace-related

  • Property mode set to 100644
File size: 2.6 KB
Line 
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) 2011
20    the Initial Developer. All Rights Reserved.
21
22    Contributor(s):
23 * ***** END LICENSE BLOCK ***** */
24
25var EXPORTED_SYMBOLS = ["initReplyTo", "addReplyToSelf"]
26
27const {classes: Cc, interfaces: Ci, utils: Cu, results : Cr} = Components;
28Cu.import("resource://v_identity/vI_prefs.js");
29Cu.import("resource://v_identity/vI_log.js");
30let Log = setupLogging("virtualIdentity.replyToSelf");
31
32function initReplyTo() {
33  if (vIprefs.get("autoReplyToSelf")) {
34    replyToSelfObj.removeAttribute("hidden");
35    removeAllReplyTos();
36  }
37  else
38    replyToSelfObj.setAttribute("hidden", "true");
39};
40
41function removeAllReplyTos() {
42  if (!replyToSelfObj.hasAttribute("hidden")) {
43    for (var row = 1; row <= currentWindow.top.MAX_RECIPIENTS; row ++) {
44      var awType = currentWindow.awGetPopupElement(row).selectedItem.getAttribute("value");
45      if (awType == "addr_reply") {
46        Log.debug("removed ReplyTo found in row " + row + "\n");
47        currentWindow.awDeleteRow(row--); // removed one line therefore decrease row-value
48      }
49    }
50  }
51};
52
53function addReplyToSelf() {
54  if (!replyToSelfObj.hasAttribute("hidden")) {
55    currentWindow.awAddRecipient("addr_reply",currentWindow.document.getElementById("virtualIdentityExtension_msgIdentityClone").label);
56    Log.debug("added ReplyToSelf");
57    replyToSelfObj.setAttribute("hidden","true");
58  }
59}
60
61let replyToSelfObj = null;
62currentWindow = Cc["@mozilla.org/appshell/window-mediator;1"]
63  .getService(Ci.nsIWindowMediator)
64  .getMostRecentWindow(null);
65currentWindow.addEventListener("load", function () {
66  replyToSelfObj = currentWindow.document.getElementById("virtualIdentityExtension_autoReplyToSelfLabel");
67  }, false);
Note: See TracBrowser for help on using the repository browser.