Change the client API to use GridInstantMessage for the "last mile" of IM
sending. With this change, all methods that handle IM now use GridInstantMessage rather than individual parameters.0.6.5-rc1
parent
404bfdc9a6
commit
c483206fd7
|
@ -885,12 +885,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
Session.Send(chatActionEvent);
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
public void SendInstantMessage(GridInstantMessage im)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
|
|
@ -61,13 +61,7 @@ namespace OpenSim.Framework.Client
|
|||
|
||||
public interface IClientIM
|
||||
{
|
||||
void SendInstantMessage(UUID fromAgent, string message, UUID toAgent,
|
||||
string fromName, byte dialog, uint timeStamp);
|
||||
|
||||
void SendInstantMessage(UUID fromAgent, string message, UUID toAgent,
|
||||
string fromName, byte dialog, uint timeStamp,
|
||||
UUID transactionID, bool fromGroup,
|
||||
byte[] binaryBucket);
|
||||
void SendInstantMessage(GridInstantMessage im);
|
||||
|
||||
event ImprovedInstantMessage OnInstantMessage;
|
||||
}
|
||||
|
|
|
@ -815,11 +815,7 @@ namespace OpenSim.Framework
|
|||
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
|
||||
byte audible);
|
||||
|
||||
void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
|
||||
uint timeStamp);
|
||||
|
||||
void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
|
||||
uint timeStamp, UUID transactionID, bool fromGroup, byte[] binaryBucket);
|
||||
void SendInstantMessage(GridInstantMessage im);
|
||||
|
||||
void SendGenericMessage(string method, List<string> message);
|
||||
|
||||
|
|
|
@ -1187,71 +1187,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
OutPacket(reply, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send an instant message to this client
|
||||
/// </summary>
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
|
||||
{
|
||||
SendInstantMessage(fromAgent, message, toAgent, fromName, dialog, timeStamp, UUID.Zero, false, new byte[0]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send an instant message to this client
|
||||
/// </summary>
|
||||
//
|
||||
// Don't remove transaction ID! Groups and item gives need to set it!
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent,
|
||||
string fromName, byte dialog, uint timeStamp,
|
||||
UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
public void SendInstantMessage(GridInstantMessage im)
|
||||
{
|
||||
if (((Scene)(m_scene)).Permissions.CanInstantMessage(fromAgent, toAgent))
|
||||
if (((Scene)(m_scene)).Permissions.CanInstantMessage(new UUID(im.fromAgentID), new UUID(im.toAgentID)))
|
||||
{
|
||||
ImprovedInstantMessagePacket msg
|
||||
= (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
|
||||
|
||||
msg.AgentData.AgentID = fromAgent;
|
||||
msg.AgentData.AgentID = new UUID(im.fromAgentID);
|
||||
msg.AgentData.SessionID = UUID.Zero;
|
||||
msg.MessageBlock.FromAgentName = Utils.StringToBytes(fromName);
|
||||
msg.MessageBlock.Dialog = dialog;
|
||||
msg.MessageBlock.FromGroup = fromGroup;
|
||||
if (transactionID == UUID.Zero)
|
||||
msg.MessageBlock.ID = fromAgent ^ toAgent;
|
||||
msg.MessageBlock.FromAgentName = Utils.StringToBytes(im.fromAgentName);
|
||||
msg.MessageBlock.Dialog = im.dialog;
|
||||
msg.MessageBlock.FromGroup = im.fromGroup;
|
||||
if (im.imSessionID == UUID.Zero.Guid)
|
||||
msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID);
|
||||
else
|
||||
msg.MessageBlock.ID = transactionID;
|
||||
msg.MessageBlock.Offline = 0;
|
||||
msg.MessageBlock.ParentEstateID = 0;
|
||||
msg.MessageBlock.Position = new Vector3();
|
||||
msg.MessageBlock.RegionID = UUID.Zero;
|
||||
msg.MessageBlock.Timestamp = timeStamp;
|
||||
msg.MessageBlock.ToAgentID = toAgent;
|
||||
msg.MessageBlock.ID = new UUID(im.imSessionID);
|
||||
msg.MessageBlock.Offline = im.offline;
|
||||
msg.MessageBlock.ParentEstateID = im.ParentEstateID;
|
||||
msg.MessageBlock.Position = im.Position;
|
||||
msg.MessageBlock.RegionID = new UUID(im.RegionID);
|
||||
msg.MessageBlock.Timestamp = im.timestamp;
|
||||
msg.MessageBlock.ToAgentID = new UUID(im.toAgentID);
|
||||
// Cap the message length at 1099. There is a limit in ImprovedInstantMessagePacket
|
||||
// the limit is 1100 but a 0 byte gets added to mark the end of the string
|
||||
if (message != null && message.Length > 1099)
|
||||
msg.MessageBlock.Message = Utils.StringToBytes(message.Substring(0, 1099));
|
||||
if (im.message != null && im.message.Length > 1099)
|
||||
msg.MessageBlock.Message = Utils.StringToBytes(im.message.Substring(0, 1099));
|
||||
else
|
||||
msg.MessageBlock.Message = Utils.StringToBytes(message);
|
||||
msg.MessageBlock.BinaryBucket = binaryBucket;
|
||||
msg.MessageBlock.Message = Utils.StringToBytes(im.message);
|
||||
msg.MessageBlock.BinaryBucket = im.binaryBucket;
|
||||
|
||||
if (message.StartsWith("[grouptest]"))
|
||||
if (im.message.StartsWith("[grouptest]"))
|
||||
{ // this block is test code for implementing group IM - delete when group IM is finished
|
||||
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
|
||||
if (eq != null)
|
||||
{
|
||||
dialog = 17;
|
||||
im.dialog = 17;
|
||||
|
||||
//eq.ChatterboxInvitation(
|
||||
// new UUID("00000000-68f9-1111-024e-222222111123"),
|
||||
// "OpenSimulator Testing", fromAgent, message, toAgent, fromName, dialog, 0,
|
||||
// false, 0, new Vector3(), 1, transactionID, fromGroup, binaryBucket);
|
||||
// "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
|
||||
// false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
|
||||
|
||||
eq.ChatterboxInvitation(
|
||||
new UUID("00000000-68f9-1111-024e-222222111123"),
|
||||
"OpenSimulator Testing", fromAgent, message, toAgent, fromName, dialog, 0,
|
||||
false, 0, new Vector3(), 1, transactionID, fromGroup, Utils.StringToBytes("OpenSimulator Testing"));
|
||||
"OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
|
||||
false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Utils.StringToBytes("OpenSimulator Testing"));
|
||||
|
||||
eq.ChatterBoxSessionAgentListUpdates(
|
||||
new UUID("00000000-68f9-1111-024e-222222111123"),
|
||||
fromAgent, toAgent, false, false, false);
|
||||
new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
|
||||
}
|
||||
|
||||
Console.WriteLine("SendInstantMessage: " + msg);
|
||||
|
@ -7645,7 +7635,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
|
||||
{
|
||||
if (!ChildAgentStatus())
|
||||
SendInstantMessage(FromAvatarID, Message, AgentId, FromAvatarName, 1, (uint)Util.UnixTimeSinceEpoch());
|
||||
SendInstantMessage(new GridInstantMessage(null, FromAvatarID, FromAvatarName, AgentId, 1, Message, false, new Vector3()));
|
||||
|
||||
//SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch());
|
||||
}
|
||||
|
|
|
@ -679,9 +679,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
CreateCallingCard(client, friendID, callingCardFolders[0], friendPresence.Name);
|
||||
|
||||
// local message means OnGridInstantMessage won't be triggered, so do the work here.
|
||||
friendPresence.ControllingClient.SendInstantMessage(agentID, agentID.ToString(), friendID, client.Name,
|
||||
(byte)InstantMessageDialog.FriendshipAccepted,
|
||||
(uint)Util.UnixTimeSinceEpoch());
|
||||
friendPresence.ControllingClient.SendInstantMessage(
|
||||
new GridInstantMessage(client.Scene, agentID,
|
||||
client.Name, friendID,
|
||||
(byte)InstantMessageDialog.FriendshipAccepted,
|
||||
agentID.ToString(), false, Vector3.Zero));
|
||||
ApproveFriendship(agentID, friendID, client.Name);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -137,12 +137,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
|
||||
if ((client != null) && !success)
|
||||
{
|
||||
client.SendInstantMessage(new UUID(im.toAgentID),
|
||||
"Unable to send instant message. "+
|
||||
"User is not logged in.",
|
||||
new UUID(im.fromAgentID), "System",
|
||||
client.SendInstantMessage(
|
||||
new GridInstantMessage(
|
||||
null, new UUID(im.fromAgentID), "System",
|
||||
new UUID(im.toAgentID),
|
||||
(byte)InstantMessageDialog.BusyAutoResponse,
|
||||
(uint)Util.UnixTimeSinceEpoch());
|
||||
"Unable to send instant message. "+
|
||||
"User is not logged in.", false,
|
||||
new Vector3()));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -113,16 +113,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
if (!user.IsChildAgent)
|
||||
{
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
|
||||
user.ControllingClient.SendInstantMessage(
|
||||
new UUID(im.fromAgentID),
|
||||
im.message,
|
||||
new UUID(im.toAgentID),
|
||||
im.fromAgentName,
|
||||
im.dialog,
|
||||
im.timestamp,
|
||||
new UUID(im.imSessionID),
|
||||
im.fromGroup,
|
||||
im.binaryBucket);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
// Message sent
|
||||
result(true);
|
||||
return;
|
||||
|
@ -143,16 +135,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
|
||||
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
|
||||
user.ControllingClient.SendInstantMessage(
|
||||
new UUID(im.fromAgentID),
|
||||
im.message,
|
||||
new UUID(im.toAgentID),
|
||||
im.fromAgentName,
|
||||
im.dialog,
|
||||
im.timestamp,
|
||||
new UUID(im.imSessionID),
|
||||
im.fromGroup,
|
||||
im.binaryBucket);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
// Message sent
|
||||
result(true);
|
||||
return;
|
||||
|
|
|
@ -167,11 +167,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
{
|
||||
DateTime saved = Util.ToDateTime((uint)im.timestamp);
|
||||
|
||||
client.SendInstantMessage(new UUID(im.toAgentID),
|
||||
"(saved " + saved.ToString() + ") " + im.message,
|
||||
new UUID(im.fromAgentID), im.fromAgentName,
|
||||
(byte)im.dialog,
|
||||
(uint)im.timestamp);
|
||||
im.message = "(saved " + saved.ToString() + ") " + im.message;
|
||||
client.SendInstantMessage(im);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,12 +185,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
if (client == null)
|
||||
return;
|
||||
|
||||
client.SendInstantMessage(new UUID(im.fromAgentID),
|
||||
client.SendInstantMessage(new GridInstantMessage(
|
||||
null, new UUID(im.toAgentID),
|
||||
"System", new UUID(im.fromAgentID),
|
||||
(byte)InstantMessageDialog.MessageFromAgent,
|
||||
"User is not logged in. "+
|
||||
(success ? "Message saved." : "Message not saved"),
|
||||
new UUID(im.toAgentID), "System",
|
||||
(byte)InstantMessageDialog.MessageFromAgent,
|
||||
(uint)Util.UnixTimeSinceEpoch());
|
||||
false, new Vector3()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,11 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
// And notify. Transaction ID is the item ID. We get that
|
||||
// same ID back on the reply so we know what to act on
|
||||
//
|
||||
user.ControllingClient.SendInstantMessage(
|
||||
new UUID(im.fromAgentID), im.message,
|
||||
new UUID(im.toAgentID),
|
||||
im.fromAgentName, im.dialog, im.timestamp,
|
||||
copyID, false, im.binaryBucket);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -232,11 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
if (user != null) // Local
|
||||
{
|
||||
user.ControllingClient.SendInstantMessage(
|
||||
new UUID(im.fromAgentID), im.message,
|
||||
new UUID(im.toAgentID),
|
||||
im.fromAgentName, im.dialog, im.timestamp,
|
||||
UUID.Zero, false, im.binaryBucket);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -303,11 +295,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
if (user != null) // Local
|
||||
{
|
||||
user.ControllingClient.SendInstantMessage(
|
||||
new UUID(im.fromAgentID), im.message,
|
||||
new UUID(im.toAgentID),
|
||||
im.fromAgentName, im.dialog, im.timestamp,
|
||||
UUID.Zero, false, im.binaryBucket);
|
||||
user.ControllingClient.SendInstantMessage(im);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -460,11 +448,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
// Deliver message
|
||||
//
|
||||
user.ControllingClient.SendInstantMessage(
|
||||
new UUID(msg.fromAgentID), msg.message,
|
||||
new UUID(msg.toAgentID),
|
||||
msg.fromAgentName, msg.dialog, msg.timestamp,
|
||||
folderID, false, msg.binaryBucket);
|
||||
user.ControllingClient.SendInstantMessage(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -497,11 +481,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
|
||||
// Deliver message
|
||||
//
|
||||
user.ControllingClient.SendInstantMessage(
|
||||
new UUID(msg.fromAgentID), msg.message,
|
||||
new UUID(msg.toAgentID),
|
||||
msg.fromAgentName, msg.dialog, msg.timestamp,
|
||||
itemID, false, msg.binaryBucket);
|
||||
user.ControllingClient.SendInstantMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -416,12 +416,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
{
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
public void SendInstantMessage(GridInstantMessage im)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -505,12 +505,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
{
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transationID, bool fromGroup, byte[] binaryBucket)
|
||||
public void SendInstantMessage(GridInstantMessage im)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -468,12 +468,7 @@ namespace OpenSim.Tests.Common.Mock
|
|||
{
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
public void SendInstantMessage(GridInstantMessage im)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue