add event queue code for sending group IM for future group support
parent
178fd97bd0
commit
68978e6e2a
|
@ -35,6 +35,7 @@ using System.Timers;
|
|||
using System.Xml;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Client;
|
||||
|
@ -1182,6 +1183,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
string fromName, byte dialog, uint timeStamp,
|
||||
UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
{
|
||||
|
||||
if (((Scene)(m_scene)).Permissions.CanInstantMessage(fromAgent, toAgent))
|
||||
{
|
||||
ImprovedInstantMessagePacket msg
|
||||
|
@ -1205,8 +1207,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
msg.MessageBlock.Message = Utils.StringToBytes(message);
|
||||
msg.MessageBlock.BinaryBucket = binaryBucket;
|
||||
|
||||
//System.Console.WriteLine("SendInstantMessage: " + msg);
|
||||
OutPacket(msg, ThrottleOutPacketType.Task);
|
||||
if (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;
|
||||
|
||||
//OSD Item = Environment.EventQueueHelper.ChatterboxInvitation(
|
||||
// new UUID("00000000-68f9-1111-024e-222222111123"),
|
||||
// "Test Group", fromAgent, message, toAgent, fromName, dialog, 0,
|
||||
// false, 0, new Vector3(), 1, transactionID, fromGroup,
|
||||
// Utils.StringToBytes("Test Group"));
|
||||
|
||||
OSD Item = Environment.EventQueueHelper.ChatterboxInvitation(
|
||||
new UUID("00000000-68f9-1111-024e-222222111123"),
|
||||
"Test Group", fromAgent, message, toAgent, fromName, dialog, 0,
|
||||
false, 0, new Vector3(), 1, transactionID, fromGroup, binaryBucket);
|
||||
|
||||
eq.Enqueue(Item, toAgent);
|
||||
m_log.Info("########### eq chatterbox invitation #############\n" + Item);
|
||||
}
|
||||
|
||||
System.Console.WriteLine("SendInstantMessage: " + msg);
|
||||
}
|
||||
else
|
||||
OutPacket(msg, ThrottleOutPacketType.Task);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Region.Environment
|
||||
|
@ -192,5 +193,87 @@ namespace OpenSim.Region.Environment
|
|||
{
|
||||
return buildEvent("FAKEEVENT", new OSDMap());
|
||||
}
|
||||
|
||||
public static OSD AgentParams(UUID agentID, bool checkEstate, int godLevel, bool limitedToEstate)
|
||||
{
|
||||
OSDMap body = new OSDMap(4);
|
||||
|
||||
body.Add("agent_id", new OSDUUID(agentID));
|
||||
body.Add("check_estate", new OSDInteger(checkEstate ? 1 : 0));
|
||||
body.Add("god_level", new OSDInteger(godLevel));
|
||||
body.Add("limited_to_estate", new OSDInteger(limitedToEstate ? 1 : 0));
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
public static OSD InstantMessageParams(UUID fromAgent, string message, UUID toAgent,
|
||||
string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID,
|
||||
Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
{
|
||||
OSDMap messageParams = new OSDMap(15);
|
||||
messageParams.Add("type", new OSDInteger((int)dialog));
|
||||
|
||||
OSDArray positionArray = new OSDArray(3);
|
||||
positionArray.Add(OSD.FromReal(position.X));
|
||||
positionArray.Add(OSD.FromReal(position.Y));
|
||||
positionArray.Add(OSD.FromReal(position.Z));
|
||||
messageParams.Add("position", positionArray);
|
||||
|
||||
messageParams.Add("region_id", new OSDUUID(UUID.Zero));
|
||||
messageParams.Add("to_id", new OSDUUID(toAgent));
|
||||
messageParams.Add("source", new OSDInteger(0));
|
||||
|
||||
OSDMap data = new OSDMap(1);
|
||||
data.Add("binary_bucket", OSD.FromBinary(binaryBucket));
|
||||
messageParams.Add("data", data);
|
||||
messageParams.Add("message", new OSDString(message));
|
||||
messageParams.Add("id", new OSDUUID(transactionID));
|
||||
messageParams.Add("from_name", new OSDString(fromName));
|
||||
messageParams.Add("timestamp", new OSDInteger((int)timeStamp));
|
||||
messageParams.Add("offline", new OSDInteger(offline ? 1 : 0));
|
||||
messageParams.Add("parent_estate_id", new OSDInteger(parentEstateID));
|
||||
messageParams.Add("ttl", new OSDInteger((int)ttl));
|
||||
messageParams.Add("from_id", new OSDUUID(fromAgent));
|
||||
messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0));
|
||||
|
||||
return messageParams;
|
||||
}
|
||||
|
||||
public static OSD InstantMessage(UUID fromAgent, string message, UUID toAgent,
|
||||
string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID,
|
||||
Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket,
|
||||
bool checkEstate, int godLevel, bool limitedToEstate)
|
||||
{
|
||||
OSDMap im = new OSDMap(2);
|
||||
im.Add("message_params", InstantMessageParams(fromAgent, message, toAgent,
|
||||
fromName, dialog, timeStamp, offline, parentEstateID,
|
||||
position, ttl, transactionID, fromGroup, binaryBucket));
|
||||
|
||||
im.Add("agent_params", AgentParams(fromAgent, checkEstate, godLevel, limitedToEstate));
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
|
||||
public static OSD ChatterboxInvitation(UUID sessionID, string sessionName,
|
||||
UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
|
||||
uint timeStamp, bool offline, int parentEstateID, Vector3 position,
|
||||
uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
{
|
||||
OSDMap body = new OSDMap(5);
|
||||
body.Add("session_id", new OSDUUID(sessionID));
|
||||
body.Add("from_name", new OSDString(fromName));
|
||||
body.Add("session_name", new OSDString(sessionName));
|
||||
body.Add("from_id", new OSDUUID(fromAgent));
|
||||
|
||||
body.Add("instantmessage", InstantMessage(fromAgent, message, toAgent,
|
||||
fromName, dialog, timeStamp, offline, parentEstateID, position,
|
||||
ttl, transactionID, fromGroup, binaryBucket, true, 0, true));
|
||||
|
||||
OSDMap chatterboxInvitation = new OSDMap(2);
|
||||
chatterboxInvitation.Add("message", new OSDString("ChatterBoxInvitation"));
|
||||
chatterboxInvitation.Add("body", body);
|
||||
return chatterboxInvitation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1059,6 +1059,7 @@
|
|||
<Reference name="System" localCopy="false"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="OpenMetaverseTypes.dll"/>
|
||||
<Reference name="OpenMetaverse.StructuredData.dll"/>
|
||||
<Reference name="OpenMetaverse.dll"/>
|
||||
<Reference name="OpenSim.Region.Environment"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
|
|
Loading…
Reference in New Issue