28 using System.Collections;
29 using System.Collections.Generic;
31 using System.Reflection;
37 using OpenSim.Framework;
39 namespace OpenSim.Services.Connectors.InstantMessage
43 private static readonly ILog m_log =
45 MethodBase.GetCurrentMethod().DeclaringType);
55 Hashtable xmlrpcdata = ConvertGridInstantMessageToXMLRPC(im);
56 xmlrpcdata[
"region_handle"] = 0;
58 ArrayList SendParams =
new ArrayList();
59 SendParams.Add(xmlrpcdata);
60 XmlRpcRequest GridReq =
new XmlRpcRequest(
"grid_instant_message", SendParams);
64 XmlRpcResponse GridResp = GridReq.Send(url, 10000);
66 Hashtable responseData = (Hashtable)GridResp.Value;
68 if (responseData.ContainsKey(
"success"))
70 if ((
string)responseData[
"success"] ==
"TRUE")
83 m_log.DebugFormat(
"[GRID INSTANT MESSAGE]: No response from {0}", url);
87 catch (WebException e)
89 m_log.ErrorFormat(
"[GRID INSTANT MESSAGE]: Error sending message to {0} the host didn't respond " + e.ToString(), url);
102 Hashtable gim =
new Hashtable();
103 gim[
"from_agent_id"] = msg.fromAgentID.ToString();
105 gim[
"from_agent_session"] = UUID.Zero.ToString();
106 gim[
"to_agent_id"] = msg.toAgentID.ToString();
107 gim[
"im_session_id"] = msg.imSessionID.ToString();
108 gim[
"timestamp"] = msg.timestamp.ToString();
109 gim[
"from_agent_name"] = msg.fromAgentName;
110 gim[
"message"] = msg.message;
111 byte[] dialogdata =
new byte[1]; dialogdata[0] = msg.dialog;
112 gim[
"dialog"] = Convert.ToBase64String(dialogdata, Base64FormattingOptions.None);
115 gim[
"from_group"] =
"TRUE";
117 gim[
"from_group"] =
"FALSE";
118 byte[] offlinedata =
new byte[1]; offlinedata[0] = msg.offline;
119 gim[
"offline"] = Convert.ToBase64String(offlinedata, Base64FormattingOptions.None);
120 gim[
"parent_estate_id"] = msg.ParentEstateID.ToString();
121 gim[
"position_x"] = msg.Position.X.ToString();
122 gim[
"position_y"] = msg.Position.Y.ToString();
123 gim[
"position_z"] = msg.Position.Z.ToString();
124 gim[
"region_id"] = msg.RegionID.ToString();
125 gim[
"binary_bucket"] = Convert.ToBase64String(msg.binaryBucket, Base64FormattingOptions.None);
126 gim[
"region_id"] =
new UUID(msg.
RegionID).ToString();
static bool SendInstantMessage(string url, GridInstantMessage im)
This actually does the XMLRPC Request
static Hashtable ConvertGridInstantMessageToXMLRPC(GridInstantMessage msg)
Takes a GridInstantMessage and converts it into a Hashtable for XMLRPC
Interactive OpenSim region server