Megapatch. Completely remove the multiparameter IM methods. Remove the insecure
fromAgentSession field.0.6.1-post-fixes
parent
78d42a7fc8
commit
5e2e05a1c1
|
@ -35,7 +35,6 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public Guid fromAgentID;
|
public Guid fromAgentID;
|
||||||
public string fromAgentName;
|
public string fromAgentName;
|
||||||
public Guid fromAgentSession;
|
|
||||||
public Guid toAgentID;
|
public Guid toAgentID;
|
||||||
public byte dialog;
|
public byte dialog;
|
||||||
public bool fromGroup;
|
public bool fromGroup;
|
||||||
|
@ -56,14 +55,13 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridInstantMessage(IScene scene, UUID _fromAgentID,
|
public GridInstantMessage(IScene scene, UUID _fromAgentID,
|
||||||
string _fromAgentName, UUID _fromAgentSession, UUID _toAgentID,
|
string _fromAgentName, UUID _toAgentID,
|
||||||
byte _dialog, bool _fromGroup, string _message,
|
byte _dialog, bool _fromGroup, string _message,
|
||||||
UUID _imSessionID, bool _offline, Vector3 _position,
|
UUID _imSessionID, bool _offline, Vector3 _position,
|
||||||
byte[] _binaryBucket)
|
byte[] _binaryBucket)
|
||||||
{
|
{
|
||||||
fromAgentID = _fromAgentID.Guid;
|
fromAgentID = _fromAgentID.Guid;
|
||||||
fromAgentName = _fromAgentName;
|
fromAgentName = _fromAgentName;
|
||||||
fromAgentSession = _fromAgentSession.Guid;
|
|
||||||
toAgentID = _toAgentID.Guid;
|
toAgentID = _toAgentID.Guid;
|
||||||
dialog = _dialog;
|
dialog = _dialog;
|
||||||
fromGroup = _fromGroup;
|
fromGroup = _fromGroup;
|
||||||
|
@ -88,7 +86,7 @@ namespace OpenSim.Framework
|
||||||
string _fromAgentName, UUID _toAgentID, byte _dialog,
|
string _fromAgentName, UUID _toAgentID, byte _dialog,
|
||||||
string _message, bool _offline,
|
string _message, bool _offline,
|
||||||
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
|
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
|
||||||
UUID.Zero, _toAgentID, _dialog, false, _message,
|
_toAgentID, _dialog, false, _message,
|
||||||
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0])
|
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,12 +46,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void AvatarNowWearing(Object sender, AvatarWearingArgs e);
|
public delegate void AvatarNowWearing(Object sender, AvatarWearingArgs e);
|
||||||
|
|
||||||
public delegate void ImprovedInstantMessage(IClientAPI remoteclient,
|
public delegate void ImprovedInstantMessage(IClientAPI remoteclient, GridInstantMessage im);
|
||||||
UUID fromAgentID, UUID fromAgentSession, UUID toAgentID,
|
|
||||||
UUID imSessionID, uint timestamp,
|
|
||||||
string fromAgentName, string message, byte dialog, bool fromGroup,
|
|
||||||
byte offline, uint ParentEstateID,
|
|
||||||
Vector3 Position, UUID RegionID, byte[] binaryBucket);
|
|
||||||
|
|
||||||
// This shouldn't be cut down...
|
// This shouldn't be cut down...
|
||||||
// especially if we're ever going to implement groups, presence, estate message dialogs...
|
// especially if we're ever going to implement groups, presence, estate message dialogs...
|
||||||
|
|
|
@ -4030,13 +4030,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
if (handlerInstantMessage != null)
|
if (handlerInstantMessage != null)
|
||||||
{
|
{
|
||||||
handlerInstantMessage(this, msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
|
GridInstantMessage im = new GridInstantMessage(Scene,
|
||||||
msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID,
|
msgpack.AgentData.AgentID,
|
||||||
msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
|
IMfromName,
|
||||||
msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup,
|
msgpack.MessageBlock.ToAgentID,
|
||||||
msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID,
|
msgpack.MessageBlock.Dialog,
|
||||||
msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
|
msgpack.MessageBlock.FromGroup,
|
||||||
msgpack.MessageBlock.BinaryBucket);
|
IMmessage,
|
||||||
|
msgpack.MessageBlock.ID,
|
||||||
|
msgpack.MessageBlock.Offline != 0 ? true : false,
|
||||||
|
msgpack.MessageBlock.Position,
|
||||||
|
msgpack.MessageBlock.BinaryBucket);
|
||||||
|
|
||||||
|
handlerInstantMessage(this, im);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
// to a user to 'add a friend' without causing dialog box spam
|
// to a user to 'add a friend' without causing dialog box spam
|
||||||
|
|
||||||
// Subscribe to instant messages
|
// Subscribe to instant messages
|
||||||
client.OnInstantMessage += OnInstantMessage;
|
// client.OnInstantMessage += OnInstantMessage;
|
||||||
|
|
||||||
// Friend list management
|
// Friend list management
|
||||||
client.OnApproveFriendRequest += OnApproveFriendRequest;
|
client.OnApproveFriendRequest += OnApproveFriendRequest;
|
||||||
|
@ -370,7 +370,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
#region FriendRequestHandling
|
#region FriendRequestHandling
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI client, UUID fromAgentID,
|
private void OnInstantMessage(IClientAPI client, UUID fromAgentID,
|
||||||
UUID fromAgentSession, UUID toAgentID,
|
UUID toAgentID,
|
||||||
UUID imSessionID, uint timestamp, string fromAgentName,
|
UUID imSessionID, uint timestamp, string fromAgentName,
|
||||||
string message, byte dialog, bool fromGroup, byte offline,
|
string message, byte dialog, bool fromGroup, byte offline,
|
||||||
uint ParentEstateID, Vector3 Position, UUID RegionID,
|
uint ParentEstateID, Vector3 Position, UUID RegionID,
|
||||||
|
@ -393,86 +393,65 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
// some properties are misused here:
|
// some properties are misused here:
|
||||||
// fromAgentName is the *destination* name (the friend we offer friendship to)
|
// fromAgentName is the *destination* name (the friend we offer friendship to)
|
||||||
|
|
||||||
if (fromAgentSession != UUID.Zero)
|
// (1)
|
||||||
|
// send the friendship-offer to the target
|
||||||
|
m_log.InfoFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}",
|
||||||
|
fromAgentID, fromAgentName, toAgentID, imSessionID, message, offline);
|
||||||
|
|
||||||
|
UUID transactionID = UUID.Random();
|
||||||
|
|
||||||
|
// 1.20 protocol sends an UUID in the message field, instead of the friendship offer text.
|
||||||
|
// For interoperability, we have to clear that
|
||||||
|
if (Util.isUUID(message)) message = "";
|
||||||
|
|
||||||
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
|
msg.fromAgentID = fromAgentID.Guid;
|
||||||
|
msg.toAgentID = toAgentID.Guid;
|
||||||
|
msg.imSessionID = transactionID.Guid; // Start new transaction
|
||||||
|
m_log.DebugFormat("[FRIEND]: new transactionID: {0}", msg.imSessionID);
|
||||||
|
msg.timestamp = timestamp;
|
||||||
|
if (client != null)
|
||||||
{
|
{
|
||||||
// (1)
|
msg.fromAgentName = client.Name; // fromAgentName;
|
||||||
// send the friendship-offer to the target
|
|
||||||
m_log.InfoFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}",
|
|
||||||
fromAgentID, fromAgentName, toAgentID, imSessionID, message, offline);
|
|
||||||
|
|
||||||
UUID transactionID = UUID.Random();
|
|
||||||
|
|
||||||
// 1.20 protocol sends an UUID in the message field, instead of the friendship offer text.
|
|
||||||
// For interoperability, we have to clear that
|
|
||||||
if (Util.isUUID(message)) message = "";
|
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
|
||||||
msg.fromAgentID = fromAgentID.Guid;
|
|
||||||
msg.fromAgentSession = UUID.Zero.Guid; // server IMs don't have a session
|
|
||||||
msg.toAgentID = toAgentID.Guid;
|
|
||||||
msg.imSessionID = transactionID.Guid; // Start new transaction
|
|
||||||
m_log.DebugFormat("[FRIEND]: new transactionID: {0}", msg.imSessionID);
|
|
||||||
msg.timestamp = timestamp;
|
|
||||||
if (client != null)
|
|
||||||
{
|
|
||||||
msg.fromAgentName = client.Name; // fromAgentName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg.fromAgentName = "(hippos)"; // Added for posterity. This means that we can't figure out who sent it
|
|
||||||
}
|
|
||||||
msg.message = message;
|
|
||||||
msg.dialog = dialog;
|
|
||||||
msg.fromGroup = fromGroup;
|
|
||||||
msg.offline = offline;
|
|
||||||
msg.ParentEstateID = ParentEstateID;
|
|
||||||
msg.Position = Position;
|
|
||||||
msg.RegionID = RegionID.Guid;
|
|
||||||
msg.binaryBucket = binaryBucket;
|
|
||||||
|
|
||||||
m_log.DebugFormat("[FRIEND]: storing transactionID {0} on sender side", transactionID);
|
|
||||||
lock (m_pendingFriendRequests)
|
|
||||||
{
|
|
||||||
m_pendingFriendRequests.Add(transactionID, new Transaction(fromAgentID, fromAgentName));
|
|
||||||
outPending();
|
|
||||||
}
|
|
||||||
|
|
||||||
// we don't want to get that new IM into here if we aren't local, as only on the destination
|
|
||||||
// should receive it. If we *are* local, *we* are the destination, so we have to receive it.
|
|
||||||
// As grid-IMs are routed to all modules (in contrast to local IMs), we have to decide here.
|
|
||||||
|
|
||||||
// We don't really care which local scene we pipe it through.
|
|
||||||
if (m_TransferModule != null)
|
|
||||||
{
|
|
||||||
m_TransferModule.SendInstantMessage(msg,
|
|
||||||
delegate(bool success) {}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// (2)
|
msg.fromAgentName = "(hippos)"; // Added for posterity. This means that we can't figure out who sent it
|
||||||
// we are on the receiving end here; just add the transactionID to the stored transactions for later lookup
|
}
|
||||||
m_log.DebugFormat("[FRIEND]: storing transactionID {0} on receiver side", imSessionID);
|
msg.message = message;
|
||||||
lock (m_pendingFriendRequests)
|
msg.dialog = dialog;
|
||||||
{
|
msg.fromGroup = fromGroup;
|
||||||
// if both are on the same region-server, the transaction is stored already, but we have to update the name
|
msg.offline = offline;
|
||||||
if (m_pendingFriendRequests.ContainsKey(imSessionID))
|
msg.ParentEstateID = ParentEstateID;
|
||||||
{
|
msg.Position = Position;
|
||||||
m_pendingFriendRequests[imSessionID].agentName = fromAgentName;
|
msg.RegionID = RegionID.Guid;
|
||||||
m_pendingFriendRequests[imSessionID].count++;
|
msg.binaryBucket = binaryBucket;
|
||||||
}
|
|
||||||
else m_pendingFriendRequests.Add(imSessionID, new Transaction(fromAgentID, fromAgentName));
|
m_log.DebugFormat("[FRIEND]: storing transactionID {0} on sender side", transactionID);
|
||||||
outPending();
|
lock (m_pendingFriendRequests)
|
||||||
}
|
{
|
||||||
|
m_pendingFriendRequests.Add(transactionID, new Transaction(fromAgentID, fromAgentName));
|
||||||
|
outPending();
|
||||||
|
}
|
||||||
|
|
||||||
|
// we don't want to get that new IM into here if we aren't local, as only on the destination
|
||||||
|
// should receive it. If we *are* local, *we* are the destination, so we have to receive it.
|
||||||
|
// As grid-IMs are routed to all modules (in contrast to local IMs), we have to decide here.
|
||||||
|
|
||||||
|
// We don't really care which local scene we pipe it through.
|
||||||
|
if (m_TransferModule != null)
|
||||||
|
{
|
||||||
|
m_TransferModule.SendInstantMessage(msg,
|
||||||
|
delegate(bool success) {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39
|
else if (dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39
|
||||||
{
|
{
|
||||||
// accepting the friendship offer causes a type 39 IM being sent to the (possibly remote) initiator
|
// accepting the friendship offer causes a type 39 IM being sent to the (possibly remote) initiator
|
||||||
// toAgentID is initiator, fromAgentID is new friend (which just approved)
|
// toAgentID is initiator, fromAgentID is new friend (which just approved)
|
||||||
m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agentSession {1}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})",
|
m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {1} {2}, imsession {3} to {4}: {5} (dialog {6})",
|
||||||
client != null ? client.AgentId.ToString() : "<null>", fromAgentSession,
|
client != null ? client.AgentId.ToString() : "<null>",
|
||||||
fromAgentID, fromAgentName, imSessionID, toAgentID, message, dialog);
|
fromAgentID, fromAgentName, imSessionID, toAgentID, message, dialog);
|
||||||
lock (m_pendingFriendRequests)
|
lock (m_pendingFriendRequests)
|
||||||
{
|
{
|
||||||
|
@ -520,8 +499,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
{
|
{
|
||||||
// declining the friendship offer causes a type 40 IM being sent to the (possibly remote) initiator
|
// declining the friendship offer causes a type 40 IM being sent to the (possibly remote) initiator
|
||||||
// toAgentID is initiator, fromAgentID declined friendship
|
// toAgentID is initiator, fromAgentID declined friendship
|
||||||
m_log.DebugFormat("[FRIEND]: 40 - from client {0}, agentSession {1}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})",
|
m_log.DebugFormat("[FRIEND]: 40 - from client {0}, agent {1} {2}, imsession {3} to {4}: {5} (dialog {6})",
|
||||||
client != null ? client.AgentId.ToString() : "<null>", fromAgentSession,
|
client != null ? client.AgentId.ToString() : "<null>",
|
||||||
fromAgentID, fromAgentName, imSessionID, toAgentID, message, dialog);
|
fromAgentID, fromAgentName, imSessionID, toAgentID, message, dialog);
|
||||||
|
|
||||||
// not much to do, just clean up the transaction...
|
// not much to do, just clean up the transaction...
|
||||||
|
@ -542,13 +521,42 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
|
|
||||||
private void OnGridInstantMessage(GridInstantMessage msg)
|
private void OnGridInstantMessage(GridInstantMessage msg)
|
||||||
{
|
{
|
||||||
|
if (msg.dialog == (byte)InstantMessageDialog.FriendshipOffered)
|
||||||
|
{
|
||||||
|
// we are on the receiving end here; just add the transactionID
|
||||||
|
// to the stored transactions for later lookup
|
||||||
|
//
|
||||||
|
m_log.DebugFormat("[FRIEND]: storing transactionID {0} on "+
|
||||||
|
"receiver side", msg.imSessionID);
|
||||||
|
|
||||||
|
lock (m_pendingFriendRequests)
|
||||||
|
{
|
||||||
|
// if both are on the same region-server, the transaction
|
||||||
|
// is stored already, but we have to update the name
|
||||||
|
//
|
||||||
|
if (m_pendingFriendRequests.ContainsKey(
|
||||||
|
new UUID(msg.imSessionID)))
|
||||||
|
{
|
||||||
|
m_pendingFriendRequests[new UUID(msg.imSessionID)].agentName =
|
||||||
|
msg.fromAgentName;
|
||||||
|
m_pendingFriendRequests[new UUID(msg.imSessionID)].count++;
|
||||||
|
}
|
||||||
|
else m_pendingFriendRequests.Add(new UUID(msg.imSessionID),
|
||||||
|
new Transaction(new UUID(msg.fromAgentID),
|
||||||
|
msg.fromAgentName));
|
||||||
|
|
||||||
|
outPending();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Just call the IM handler above
|
// Just call the IM handler above
|
||||||
// This event won't be raised unless we have that agent,
|
// This event won't be raised unless we have that agent,
|
||||||
// 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),
|
OnInstantMessage(null, new UUID(msg.fromAgentID),
|
||||||
new UUID(msg.fromAgentSession),
|
|
||||||
new UUID(msg.toAgentID), new UUID(msg.imSessionID),
|
new UUID(msg.toAgentID), new UUID(msg.imSessionID),
|
||||||
msg.timestamp, msg.fromAgentName, msg.message,
|
msg.timestamp, msg.fromAgentName, msg.message,
|
||||||
msg.dialog, msg.fromGroup, msg.offline,
|
msg.dialog, msg.fromGroup, msg.offline,
|
||||||
|
@ -604,7 +612,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
msg.toAgentID = friendID.Guid;
|
msg.toAgentID = friendID.Guid;
|
||||||
msg.fromAgentID = agentID.Guid;
|
msg.fromAgentID = agentID.Guid;
|
||||||
msg.fromAgentName = client.Name;
|
msg.fromAgentName = client.Name;
|
||||||
msg.fromAgentSession = UUID.Zero.Guid; // server IMs don't have a session
|
|
||||||
msg.fromGroup = false;
|
msg.fromGroup = false;
|
||||||
msg.imSessionID = transactionID.Guid;
|
msg.imSessionID = transactionID.Guid;
|
||||||
msg.message = agentID.Guid.ToString();
|
msg.message = agentID.Guid.ToString();
|
||||||
|
@ -664,7 +671,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
||||||
msg.toAgentID = friendID.Guid;
|
msg.toAgentID = friendID.Guid;
|
||||||
msg.fromAgentID = agentID.Guid;
|
msg.fromAgentID = agentID.Guid;
|
||||||
msg.fromAgentName = client.Name;
|
msg.fromAgentName = client.Name;
|
||||||
msg.fromAgentSession = UUID.Zero.Guid; // server IMs don't have a session
|
|
||||||
msg.fromGroup = false;
|
msg.fromGroup = false;
|
||||||
msg.imSessionID = transactionID.Guid;
|
msg.imSessionID = transactionID.Guid;
|
||||||
msg.message = agentID.Guid.ToString();
|
msg.message = agentID.Guid.ToString();
|
||||||
|
|
|
@ -178,27 +178,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
||||||
ActiveGroupTitle);
|
ActiveGroupTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI client, UUID fromAgentID,
|
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||||
UUID fromAgentSession, UUID toAgentID,
|
|
||||||
UUID imSessionID, uint timestamp, string fromAgentName,
|
|
||||||
string message, byte dialog, bool fromGroup, byte offline,
|
|
||||||
uint ParentEstateID, Vector3 Position, UUID RegionID,
|
|
||||||
byte[] binaryBucket)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGridInstantMessage(GridInstantMessage msg)
|
private void OnGridInstantMessage(GridInstantMessage msg)
|
||||||
{
|
{
|
||||||
// Trigger the above event handler
|
// Trigger the above event handler
|
||||||
OnInstantMessage(null, new UUID(msg.fromAgentID),
|
OnInstantMessage(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,
|
|
||||||
new Vector3(msg.Position.X, msg.Position.Y, msg.Position.Z),
|
|
||||||
new UUID(msg.RegionID),
|
|
||||||
msg.binaryBucket);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
|
private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
|
||||||
|
|
|
@ -110,33 +110,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI client, UUID fromAgentID,
|
public void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||||
UUID fromAgentSession, UUID toAgentID,
|
|
||||||
UUID imSessionID, uint timestamp, string fromAgentName,
|
|
||||||
string message, byte dialog, bool fromGroup, byte offline,
|
|
||||||
uint ParentEstateID, Vector3 Position, UUID RegionID,
|
|
||||||
byte[] binaryBucket)
|
|
||||||
{
|
|
||||||
// This module handles exclusively private text IM from user
|
|
||||||
// to user. All others will be caught in other modules
|
|
||||||
//
|
|
||||||
if ( dialog != (byte)InstantMessageDialog.MessageFromAgent
|
|
||||||
&& dialog != (byte)InstantMessageDialog.StartTyping
|
|
||||||
&& dialog != (byte)InstantMessageDialog.StopTyping)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GridInstantMessage im = new GridInstantMessage(client.Scene,
|
|
||||||
fromAgentID, fromAgentName, fromAgentSession, toAgentID,
|
|
||||||
dialog, fromGroup, message, imSessionID,
|
|
||||||
offline != 0 ? true : false, Position,
|
|
||||||
binaryBucket);
|
|
||||||
|
|
||||||
ProcessInstantMessage(client, im);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessInstantMessage(IClientAPI client, GridInstantMessage im)
|
|
||||||
{
|
{
|
||||||
byte dialog = im.dialog;
|
byte dialog = im.dialog;
|
||||||
|
|
||||||
|
@ -183,7 +157,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
|
||||||
//
|
//
|
||||||
ProcessInstantMessage(null, msg);
|
OnInstantMessage(null, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
||||||
bool successful = false;
|
bool successful = false;
|
||||||
// various rational defaults
|
// various rational defaults
|
||||||
UUID fromAgentID = UUID.Zero;
|
UUID fromAgentID = UUID.Zero;
|
||||||
UUID fromAgentSession = UUID.Zero;
|
|
||||||
UUID toAgentID = UUID.Zero;
|
UUID toAgentID = UUID.Zero;
|
||||||
UUID imSessionID = UUID.Zero;
|
UUID imSessionID = UUID.Zero;
|
||||||
uint timestamp = 0;
|
uint timestamp = 0;
|
||||||
|
@ -207,7 +206,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
||||||
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
// Check if it's got all the data
|
// Check if it's got all the data
|
||||||
if (requestData.ContainsKey("from_agent_id") && requestData.ContainsKey("from_agent_session")
|
if (requestData.ContainsKey("from_agent_id")
|
||||||
&& requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id")
|
&& requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id")
|
||||||
&& requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name")
|
&& requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name")
|
||||||
&& requestData.ContainsKey("message") && requestData.ContainsKey("dialog")
|
&& requestData.ContainsKey("message") && requestData.ContainsKey("dialog")
|
||||||
|
@ -219,7 +218,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
||||||
{
|
{
|
||||||
// Do the easy way of validating the UUIDs
|
// Do the easy way of validating the UUIDs
|
||||||
UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID);
|
UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID);
|
||||||
UUID.TryParse((string)requestData["from_agent_session"], out fromAgentSession);
|
|
||||||
UUID.TryParse((string)requestData["to_agent_id"], out toAgentID);
|
UUID.TryParse((string)requestData["to_agent_id"], out toAgentID);
|
||||||
UUID.TryParse((string)requestData["im_session_id"], out imSessionID);
|
UUID.TryParse((string)requestData["im_session_id"], out imSessionID);
|
||||||
UUID.TryParse((string)requestData["region_id"], out RegionID);
|
UUID.TryParse((string)requestData["region_id"], out RegionID);
|
||||||
|
@ -337,7 +335,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
||||||
GridInstantMessage gim = new GridInstantMessage();
|
GridInstantMessage gim = new GridInstantMessage();
|
||||||
gim.fromAgentID = fromAgentID.Guid;
|
gim.fromAgentID = fromAgentID.Guid;
|
||||||
gim.fromAgentName = fromAgentName;
|
gim.fromAgentName = fromAgentName;
|
||||||
gim.fromAgentSession = fromAgentSession.Guid;
|
|
||||||
gim.fromGroup = fromGroup;
|
gim.fromGroup = fromGroup;
|
||||||
gim.imSessionID = imSessionID.Guid;
|
gim.imSessionID = imSessionID.Guid;
|
||||||
gim.RegionID = RegionID.Guid;
|
gim.RegionID = RegionID.Guid;
|
||||||
|
@ -598,7 +595,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
||||||
{
|
{
|
||||||
Hashtable gim = new Hashtable();
|
Hashtable gim = new Hashtable();
|
||||||
gim["from_agent_id"] = msg.fromAgentID.ToString();
|
gim["from_agent_id"] = msg.fromAgentID.ToString();
|
||||||
gim["from_agent_session"] = msg.fromAgentSession.ToString();
|
// Kept for compatibility
|
||||||
|
gim["from_agent_session"] = UUID.Zero.ToString();
|
||||||
gim["to_agent_id"] = msg.toAgentID.ToString();
|
gim["to_agent_id"] = msg.toAgentID.ToString();
|
||||||
gim["im_session_id"] = msg.imSessionID.ToString();
|
gim["im_session_id"] = msg.imSessionID.ToString();
|
||||||
gim["timestamp"] = msg.timestamp.ToString();
|
gim["timestamp"] = msg.timestamp.ToString();
|
||||||
|
|
|
@ -117,38 +117,34 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI client, UUID fromAgentID,
|
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||||
UUID fromAgentSession, UUID toAgentID,
|
|
||||||
UUID imSessionID, uint timestamp, string fromAgentName,
|
|
||||||
string message, byte dialog, bool fromGroup, byte offline,
|
|
||||||
uint ParentEstateID, Vector3 Position, UUID RegionID,
|
|
||||||
byte[] binaryBucket)
|
|
||||||
{
|
{
|
||||||
Scene scene = FindClientScene(client.AgentId);
|
Scene scene = FindClientScene(client.AgentId);
|
||||||
|
|
||||||
if (scene == null) // Something seriously wrong here.
|
if (scene == null) // Something seriously wrong here.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dialog == (byte) InstantMessageDialog.InventoryOffered)
|
if (im.dialog == (byte) InstantMessageDialog.InventoryOffered)
|
||||||
{
|
{
|
||||||
ScenePresence user =
|
ScenePresence user =
|
||||||
scene.GetScenePresence(toAgentID);
|
scene.GetScenePresence(new UUID(im.toAgentID));
|
||||||
|
|
||||||
// First byte of the array is probably the item type
|
// First byte of the array is probably the item type
|
||||||
// Next 16 bytes are the UUID
|
// Next 16 bytes are the UUID
|
||||||
|
|
||||||
UUID itemID = new UUID(binaryBucket, 1);
|
UUID itemID = new UUID(im.binaryBucket, 1);
|
||||||
|
|
||||||
m_log.DebugFormat("[AGENT INVENTORY]: Inserting item {0} "+
|
m_log.DebugFormat("[AGENT INVENTORY]: Inserting item {0} "+
|
||||||
"into agent {1}'s inventory",
|
"into agent {1}'s inventory",
|
||||||
itemID, toAgentID);
|
itemID, new UUID(im.toAgentID));
|
||||||
|
|
||||||
InventoryItemBase itemCopy = scene.GiveInventoryItem(toAgentID,
|
InventoryItemBase itemCopy = scene.GiveInventoryItem(
|
||||||
|
new UUID(im.toAgentID),
|
||||||
client.AgentId, itemID);
|
client.AgentId, itemID);
|
||||||
|
|
||||||
byte[] itemCopyID = itemCopy.ID.GetBytes();
|
byte[] itemCopyID = itemCopy.ID.GetBytes();
|
||||||
|
|
||||||
Array.Copy(itemCopyID, 0, binaryBucket, 1, 16);
|
Array.Copy(itemCopyID, 0, im.binaryBucket, 1, 16);
|
||||||
|
|
||||||
// Send the IM to the recipient. The item is already
|
// Send the IM to the recipient. The item is already
|
||||||
// in their inventory, so it will not be lost if
|
// in their inventory, so it will not be lost if
|
||||||
|
@ -164,9 +160,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer
|
||||||
// same ID back on the reply so we know what to act on
|
// same ID back on the reply so we know what to act on
|
||||||
//
|
//
|
||||||
user.ControllingClient.SendInstantMessage(
|
user.ControllingClient.SendInstantMessage(
|
||||||
fromAgentID, message, toAgentID, fromAgentName,
|
new UUID(im.fromAgentID), im.message,
|
||||||
dialog, timestamp, itemCopy.ID, false,
|
new UUID(im.toAgentID),
|
||||||
binaryBucket);
|
im.fromAgentName, im.dialog, im.timestamp,
|
||||||
|
itemCopy.ID, false, im.binaryBucket);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -177,15 +174,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer
|
||||||
// TODO: Implement grid sending
|
// TODO: Implement grid sending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dialog == (byte) InstantMessageDialog.InventoryAccepted)
|
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
|
||||||
{
|
{
|
||||||
ScenePresence user = scene.GetScenePresence(toAgentID);
|
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||||
|
|
||||||
if (user != null) // Local
|
if (user != null) // Local
|
||||||
{
|
{
|
||||||
user.ControllingClient.SendInstantMessage(
|
user.ControllingClient.SendInstantMessage(
|
||||||
fromAgentID, message, toAgentID, fromAgentName,
|
new UUID(im.fromAgentID), im.message,
|
||||||
dialog, timestamp, UUID.Zero, false, binaryBucket);
|
new UUID(im.toAgentID),
|
||||||
|
im.fromAgentName, im.dialog, im.timestamp,
|
||||||
|
UUID.Zero, false, im.binaryBucket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -194,9 +193,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer
|
||||||
// TODO: Implement sending via grid
|
// TODO: Implement sending via grid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dialog == (byte) InstantMessageDialog.InventoryDeclined)
|
else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
|
||||||
{
|
{
|
||||||
UUID itemID = imSessionID; // The item, back from it's trip
|
UUID itemID = new UUID(im.imSessionID); // The item, back from it's trip
|
||||||
|
|
||||||
// Here, the recipient is local and we can assume that the
|
// Here, the recipient is local and we can assume that the
|
||||||
// inventory is loaded. Courtesy of the above bulk update,
|
// inventory is loaded. Courtesy of the above bulk update,
|
||||||
|
@ -235,13 +234,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScenePresence user = scene.GetScenePresence(toAgentID);
|
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||||
|
|
||||||
if (user != null) // Local
|
if (user != null) // Local
|
||||||
{
|
{
|
||||||
user.ControllingClient.SendInstantMessage(
|
user.ControllingClient.SendInstantMessage(
|
||||||
fromAgentID, message, toAgentID, fromAgentName,
|
new UUID(im.fromAgentID), im.message,
|
||||||
dialog, timestamp, UUID.Zero, false, binaryBucket);
|
new UUID(im.toAgentID),
|
||||||
|
im.fromAgentName, im.dialog, im.timestamp,
|
||||||
|
UUID.Zero, false, im.binaryBucket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,9 +84,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
|
||||||
|
|
||||||
public void InstantMessage(UUID target, string message)
|
public void InstantMessage(UUID target, string message)
|
||||||
{
|
{
|
||||||
OnInstantMessage(this, m_uuid, SessionId, target, UUID.Combine(m_uuid, target),
|
OnInstantMessage(this, new GridInstantMessage(m_scene,
|
||||||
(uint) Util.UnixTimeSinceEpoch(), Name, message, 0, false, 0, 0,
|
m_uuid, m_firstname + " " + m_lastname,
|
||||||
Position, m_scene.RegionInfo.RegionID, new byte[0]);
|
target, 0, false, message,
|
||||||
|
UUID.Zero, false, Position, new byte[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAgentOffline(UUID[] agentIDs)
|
public void SendAgentOffline(UUID[] agentIDs)
|
||||||
|
|
|
@ -977,7 +977,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server
|
msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server
|
||||||
msg.fromAgentSession = new Guid(transaction.ToString());
|
|
||||||
msg.toAgentID = new Guid(ret.Key.ToString());
|
msg.toAgentID = new Guid(ret.Key.ToString());
|
||||||
msg.imSessionID = new Guid(transaction.ToString());
|
msg.imSessionID = new Guid(transaction.ToString());
|
||||||
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
|
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
|
||||||
|
|
|
@ -2623,7 +2623,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid;
|
msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid;
|
||||||
msg.fromAgentSession = new Guid(friendTransactionID.ToString());// fromAgentSession.UUID;
|
|
||||||
msg.toAgentID = new Guid(user); // toAgentID.Guid;
|
msg.toAgentID = new Guid(user); // toAgentID.Guid;
|
||||||
msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here
|
msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here
|
||||||
// Console.WriteLine("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
|
// Console.WriteLine("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
|
||||||
|
|
Loading…
Reference in New Issue