aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDahlia Trimble2009-01-23 01:49:32 +0000
committerDahlia Trimble2009-01-23 01:49:32 +0000
commit68978e6e2acd6736b689669dae8de09af5acde07 (patch)
tree3f5da84b0c5e8f48066e4d9acaac65c5b62edfa3 /OpenSim/Region
parent* Fixing a group title (diff)
downloadopensim-SC_OLD-68978e6e2acd6736b689669dae8de09af5acde07.zip
opensim-SC_OLD-68978e6e2acd6736b689669dae8de09af5acde07.tar.gz
opensim-SC_OLD-68978e6e2acd6736b689669dae8de09af5acde07.tar.bz2
opensim-SC_OLD-68978e6e2acd6736b689669dae8de09af5acde07.tar.xz
add event queue code for sending group IM for future group support
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs30
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs83
2 files changed, 111 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 8257508..7b80f45 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -35,6 +35,7 @@ using System.Timers;
35using System.Xml; 35using System.Xml;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Packets; 37using OpenMetaverse.Packets;
38using OpenMetaverse.StructuredData;
38using log4net; 39using log4net;
39using OpenSim.Framework; 40using OpenSim.Framework;
40using OpenSim.Framework.Client; 41using OpenSim.Framework.Client;
@@ -1182,6 +1183,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1182 string fromName, byte dialog, uint timeStamp, 1183 string fromName, byte dialog, uint timeStamp,
1183 UUID transactionID, bool fromGroup, byte[] binaryBucket) 1184 UUID transactionID, bool fromGroup, byte[] binaryBucket)
1184 { 1185 {
1186
1185 if (((Scene)(m_scene)).Permissions.CanInstantMessage(fromAgent, toAgent)) 1187 if (((Scene)(m_scene)).Permissions.CanInstantMessage(fromAgent, toAgent))
1186 { 1188 {
1187 ImprovedInstantMessagePacket msg 1189 ImprovedInstantMessagePacket msg
@@ -1205,8 +1207,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1205 msg.MessageBlock.Message = Utils.StringToBytes(message); 1207 msg.MessageBlock.Message = Utils.StringToBytes(message);
1206 msg.MessageBlock.BinaryBucket = binaryBucket; 1208 msg.MessageBlock.BinaryBucket = binaryBucket;
1207 1209
1208 //System.Console.WriteLine("SendInstantMessage: " + msg); 1210 if (message.StartsWith("[grouptest]"))
1209 OutPacket(msg, ThrottleOutPacketType.Task); 1211 { // this block is test code for implementing group IM - delete when group IM is finished
1212 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
1213 if (eq != null)
1214 {
1215 dialog = 17;
1216
1217 //OSD Item = Environment.EventQueueHelper.ChatterboxInvitation(
1218 // new UUID("00000000-68f9-1111-024e-222222111123"),
1219 // "Test Group", fromAgent, message, toAgent, fromName, dialog, 0,
1220 // false, 0, new Vector3(), 1, transactionID, fromGroup,
1221 // Utils.StringToBytes("Test Group"));
1222
1223 OSD Item = Environment.EventQueueHelper.ChatterboxInvitation(
1224 new UUID("00000000-68f9-1111-024e-222222111123"),
1225 "Test Group", fromAgent, message, toAgent, fromName, dialog, 0,
1226 false, 0, new Vector3(), 1, transactionID, fromGroup, binaryBucket);
1227
1228 eq.Enqueue(Item, toAgent);
1229 m_log.Info("########### eq chatterbox invitation #############\n" + Item);
1230 }
1231
1232 System.Console.WriteLine("SendInstantMessage: " + msg);
1233 }
1234 else
1235 OutPacket(msg, ThrottleOutPacketType.Task);
1210 } 1236 }
1211 } 1237 }
1212 1238
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs
index 0ffa8aa..5f471e5 100644
--- a/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Net; 29using System.Net;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.Packets;
31using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
32 33
33namespace OpenSim.Region.Environment 34namespace OpenSim.Region.Environment
@@ -192,5 +193,87 @@ namespace OpenSim.Region.Environment
192 { 193 {
193 return buildEvent("FAKEEVENT", new OSDMap()); 194 return buildEvent("FAKEEVENT", new OSDMap());
194 } 195 }
196
197 public static OSD AgentParams(UUID agentID, bool checkEstate, int godLevel, bool limitedToEstate)
198 {
199 OSDMap body = new OSDMap(4);
200
201 body.Add("agent_id", new OSDUUID(agentID));
202 body.Add("check_estate", new OSDInteger(checkEstate ? 1 : 0));
203 body.Add("god_level", new OSDInteger(godLevel));
204 body.Add("limited_to_estate", new OSDInteger(limitedToEstate ? 1 : 0));
205
206 return body;
207 }
208
209 public static OSD InstantMessageParams(UUID fromAgent, string message, UUID toAgent,
210 string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID,
211 Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket)
212 {
213 OSDMap messageParams = new OSDMap(15);
214 messageParams.Add("type", new OSDInteger((int)dialog));
215
216 OSDArray positionArray = new OSDArray(3);
217 positionArray.Add(OSD.FromReal(position.X));
218 positionArray.Add(OSD.FromReal(position.Y));
219 positionArray.Add(OSD.FromReal(position.Z));
220 messageParams.Add("position", positionArray);
221
222 messageParams.Add("region_id", new OSDUUID(UUID.Zero));
223 messageParams.Add("to_id", new OSDUUID(toAgent));
224 messageParams.Add("source", new OSDInteger(0));
225
226 OSDMap data = new OSDMap(1);
227 data.Add("binary_bucket", OSD.FromBinary(binaryBucket));
228 messageParams.Add("data", data);
229 messageParams.Add("message", new OSDString(message));
230 messageParams.Add("id", new OSDUUID(transactionID));
231 messageParams.Add("from_name", new OSDString(fromName));
232 messageParams.Add("timestamp", new OSDInteger((int)timeStamp));
233 messageParams.Add("offline", new OSDInteger(offline ? 1 : 0));
234 messageParams.Add("parent_estate_id", new OSDInteger(parentEstateID));
235 messageParams.Add("ttl", new OSDInteger((int)ttl));
236 messageParams.Add("from_id", new OSDUUID(fromAgent));
237 messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0));
238
239 return messageParams;
240 }
241
242 public static OSD InstantMessage(UUID fromAgent, string message, UUID toAgent,
243 string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID,
244 Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket,
245 bool checkEstate, int godLevel, bool limitedToEstate)
246 {
247 OSDMap im = new OSDMap(2);
248 im.Add("message_params", InstantMessageParams(fromAgent, message, toAgent,
249 fromName, dialog, timeStamp, offline, parentEstateID,
250 position, ttl, transactionID, fromGroup, binaryBucket));
251
252 im.Add("agent_params", AgentParams(fromAgent, checkEstate, godLevel, limitedToEstate));
253
254 return im;
255 }
256
257
258 public static OSD ChatterboxInvitation(UUID sessionID, string sessionName,
259 UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
260 uint timeStamp, bool offline, int parentEstateID, Vector3 position,
261 uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket)
262 {
263 OSDMap body = new OSDMap(5);
264 body.Add("session_id", new OSDUUID(sessionID));
265 body.Add("from_name", new OSDString(fromName));
266 body.Add("session_name", new OSDString(sessionName));
267 body.Add("from_id", new OSDUUID(fromAgent));
268
269 body.Add("instantmessage", InstantMessage(fromAgent, message, toAgent,
270 fromName, dialog, timeStamp, offline, parentEstateID, position,
271 ttl, transactionID, fromGroup, binaryBucket, true, 0, true));
272
273 OSDMap chatterboxInvitation = new OSDMap(2);
274 chatterboxInvitation.Add("message", new OSDString("ChatterBoxInvitation"));
275 chatterboxInvitation.Add("body", body);
276 return chatterboxInvitation;
277 }
195 } 278 }
196} 279}