diff options
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs | 83 |
1 files changed, 83 insertions, 0 deletions
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 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Net; | 29 | using System.Net; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.Packets; | ||
31 | using OpenMetaverse.StructuredData; | 32 | using OpenMetaverse.StructuredData; |
32 | 33 | ||
33 | namespace OpenSim.Region.Environment | 34 | namespace 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 | } |