public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { Classified classified = ProfileFrontend.GetClassified(queryClassifiedID); if (classified == null || classified.CreatorUUID == UUID.Zero) { return; } remoteClient.SendClassifiedInfoReply(queryClassifiedID, classified.CreatorUUID, classified.CreationDate, classified.ExpirationDate, classified.Category, classified.Name, classified.Description, classified.ParcelUUID, classified.ParentEstate, classified.SnapshotUUID, classified.SimName, classified.GlobalPos, classified.ParcelName, classified.ClassifiedFlags, classified.PriceForListing); }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { if (m_debug) { m_log.DebugFormat("[{0}] ClassifiedInfoRequest for AgentId {1} for {2}", m_moduleName, remoteClient.AgentId.ToString(), queryClassifiedID.ToString()); } Hashtable ReqHash = new Hashtable(); ReqHash["classifiedID"] = queryClassifiedID.ToString(); Hashtable result = GenericXMLRPCRequest(ReqHash, "classifieds_info_query"); if (!Convert.ToBoolean(result["success"])) { remoteClient.SendAgentAlertMessage( result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; if (dataArray.Count == 0) { // something bad happened here, if we could return an // event after the search, // we should be able to find it here // TODO do some (more) sensible error-handling here // remoteClient.SendAgentAlertMessage("Couldn't find any classifieds.",false); return; } Hashtable d = (Hashtable)dataArray[0]; Vector3 globalPos = new Vector3(); Vector3.TryParse(d["posglobal"].ToString(), out globalPos); remoteClient.SendClassifiedInfoReply( new UUID(d["classifieduuid"].ToString()), new UUID(d["creatoruuid"].ToString()), Convert.ToUInt32(d["creationdate"]), Convert.ToUInt32(d["expirationdate"]), Convert.ToUInt32(d["category"]), d["name"].ToString(), d["description"].ToString(), new UUID(d["parceluuid"].ToString()), Convert.ToUInt32(d["parentestate"]), new UUID(d["snapshotuuid"].ToString()), d["simname"].ToString(), globalPos, d["parcelname"].ToString(), Convert.ToByte(d["classifiedflags"]), Convert.ToInt32(d["priceforlisting"])); }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { Hashtable ReqHash = new Hashtable(); ReqHash["classifiedID"] = queryClassifiedID.ToString(); Hashtable result = GenericXMLRPCRequest(ReqHash, "classifieds_info_query"); if (!Convert.ToBoolean(result["success"])) { remoteClient.SendAgentAlertMessage( result["errorMessage"].ToString(), false); return; } //The viewer seems to issue an info request even when it is //creating a new classified which means the data hasn't been //saved to the database yet so there is no info to find. ArrayList dataArray = (ArrayList)result["data"]; if (dataArray.Count == 0) { // Something bad happened here if we could not return an // event after the search. We should be able to find it here. // TODO do some (more) sensible error-handling here // remoteClient.SendAgentAlertMessage("Couldn't find data for classified ad.", // false); return; } Hashtable d = (Hashtable)dataArray[0]; Vector3 globalPos = new Vector3(); Vector3.TryParse(d["posglobal"].ToString(), out globalPos); remoteClient.SendClassifiedInfoReply( new UUID(d["classifieduuid"].ToString()), new UUID(d["creatoruuid"].ToString()), Convert.ToUInt32(d["creationdate"]), Convert.ToUInt32(d["expirationdate"]), Convert.ToUInt32(d["category"]), d["name"].ToString(), d["description"].ToString(), new UUID(d["parceluuid"].ToString()), Convert.ToUInt32(d["parentestate"]), new UUID(d["snapshotuuid"].ToString()), d["simname"].ToString(), globalPos, d["parcelname"].ToString(), Convert.ToByte(d["classifiedflags"]), Convert.ToInt32(d["priceforlisting"])); }
// Request Classifieds public void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client) { Hashtable ReqHash = new Hashtable(); ReqHash["avatar_id"] = client.AgentId.ToString(); ReqHash["classified_id"] = classifiedID.ToString(); Hashtable result = GenericXMLRPCRequest(ReqHash, "classifiedinforequest"); if (!Convert.ToBoolean(result["success"])) { client.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; if (dataArray != null && dataArray[0] != null) { Hashtable d = (Hashtable)dataArray[0]; Vector3 globalPos = new Vector3(); Vector3.TryParse(d["posglobal"].ToString(), out globalPos); if (d["description"] == null) { d["description"] = String.Empty; } string name = d["name"].ToString(); string desc = d["description"].ToString(); if (Enc != null) { name = Enc.GetString(Convert.FromBase64String(name)); desc = Enc.GetString(Convert.FromBase64String(desc)); } client.SendClassifiedInfoReply(new UUID(d["classifieduuid"].ToString()), new UUID(d["creatoruuid"].ToString()), Convert.ToUInt32(d["creationdate"]), Convert.ToUInt32(d["expirationdate"]), Convert.ToUInt32(d["category"]), name, desc, new UUID(d["parceluuid"].ToString()), Convert.ToUInt32(d["parentestate"]), new UUID(d["snapshotuuid"].ToString()), d["simname"].ToString(), globalPos, d["parcelname"].ToString(), Convert.ToByte(d["classifiedflags"]), Convert.ToInt32(d["priceforlisting"])); } }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { UUID target = remoteClient.AgentId; UserClassifiedAdd ad = new UserClassifiedAdd(); ad.ClassifiedId = queryClassifiedID; lock (m_classifiedCache) { if (m_classifiedCache.ContainsKey(queryClassifiedID)) { target = m_classifiedCache[queryClassifiedID]; m_classifiedInterest[queryClassifiedID]--; if (m_classifiedInterest[queryClassifiedID] == 0) { m_classifiedInterest.Remove(queryClassifiedID); m_classifiedCache.Remove(queryClassifiedID); } } } string serverURI = string.Empty; GetUserProfileServerURI(target, out serverURI); object Ad = (object)ad; if (!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage( "Error getting classified info", false); return; } ad = (UserClassifiedAdd)Ad; if (ad.CreatorId == UUID.Zero) { return; } Vector3 globalPos = new Vector3(); Vector3.TryParse(ad.GlobalPos, out globalPos); remoteClient.SendClassifiedInfoReply(ad.ClassifiedId, ad.CreatorId, (uint)ad.CreationDate, (uint)ad.ExpirationDate, (uint)ad.Category, ad.Name, ad.Description, ad.ParcelId, (uint)ad.ParentEstate, ad.SnapshotId, ad.SimName, globalPos, ad.ParcelName, ad.Flags, ad.Price); }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { // okies this is pretty simple straightforward stuff as well... pull the info from the // db based on the Classified ID we got back from viewer from the original query above // and send it back. //ClassifiedData data = new ClassifiedData(); string query = "select * from classifieds where classifieduuid=?classifiedID"; Dictionary <string, object> parms = new Dictionary <string, object>(); parms.Add("?classifiedID", queryClassifiedID); Vector3 globalPos = new Vector3(); using (ISimpleDB db = _connFactory.GetConnection()) { List <Dictionary <string, string> > results = db.QueryWithResults(query, parms); foreach (Dictionary <string, string> row in results) { Vector3.TryParse(row["posglobal"].ToString(), out globalPos); //remoteClient.SendClassifiedInfoReply(data); remoteClient.SendClassifiedInfoReply( new UUID(row["classifieduuid"].ToString()), new UUID(row["creatoruuid"].ToString()), Convert.ToUInt32(row["creationdate"]), Convert.ToUInt32(row["expirationdate"]), Convert.ToUInt32(row["category"]), row["name"].ToString(), row["description"].ToString(), new UUID(row["parceluuid"].ToString()), Convert.ToUInt32(row["parentestate"]), new UUID(row["snapshotuuid"].ToString()), row["simname"].ToString(), globalPos, row["parcelname"].ToString(), Convert.ToByte(row["classifiedflags"]), Convert.ToInt32(row["priceforlisting"])); } } }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { Classified classified = ProfileFrontend.GetClassified(queryClassifiedID); if (classified == null || classified.CreatorUUID == UUID.Zero) return; remoteClient.SendClassifiedInfoReply(queryClassifiedID, classified.CreatorUUID, classified.CreationDate, classified.ExpirationDate, classified.Category, classified.Name, classified.Description, classified.ParcelUUID, classified.ParentEstate, classified.SnapshotUUID, classified.SimName, classified.GlobalPos, classified.ParcelName, classified.ClassifiedFlags, classified.PriceForListing); }
private void ClassifiedInfoRequestHandler(UUID classifiedID, IClientAPI client) { // FIXME: Fetch this info client.SendClassifiedInfoReply(classifiedID, UUID.Zero, 0, Utils.DateTimeToUnixTime(DateTime.UtcNow + TimeSpan.FromDays(1)), 0, String.Empty, String.Empty, UUID.Zero, 0, UUID.Zero, String.Empty, Vector3.Zero, String.Empty, 0, 0); }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { IUserProfileInfo info = ProfileFrontend.GetUserProfile(remoteClient.AgentId); if (info == null) return; if (info.Classifieds.ContainsKey(queryClassifiedID.ToString())) { Classified classified = new Classified(); classified.FromOSD((OSDMap)info.Classifieds[queryClassifiedID.ToString()]); remoteClient.SendClassifiedInfoReply(queryClassifiedID, classified.CreatorUUID, classified.CreationDate, classified.ExpirationDate, classified.Category, classified.Name, classified.Description, classified.ParcelUUID, classified.ParentEstate, classified.SnapshotUUID, classified.SimName, classified.GlobalPos, classified.ParcelName, classified.ClassifiedFlags, classified.PriceForListing); } }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { // okies this is pretty simple straightforward stuff as well... pull the info from the // db based on the Classified ID we got back from viewer from the original query above // and send it back. //ClassifiedData data = new ClassifiedData(); string query = "select * from classifieds where classifieduuid=?classifiedID"; Dictionary<string, object> parms = new Dictionary<string, object>(); parms.Add("?classifiedID", queryClassifiedID); Vector3 globalPos = new Vector3(); using (ISimpleDB db = _connFactory.GetConnection()) { List<Dictionary<string, string>> results = db.QueryWithResults(query, parms); foreach (Dictionary<string, string> row in results) { Vector3.TryParse(row["posglobal"].ToString(), out globalPos); //remoteClient.SendClassifiedInfoReply(data); remoteClient.SendClassifiedInfoReply( new UUID(row["classifieduuid"].ToString()), new UUID(row["creatoruuid"].ToString()), Convert.ToUInt32(row["creationdate"]), Convert.ToUInt32(row["expirationdate"]), Convert.ToUInt32(row["category"]), row["name"].ToString(), row["description"].ToString(), new UUID(row["parceluuid"].ToString()), Convert.ToUInt32(row["parentestate"]), new UUID(row["snapshotuuid"].ToString()), row["simname"].ToString(), globalPos, row["parcelname"].ToString(), Convert.ToByte(row["classifiedflags"]), Convert.ToInt32(row["priceforlisting"])); } } }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { UUID target = remoteClient.AgentId; UserClassifiedAdd ad = new UserClassifiedAdd(); ad.ClassifiedId = queryClassifiedID; lock (m_classifiedCache) { if (m_classifiedCache.ContainsKey(queryClassifiedID)) { target = m_classifiedCache[queryClassifiedID]; m_classifiedInterest[queryClassifiedID] --; if (m_classifiedInterest[queryClassifiedID] == 0) { m_classifiedInterest.Remove(queryClassifiedID); m_classifiedCache.Remove(queryClassifiedID); } } } string serverURI = string.Empty; GetUserProfileServerURI(target, out serverURI); object Ad = (object)ad; if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage( "Error getting classified info", false); return; } ad = (UserClassifiedAdd) Ad; if(ad.CreatorId == UUID.Zero) return; Vector3 globalPos = new Vector3(); Vector3.TryParse(ad.GlobalPos, out globalPos); remoteClient.SendClassifiedInfoReply(ad.ClassifiedId, ad.CreatorId, (uint)ad.CreationDate, (uint)ad.ExpirationDate, (uint)ad.Category, ad.Name, ad.Description, ad.ParcelId, (uint)ad.ParentEstate, ad.SnapshotId, ad.SimName, globalPos, ad.ParcelName, ad.Flags, ad.Price); }
// Request Classifieds public void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client) { Hashtable ReqHash = new Hashtable(); ReqHash["avatar_id"] = client.AgentId.ToString(); ReqHash["classified_id"] = classifiedID.ToString(); Hashtable result = GenericXMLRPCRequest(ReqHash, "classifiedinforequest"); if (!Convert.ToBoolean(result["success"])) { client.SendAgentAlertMessage(result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; if (dataArray.Count==0) { //client.SendAgentAlertMessage("Couldn't find this classifieds.", false); return; } Hashtable d = (Hashtable)dataArray[0]; Vector3 globalPos = new Vector3(); Vector3.TryParse(d["posglobal"].ToString(), out globalPos); if (d["name"]==null) d["name"] = String.Empty; if (d["description"]==null) d["description"] = String.Empty; if (d["parcelname"]==null) d["parcelname"] = String.Empty; string name = d["name"].ToString(); string desc = d["description"].ToString(); if (Enc!=null) { name = Enc.GetString(Convert.FromBase64String(name)); desc = Enc.GetString(Convert.FromBase64String(desc)); } client.SendClassifiedInfoReply( new UUID(d["classifieduuid"].ToString()), new UUID(d["creatoruuid"].ToString()), Convert.ToUInt32(d["creationdate"]), Convert.ToUInt32(d["expirationdate"]), Convert.ToUInt32(d["category"]), name, desc, new UUID(d["parceluuid"].ToString()), Convert.ToUInt32(d["parentestate"]), new UUID(d["snapshotuuid"].ToString()), d["simname"].ToString(), globalPos, d["parcelname"].ToString(), Convert.ToByte(d["classifiedflags"]), Convert.ToInt32(d["priceforlisting"])); }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { Hashtable ReqHash = new Hashtable(); ReqHash["classifiedID"] = queryClassifiedID.ToString(); Hashtable result = GenericXMLRPCRequest(ReqHash, "classifieds_info_query"); if (!Convert.ToBoolean(result["success"])) { remoteClient.SendAgentAlertMessage( result["errorMessage"].ToString(), false); return; } ArrayList dataArray = (ArrayList)result["data"]; if (dataArray.Count == 0) { // something bad happened here, if we could return an // event after the search, // we should be able to find it here // TODO do some (more) sensible error-handling here remoteClient.SendAgentAlertMessage("Couldn't find this classifieds.", false); return; } Hashtable d = (Hashtable)dataArray[0]; Vector3 globalPos = new Vector3(); Vector3.TryParse(d["posglobal"].ToString(), out globalPos); remoteClient.SendClassifiedInfoReply( new UUID(d["classifieduuid"].ToString()), new UUID(d["creatoruuid"].ToString()), Convert.ToUInt32(d["creationdate"]), Convert.ToUInt32(d["expirationdate"]), Convert.ToUInt32(d["category"]), d["name"].ToString(), d["description"].ToString(), new UUID(d["parceluuid"].ToString()), Convert.ToUInt32(d["parentestate"]), new UUID(d["snapshotuuid"].ToString()), d["simname"].ToString(), globalPos, d["parcelname"].ToString(), Convert.ToByte(d["classifiedflags"]), Convert.ToInt32(d["priceforlisting"])); }
public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) { UUID target = remoteClient.AgentId; UserClassifiedAdd ad = new UserClassifiedAdd(); ad.ClassifiedId = queryClassifiedID; lock (m_classifiedCache) { if (m_classifiedCache.ContainsKey(queryClassifiedID)) { target = m_classifiedCache[queryClassifiedID]; m_classifiedInterest[queryClassifiedID] --; if (m_classifiedInterest[queryClassifiedID] == 0) { m_classifiedInterest.Remove(queryClassifiedID); m_classifiedCache.Remove(queryClassifiedID); } } } UserProfileCacheEntry uce = null; lock(m_profilesCache) { if(m_profilesCache.TryGetValue(target, out uce) && uce != null) { if(uce.classifieds != null && uce.classifieds.ContainsKey(queryClassifiedID)) { ad = uce.classifieds[queryClassifiedID]; Vector3 gPos = new Vector3(); Vector3.TryParse(ad.GlobalPos, out gPos); remoteClient.SendClassifiedInfoReply(ad.ClassifiedId, ad.CreatorId, (uint)ad.CreationDate, (uint)ad.ExpirationDate, (uint)ad.Category, ad.Name, ad.Description, ad.ParcelId, (uint)ad.ParentEstate, ad.SnapshotId, ad.SimName, gPos, ad.ParcelName, ad.Flags, ad.Price); return; } } } string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(target, out serverURI); if(string.IsNullOrWhiteSpace(serverURI)) { return; } object Ad = (object)ad; if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage( "Error getting classified info", false); return; } ad = (UserClassifiedAdd) Ad; if(ad.CreatorId == UUID.Zero) return; if(foreign) cacheForeignImage(target, ad.SnapshotId); lock(m_profilesCache) { if(!m_profilesCache.TryGetValue(target, out uce) || uce == null) uce = new UserProfileCacheEntry(); if(uce.classifieds == null) uce.classifieds = new Dictionary<UUID, UserClassifiedAdd>(); uce.classifieds[ad.ClassifiedId] = ad; m_profilesCache.AddOrUpdate(target, uce, PROFILECACHEEXPIRE); } Vector3 globalPos = new Vector3(); Vector3.TryParse(ad.GlobalPos, out globalPos); remoteClient.SendClassifiedInfoReply(ad.ClassifiedId, ad.CreatorId, (uint)ad.CreationDate, (uint)ad.ExpirationDate, (uint)ad.Category, ad.Name, ad.Description, ad.ParcelId, (uint)ad.ParentEstate, ad.SnapshotId, ad.SimName, globalPos, ad.ParcelName, ad.Flags, ad.Price); }