2008-10-02 17 views
7

मैं थंडरबर्ड एक्सटेंशन बना रहा हूं और सभी आउटगोइंग ईमेल (जैसे < myext-version: 1.0 >) पर अपना हेडर जोड़ना चाहता हूं। कोई आईडिया कि इसे कैसे किया जाए? मुझे पता है कि यह संभव है क्योंकि यह OpenPGP Enigmail एक्सटेंशन में किया जाता है। धन्यवाद!आप थंडरबर्ड एक्सटेंशन के साथ ईमेल शीर्षलेख कैसे डालते हैं?

+0

क्या यह superuser.com में नहीं है? –

+1

यह उचित है क्योंकि वह एक एक्सटेंशन कोडिंग कर रहा है। यदि वह मौजूदा एक्सटेंशन की तलाश में है तो यह superuser.com पर होगा। – studgeek

उत्तर

1

मैं इस सवाल का जवाब लेकिन सिर्फ कुछ विचार नहीं पता ...

मुझे लगता है कि थंडरबर्ड एक्सटेंशन आम तौर पर सिर्फ xul और जे एस कर रहे हैं। Enigmail साइट से:

सबसे मोज़िला AddOns के विपरीत, Enigmail मंच निर्भर भाग शामिल हैं: यह सीपीयू पर निर्भर करता है, संकलक, ऑपरेटिंग सिस्टम की पुस्तकालयों और ईमेल अनुप्रयोग यह में एकीकृत जाएगा।

Enigmail स्रोत कोड को देखते हुए, this might be the relevant section (ग में लिखा ++)

तो आप या तो अनुवाद करने के लिए वे क्या js में किया है एक अलग उदाहरण के लिए देखते रहो आवश्यकता हो सकती है (!) या।

function SendObserver() { 
    this.register(); 
} 

SendObserver.prototype = { 
    observe: function(subject, topic, data) { 

    /* thunderbird sends a notification even when it's only saving the message as a draft. 
     * We examine the caller chain to check for valid send notifications 
     */ 
    var f = this.observe; 
    while (f) { 
     if(/Save/.test(f.name)) { 
      print("Ignoring send notification because we're probably autosaving or saving as a draft/template"); 
      return; 
     } 
     f = f.caller; 
    } 

    // add your headers here, separated by \r\n 
    subject.gMsgCompose.compFields.otherRandomHeaders += "x-test: test\r\n"; 
    } 

    }, 
    register: function() { 
    var observerService = Components.classes["@mozilla.org/observer-service;1"] 
          .getService(Components.interfaces.nsIObserverService); 
    observerService.addObserver(this, "mail:composeOnSend", false); 
    }, 
    unregister: function() { 
    var observerService = Components.classes["@mozilla.org/observer-service;1"] 
          .getService(Components.interfaces.nsIObserverService); 
    observerService.removeObserver(this, "mail:composeOnSend"); 
    } 
}; 


/* 
* Register observer for send events. Check for event target to ensure that the 
* compose window is loaded/unloaded (and not the content of the editor). 
* 
* Unregister to prevent memory leaks (as per MDC documentation). 
*/ 
var sendObserver; 
window.addEventListener('load', function (e) {if (e.target == document) sendObserver = new SendObserver(); }, true); 
window.addEventListener('unload', function (e) { if (e.target == document) sendObserver.unregister();}, true); 

कि chrome://messenger/content/messengercompose/messengercompose.xul) ओवरले करके लिखें विंडो (उदाहरण के लिए द्वारा भरी हुई है एक .js फ़ाइल के अंदर इस रखो:

Here's another link that might be helpful

3

यहाँ एक विस्तार से कोड मैं पर काम कर रहा हूँ है।

SendObserver.observe में चेक मेरे मामले में आवश्यक था क्योंकि मैं उपयोगकर्ता की बातचीत करना चाहता था, लेकिन आप शायद इसे छोड़ सकते हैं।

संबंधित मुद्दे