Patch Messaging Adding Timestamps to All Received Messages

From WebOS Internals

Jump to: navigation, search


Contents

Introduction

A number of users have requested adding timestamps to each message that arrives on the device. Palm actually goes out of their way to group messages that have arrived during various time intervals, but if you'd prefer to see a timestamp on each message, simply follow the instructions below.

Procedure

1. Remount the file system as read/write

2. cd to /usr/palm/applications/com.palm.app.messaging/app/controllers/

3. Backup chatview-assistant.js (just to be safe)

4. Open chatview-assistant.js and comment out the following lines:

* 1169 (webOS 1.1: 1242) (webOS 1.2: 1306)- line that starts with: if(!ChatFlags.
* 1177 (webOS 1.1: 1250) (webOS 1.2: 1314)- line that starts with: if(today-msg.
* 1179 (webOS 1.1: 1252) (webOS 1.2: 1316)- first closing bracket on its own line: }
* 1180 (webOS 1.1: 1253) (webOS 1.2: 1317)- second closing bracket on its own line: }

5. Save the file and exit the editor

6. Remount the file system as read-only

7. Logout of your root session

8. Reboot the device

You should now see a full timestamp on all received messages.

Add Timestamps to All Messages - another approach

Introduction

The method described above is the easiest way to display message timestamps. I went a little farther since I didn't want the "Message Sent:" label and I also wanted to format the string a bit more. While I was at it, I also modified the view for the message text to display as pre-formatted text since text messages are text after all, not html.

Procedure

  • same as steps 1 & 2 above
  • save a backup of /usr/palm/applications/com.palm.app.messaging/
    • stylesheets/messaging.css
    • app/views/chatview/message/message-text.html
    • app/controllers/chatview-assistant.js
  • edit stylesheets/messaging.css
    • search for the string 'messageText' and append the following after its style definition
.messageText pre {
   font-family: inherit;
   font-size: inherit;
   color: inherit;
}
.timeStamp {
   font-size: 12px;
   font-style: italic;
   color: #1111ff;
}
    • feel free to change the style to your liking. I tried using 'white-space: pre-wrap' in the .messageText class but it didn't behave as expected, hence the use of the pre tag.
  • edit app/views/chatview/message/message-text.html
    • change the single line to:
<div class="messageText"><pre>#{-messageText}</pre> #{-errorContent}<span class="timeStamp">#{-timeStampText}</span></div>
  • edit app/controllers/chatview-assistant.js
    • search for the string 'preFormatChatList:' and just below that look for 'var msg = stuff.list[i];'
    • somewhere after that line (within the for loop) add the following:
var ts = new Date();
ts.setTime(msg.deviceTimeStamp);
msg.timeStampText = Mojo.Format.formatDate(ts,'short');
    • note that I used msg.deviceTimeStamp which I believe is when your phone sent/received the message. If you'd prefer the time it was actually sent by the sender, use msg.timeStamp instead. while you're in here, you may consider applying the send on return behavior changes.
  • restart LunaSysMgr or reboot

be sure to save the files you modified as they could get overwritten on the next sprint update. better yet, install quilt to manage the diffs as a patch.

Remove 5min timestamp divider

Intro

The Divider popping up in messages every 5 minutes can get mildly annoying. It is possible to make it so that the divider only shows up when the message protocol/transport is changed.

Procedure

  • Complete one of the two methods above to enable timestamps in your messages.
  • While you're in chatview-assistant.js look for "d.setMinutes" it should be around line 1232 in 1.1 1302 in 1.2
    • Find the line that says
msg.dividerText = msg.transportClas; + BucketDateFormatter.getDateBucket(d,true,true);
    • Replace it with
msg.dividerText = msg.transportClass; // + BucketDateFormatter.getDateBucket(d,true,true);

Acknowledgements

Thanks to tk102 and scuba_steve on PreCentral for the mod.

Personal tools
Google AdSense