Пример #1
0
 public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
 {
 }
Пример #2
0
 public void SendDirPlacesReply(OpenMetaverse.UUID queryID, DirPlacesReplyData[] data)
 {
 }
Пример #3
0
 public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
 {
     throw new System.NotImplementedException();
 }
        protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID,
                string queryText, int queryFlags, int category, string simName,
                int queryStart)
        {
            Hashtable ReqHash = new Hashtable();
            ReqHash["text"] = queryText;
            ReqHash["flags"] = queryFlags.ToString();
            ReqHash["category"] = category.ToString();
            ReqHash["sim_name"] = simName;
            ReqHash["query_start"] = queryStart.ToString();

            Hashtable result = GenericXMLRPCRequest(ReqHash,
                    "dir_places_query");

            if (!Convert.ToBoolean(result["success"]))
            {
                remoteClient.SendAgentAlertMessage(
                        result["errorMessage"].ToString(), false);
                return;
            }

            ArrayList dataArray = (ArrayList)result["data"];

            int count = dataArray.Count;
            if (count > 100)
                count = 101;

            DirPlacesReplyData[] data = new DirPlacesReplyData[count];

            int i = 0;

            foreach (Object o in dataArray)
            {
                Hashtable d = (Hashtable)o;

                data[i] = new DirPlacesReplyData();
                data[i].parcelID = new UUID(d["parcel_id"].ToString());
                data[i].name = d["name"].ToString();
                data[i].forSale = Convert.ToBoolean(d["for_sale"]);
                data[i].auction = Convert.ToBoolean(d["auction"]);
                data[i].dwell = Convert.ToSingle(d["dwell"]);

                if (++i >= count)
                    break;
            }

            remoteClient.SendDirPlacesReply(queryID, data);
        }
        protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID, string queryText, int queryFlags, int category, string simName,
                int queryStart)
        {
//            m_log.DebugFormat("[LAND SEARCH]: In Places Search for queryText: {0} with queryFlag: {1} with category {2} for simName {3}",
//                queryText, queryFlags.ToString("X"), category.ToString(), simName);

            queryText = queryText.Trim();   // newer viewers sometimes append a space

            string query = String.Empty;

            //string newQueryText = "%" + queryText + "%";
            Dictionary<string, object> parms = new Dictionary<string, object>();
            parms.Add("?searchText", queryText);
            parms.Add("?searchFlags", queryFlags);
            if (category > 0)
                parms.Add("?searchCategory", category);
            //parms.Add("?searchSimName", simName);

            Single dwell = 0;

            int count = MAX_RESULTS + 1;    // +1 so that the viewer knows to enable the NEXT button (it seems)
            int i = 0;

            int queryEnd = queryStart + count - 1;  // 0-based

            query = "select * from land where LandFlags & "+ParcelFlags.ShowDirectory.ToString("d");
            if (category > 0)
                query += " AND Category=?searchCategory";
            query += " AND (Name REGEXP ?searchText OR Description REGEXP ?searchText) order by Name, Description";

            using (ISimpleDB db = _connFactory.GetConnection())
            {
                List<UUID> regionsToInclude = UpdateRegionsList(db);
                List<Dictionary<string, string>> results = DoLandQueryAndCombine(remoteClient, db, query, parms, 0, queryStart, queryEnd, regionsToInclude);
                DirPlacesReplyData[] data = new DirPlacesReplyData[results.Count < 1 ? 1 : results.Count];
                foreach (Dictionary<string, string> row in results)
                {
                    bool auction = false;
                    data[i] = new DirPlacesReplyData();
                    data[i].parcelID = new UUID(row["uuid"]);
                    data[i].name = row["name"];
                    data[i].forSale = (Convert.ToInt16(row["SalePrice"]) > 0);
                    data[i].auction = auction;
                    data[i].dwell = dwell;
                    data[i].Status = STATUS_SEARCH_PLACES_NONE; // 0, success
                    i++;
                }

                if (results.Count == 0)
                {
                    data[0] = new DirPlacesReplyData();
                    data[0].parcelID = UUID.Zero;
                    data[0].name = String.Empty;
                    data[0].forSale = false;
                    data[0].auction = false;
                    data[0].dwell = 0;
                    data[0].Status = STATUS_SEARCH_PLACES_FOUNDNONE;    // empty results
                }

                remoteClient.SendDirPlacesReply(queryID, data);
            }
        }