我可以在 Thunderbird 扩展中挂钩 Reply 事件吗

发布于 2024-11-14 04:05:42 字数 60 浏览 7 评论 0原文

有没有办法在 Thunderbird 扩展中添加一个事件处理程序,当用户单击“回复”时触发该事件处理程序?

Is there a way add an event handler in a Thunderbird extension that fires when the user clicks "Reply"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

节枝 2024-11-21 04:05:42

在 compose_overlay.js 中:

window.addEventListener("compose-send-message", mySendHandler, true);
window.addEventListener("compose-window-init", myReplyHandler, true);

function mySendHandler(evt){
    var msgcomposeWindow = document.getElementById( "msgcomposeWindow" );
    var msg_type = msgcomposeWindow.getAttribute( "msgtype" );

    // do not continue unless this is an actual send event
    if(!(msg_type == nsIMsgCompDeliverMode.Now || msg_type == nsIMsgCompDeliverMode.Later) )
        return;

    //do not continue unless it is a reply action (not a forward)
    var msgType = gMsgCompose.type;
    if(!(msgType == Components.interfaces.nsIMsgCompType.ReplyToSender || msgType == Components.interfaces.nsIMsgCompType.Reply))
        return;

    var origURI = gMsgCompose.originalMsgURI;
    if(origURI == ""){
        return;
    }

    var TBmain = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService().QueryInterface(Components.interfaces.nsIWindowMediator).getMostRecentWindow("mail:3pane");
    var msgHdr = TBmain.messenger.messageServiceFromURI(origURI).messageURIToMsgHdr(origURI);

    //TODO
    //Do something with the msgHdr

}

function myReplyHandler(evt){
    var origURI = gMsgCompose.originalMsgURI;
    var TBmain = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService().QueryInterface(Components.interfaces.nsIWindowMediator).getMostRecentWindow("mail:3pane");
    var msgHdr = TBmain.messenger.messageServiceFromURI(origURI).messageURIToMsgHdr(origURI); 

    //TODO
    //Do something with the msgHdr
}

礼貌:gaurang1988

http://forums.mozillazine.org/viewtopic.php?p=9182225&sid=c81555cc47c06bafde88cadbbd7f7808#p9182225

In compose_overlay.js:

window.addEventListener("compose-send-message", mySendHandler, true);
window.addEventListener("compose-window-init", myReplyHandler, true);

function mySendHandler(evt){
    var msgcomposeWindow = document.getElementById( "msgcomposeWindow" );
    var msg_type = msgcomposeWindow.getAttribute( "msgtype" );

    // do not continue unless this is an actual send event
    if(!(msg_type == nsIMsgCompDeliverMode.Now || msg_type == nsIMsgCompDeliverMode.Later) )
        return;

    //do not continue unless it is a reply action (not a forward)
    var msgType = gMsgCompose.type;
    if(!(msgType == Components.interfaces.nsIMsgCompType.ReplyToSender || msgType == Components.interfaces.nsIMsgCompType.Reply))
        return;

    var origURI = gMsgCompose.originalMsgURI;
    if(origURI == ""){
        return;
    }

    var TBmain = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService().QueryInterface(Components.interfaces.nsIWindowMediator).getMostRecentWindow("mail:3pane");
    var msgHdr = TBmain.messenger.messageServiceFromURI(origURI).messageURIToMsgHdr(origURI);

    //TODO
    //Do something with the msgHdr

}

function myReplyHandler(evt){
    var origURI = gMsgCompose.originalMsgURI;
    var TBmain = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService().QueryInterface(Components.interfaces.nsIWindowMediator).getMostRecentWindow("mail:3pane");
    var msgHdr = TBmain.messenger.messageServiceFromURI(origURI).messageURIToMsgHdr(origURI); 

    //TODO
    //Do something with the msgHdr
}

Courtesy: gaurang1988

http://forums.mozillazine.org/viewtopic.php?p=9182225&sid=c81555cc47c06bafde88cadbbd7f7808#p9182225

悲欢浪云 2024-11-21 04:05:42

根据您的目标,您可以覆盖回复按钮并在用户单击回复按钮时获取单击事件。

Depending on your goals you could overlay the reply button and get a click event when the user clicked the reply button(s).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文