diff -ubr quickreply/content/messenger-quickreply/msgQuickReplyOverlay.js quickreply-modified/content/messenger-quickreply/msgQuickReplyOverlay.js --- quickreply/content/messenger-quickreply/msgQuickReplyOverlay.js Thu Jul 31 15:59:56 2003 +++ quickreply-modified/content/messenger-quickreply/msgQuickReplyOverlay.js Thu Jul 31 16:40:58 2003 @@ -162,6 +162,44 @@ } } +/** function getQuotedOriginal + * This returns the original message (or a selected part) quoted for inclusion in the reply + */ +function getQuotedOriginal( author ) { + // try to get selection from the message pane + var messagepaneframe = GetMessagePaneFrame(); + var selection = messagepaneframe.getSelection(); + var selectiontext = selection.toString(); + if (selectiontext == "") { + // if no selection, quote the whole document... + selection.selectAllChildren(messagepaneframe.document.body); + selectiontext = selection.toString(); + selection.collapseToStart(); + } + // say who wrote the quoted part + var quoteauthor = author + " wrote:"; + // add a > at the beginning of each line + var quotedsection = ""; + var eolpos = 0; + var endofline = new RegExp("$", "m"); + var stilltoreplace = selectiontext; + while (stilltoreplace != "") + { + eolpos = stilltoreplace.search(endofline); + if (eolpos >= 0) + { + quotedsection = quotedsection + "> " + stilltoreplace.slice(0, eolpos+1); + stilltoreplace = stilltoreplace.slice(eolpos+1); + } + else + { + quotedsection = quotedsection + "> " + stilltoreplace; + } + } + // put them all together... + return quoteauthor + "\n" + quotedsection + "\n"; +} + /** function doQuickReply * This is the callback of the QuickReply button. */ @@ -171,7 +209,7 @@ return; } - var srcMsgHdr, tgt; + var srcMsgHdr, tgt, author; disableQR(); var srcMsgURI = GetLoadedMessage(); try { @@ -194,7 +232,18 @@ tgt = currentHeaderData['reply-to'].headerValue; else tgt = srcMsgHdr.author; - doReply( e.shiftKey == false, tgt, subj, document.getElementById("quickReplyInput").value, srcMsgId ); + + var quoteoriginal = false; + try { + quoteoriginal = pref.getBoolPref('quickreply.quoting'); + } catch(e) { + quoteoriginal = false; + } + if (quoteoriginal) + quotedoriginal = getQuotedOriginal(srcMsgHdr.author); + else + quotedoriginal = ""; + doReply( e.shiftKey == false, tgt, subj, document.getElementById("quickReplyInput").value, srcMsgId, quotedoriginal ); } // Check mail.warn_on_send_accel_key, and if necessary, ask for confirmation. @@ -315,7 +364,7 @@ } // the actual sending function. -function doReply( sendNow, to, sbj, bdy, srcId ) { +function doReply( sendNow, to, sbj, bdy, srcId, quotedreply ) { // set references & in-reply-to var compfields = Components.classes["@mozilla.org/messengercompose/composefields;1"].createInstance(Components.interfaces.nsIMsgCompFields); @@ -352,10 +401,9 @@ } progress.registerListener(progressListener); - compfields.to = to; - compfields.subject = sbj - compfields.body = bdy; + compfields.subject = sbj; + compfields.body = quotedoriginal + bdy ; compfields.references = "<"+srcId+">"; // compfields.forcePlainText = true; // alert('body'+compfields.body); diff -ubr quickreply/locale/en-US/messenger-quickreply/prefQuickReply.dtd quickreply-modified/locale/en-US/messenger-quickreply/prefQuickReply.dtd --- quickreply/locale/en-US/messenger-quickreply/prefQuickReply.dtd Fri Jul 4 13:28:02 2003 +++ quickreply-modified/locale/en-US/messenger-quickreply/prefQuickReply.dtd Thu Jul 31 16:22:31 2003 @@ -2,7 +2,7 @@ - +