MessageTransferModule.cs 26 KB

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