Difference between revisions of "Adding Timestamps to All Received Messages"

From WebOS Internals
Jump to navigation Jump to search
 
Line 1: Line 1:
== Introduction==
+
#Redirect [[Patch Messaging Adding Timestamps to All Received Messages]]
 
 
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''') - line that starts with: '''if(!ChatFlags.'''
 
* 1177 (webOS 1.1: '''1250''') - line that starts with: '''if(today-msg.'''
 
* 1179 (webOS 1.1: '''1252''') - first closing bracket on its own line: '''}'''
 
* 1180 (webOS 1.1: '''1253''') - 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:
 
<nowiki><div class="messageText"><pre>#{-messageText}</pre> #{-errorContent}<span class="timeStamp">#{-timeStampText}</span</div></nowiki>
 
* 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 [[Patch Messaging Change "Enter Key" To Create Newline|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 [[Applying_Patches|quilt]] to manage the diffs as a patch.
 
 
 
 
 
== Acknowledgements==
 
 
 
Thanks to tk102 and scuba_steve on [http://www.precentral.net/ PreCentral] for the mod.
 

Latest revision as of 00:12, 2 August 2009