/// <summary> /// Handles the avatar picks request. /// </summary> /// <param name='sender'> /// Sender. /// </param> /// <param name='method'> /// Method. /// </param> /// <param name='args'> /// Arguments. /// </param> public void PicksRequest(Object sender, string method, List <String> args) { if (!(sender is IClientAPI)) { return; } IClientAPI remoteClient = (IClientAPI)sender; UUID targetId; UUID.TryParse(args[0], out targetId); // Can't handle NPC yet... ScenePresence p = FindPresence(targetId); if (null != p) { if (p.PresenceType == PresenceType.Npc) { return; } } string serverURI = string.Empty; GetUserProfileServerURI(targetId, out serverURI); Dictionary <UUID, string> picks = new Dictionary <UUID, string>(); OSDMap parameters = new OSDMap(); parameters.Add("creatorId", OSD.FromUUID(targetId)); OSD Params = (OSD)parameters; if (!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString())) { remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); return; } parameters = (OSDMap)Params; OSDArray list = (OSDArray)parameters["result"]; foreach (OSD map in list) { OSDMap m = (OSDMap)map; UUID cid = m["pickuuid"].AsUUID(); string name = m["name"].AsString(); m_log.DebugFormat("[PROFILES]: PicksRequest {0}", name); picks[cid] = name; } remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); }
// Picks Handler public void HandleAvatarPicksRequest(Object sender, List <String> args) { if (!(sender is IClientAPI)) { return; } IClientAPI remoteClient = (IClientAPI)sender; UUID avatarID = new UUID(args[0]); using (ISimpleDB db = _connFactory.GetConnection()) { Dictionary <UUID, string> picksRequest = new Dictionary <UUID, string>(); Dictionary <string, object> parms = new Dictionary <string, object>(); parms.Add("?avatarID", avatarID); string query = "SELECT pickuuid, name from userpicks " + "WHERE creatoruuid=?avatarID"; List <Dictionary <string, string> > results = db.QueryWithResults(query, parms); foreach (Dictionary <string, string> row in results) { picksRequest[new UUID(row["pickuuid"].ToString())] = row["name"].ToString(); } remoteClient.SendAvatarPicksReply(avatarID, picksRequest); } }
// Picks Handler public void HandleAvatarPicksRequest(Object sender, string method, List <String> args) { if (!(sender is IClientAPI)) { return; } IClientAPI remoteClient = (IClientAPI)sender; UUID targetID; UUID.TryParse(args[0], out targetID); // Can't handle NPC yet... ScenePresence p = FindPresence(targetID); if (null != p) { if (p.PresenceType == PresenceType.Npc) { return; } } string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(targetID, out serverURI); Hashtable ReqHash = new Hashtable(); ReqHash["uuid"] = args[0]; Hashtable result = GenericXMLRPCRequest(ReqHash, method, serverURI); if (!Convert.ToBoolean(result["success"])) { remoteClient.SendAgentAlertMessage( result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; Dictionary <UUID, string> picks = new Dictionary <UUID, string>(); if (dataArray != null) { foreach (Object o in dataArray) { Hashtable d = (Hashtable)o; picks[new UUID(d["pickid"].ToString())] = d["name"].ToString(); } } remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Picks // // Request Picks Name public void HandleAvatarPicksRequest(Object sender, string method, List <String> args) { if (!(sender is IClientAPI)) { return; } IClientAPI remoteClient = (IClientAPI)sender; Hashtable ReqHash = new Hashtable(); ReqHash["uuid"] = args[0]; Hashtable result = GenericXMLRPCRequest(ReqHash, method); if (!Convert.ToBoolean(result["success"])) { remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; Dictionary <UUID, string> picks = new Dictionary <UUID, string>(); string uuid = ""; foreach (Object o in dataArray) { Hashtable d = (Hashtable)o; uuid = d["creatoruuid"].ToString(); string name = d["name"].ToString(); if (Enc != null) { name = Enc.GetString(Convert.FromBase64String(name)); } picks[new UUID(d["pickid"].ToString())] = name; } UUID agentid; if (uuid != "") { agentid = new UUID(uuid); } else { agentid = remoteClient.AgentId; } remoteClient.SendAvatarPicksReply(agentid, picks); }
public void HandleAvatarPicksRequest(Object sender, string method, List <String> args) { if (!(sender is IClientAPI)) { return; } IClientAPI remoteClient = (IClientAPI)sender; UUID requestedUUID = new UUID(args[0]); Dictionary <UUID, string> picks = ProfileFrontend.GetPicks(requestedUUID).ToDictionary(Pick => Pick.PickUUID, Pick => Pick.Name); remoteClient.SendAvatarPicksReply(requestedUUID, picks); }
public void HandleAvatarPicksRequest(object sender, string method, List <string> args) { if (!(sender is IClientAPI)) { return; } IClientAPI remoteClient = (IClientAPI)sender; UUID requestedUUID = new UUID(args [0]); // 20170120 - greythane - May need to check for NPC bots here and send an appropriate reply Dictionary <UUID, string> picks = ProfileFrontend.GetPicks(requestedUUID) .ToDictionary(Pick => Pick.PickUUID, Pick => Pick.Name); remoteClient.SendAvatarPicksReply(requestedUUID, picks); }
// Picks Handler public void HandleAvatarPicksRequest(Object sender, string method, List <String> args) { IClientAPI remoteClient = (IClientAPI)sender; if (m_Debug) { m_log.DebugFormat("[{0}] HandleAvatarPicksRequest for {1} with method {2}", m_moduleName, remoteClient.AgentId.ToString(), method); } if (!(sender is IClientAPI)) { if (m_Debug) { m_log.DebugFormat("[{0}] HandleAvatarPicksRequest for (!(sender {1} is IClientAPI {2}))", m_moduleName, sender.ToString(), remoteClient.AgentId.ToString()); } return; } Hashtable ReqHash = new Hashtable(); ReqHash["uuid"] = args[0]; Hashtable result = GenericXMLRPCRequest(ReqHash, method); if (!Convert.ToBoolean(result["success"])) { remoteClient.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; Dictionary <UUID, string> picks = new Dictionary <UUID, string>(); if (dataArray != null) { foreach (Object o in dataArray) { Hashtable d = (Hashtable)o; picks[new UUID(d["pickid"].ToString())] = d["name"].ToString(); } } remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); }
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]); foreach (ProfilePickInfo Pick in ProfileFrontend.GetPicks(requestedUUID)) { picks.Add(Pick.PickUUID, Pick.Name); } remoteClient.SendAvatarPicksReply(requestedUUID, picks); }
private void HandleAvatarPicksRequest(Object sender, string method, List <String> args) { if (!(sender is IClientAPI)) { return; } IClientAPI client = (IClientAPI)sender; UUID targetAvatarID; if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID)) { m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method); return; } // FIXME: Fetch these client.SendAvatarPicksReply(targetAvatarID, new Dictionary <UUID, string>(0)); }
// Picks Handler public void HandleAvatarPicksRequest(Object sender, string method, List <String> args) { if (!(sender is IClientAPI)) { return; } IClientAPI remoteClient = (IClientAPI)sender; Hashtable ReqHash = new Hashtable(); ReqHash["uuid"] = args[0]; Hashtable result = GenericXMLRPCRequest(ReqHash, method); if (!Convert.ToBoolean(result["success"])) { remoteClient.SendAgentAlertMessage( result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; Dictionary <UUID, string> picks = new Dictionary <UUID, string>(); if (dataArray != null) { foreach (Object o in dataArray) { Hashtable d = (Hashtable)o; picks[new UUID(d["pickid"].ToString())] = d["name"].ToString(); } } remoteClient.SendAvatarPicksReply(remoteClient.AgentId, picks); }
/// <summary> /// Updates the userpicks /// </summary> /// <param name='remoteClient'> /// Remote client. /// </param> /// <param name='pickID'> /// Pick I. /// </param> /// <param name='creatorID'> /// the creator of the pick /// </param> /// <param name='topPick'> /// Top pick. /// </param> /// <param name='name'> /// Name. /// </param> /// <param name='desc'> /// Desc. /// </param> /// <param name='snapshotID'> /// Snapshot I. /// </param> /// <param name='sortOrder'> /// Sort order. /// </param> /// <param name='enabled'> /// Enabled. /// </param> public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) { m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); UserProfilePick pick = new UserProfilePick(); string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) { return; } ScenePresence p = FindPresence(remoteClient.AgentId); Vector3 avaPos = p.AbsolutePosition; // Getting the global position for the Avatar Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.WorldLocX + avaPos.X, remoteClient.Scene.RegionInfo.WorldLocY + avaPos.Y, avaPos.Z); string landParcelName = "My Parcel"; // UUID landParcelID = p.currentParcelUUID; // to locate parcels we use a fake id that encodes the region handle // since we do not have a global locator // this fails on HG UUID landParcelID = Util.BuildFakeParcelID(remoteClient.Scene.RegionInfo.RegionHandle, (uint)avaPos.X, (uint)avaPos.Y); ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y); if (land != null) { // If land found, use parcel uuid from here because the value from SP will be blank if the avatar hasnt moved landParcelName = land.LandData.Name; // landParcelID = land.LandData.GlobalID; } else { m_log.WarnFormat( "[PROFILES]: PickInfoUpdate found no parcel info at {0},{1} in {2}", avaPos.X, avaPos.Y, p.Scene.Name); } pick.PickId = pickID; pick.CreatorId = creatorID; pick.TopPick = topPick; pick.Name = name; pick.Desc = desc; pick.ParcelId = landParcelID; pick.SnapshotId = snapshotID; pick.ParcelName = landParcelName; pick.SimName = remoteClient.Scene.RegionInfo.RegionName; pick.Gatekeeper = MyGatekeeper; pick.GlobalPos = posGlobal.ToString(); pick.SortOrder = sortOrder; pick.Enabled = enabled; object Pick = (object)pick; if(!rpc.JsonRpcRequest(ref Pick, "picks_update", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage( "Error updating pick", false); return; } UserProfileCacheEntry uce = null; lock(m_profilesCache) { if(!m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) || uce == null) uce = new UserProfileCacheEntry(); if(uce.picks == null) uce.picks = new Dictionary<UUID, UserProfilePick>(); if(uce.picksList == null) uce.picksList = new Dictionary<UUID, string>(); uce.picks[pick.PickId] = pick; uce.picksList[pick.PickId] = pick.Name; m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE); } remoteClient.SendAvatarPicksReply(remoteClient.AgentId, uce.picksList); remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName, posGlobal,pick.SortOrder,pick.Enabled); m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); }
/// <summary> /// Delete a Pick /// </summary> /// <param name='remoteClient'> /// Remote client. /// </param> /// <param name='queryPickID'> /// Query pick I. /// </param> public void PickDelete(IClientAPI remoteClient, UUID queryPickID) { string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) { return; } OSDMap parameters= new OSDMap(); parameters.Add("pickId", OSD.FromUUID(queryPickID)); OSD Params = (OSD)parameters; if(!rpc.JsonRpcRequest(ref Params, "picks_delete", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage( "Error picks delete", false); return; } UserProfileCacheEntry uce = null; lock(m_profilesCache) { if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) { if(uce.picks != null && uce.picks.ContainsKey(queryPickID)) uce.picks.Remove(queryPickID); if(uce.picksList != null && uce.picksList.ContainsKey(queryPickID)) uce.picksList.Remove(queryPickID); m_profilesCache.AddOrUpdate(remoteClient.AgentId, uce, PROFILECACHEEXPIRE); } } if(uce != null && uce.picksList != null) remoteClient.SendAvatarPicksReply(remoteClient.AgentId, uce.picksList); else remoteClient.SendAvatarPicksReply(remoteClient.AgentId, new Dictionary<UUID, string>()); }