コード例 #1
0
        /// <summary>
        ///   Parcel request
        /// </summary>
        /// <param name = "remoteClient"></param>
        /// <param name = "queryID"></param>
        /// <param name = "queryText">The thing to search for</param>
        /// <param name = "queryFlags"></param>
        /// <param name = "category"></param>
        /// <param name = "simName"></param>
        /// <param name = "queryStart"></param>
        protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID,
                                      string queryText, int queryFlags, int category, string simName,
                                      int queryStart)
        {
            List <DirPlacesReplyData> ReturnValues =
                directoryService.FindLand(queryText, category.ToString(), queryStart,
                                          (uint)queryFlags, remoteClient.ScopeID);

#if (!ISWIN)
            SplitPackets <DirPlacesReplyData>(ReturnValues, delegate(DirPlacesReplyData[] data)
            {
                remoteClient.SendDirPlacesReply(queryID, data);
            });
#else
            SplitPackets(ReturnValues,
                         data => remoteClient.SendDirPlacesReply(queryID, data));
#endif
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <summary>
        ///     Parcel request
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="queryID"></param>
        /// <param name="queryText">The thing to search for</param>
        /// <param name="queryFlags"></param>
        /// <param name="category"></param>
        /// <param name="simName"></param>
        /// <param name="queryStart"></param>
        protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID,
                                      string queryText, int queryFlags, int category, string simName,
                                      int queryStart)
        {
            List <DirPlacesReplyData> ReturnValues =
                DirectoryService.FindLand(queryText.Trim(), category.ToString(), queryStart,
                                          (uint)queryFlags, remoteClient.ScopeID);

            SplitPackets(ReturnValues,
                         data => remoteClient.SendDirPlacesReply(queryID, data));
        }
コード例 #4
0
        /// <summary>
        /// Parcel request
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="queryID"></param>
        /// <param name="queryText">The thing to search for</param>
        /// <param name="queryFlags"></param>
        /// <param name="category"></param>
        /// <param name="simName"></param>
        /// <param name="queryStart"></param>
        protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID,
                                      string queryText, int queryFlags, int category, string simName,
                                      int queryStart)
        {
            DirPlacesReplyData[] ReturnValues = directoryService.FindLand(queryText, category.ToString(), queryStart, (uint)queryFlags);
            
            //Only send 10 at a time so that we don't kill the client with too big of a packet
            if (ReturnValues.Length > 10)
            {
                DirPlacesReplyData[] data = new DirPlacesReplyData[10];

                int i = 0;
                foreach (DirPlacesReplyData d in ReturnValues)
                {
                    data[i] = d;
                    i++;
                    if (i == 10)
                    {
                        //Rebuild the packets every 10 places
                        remoteClient.SendDirPlacesReply(queryID, data);
                        i = 0;
                        if (ReturnValues.Length - i < 10)
                        {
                            data = new DirPlacesReplyData[ReturnValues.Length - i];
                        }
                        else
                        {
                            data = new DirPlacesReplyData[10];
                        }
                    }
                }
                //Send all the remaining packets
                if(data.Length != 0)
                    remoteClient.SendDirPlacesReply(queryID, data);
            }
            else //Send all then if it is less than 10
                remoteClient.SendDirPlacesReply(queryID, ReturnValues);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        /// <summary>
        /// Parcel request
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="queryID"></param>
        /// <param name="queryText"></param>
        /// <param name="queryFlags"></param>
        /// <param name="category"></param>
        /// <param name="simName"></param>
        /// <param name="queryStart"></param>
        protected void DirPlacesQuery(IClientAPI remoteClient, UUID queryID,
                                      string queryText, int queryFlags, int category, string simName,
                                      int queryStart)
        {
            DirPlacesReplyData[] ReturnValues = DSC.FindLand(queryText, category.ToString(), queryStart, (uint)queryFlags);
            if (ReturnValues.Length > 10)
            {
                DirPlacesReplyData[] data = new DirPlacesReplyData[10];

                int i = 0;
                foreach (DirPlacesReplyData d in ReturnValues)
                {
                    data[i] = d;
                    i++;
                    if (i == 10)
                    {
                        remoteClient.SendDirPlacesReply(queryID, data);
                        i = 0;
                        if (ReturnValues.Length - i < 10)
                        {
                            data = new DirPlacesReplyData[ReturnValues.Length - i];
                        }
                        else
                        {
                            data = new DirPlacesReplyData[10];
                        }
                    }
                }
                remoteClient.SendDirPlacesReply(queryID, data);
            }
            else
            {
                remoteClient.SendDirPlacesReply(queryID, ReturnValues);
            }
        }
コード例 #8
0
        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 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);
            }
        }