Patch Messaging Forward Messages

From WebOS Internals
Revision as of 00:24, 21 July 2009 by Hopspitfire (talk | contribs)
Jump to navigation Jump to search

Description: This mod will allow you to forward a message by simply tapping on the text of a message in the chat view. It does not interfere with the current attachment-tapping behavior. Tapping an attached image will still prompt for a save, etc.

Update: There is a patch available for the mod. Please see Applying Patches for instructions.

Step One: Create the model

Back up and modify /usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js.

After line 7, add the following:

forwardIdentifier: 'palm://com.palm.applicationManager',

  forwardMessage: function(sceneController,messageText) {
	return sceneController.serviceRequest(MessagingMojoService.forwardIdentifier,{
		method: 'launch',
			parameters: {
				id: 'com.palm.app.messaging',
				params: {
					messageText: 'FWD: '+messageText
				}
			}		
	});
  },

Step Two: Make it respond to a tap on the text

Back up and modify /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js

Find this block of code, starting at or near line 1440:

                var mmsVcalTarget = MessagingUtils.getClassUpChain(eventTarget,'mms-vcal');
                if(mmsVcalTarget) {
                        var filePath = mmsVcalTarget.getAttribute('filePath');
                        this.controller.stageController.pushScene('mmsTextAttachment', filePath);
                        return;
                }

Immediately below that block, add the following:

if (!mmsImageTarget && !mmsVideoTarget && !mmsVcardTarget && !mmsVcalTarget) {
	this.controller.showAlertDialog({
		onChoose: function(value) {if(value == "forward"){MessagingMojoService.forwardMessage(this.controller, event.item.messageText);}},
		title: $L("Forward Message"),
		message: $L("Do you want to forward this message?"),
		choices:[
					{label:$L("Yes"), value:"forward", type:"affirmative"},
					{label:$L("No"), value:"", type:"negative"}
				]
	});
}

-showAlertDialog by Atlanta

Reboot for the changes to take effect.

Usage

To forward a message, open the Messaging application, tap a chat thread, then tap an individual message. If the message has an attachment, make sure you tap on the text of the message. A new compose card will open with the message text pre-populated. Simply choose the recipient(s).

Credits

Submitted by JackieRipper