I am currently developing a jabber client using the Smack library (1.5.1) and Messenger (2.2.0). Today I was working with the delayed delivery classes in order to get the correct timestamps on stored chat messages. It seems to me there is a small bug with the date format Messenger is sending to my client. All the offline message timestamps I receive on the client have a correct date and the correct digits for the time, however it does not take into account AM or PM and simply sets all the times to AM. After tracing through the code, it looks like the problem is in the simple date formatter of Messenger’'s OfflineMessageStore class (line 75):
dateFormat = new SimpleDateFormat(“yyyyMMdd’‘T’'hh:mm:ss”);
I believe the format should use “HH” for the hours instead of “hh”, so the time includes the needed information to compute the AM or PM value on the client.
I also examined the raw XML sent from Messenger using the Smack debugger and the hours were in fact off by exactly 12 hours in the afternoon. When I looked at the code for the DelayInformation class in Smack it does use “HH” for hours, so I think it is only the server that has a problem.
If I am not understanding the implementation correctly, I am open to any suggestions.