public List<ProfilePickInfo> GetPicks(UUID ownerID) { QueryFilter filter = new QueryFilter(); filter.andFilters["OwnerUUID"] = ownerID; List<string> query = GD.Query(new string[1] { "*" }, "userpicks", filter, null, null, null); List<ProfilePickInfo> picks = new List<ProfilePickInfo>(); for (int i = 0; i < query.Count; i += 5) { ProfilePickInfo pick = new ProfilePickInfo(); pick.FromOSD((OSDMap) OSDParser.DeserializeJson(query[i + 4])); picks.Add(pick); } return picks; }
public bool AddPick (ProfilePickInfo pick) { try { List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService> ().FindValueOf (pick.CreatorUUID.ToString (), "RemoteServerURI"); foreach (string url in serverURIs) { OSDMap map = new OSDMap (); map["Method"] = "addpick"; map["Pick"] = pick.ToOSD (); WebUtils.PostToService (url + "osd", map, false, false); } } catch (Exception e) { m_log.DebugFormat ("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.ToString ()); } return true; }
public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled, Vector3d globalPos) { IScenePresence p = remoteClient.Scene.GetScenePresence(remoteClient.AgentId); UUID parceluuid = p.CurrentParcelUUID; string user = "******"; string OrigionalName = "(unknown)"; Vector3 pos_global = new Vector3(globalPos); IParcelManagementModule parcelManagement = remoteClient.Scene.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { ILandObject targetlandObj = parcelManagement.GetLandObject(pos_global.X/Constants.RegionSize, pos_global.Y/Constants.RegionSize); if (targetlandObj != null) { UserAccount parcelOwner = remoteClient.Scene.UserAccountService.GetUserAccount(UUID.Zero, targetlandObj.LandData .OwnerID); if (parcelOwner != null) user = parcelOwner.Name; parceluuid = targetlandObj.LandData.InfoUUID; OrigionalName = targetlandObj.LandData.Name; } } ProfilePickInfo pick = new ProfilePickInfo { PickUUID = pickID, CreatorUUID = creatorID, TopPick = topPick ? 1 : 0, ParcelUUID = parceluuid, Name = name, Description = desc, SnapshotUUID = snapshotID, User = user, OriginalName = OrigionalName, SimName = remoteClient.Scene.RegionInfo.RegionName, GlobalPos = pos_global, SortOrder = sortOrder, Enabled = enabled ? 1 : 0 }; ProfileFrontend.AddPick(pick); }
public ProfilePickInfo GetPick (UUID queryPickID) { List<string> query = GD.Query (new string[1] { "PickUUID" }, new object[1] { queryPickID }, "userpicks", "*"); if (query.Count < 5) return null; ProfilePickInfo pick = new ProfilePickInfo (); pick.FromOSD ((OSDMap)OSDParser.DeserializeJson (query[4])); return pick; }
public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled, Vector3d globalPos) { IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId); if (info == null) return; ScenePresence p = GetRegionUserIsIn(remoteClient.AgentId).GetScenePresence(remoteClient.AgentId); UUID parceluuid = p.currentParcelUUID; string user = "******"; string OrigionalName = "(unknown)"; Vector3 pos_global = new Vector3(globalPos); IParcelManagementModule parcelManagement = GetRegionUserIsIn(remoteClient.AgentId).RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { ILandObject targetlandObj = parcelManagement.GetLandObject(pos_global.X / Constants.RegionSize, pos_global.Y / Constants.RegionSize); if (targetlandObj != null) { UserAccount parcelOwner = GetRegionUserIsIn(remoteClient.AgentId).UserAccountService.GetUserAccount(UUID.Zero, targetlandObj.LandData.OwnerID); if (parcelOwner != null) user = parcelOwner.Name; parceluuid = targetlandObj.LandData.InfoUUID; OrigionalName = targetlandObj.LandData.Name; } } if (!info.Picks.ContainsKey(pickID.ToString())) { ProfilePickInfo values = new ProfilePickInfo(); values.PickUUID = pickID; values.CreatorUUID = creatorID; values.TopPick = topPick ? 1 : 0; values.ParcelUUID = parceluuid; values.Name = name; values.Description = desc; values.SnapshotUUID = snapshotID; values.User = user; values.OriginalName = OrigionalName; values.SimName = remoteClient.Scene.RegionInfo.RegionName; values.GlobalPos = pos_global; values.SortOrder = sortOrder; values.Enabled = enabled ? 1 : 0; info.Picks.Add(pickID.ToString(), values.ToOSD()); } else { ProfilePickInfo oldpick = new ProfilePickInfo(); oldpick.FromOSD((OSDMap)info.Picks[pickID.ToString()]); //Security check if (oldpick.CreatorUUID != remoteClient.AgentId) return; oldpick.TopPick = topPick ? 1 : 0; oldpick.ParcelUUID = parceluuid; oldpick.Name = name; oldpick.Description = desc; oldpick.SnapshotUUID = snapshotID; oldpick.User = user; oldpick.OriginalName = OrigionalName; oldpick.SimName = remoteClient.Scene.RegionInfo.RegionName; oldpick.GlobalPos = pos_global; oldpick.SortOrder = sortOrder; oldpick.Enabled = enabled ? 1 : 0; info.Picks.Remove(pickID.ToString()); info.Picks.Add(pickID.ToString(), oldpick.ToOSD()); } ProfileFrontend.UpdateUserProfile(info); }
public void PickDelete(IClientAPI remoteClient, UUID queryPickID) { IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId); if (info == null) return; if (info.Picks.ContainsKey(queryPickID.ToString())) { ProfilePickInfo oldpick = new ProfilePickInfo(); oldpick.FromOSD((OSDMap)info.Picks[queryPickID.ToString()]); if (oldpick.CreatorUUID != remoteClient.AgentId) return; info.Picks.Remove(queryPickID.ToString()); ProfileFrontend.UpdateUserProfile(info); } }
public bool AddPick(ProfilePickInfo pick) { bool success = m_localService.AddPick(pick); if (!success) success = (bool)DoRemoteForced(pick); return success; }
public void HandleAvatarPicksRequest(Object sender, string method, List<String> args) { if (!(sender is IClientAPI)) return; IClientAPI remoteClient = (IClientAPI)sender; Dictionary<UUID, string> picks = new Dictionary<UUID, string>(); UUID requestedUUID = new UUID(args[0]); bool isFriend = IsFriendOfUser(remoteClient.AgentId, requestedUUID); if (isFriend) { IUserProfileInfo profile = ProfileFrontend.GetUserProfile(requestedUUID); if (profile == null) return; foreach (OSD pick in profile.Picks.Values) { ProfilePickInfo Pick = new ProfilePickInfo(); Pick.FromOSD((OSDMap)pick); picks.Add(Pick.PickUUID, Pick.Name); } } remoteClient.SendAvatarPicksReply(requestedUUID, picks); }
public ProfilePickInfo GetPick(UUID queryPickID) { Dictionary<string, object> where = new Dictionary<string, object>(1); where["PickUUID"] = queryPickID; List<string> query = GD.Query(new string[1] { "*" }, "userpicks", new QueryFilter { andFilters = where }, null, null, null); if (query.Count < 5) return null; ProfilePickInfo pick = new ProfilePickInfo(); pick.FromOSD((OSDMap) OSDParser.DeserializeJson(query[4])); return pick; }
public List<ProfilePickInfo> GetPicks(UUID ownerID) { Dictionary<string, object> where = new Dictionary<string, object>(1); where["OwnerUUID"] = ownerID; List<string> query = GD.Query(new string[1] { "*" }, "userpicks", new QueryFilter { andFilters = where }, null, null, null); List<ProfilePickInfo> picks = new List<ProfilePickInfo>(); for (int i = 0; i < query.Count; i += 5) { ProfilePickInfo pick = new ProfilePickInfo(); pick.FromOSD((OSDMap) OSDParser.DeserializeJson(query[i + 4])); picks.Add(pick); } return picks; }
public bool AddPick(ProfilePickInfo pick) { return false; }
public ProfilePickInfo FindPick(UUID pickID) { Dictionary<string, object> sendData = new Dictionary<string, object>(); sendData["PICKID"] = pickID; sendData["METHOD"] = "getpick"; string reqString = ServerUtils.BuildXmlResponse(sendData); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); if (reply != string.Empty) { Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData != null) { if (!replyData.ContainsKey("result")) return null; Dictionary<string, object>.ValueCollection replyvalues = replyData.Values; ProfilePickInfo pick = null; foreach (object f in replyvalues) { if (f is Dictionary<string, object>) { pick = new ProfilePickInfo((Dictionary<string, object>)f); } } // Success return pick; } else m_log.DebugFormat("[AuroraRemoteProfileConnector]: GetPick {0} received null response", pickID); } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.Message); } return null; }
public void UpdatePick(ProfilePickInfo pick) { Dictionary<string, object> sendData = pick.ToKeyValuePairs(); sendData["METHOD"] = "updatepick"; string reqString = ServerUtils.BuildQueryString(sendData); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); if (reply != string.Empty) { Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); if (replyData != null) { if (replyData.ContainsKey("result") && (replyData["result"].ToString().ToLower() == "null")) { m_log.DebugFormat("[AuroraRemoteProfileConnector]: UpdatePick {0} received null response", pick.PickUUID); } } else { m_log.DebugFormat("[AuroraRemoteProfileConnector]: UpdatePick {0} received null response", pick.PickUUID); } } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.Message); } }
public ProfilePickInfo GetPick (UUID queryPickID) { try { List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService> ().FindValueOf ("RemoteServerURI"); foreach (string url in serverURIs) { OSDMap map = new OSDMap (); map["Method"] = "getpick"; map["PickUUID"] = queryPickID; OSDMap response = WebUtils.PostToService (url + "osd", map, true, true); if (response["_Result"].Type == OSDType.Map) { OSDMap responsemap = (OSDMap)response["_Result"]; ProfilePickInfo info = new ProfilePickInfo (); info.FromOSD (responsemap); return info; } } } catch (Exception e) { m_log.DebugFormat ("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.ToString ()); } return null; }
public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) { IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId); if (info == null) return; ScenePresence p = m_scene.GetScenePresence(remoteClient.AgentId); UUID parceluuid = p.currentParcelUUID; string user = "******"; string OrigionalName = "(unknown)"; Vector3 pos_global = new Vector3(p.AbsolutePosition.X + p.Scene.RegionInfo.RegionLocX * 256, p.AbsolutePosition.Y + p.Scene.RegionInfo.RegionLocY * 256, p.AbsolutePosition.Z); ILandObject targetlandObj = m_scene.LandChannel.GetLandObject(p.AbsolutePosition.X, p.AbsolutePosition.Y); if (targetlandObj != null) { ScenePresence parcelowner = m_scene.GetScenePresence(targetlandObj.LandData.OwnerID); if (parcelowner != null) user = parcelowner.Name; parceluuid = targetlandObj.LandData.InfoUUID; OrigionalName = targetlandObj.LandData.Name; } OSDMap picks = Util.DictionaryToOSD(info.Picks); if (!picks.ContainsKey(pickID.ToString())) { ProfilePickInfo values = new ProfilePickInfo(); values.PickUUID = pickID; values.CreatorUUID = creatorID; values.TopPick = topPick ? 1 : 0; values.ParcelUUID = parceluuid; values.Name = name; values.Description = desc; values.SnapshotUUID = snapshotID; values.User = user; values.OriginalName = OrigionalName; values.SimName = remoteClient.Scene.RegionInfo.RegionName; values.GlobalPos = pos_global; values.SortOrder = sortOrder; values.Enabled = enabled ? 1 : 0; picks.Add(pickID.ToString(), Util.DictionaryToOSD(values.ToKeyValuePairs())); } else { ProfilePickInfo oldpick = new ProfilePickInfo(Util.OSDToDictionary((OSDMap)picks[pickID.ToString()])); //Security check if (oldpick.CreatorUUID != remoteClient.AgentId) return; oldpick.ParcelUUID = parceluuid; oldpick.Name = name; oldpick.SnapshotUUID = snapshotID; oldpick.Description = desc; oldpick.SimName = remoteClient.Scene.RegionInfo.RegionName; oldpick.GlobalPos = pos_global; oldpick.SortOrder = sortOrder; oldpick.Enabled = enabled ? 1 : 0; picks.Add(pickID.ToString(), Util.DictionaryToOSD(oldpick.ToKeyValuePairs())); } info.Picks = Util.OSDToDictionary(picks); ProfileFrontend.UpdateUserProfile(info); }
public List<ProfilePickInfo> GetPicks (UUID ownerID) { try { List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService> ().FindValueOf (ownerID.ToString (), "RemoteServerURI"); foreach (string url in serverURIs) { OSDMap map = new OSDMap (); map["Method"] = "getpicks"; map["PrincipalID"] = ownerID; OSDMap response = WebUtils.PostToService (url + "osd", map, true, true); if (response["_Result"].Type == OSDType.Map) { OSDMap responsemap = (OSDMap)response["_Result"]; if (responsemap.ContainsKey ("Result")) { List<ProfilePickInfo> list = new List<ProfilePickInfo> (); OSDArray picks = (OSDArray)responsemap["Result"]; foreach (OSD o in picks) { ProfilePickInfo info = new ProfilePickInfo (); info.FromOSD ((OSDMap)o); list.Add (info); } return list; } return new List<ProfilePickInfo>(); } } } catch (Exception e) { m_log.DebugFormat ("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.ToString ()); } return null; }
public void GodPickDelete(IClientAPI remoteClient, UUID AgentID, UUID queryPickID, UUID queryID) { if (m_scene.Permissions.IsGod(remoteClient.AgentId)) { IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId); if (info == null) return; if (info.Picks.ContainsKey(queryPickID.ToString())) { OSDMap picks = Util.DictionaryToOSD(info.Picks); ProfilePickInfo oldpick = new ProfilePickInfo(Util.OSDToDictionary((OSDMap)picks[queryPickID.ToString()])); if (oldpick.CreatorUUID != remoteClient.AgentId) return; info.Picks.Remove(queryPickID.ToString()); ProfileFrontend.UpdateUserProfile(info); } } }
public void HandlePickInfoRequest(Object sender, string method, List<String> args) { if (!(sender is IClientAPI)) return; IClientAPI remoteClient = (IClientAPI)sender; UUID PickUUID = UUID.Parse(args[1]); IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId); if (info == null) return; if (info.Picks.ContainsKey(PickUUID.ToString())) { ProfilePickInfo pick = new ProfilePickInfo(); pick.FromOSD((OSDMap)info.Picks[PickUUID.ToString()]); remoteClient.SendPickInfoReply(pick.PickUUID, pick.CreatorUUID, pick.TopPick == 1 ? true : false, pick.ParcelUUID, pick.Name, pick.Description, pick.SnapshotUUID, pick.User, pick.OriginalName, pick.SimName, pick.GlobalPos, pick.SortOrder, pick.Enabled == 1 ? true : false); } }
public ProfilePickInfo GetPick(UUID queryPickID) { object remoteValue = DoRemote(queryPickID); if (remoteValue != null || m_doRemoteOnly) return (ProfilePickInfo)remoteValue; QueryFilter filter = new QueryFilter(); filter.andFilters["PickUUID"] = queryPickID; List<string> query = GD.Query(new[] { "*" }, "userpicks", filter, null, null, null); if (query.Count < 5) return null; ProfilePickInfo pick = new ProfilePickInfo(); pick.FromOSD((OSDMap) OSDParser.DeserializeJson(query[4])); return pick; }
public void GodPickDelete(IClientAPI remoteClient, UUID AgentID, UUID queryPickID, UUID queryID) { if (GetRegionUserIsIn(remoteClient.AgentId).Permissions.IsGod(remoteClient.AgentId)) { IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId); if (info == null) return; if (info.Picks.ContainsKey(queryPickID.ToString())) { ProfilePickInfo oldpick = new ProfilePickInfo(); oldpick.FromOSD((OSDMap)info.Picks[queryPickID.ToString()]); info.Picks.Remove(queryPickID.ToString()); ProfileFrontend.UpdateUserProfile(info); } } }
public List<ProfilePickInfo> GetPicks(UUID ownerID) { object remoteValue = DoRemote(ownerID); if (remoteValue != null || m_doRemoteOnly) return (List<ProfilePickInfo>)remoteValue; QueryFilter filter = new QueryFilter(); filter.andFilters["OwnerUUID"] = ownerID; List<string> query = GD.Query(new[] { "*" }, "userpicks", filter, null, null, null); List<ProfilePickInfo> picks = new List<ProfilePickInfo>(); for (int i = 0; i < query.Count; i += 5) { ProfilePickInfo pick = new ProfilePickInfo(); pick.FromOSD((OSDMap) OSDParser.DeserializeJson(query[i + 4])); picks.Add(pick); } return picks; }
public byte[] AddPick (OSDMap request) { ProfilePickInfo info = new ProfilePickInfo (); info.FromOSD ((OSDMap)request["Pick"]); ProfileConnector.AddPick (info); string xmlString = OSDParser.SerializeJsonString (new OSDMap ()); //m_log.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding (); return encoding.GetBytes (xmlString); }
public bool AddPick(ProfilePickInfo pick) { object remoteValue = DoRemote(pick); if (remoteValue != null || m_doRemoteOnly) return remoteValue != null && (bool)remoteValue; if (GetUserProfile(pick.CreatorUUID) == null) return false; //It might be updating, delete the old QueryFilter filter = new QueryFilter(); filter.andFilters["PickUUID"] = pick.PickUUID; GD.Delete("userpicks", filter); List<object> values = new List<object> { pick.Name.MySqlEscape(), pick.SimName.MySqlEscape(), pick.CreatorUUID, pick.PickUUID, OSDParser.SerializeJsonString(pick.ToOSD()) }; return GD.Insert("userpicks", values.ToArray()); }
public bool AddPick (ProfilePickInfo pick) { if (GetUserProfile (pick.CreatorUUID) == null) return false; //It might be updating, delete the old GD.Delete ("userpicks", new string[1] { "PickUUID" }, new object[1] { pick.PickUUID }); List<object> values = new List<object> (); values.Add (pick.Name); values.Add (pick.SimName); values.Add (pick.CreatorUUID); values.Add (pick.PickUUID); values.Add (OSDParser.SerializeJsonString (pick.ToOSD ())); return GD.Insert ("userpicks", values.ToArray ()); }
public bool AddPick (ProfilePickInfo pick) { bool success = m_localService.AddPick (pick); if (!success) success = m_remoteService.AddPick (pick); return success; }
public List<ProfilePickInfo> GetPicks (UUID ownerID) { List<ProfilePickInfo> picks = new List<ProfilePickInfo> (); List<string> query = GD.Query (new string[1] { "OwnerUUID" }, new object[1] { ownerID }, "userpicks", "*"); for (int i = 0; i < query.Count; i+=5) { ProfilePickInfo pick = new ProfilePickInfo (); pick.FromOSD ((OSDMap)OSDParser.DeserializeJson (query[i+4])); picks.Add (pick); } return picks; }
public ProfilePickInfo GetPick(UUID queryPickID) { QueryFilter filter = new QueryFilter(); filter.andFilters["PickUUID"] = queryPickID; List<string> query = GD.Query(new string[1] { "*" }, "userpicks", filter, null, null, null); if (query.Count < 5) return null; ProfilePickInfo pick = new ProfilePickInfo(); pick.FromOSD((OSDMap) OSDParser.DeserializeJson(query[4])); return pick; }