MessageTransferModule.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections;
  29. using System.Collections.Generic;
  30. using System.Reflection;
  31. using System.Net;
  32. using System.Threading;
  33. using OpenMetaverse;
  34. using log4net;
  35. using Nini.Config;
  36. using Nwc.XmlRpc;
  37. using OpenSim.Framework;
  38. using OpenSim.Framework.Client;
  39. using OpenSim.Region.Interfaces;
  40. using OpenSim.Region.Environment.Interfaces;
  41. using OpenSim.Region.Environment.Scenes;
  42. namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
  43. {
  44. public class MessageTransferModule : IRegionModule, IMessageTransferModule
  45. {
  46. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  47. // private bool m_Enabled = false;
  48. private bool m_Gridmode = false;
  49. private List<Scene> m_Scenes = new List<Scene>();
  50. private Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>();
  51. public void Initialise(Scene scene, IConfigSource config)
  52. {
  53. IConfig cnf = config.Configs["Messaging"];
  54. if (cnf != null && cnf.GetString(
  55. "MessageTransferModule", "MessageTransferModule") !=
  56. "MessageTransferModule")
  57. return;
  58. cnf = config.Configs["Startup"];
  59. if (cnf != null)
  60. m_Gridmode = cnf.GetBoolean("gridmode", false);
  61. // m_Enabled = true;
  62. lock (m_Scenes)
  63. {
  64. if (m_Scenes.Count == 0)
  65. {
  66. scene.CommsManager.HttpServer.AddXmlRPCHandler(
  67. "grid_instant_message", processXMLRPCGridInstantMessage);
  68. }
  69. scene.RegisterModuleInterface<IMessageTransferModule>(this);
  70. m_Scenes.Add(scene);
  71. }
  72. }
  73. public void PostInitialise()
  74. {
  75. }
  76. public void Close()
  77. {
  78. }
  79. public string Name
  80. {
  81. get { return "MessageTransferModule"; }
  82. }
  83. public bool IsSharedModule
  84. {
  85. get { return true; }
  86. }
  87. public void SendInstantMessage(GridInstantMessage im, MessageResultNotification result)
  88. {
  89. UUID toAgentID = new UUID(im.toAgentID);
  90. m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString());
  91. // Try root avatar only first
  92. foreach (Scene scene in m_Scenes)
  93. {
  94. if (scene.Entities.ContainsKey(toAgentID) &&
  95. scene.Entities[toAgentID] is ScenePresence)
  96. {
  97. m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName);
  98. // Local message
  99. ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
  100. if (!user.IsChildAgent)
  101. {
  102. m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
  103. user.ControllingClient.SendInstantMessage(
  104. new UUID(im.fromAgentID),
  105. im.message,
  106. new UUID(im.toAgentID),
  107. im.fromAgentName,
  108. im.dialog,
  109. im.timestamp,
  110. new UUID(im.imSessionID),
  111. im.fromGroup,
  112. im.binaryBucket);
  113. // Message sent
  114. result(true);
  115. return;
  116. }
  117. }
  118. }
  119. // try child avatar second
  120. foreach (Scene scene in m_Scenes)
  121. {
  122. m_log.DebugFormat("[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName);
  123. if (scene.Entities.ContainsKey(toAgentID) &&
  124. scene.Entities[toAgentID] is ScenePresence)
  125. {
  126. // Local message
  127. ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
  128. m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
  129. user.ControllingClient.SendInstantMessage(
  130. new UUID(im.fromAgentID),
  131. im.message,
  132. new UUID(im.toAgentID),
  133. im.fromAgentName,
  134. im.dialog,
  135. im.timestamp,
  136. new UUID(im.imSessionID),
  137. im.fromGroup,
  138. im.binaryBucket);
  139. // Message sent
  140. result(true);
  141. return;
  142. }
  143. }
  144. if (m_Gridmode)
  145. {
  146. m_log.DebugFormat("[INSTANT MESSAGE]: Delivering via grid");
  147. // Still here, try send via Grid
  148. SendGridInstantMessageViaXMLRPC(im, result);
  149. return;
  150. }
  151. m_log.DebugFormat("[INSTANT MESSAGE]: Undeliverable");
  152. result(false);
  153. return;
  154. }
  155. /// <summary>
  156. /// Process a XMLRPC Grid Instant Message
  157. /// </summary>
  158. /// <param name="request">XMLRPC parameters
  159. /// </param>
  160. /// <returns>Nothing much</returns>
  161. protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request)
  162. {
  163. bool successful = false;
  164. // TODO: For now, as IMs seem to be a bit unreliable on OSGrid, catch all exception that
  165. // happen here and aren't caught and log them.
  166. try {
  167. // various rational defaults
  168. UUID fromAgentID = UUID.Zero;
  169. UUID toAgentID = UUID.Zero;
  170. UUID imSessionID = UUID.Zero;
  171. uint timestamp = 0;
  172. string fromAgentName = "";
  173. string message = "";
  174. byte dialog = (byte)0;
  175. bool fromGroup = false;
  176. byte offline = (byte)0;
  177. uint ParentEstateID=0;
  178. Vector3 Position = Vector3.Zero;
  179. UUID RegionID = UUID.Zero ;
  180. byte[] binaryBucket = new byte[0];
  181. float pos_x = 0;
  182. float pos_y = 0;
  183. float pos_z = 0;
  184. //m_log.Info("Processing IM");
  185. Hashtable requestData = (Hashtable)request.Params[0];
  186. // Check if it's got all the data
  187. if (requestData.ContainsKey("from_agent_id")
  188. && requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id")
  189. && requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name")
  190. && requestData.ContainsKey("message") && requestData.ContainsKey("dialog")
  191. && requestData.ContainsKey("from_group")
  192. && requestData.ContainsKey("offline") && requestData.ContainsKey("parent_estate_id")
  193. && requestData.ContainsKey("position_x") && requestData.ContainsKey("position_y")
  194. && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id")
  195. && requestData.ContainsKey("binary_bucket"))
  196. {
  197. // Do the easy way of validating the UUIDs
  198. UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID);
  199. UUID.TryParse((string)requestData["to_agent_id"], out toAgentID);
  200. UUID.TryParse((string)requestData["im_session_id"], out imSessionID);
  201. UUID.TryParse((string)requestData["region_id"], out RegionID);
  202. try
  203. {
  204. timestamp = (uint)Convert.ToInt32((string)requestData["timestamp"]);
  205. }
  206. catch (ArgumentException)
  207. {
  208. }
  209. catch (FormatException)
  210. {
  211. }
  212. catch (OverflowException)
  213. {
  214. }
  215. fromAgentName = (string)requestData["from_agent_name"];
  216. message = (string)requestData["message"];
  217. // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them.
  218. string requestData1 = (string)requestData["dialog"];
  219. if (string.IsNullOrEmpty(requestData1))
  220. {
  221. dialog = 0;
  222. }
  223. else
  224. {
  225. byte[] dialogdata = Convert.FromBase64String(requestData1);
  226. dialog = dialogdata[0];
  227. }
  228. if ((string)requestData["from_group"] == "TRUE")
  229. fromGroup = true;
  230. string requestData2 = (string)requestData["offline"];
  231. if (String.IsNullOrEmpty(requestData2))
  232. {
  233. offline = 0;
  234. }
  235. else
  236. {
  237. byte[] offlinedata = Convert.FromBase64String(requestData2);
  238. offline = offlinedata[0];
  239. }
  240. try
  241. {
  242. ParentEstateID = (uint)Convert.ToInt32((string)requestData["parent_estate_id"]);
  243. }
  244. catch (ArgumentException)
  245. {
  246. }
  247. catch (FormatException)
  248. {
  249. }
  250. catch (OverflowException)
  251. {
  252. }
  253. try
  254. {
  255. pos_x = (uint)Convert.ToInt32((string)requestData["position_x"]);
  256. }
  257. catch (ArgumentException)
  258. {
  259. }
  260. catch (FormatException)
  261. {
  262. }
  263. catch (OverflowException)
  264. {
  265. }
  266. try
  267. {
  268. pos_y = (uint)Convert.ToInt32((string)requestData["position_y"]);
  269. }
  270. catch (ArgumentException)
  271. {
  272. }
  273. catch (FormatException)
  274. {
  275. }
  276. catch (OverflowException)
  277. {
  278. }
  279. try
  280. {
  281. pos_z = (uint)Convert.ToInt32((string)requestData["position_z"]);
  282. }
  283. catch (ArgumentException)
  284. {
  285. }
  286. catch (FormatException)
  287. {
  288. }
  289. catch (OverflowException)
  290. {
  291. }
  292. Position = new Vector3(pos_x, pos_y, pos_z);
  293. string requestData3 = (string)requestData["binary_bucket"];
  294. if (string.IsNullOrEmpty(requestData3))
  295. {
  296. binaryBucket = new byte[0];
  297. }
  298. else
  299. {
  300. binaryBucket = Convert.FromBase64String(requestData3);
  301. }
  302. // Create a New GridInstantMessageObject the the data
  303. GridInstantMessage gim = new GridInstantMessage();
  304. gim.fromAgentID = fromAgentID.Guid;
  305. gim.fromAgentName = fromAgentName;
  306. gim.fromGroup = fromGroup;
  307. gim.imSessionID = imSessionID.Guid;
  308. gim.RegionID = RegionID.Guid;
  309. gim.timestamp = timestamp;
  310. gim.toAgentID = toAgentID.Guid;
  311. gim.message = message;
  312. gim.dialog = dialog;
  313. gim.offline = offline;
  314. gim.ParentEstateID = ParentEstateID;
  315. gim.Position = Position;
  316. gim.binaryBucket = binaryBucket;
  317. // Trigger the Instant message in the scene.
  318. foreach (Scene scene in m_Scenes)
  319. {
  320. if (scene.Entities.ContainsKey(toAgentID) &&
  321. scene.Entities[toAgentID] is ScenePresence)
  322. {
  323. ScenePresence user =
  324. (ScenePresence)scene.Entities[toAgentID];
  325. if (!user.IsChildAgent)
  326. {
  327. scene.EventManager.TriggerIncomingInstantMessage(gim);
  328. successful = true;
  329. }
  330. }
  331. }
  332. if (!successful)
  333. {
  334. // If the message can't be delivered to an agent, it
  335. // is likely to be a group IM. On a group IM, the
  336. // imSessionID = toAgentID = group id. Raise the
  337. // unhandled IM event to give the groups module
  338. // a chance to pick it up. We raise that in a random
  339. // scene, since the groups module is shared.
  340. //
  341. m_Scenes[0].EventManager.TriggerUnhandledInstantMessage(gim);
  342. }
  343. }
  344. }
  345. catch (Exception e)
  346. {
  347. m_log.Error("[INSTANT MESSAGE]: Caught unexpected exception:", e);
  348. successful = false;
  349. }
  350. //Send response back to region calling if it was successful
  351. // calling region uses this to know when to look up a user's location again.
  352. XmlRpcResponse resp = new XmlRpcResponse();
  353. Hashtable respdata = new Hashtable();
  354. if (successful)
  355. respdata["success"] = "TRUE";
  356. else
  357. respdata["success"] = "FALSE";
  358. resp.Value = respdata;
  359. return resp;
  360. }
  361. /// <summary>
  362. /// delegate for sending a grid instant message asynchronously
  363. /// </summary>
  364. public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle);
  365. private void GridInstantMessageCompleted(IAsyncResult iar)
  366. {
  367. GridInstantMessageDelegate icon =
  368. (GridInstantMessageDelegate)iar.AsyncState;
  369. icon.EndInvoke(iar);
  370. }
  371. protected virtual void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result)
  372. {
  373. GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync;
  374. d.BeginInvoke(im, result, 0, GridInstantMessageCompleted, d);
  375. }
  376. /// <summary>
  377. /// Recursive SendGridInstantMessage over XMLRPC method.
  378. /// This is called from within a dedicated thread.
  379. /// The first time this is called, prevRegionHandle will be 0 Subsequent times this is called from
  380. /// itself, prevRegionHandle will be the last region handle that we tried to send.
  381. /// If the handles are the same, we look up the user's location using the grid.
  382. /// If the handles are still the same, we end. The send failed.
  383. /// </summary>
  384. /// <param name="prevRegionHandle">
  385. /// Pass in 0 the first time this method is called. It will be called recursively with the last
  386. /// regionhandle tried
  387. /// </param>
  388. protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle)
  389. {
  390. UUID toAgentID = new UUID(im.toAgentID);
  391. UserAgentData upd = null;
  392. bool lookupAgent = false;
  393. lock (m_UserRegionMap)
  394. {
  395. if (m_UserRegionMap.ContainsKey(toAgentID))
  396. {
  397. upd = new UserAgentData();
  398. upd.AgentOnline = true;
  399. upd.Handle = m_UserRegionMap[toAgentID];
  400. // We need to compare the current regionhandle with the previous region handle
  401. // or the recursive loop will never end because it will never try to lookup the agent again
  402. if (prevRegionHandle == upd.Handle)
  403. {
  404. lookupAgent = true;
  405. }
  406. }
  407. else
  408. {
  409. lookupAgent = true;
  410. }
  411. }
  412. // Are we needing to look-up an agent?
  413. if (lookupAgent)
  414. {
  415. // Non-cached user agent lookup.
  416. upd = m_Scenes[0].CommsManager.UserService.GetAgentByUUID(toAgentID);
  417. if (upd != null)
  418. {
  419. // check if we've tried this before..
  420. // This is one way to end the recursive loop
  421. //
  422. if (upd.Handle == prevRegionHandle)
  423. {
  424. m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
  425. result(false);
  426. return;
  427. }
  428. }
  429. else
  430. {
  431. m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
  432. result(false);
  433. return;
  434. }
  435. }
  436. if (upd != null)
  437. {
  438. if (upd.AgentOnline)
  439. {
  440. RegionInfo reginfo = m_Scenes[0].SceneGridService.RequestNeighbouringRegionInfo(upd.Handle);
  441. if (reginfo != null)
  442. {
  443. Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
  444. // Not actually used anymore, left in for compatibility
  445. // Remove at next interface change
  446. //
  447. msgdata["region_handle"] = 0;
  448. bool imresult = doIMSending(reginfo, msgdata);
  449. if (imresult)
  450. {
  451. // IM delivery successful, so store the Agent's location in our local cache.
  452. lock (m_UserRegionMap)
  453. {
  454. if (m_UserRegionMap.ContainsKey(toAgentID))
  455. {
  456. m_UserRegionMap[toAgentID] = upd.Handle;
  457. }
  458. else
  459. {
  460. m_UserRegionMap.Add(toAgentID, upd.Handle);
  461. }
  462. }
  463. result(true);
  464. }
  465. else
  466. {
  467. // try again, but lookup user this time.
  468. // Warning, this must call the Async version
  469. // of this method or we'll be making thousands of threads
  470. // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
  471. // The version that spawns the thread is SendGridInstantMessageViaXMLRPC
  472. // This is recursive!!!!!
  473. SendGridInstantMessageViaXMLRPCAsync(im, result,
  474. upd.Handle);
  475. }
  476. }
  477. else
  478. {
  479. m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.Handle);
  480. result(false);
  481. }
  482. }
  483. else
  484. {
  485. result(false);
  486. }
  487. }
  488. else
  489. {
  490. m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find user {0}", toAgentID);
  491. result(false);
  492. }
  493. }
  494. /// <summary>
  495. /// This actually does the XMLRPC Request
  496. /// </summary>
  497. /// <param name="reginfo">RegionInfo we pull the data out of to send the request to</param>
  498. /// <param name="xmlrpcdata">The Instant Message data Hashtable</param>
  499. /// <returns>Bool if the message was successfully delivered at the other side.</returns>
  500. private bool doIMSending(RegionInfo reginfo, Hashtable xmlrpcdata)
  501. {
  502. ArrayList SendParams = new ArrayList();
  503. SendParams.Add(xmlrpcdata);
  504. XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams);
  505. try
  506. {
  507. XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000);
  508. Hashtable responseData = (Hashtable)GridResp.Value;
  509. if (responseData.ContainsKey("success"))
  510. {
  511. if ((string)responseData["success"] == "TRUE")
  512. {
  513. return true;
  514. }
  515. else
  516. {
  517. return false;
  518. }
  519. }
  520. else
  521. {
  522. return false;
  523. }
  524. }
  525. catch (WebException e)
  526. {
  527. m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})",
  528. reginfo.ExternalHostName, reginfo.HttpPort, e.Message);
  529. }
  530. return false;
  531. }
  532. /// <summary>
  533. /// Get ulong region handle for region by it's Region UUID.
  534. /// We use region handles over grid comms because there's all sorts of free and cool caching.
  535. /// </summary>
  536. /// <param name="regionID">UUID of region to get the region handle for</param>
  537. /// <returns></returns>
  538. // private ulong getLocalRegionHandleFromUUID(UUID regionID)
  539. // {
  540. // ulong returnhandle = 0;
  541. //
  542. // lock (m_Scenes)
  543. // {
  544. // foreach (Scene sn in m_Scenes)
  545. // {
  546. // if (sn.RegionInfo.RegionID == regionID)
  547. // {
  548. // returnhandle = sn.RegionInfo.RegionHandle;
  549. // break;
  550. // }
  551. // }
  552. // }
  553. // return returnhandle;
  554. // }
  555. /// <summary>
  556. /// Takes a GridInstantMessage and converts it into a Hashtable for XMLRPC
  557. /// </summary>
  558. /// <param name="msg">The GridInstantMessage object</param>
  559. /// <returns>Hashtable containing the XMLRPC request</returns>
  560. private Hashtable ConvertGridInstantMessageToXMLRPC(GridInstantMessage msg)
  561. {
  562. Hashtable gim = new Hashtable();
  563. gim["from_agent_id"] = msg.fromAgentID.ToString();
  564. // Kept for compatibility
  565. gim["from_agent_session"] = UUID.Zero.ToString();
  566. gim["to_agent_id"] = msg.toAgentID.ToString();
  567. gim["im_session_id"] = msg.imSessionID.ToString();
  568. gim["timestamp"] = msg.timestamp.ToString();
  569. gim["from_agent_name"] = msg.fromAgentName;
  570. gim["message"] = msg.message;
  571. byte[] dialogdata = new byte[1];dialogdata[0] = msg.dialog;
  572. gim["dialog"] = Convert.ToBase64String(dialogdata,Base64FormattingOptions.None);
  573. if (msg.fromGroup)
  574. gim["from_group"] = "TRUE";
  575. else
  576. gim["from_group"] = "FALSE";
  577. byte[] offlinedata = new byte[1]; offlinedata[0] = msg.offline;
  578. gim["offline"] = Convert.ToBase64String(offlinedata, Base64FormattingOptions.None);
  579. gim["parent_estate_id"] = msg.ParentEstateID.ToString();
  580. gim["position_x"] = msg.Position.X.ToString();
  581. gim["position_y"] = msg.Position.Y.ToString();
  582. gim["position_z"] = msg.Position.Z.ToString();
  583. gim["region_id"] = msg.RegionID.ToString();
  584. gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None);
  585. return gim;
  586. }
  587. }
  588. }