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

source: chrome/content/v_identity/vI_getHeader.js @ 9e9bab

Last change on this file since 9e9bab was 9e9bab, checked in by root <root@…>, 15 years ago

initial import v0.4.0

  • Property mode set to 100644
File size: 3.1 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) 2007
20    the Initial Developer. All Rights Reserved.
21
22    Contributor(s): Christian Weiske
23 * ***** END LICENSE BLOCK ***** */
24
25/**
26* some code copied and adapted from 'display Mail User Agent (MUA)'
27* thanks to Christian Weiske <cweiske@cweiske.de>
28*/
29
30var vI_getHeader = {
31    messenger: null,
32    preferences : Components.classes["@mozilla.org/preferences-service;1"]
33            .getService(Components.interfaces.nsIPrefService)
34            .getBranch("extensions.virtualIdentity."),
35    label: null,
36    note_list : new Array(),
37   
38    strings : document.getElementById("vIdentBundle"),
39
40    noop: function() { return; },
41
42    getHeader: function() {
43        dump("## vI_getHeader: onEndHeaders\n")
44       
45        var srcMsgURI = GetLoadedMessage();
46        if (srcMsgURI == null) return;
47
48        var header_list = vI_getHeader.preferences.getCharPref("smart_reply_headers").split(/\n/)
49        var hdr = vI_getHeader.messenger.messageServiceFromURI(srcMsgURI).messageURIToMsgHdr(srcMsgURI);
50        //loop through the headers
51        var found = false;
52        var label = vI_getHeader.strings.getString("vident.getHeader.noHeader");
53        for (headerName in currentHeaderData) {
54            for (index = 0; index < header_list.length; index++) {
55                header_to_search=header_list[index]
56                if (headerName.toLowerCase() == header_to_search.toLowerCase()) {
57                    hdr.setStringProperty(headerName.toLowerCase(),
58                        currentHeaderData[headerName].headerValue);
59                    if (!found) label = vI_getHeader.strings.getString("vident.getHeader.headerFound");
60                    label += " " + headerName.toLowerCase()
61                        + ":" + currentHeaderData[headerName].headerValue
62                    found = true;
63                }
64            }
65        }
66        vI_notificationBar.setNote(label, "get_header_notification");
67    },
68
69    setupEventListener: function() {
70        var listener = {};
71        listener.onStartHeaders = vI_getHeader.noop;
72        listener.onEndHeaders   = vI_getHeader.getHeader;
73        gMessageListeners.push(listener);
74
75        vI_getHeader.messenger = Components.classes["@mozilla.org/messenger;1"].createInstance();
76        vI_getHeader.messenger = vI_getHeader.messenger.QueryInterface(Components.interfaces.nsIMessenger);
77        vI_getHeader.strings = document.getElementById("vIdentBundle");
78    },
79}
80
81addEventListener('messagepane-loaded', vI_getHeader.setupEventListener, true);
Note: See TracBrowser for help on using the repository browser.