Fix IMs the right way. This sets it up so that timestamps are actually

in PST (to match viewer time), does correct storage and retrieval of
IMs, corrects the session ID and makes sure IMs don't get marked "saved"
if they're live. Removes the group IM save option, which our group IM
module never had in the first place, as saving group chatter makes no
sense at all.
This commit is contained in:
Melanie Thielker
2010-07-03 20:27:00 +02:00
parent e4739523d3
commit edcfaf60c9
4 changed files with 85 additions and 34 deletions

View File

@@ -156,15 +156,30 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
return;
}
// Force timestamp to server time to avoid "Saved on" headers
// being generated for online users
im.timestamp = (uint)Util.UnixTimeSinceEpoch();
DateTime dt = DateTime.UtcNow;
if (dialog == (byte)InstantMessageDialog.MessageFromAgent ||
dialog == (byte)InstantMessageDialog.MessageFromObject)
// Ticks from UtcNow, but make it look like local. Evil, huh?
dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
try
{
im.offline = 1;
// Convert that to the PST timezone
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
}
catch
{
m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp.");
}
// And make it look local again to fool the unix time util
dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
im.timestamp = (uint)Util.ToUnixTime(dt);
// If client is null, this message comes from storage and IS offline
if (client != null)
im.offline = 0;
if (m_TransferModule != null)
{