Reply to Message

Modify Quoted Message (before normal composition)

 To get noticed of the availability of the body, you need to register a State Listener as follow.

var myStateListener = {  
  NotifyComposeFieldsReady: function() {
   },
  NotifyComposeBodyReady: function() {
  // The body is available and can be tweaked    },
  ComposeProcessDone: function(aResult) {
   },
  SaveInFolderDone: function(folderURI) {
   }
  };

The State Listener must be registered when the compose window is initialized:

addEventListener("compose-window-init", function (event) {
    gMsgCompose.RegisterStateListener(myStateListener);
    },true);

These script must be put in an overlay of chrome://messenger/content/messenger...gercompose.xul 

Reply / forward / reply to all...

We assume that msgHdr is a nsIMsgDbHdr.

/* The reply, reply to all, forward links. For reference, start reading
         * http://mxr.mozilla.org/comm-central/source/mail/base/content/messageWindow.js#949
         * and follow the function definitions. */
        let uri = msgHdr.folder.getUriForMsg(msgHdr);
        let compose = function compose_ (aCompType, aEvent) {
          if (aEvent.shiftKey) {
            ComposeMessage(aCompType, Ci.nsIMsgCompFormat.OppositeOfDefault, msgHdr.folder, [uri]);
          } else {
            ComposeMessage(aCompType, Ci.nsIMsgCompFormat.Default, msgHdr.folder, [uri]);
          }
        };

 

See http://mxr.mozilla.org/comm-central/...eParams.idl#48 for all the possible actions. Example:

compose(Ci.nsIMsgCompType.ReplyToSender, event);

Tags (2)

Edit tags

Attachments (0)

 

Attach file