public bool ResetAvatar(UUID userID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "resetavatar"; sendData["UserID"] = userID.ToString(); string reqString = ServerUtils.BuildQueryString(sendData); // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/avatar", reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("result")) { if (replyData["result"].ToString().ToLower() == "success") { return(true); } else { return(false); } } else { m_log.DebugFormat("[AVATAR CONNECTOR]: SetItems reply data does not contain result field"); } } else { m_log.DebugFormat("[AVATAR CONNECTOR]: SetItems received empty reply"); } } catch (Exception e) { m_log.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message); } return(false); }
public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["NAME"] = regionName; sendData["METHOD"] = "get_region_by_name"; GridRegion rinfo = null; string reply = string.Empty; try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(sendData)); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { rinfo = new GridRegion((Dictionary <string, object>)replyData["result"]); rinfo.GenericMap["URL"] = m_ServerURI; } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response", scopeID, regionName); } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply"); } } } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); return(null); } return(rinfo); }
private void ReportAgent(IScenePresence presence) { IAgentInfoService aservice = m_scene.RequestModuleInterface <IAgentInfoService>(); if (aservice != null) { aservice.SetLoggedIn(presence.UUID.ToString(), true, false, presence.Scene.RegionInfo.RegionID); } Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "login"; sendData["UserID"] = presence.UUID.ToString(); sendData["SessionID"] = presence.ControllingClient.SessionId.ToString(); sendData["SecureSessionID"] = presence.ControllingClient.SecureSessionId.ToString(); string reqString = WebUtils.BuildQueryString(sendData); List <string> urls = m_scene.RequestModuleInterface <IConfigurationService>().FindValueOf("PresenceServerURI"); foreach (string url in urls) { SynchronousRestFormsRequester.MakeRequest("POST", url, reqString); } sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "report"; sendData["SessionID"] = presence.ControllingClient.SessionId.ToString(); sendData["RegionID"] = presence.Scene.RegionInfo.RegionID.ToString(); reqString = WebUtils.BuildQueryString(sendData); // MainConsole.Instance.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); foreach (string url in urls) { string resp = SynchronousRestFormsRequester.MakeRequest("POST", url, reqString); } if (aservice != null) { aservice.SetLastPosition(presence.UUID.ToString(), presence.Scene.RegionInfo.RegionID, presence.AbsolutePosition, Vector3.Zero); } }
public bool NewFriendship(UUID PrincipalID, string Friend) { FriendInfo finfo = new FriendInfo(); finfo.PrincipalID = PrincipalID; finfo.Friend = Friend; Dictionary <string, object> sendData = finfo.ToKeyValuePairs(); sendData["METHOD"] = "newfriendship"; sendData["KEY"] = m_ServiceKey; sendData["SESSIONID"] = m_SessionID.ToString(); string reply = string.Empty; string uri = m_ServerURI + "/hgfriends"; try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); } catch (Exception e) { m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); return(false); } if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null)) { bool success = false; Boolean.TryParse(replyData["Result"].ToString(), out success); return(success); } else { m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend {0} {1} received null response", PrincipalID, Friend); } } else { m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend received null reply"); } return(false); }
public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); sendData["METHOD"] = "get_region_by_uuid"; string reply = string.Empty; string uri = m_ServerURI + "/grid"; try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); return(null); } GridRegion rinfo = null; if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if ((replyData != null) && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { rinfo = new GridRegion((Dictionary <string, object>)replyData["result"]); } //else // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", // scopeID, regionID); } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", scopeID, regionID); } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply"); } return(rinfo); }
public multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType gridItemType) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["REGIONHANDLE"] = regionHandle; sendData["GRIDITEMTYPE"] = (int)gridItemType; sendData["METHOD"] = "getmapitems"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridServerURI"); foreach (string m_ServerURI in serverURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { multipleMapItemReply items = new multipleMapItemReply(); if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure")) { return(items); } items = new multipleMapItemReply((replyData["MapItems"]) as Dictionary <string, object>); // Success return(items); } else { m_log.DebugFormat("[GRID CONNECTOR]: GetMapItems {0} received null response", regionHandle); } } } } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting server: {0}", e.Message); } return(null); }
private bool AddToQueue(OSD ev, UUID avatarID, ulong regionHandle, bool runasync) { //m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName); if (ev == null) { return(false); } try { OSDMap request = new OSDMap(); request.Add("AgentID", avatarID); request.Add("RegionHandle", regionHandle); OSDArray events = new OSDArray(); //Note: we HAVE to convert it to xml, otherwise things like byte[] arrays will not be passed through correctly! events.Add(OSDParser.SerializeLLSDXmlString(ev)); //Add this event request.Add("Events", events); List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(avatarID.ToString(), regionHandle.ToString(), "EventQueueServiceURI"); foreach (string serverURI in serverURIs) { if (runasync) { /*AsynchronousRestObjectRequester.MakeRequest("POST", serverURI + "/CAPS/EQMPOSTER", * OSDParser.SerializeJsonString(request), * delegate(string resp) * { * return RequestHandler(resp, events, avatarID, regionHandle); * }); * * return true;*/ string resp = SynchronousRestFormsRequester.MakeRequest("POST", serverURI + "/CAPS/EQMPOSTER", OSDParser.SerializeJsonString(request)); return(RequestHandler(resp, events, avatarID, regionHandle)); } else { string resp = SynchronousRestFormsRequester.MakeRequest("POST", serverURI + "/CAPS/EQMPOSTER", OSDParser.SerializeJsonString(request)); return(RequestHandler(resp, events, avatarID, regionHandle)); } } } catch (Exception e) { m_log.Error("[EVENTQUEUE] Caught exception: " + e.ToString()); } return(false); }
public int GetRegionFlags(UUID scopeID, UUID regionID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); sendData["METHOD"] = "get_region_flags"; string reply = string.Empty; string uri = m_ServerURI + "/grid"; try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); return(-1); } int flags = -1; if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) { Int32.TryParse((string)replyData["result"], out flags); //else // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received wrong type {2}", // scopeID, regionID, replyData["result"].GetType()); } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received null response", scopeID, regionID); } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags received null reply"); } return(flags); }
// Helpers // private Dictionary <string, object> MakeRequest(string method, Dictionary <string, object> sendData) { sendData["METHOD"] = method; string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/xinventory", ServerUtils.BuildQueryString(sendData)); Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse( reply); return(replyData); }
public bool Delete(UUID PrincipalID, string Friend) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["FRIEND"] = Friend; sendData["METHOD"] = "deletefriend"; string reply = string.Empty; try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("FriendsServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(sendData)); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null)) { bool success = false; Boolean.TryParse(replyData["Result"].ToString(), out success); if (success) { return(success); } } else { m_log.DebugFormat("[FRIENDS CONNECTOR]: DeleteFriend {0} {1} received null response", PrincipalID, Friend); } } else { m_log.DebugFormat("[FRIENDS CONNECTOR]: DeleteFriend received null reply"); } } } catch (Exception e) { m_log.DebugFormat("[FRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message); return(false); } return(false); }
public virtual bool ResetAvatar(UUID userID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "resetavatar"; sendData["UserID"] = userID.ToString(); string reqString = WebUtils.BuildQueryString(sendData); // MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AvatarServerURI"); foreach (string mServerUri in serverURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", mServerUri, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("result")) { if (replyData["result"].ToString().ToLower() == "success") { return(true); } } else { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: SetItems reply data does not contain result field"); } } else { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: SetItems received empty reply"); } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message); } return(false); }
public bool GetOSDMap(string url, OSDMap map, out OSDMap response) { response = null; string resp = SynchronousRestFormsRequester.MakeRequest("POST", url, OSDParser.SerializeJsonString(map)); if (resp == "") { return(false); } response = (OSDMap)OSDParser.DeserializeJson(resp); return(response["Success"]); }
public virtual List <GridRegion> GetNeighbours(UUID scopeID, UUID regionID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["REGIONID"] = regionID.ToString(); sendData["METHOD"] = "get_neighbours"; List <GridRegion> rinfos = new List <GridRegion>(); string reqString = ServerUtils.BuildQueryString(sendData); string reply = string.Empty; try { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/grid", reqString); } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); return(rinfos); } Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary <string, object> .ValueCollection rinfosList = replyData.Values; //m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count); foreach (object r in rinfosList) { if (r is Dictionary <string, object> ) { GridRegion rinfo = new GridRegion((Dictionary <string, object>)r); rinfos.Add(rinfo); } } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received null response", scopeID, regionID); } return(rinfos); }
private bool Call(GridRegion region, Dictionary <string, object> sendData) { string reqString = ServerUtils.BuildQueryString(sendData); //m_log.DebugFormat("[FRIENDS CONNECTOR]: queryString = {0}", reqString); if (region == null) { return(false); } m_log.DebugFormat("[FRIENDS CONNECTOR]: region: {0}", region.ExternalHostName + ":" + region.HttpPort); try { string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; string reply = SynchronousRestFormsRequester.MakeRequest("POST", url + "/friends", reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("RESULT")) { if (replyData["RESULT"].ToString().ToLower() == "true") { return(true); } else { return(false); } } else { m_log.DebugFormat("[FRIENDS CONNECTOR]: reply data does not contain result field"); } } else { m_log.DebugFormat("[FRIENDS CONNECTOR]: received empty reply"); } } catch (Exception e) { m_log.DebugFormat("[FRIENDS CONNECTOR]: Exception when contacting remote sim: {0}", e.ToString()); } return(false); }
public virtual AvatarData GetAvatar(UUID userID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "getavatar"; sendData["UserID"] = userID; string reply = string.Empty; string reqString = WebUtils.BuildQueryString(sendData); AvatarData avatar = null; // MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AvatarServerURI"); foreach (string m_ServerURI in serverURIs) { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply == null || (reply != null && reply == string.Empty)) { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); return(null); } Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { avatar = new AvatarData((Dictionary <string, object>)replyData["result"]); return(avatar); } } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting presence server: {0}", e.Message); } return(avatar); }
protected bool Set(Dictionary <string, object> sendData, string userID, UUID regionID, Vector3 position, Vector3 lookAt) { sendData["UserID"] = userID; sendData["RegionID"] = regionID.ToString(); sendData["Position"] = position.ToString(); sendData["LookAt"] = lookAt.ToString(); string reqString = ServerUtils.BuildQueryString(sendData); string uri = m_ServerURI + "/griduser"; // m_log.DebugFormat("[GRID USER CONNECTOR]: queryString = {0}", reqString); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("result")) { if (replyData["result"].ToString().ToLower() == "success") { return(true); } else { return(false); } } else { m_log.DebugFormat("[GRID USER CONNECTOR]: SetPosition reply data does not contain result field"); } } else { m_log.DebugFormat("[GRID USER CONNECTOR]: SetPosition received empty reply"); } } catch (Exception e) { m_log.DebugFormat("[GRID USER CONNECTOR]: Exception when contacting grid user server at {0}: {1}", uri, e.Message); } return(false); }
public bool DeleteFriendship(UUID PrincipalID, UUID Friend, string secret) { FriendInfo finfo = new FriendInfo(); finfo.PrincipalID = PrincipalID; finfo.Friend = Friend.ToString(); Dictionary <string, object> sendData = finfo.ToKVP(); sendData["METHOD"] = "deletefriendship"; sendData["SECRET"] = secret; string reply = string.Empty; try { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/hgfriends", WebUtils.BuildQueryString(sendData)); } catch (Exception e) { MainConsole.Instance.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message); return(false); } if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null)) { bool success = false; Boolean.TryParse(replyData["Result"].ToString(), out success); return(success); } else { MainConsole.Instance.DebugFormat("[HGFRIENDS CONNECTOR]: Delete {0} {1} received null response", PrincipalID, Friend); } } else { MainConsole.Instance.DebugFormat("[HGFRIENDS CONNECTOR]: DeleteFriend received null reply"); } return(false); }
public Dictionary <UUID, bool> FetchExperiencePermissions(UUID agent_id) { //m_log.InfoFormat("[ExperienceServiceConnector]: FetchExperiencePermissions for {0}", agent_id); Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["METHOD"] = "getpermissions"; sendData["agent_id"] = agent_id.ToString(); string request_str = ServerUtils.BuildQueryString(sendData); Dictionary <UUID, bool> experiences = new Dictionary <UUID, bool>(); string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, request_str, m_Auth); if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); int iter = 0; while (true) { string key = string.Format("uuid_{0}", iter); string perm = string.Format("perm_{0}", iter); if (replyData.ContainsKey(key) && replyData.ContainsKey(perm)) { UUID experience_id; if (UUID.TryParse(replyData[key].ToString(), out experience_id)) { bool allow = bool.Parse(replyData[perm].ToString()); experiences.Add(experience_id, allow); //m_log.InfoFormat("[EXPERIENCE SERVICE CONNECTOR]: {0} = {1}", experience_id, allow); } } else { break; } iter++; } } return(experiences); }
public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SCOPEID"] = scopeID.ToString(); sendData["NAME"] = regionName; sendData["METHOD"] = "get_region_by_name"; string reply = string.Empty; try { reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/grid", ServerUtils.BuildQueryString(sendData)); } catch (Exception e) { m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); return(null); } GridRegion rinfo = null; if (reply != string.Empty) { Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if ((replyData != null) && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { rinfo = new GridRegion((Dictionary <string, object>)replyData["result"]); } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response", scopeID, regionName); } } else { m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply"); } return(rinfo); }
public PresenceInfo GetAgent(UUID sessionID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "getagent"; sendData["SessionID"] = sessionID.ToString(); string reply = string.Empty; string reqString = ServerUtils.BuildQueryString(sendData); string uri = m_ServerURI + "/presence"; // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); if (reply == null || (reply != null && reply == string.Empty)) { m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); return(null); } } catch (Exception e) { m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); return(null); } Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); PresenceInfo pinfo = null; if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { pinfo = new PresenceInfo((Dictionary <string, object>)replyData["result"]); } } return(pinfo); }
public AgentPrefs GetAgentPreferences(UUID principalID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); string reply = string.Empty; string uri = String.Concat(m_ServerURI, "/agentprefs"); sendData["METHOD"] = "getagentprefs"; sendData["UserID"] = principalID; string reqString = ServerUtils.BuildQueryString(sendData); // m_log.DebugFormat("[AGENT PREFS CONNECTOR]: queryString = {0}", reqString); try { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); if (string.IsNullOrEmpty(reply)) { m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null or empty reply"); return(null); } } catch (Exception e) { m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); } Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData != null) { if (replyData.ContainsKey("result") && (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) { m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received Failure response"); return(null); } } else { m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null response"); return(null); } AgentPrefs prefs = new AgentPrefs(replyData); return(prefs); }
public bool DeleteEstate(int estateID, string password) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["ESTATEID"] = estateID; sendData["PASSWORD"] = password; sendData["METHOD"] = "deleteestate"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { if (!replyData.ContainsKey("Result") || (replyData["Result"].ToString().ToLower() == "null")) { return(false); } return(true); } else { m_log.DebugFormat("[AuroraRemoteEstateConnector]: DeleteEstate {0} received null response", estateID); } } } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteEstateConnector]: Exception when contacting server: {0}", e.ToString()); } return(false); }
public EventData CreateEvent(UUID creator, UUID regionID, UUID parcelID, DateTime date, uint cover, EventFlags maturity, uint flags, uint duration, Vector3 localPos, string name, string description, string category) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["METHOD"] = "CreateEvent"; sendData["Creator"] = creator; sendData["RegionID"] = regionID; sendData["ParcelID"] = parcelID; sendData["Date"] = date; sendData["Cover"] = cover; sendData["Maturity"] = maturity; sendData["Flags"] = flags; sendData["Duration"] = duration; sendData["LocalPos"] = localPos; sendData["Name"] = name; sendData["Description"] = description; sendData["Category"] = category; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (EventData eventdata in from m_ServerURI in m_ServerURIs select SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString) into reply where reply != string.Empty select WebUtils.ParseXmlResponse(reply) into replyData from object f in replyData select(KeyValuePair <string, object>) f into value where value.Value is Dictionary <string, object> select value.Value as Dictionary <string, object> into valuevalue select new EventData(valuevalue)) { return(eventdata); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e); } return(null); }
protected UserInfo Get(Dictionary <string, object> sendData) { string reqString = WebUtils.BuildQueryString(sendData); // MainConsole.Instance.DebugFormat("[GRID USER CONNECTOR]: queryString = {0}", reqString); try { List <string> urls = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("GridUserServerURI"); foreach (string url in urls) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", url, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); UserInfo guinfo = null; if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) { if (replyData["result"] is Dictionary <string, object> ) { guinfo = new UserInfo(); Dictionary <string, object> kvp = (Dictionary <string, object>)replyData["result"]; guinfo.UserID = kvp["UserID"].ToString(); guinfo.HomeRegionID = UUID.Parse(kvp["HomeRegionID"].ToString()); guinfo.CurrentRegionID = UUID.Parse(kvp["LastRegionID"].ToString()); guinfo.CurrentPosition = Vector3.Parse(kvp["LastPosition"].ToString()); guinfo.HomePosition = Vector3.Parse(kvp["HomePosition"].ToString()); guinfo.IsOnline = bool.Parse(kvp["Online"].ToString()); guinfo.LastLogin = DateTime.Parse(kvp["Login"].ToString()); guinfo.LastLogout = DateTime.Parse(kvp["Logout"].ToString()); } } return(guinfo); } } } catch (Exception) { } return(null); }
public void UpdateAbuseReport(AbuseReport report, string Password) { try { Dictionary <string, object> send = report.ToKeyValuePairs(); send.Add("Password", Password); send.Add("METHOD", "AddAbuseReport"); List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURIs[0] + "/abusereport", WebUtils.BuildQueryString(send)); } catch (Exception e) { m_log.DebugFormat("[ABUSEREPORT CONNECTOR]: Exception when contacting friends server: {0}", e.Message); } }
public DirLandReplyData[] FindLandForSale(string searchType, string price, string area, int StartQuery, uint Flags) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["SEARCHTYPE"] = searchType; sendData["PRICE"] = price; sendData["AREA"] = area; sendData["STARTQUERY"] = StartQuery; sendData["FLAGS"] = Flags; sendData["METHOD"] = "findlandforsale"; string reqString = WebUtils.BuildQueryString(sendData); List <DirLandReplyData> Land = new List <DirLandReplyData>(); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); foreach (object f in replyData) { KeyValuePair <string, object> value = (KeyValuePair <string, object>)f; if (value.Value is Dictionary <string, object> ) { Dictionary <string, object> valuevalue = value.Value as Dictionary <string, object>; DirLandReplyData land = new DirLandReplyData(valuevalue); Land.Add(land); } } } } return(Land.ToArray()); } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString()); } return(Land.ToArray()); }
private Dictionary <string, object> MakeRequest(string method, Dictionary <string, object> sendData) { sendData["METHOD"] = method; string reply = string.Empty; lock (m_Lock) reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/offlineim", ServerUtils.BuildQueryString(sendData), m_Auth); Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse( reply); return(replyData); }
private bool SendAndGetBoolReply(Dictionary <string, object> sendData) { string reqString = ServerUtils.BuildQueryString(sendData); string uri = m_ServerURI + "/accounts"; //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); if (reply != string.Empty) { //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: reply = {0}", reply); Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData.ContainsKey("result")) { if (replyData["result"].ToString().ToLower() == "success") { return(true); } else { return(false); } } else { m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Set or Create UserAccount reply data does not contain result field"); } } else { m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Set or Create UserAccount received empty reply"); } } catch (Exception e) { m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user accounts server at {0}: {1}", uri, e.Message); } return(false); }
private bool Call(GridRegion region, Dictionary <string, object> sendData) { string reqString = ServerUtils.BuildQueryString(sendData); // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString); try { string url = ""; if (region.HttpPort != 0) { url = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/"; } else { url = region.ServerURI; } string reply = SynchronousRestFormsRequester.MakeRequest("POST", url + "estate", reqString); if (reply != string.Empty) { if (reply != string.Empty) { int indx = reply.IndexOf("true", StringComparison.InvariantCultureIgnoreCase); if (indx > 0) { return(true); } return(false); } } else { m_log.DebugFormat("[XESTATE CONNECTOR]: received empty reply"); } } catch (Exception e) { m_log.DebugFormat("[XESTATE CONNECTOR]: Exception when contacting remote sim: {0}", e.Message); } return(false); }
public DirClassifiedReplyData[] FindClassifieds(string queryText, string category, string queryFlags, int StartQuery) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["QUERYTEXT"] = queryText; sendData["CATEGORY"] = category; sendData["QUERYFLAGS"] = queryFlags; sendData["STARTQUERY"] = StartQuery; sendData["METHOD"] = "findclassifieds"; string reqString = WebUtils.BuildQueryString(sendData); List <DirClassifiedReplyData> Classifieds = new List <DirClassifiedReplyData>(); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); foreach (object f in replyData) { KeyValuePair <string, object> value = (KeyValuePair <string, object>)f; if (value.Value is Dictionary <string, object> ) { Dictionary <string, object> valuevalue = value.Value as Dictionary <string, object>; DirClassifiedReplyData classified = new DirClassifiedReplyData(valuevalue); Classifieds.Add(classified); } } } } return(Classifieds.ToArray()); } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString()); } return(Classifieds.ToArray()); }