Bug #258278 --> Forwarding HTML RSS article to an email address results in an empty email message

When forwarding, replying or editing an RSS message,
send the http URL for the article instead of trying to load the article contents
in the compose window.

sr=bienvenu
This commit is contained in:
scott%scott-macgregor.org 2004-11-29 18:26:21 +00:00
parent 125996288f
commit c785d56c18
2 changed files with 49 additions and 3 deletions

View File

@ -172,7 +172,6 @@ function ComposeMessage(type, format, folder, messageArray)
newsgroup = folder.folderURL;
}
//
identity = getIdentityForServer(server);
// dump("identity = " + identity + "\n");
}
@ -235,7 +234,11 @@ function ComposeMessage(type, format, folder, messageArray)
if (server)
identity = getIdentityForServer(server, hintForIdentity);
if (type == msgComposeType.Reply || type == msgComposeType.ReplyAll || type == msgComposeType.ForwardInline ||
var messageID = hdr.messageId;
var messageIDScheme = messageID.split(":")[0];
if ((messageIDScheme == 'http' || messageIDScheme == 'https') && "openComposeWindowForRSSArticle" in this)
openComposeWindowForRSSArticle(messageID, hdr, type);
else if (type == msgComposeType.Reply || type == msgComposeType.ReplyAll || type == msgComposeType.ForwardInline ||
type == msgComposeType.ReplyToGroup || type == msgComposeType.ReplyToSender ||
type == msgComposeType.ReplyToSenderAndGroup ||
type == msgComposeType.Template || type == msgComposeType.Draft)
@ -252,7 +255,7 @@ function ComposeMessage(type, format, folder, messageArray)
uri += messageUri;
}
}
if (type == msgComposeType.ForwardAsAttachment)
if (type == msgComposeType.ForwardAsAttachment && uri)
msgComposeService.OpenComposeWindow(null, uri, type, format, identity, msgWindow);
}
else

View File

@ -27,6 +27,49 @@
var selectedFolders = GetSelectedMsgFolders();
openSubscriptionsDialog(selectedFolders[0].server);
}
// Special case attempts to reply/forward/edit as new RSS arrticles
// Send the feed article URL instead of trying to load the feed inside of
// an iframe. Bug #258278.
function openComposeWindowForRSSArticle(messageID, msgHdr, type)
{
// convert our messageID into a url..
var contentBase = messageID.replace("@localhost.localdomain", "");
var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
.createInstance(Components.interfaces.nsIMsgComposeParams);
if (params)
{
params.composeFields = Components.classes['@mozilla.org/messengercompose/composefields;1']
.createInstance(Components.interfaces.nsIMsgCompFields);
if (params.composeFields)
{
params.composeFields.body = contentBase;
var subject = msgHdr.mime2DecodedSubject;
if (type == msgComposeType.Reply
|| type == msgComposeType.ReplyAll
|| type == msgComposeType.ReplyToSender
|| type == msgComposeType.ReplyToGroup
|| type == msgComposeType.ReplyToSenderAndGroup)
subject = 'Re: ' + subject;
else if (type == msgComposeType.ForwardInline || type == msgComposeType.ForwardAsAttachment)
subject = '[Fwd: ' + subject + ']';
params.composeFields.subject = subject;
params.composeFields.characterSet = msgHdr.Charset;
params.bodyIsLink = true;
if (msgComposeService) {
try {
params.identity = msgComposeService.defaultIdentity;
}
catch (ex) {
params.identity = null;
}
msgComposeService.OpenComposeWindowWithParams(null, params);
}
}
}
}
</script>
<!-- Overlay into the folder pane context menu. If you change the id for the menu item, please