First step tidy-up of IM packing/unpacking/repacking

0.6.1-post-fixes
Melanie Thielker 2008-11-16 20:32:00 +00:00
parent e1ccbed982
commit 3f818e001d
1 changed files with 18 additions and 11 deletions

View File

@ -127,13 +127,26 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
return; return;
} }
IScene scene = client == null ? null : client.Scene; GridInstantMessage im = new GridInstantMessage(client.Scene,
GridInstantMessage im = new GridInstantMessage(scene,
fromAgentID, fromAgentName, fromAgentSession, toAgentID, fromAgentID, fromAgentName, fromAgentSession, toAgentID,
dialog, fromGroup, message, imSessionID, dialog, fromGroup, message, imSessionID,
offline != 0 ? true : false, Position, offline != 0 ? true : false, Position,
binaryBucket); binaryBucket);
ProcessInstantMessage(client, im);
}
private void ProcessInstantMessage(IClientAPI client, GridInstantMessage im)
{
byte dialog = im.dialog;
if ( dialog != (byte)InstantMessageDialog.MessageFromAgent
&& dialog != (byte)InstantMessageDialog.StartTyping
&& dialog != (byte)InstantMessageDialog.StopTyping)
{
return;
}
if (m_TransferModule != null) if (m_TransferModule != null)
{ {
m_TransferModule.SendInstantMessage(im, m_TransferModule.SendInstantMessage(im,
@ -147,10 +160,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
if ((client != null) && !success) if ((client != null) && !success)
{ {
client.SendInstantMessage(toAgentID, client.SendInstantMessage(new UUID(im.toAgentID),
"Unable to send instant message. "+ "Unable to send instant message. "+
"User is not logged in.", "User is not logged in.",
fromAgentID, "System", new UUID(im.fromAgentID), "System",
(byte)InstantMessageDialog.BusyAutoResponse, (byte)InstantMessageDialog.BusyAutoResponse,
(uint)Util.UnixTimeSinceEpoch()); (uint)Util.UnixTimeSinceEpoch());
} }
@ -170,13 +183,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
// so we can depend on the above not trying to send // so we can depend on the above not trying to send
// via grid again // via grid again
// //
OnInstantMessage(null, new UUID(msg.fromAgentID), ProcessInstantMessage(null, msg);
new UUID(msg.fromAgentSession),
new UUID(msg.toAgentID), new UUID(msg.imSessionID),
msg.timestamp, msg.fromAgentName, msg.message,
msg.dialog, msg.fromGroup, msg.offline,
msg.ParentEstateID, msg.Position,
new UUID(msg.RegionID), msg.binaryBucket);
} }
} }
} }