mirror of
https://github.com/opensim/opensim.git
synced 2026-05-19 06:25:44 +08:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user