public List<DirEventsReplyData> FindEvents(string queryText, uint eventFlags, int StartQuery, UUID scopeID)
        {
            object remoteValue = DoRemote(queryText, eventFlags, StartQuery, scopeID);
            if (remoteValue != null || m_doRemoteOnly)
                return (List<DirEventsReplyData>) remoteValue;

            List<DirEventsReplyData> Data = new List<DirEventsReplyData>();

            QueryFilter filter = new QueryFilter();

            //|0| means search between some days
            if (queryText.Contains("|0|"))
            {
                string StringDay = queryText.Split('|')[0];
                if (StringDay == "u") //"u" means search for events that are going on today
                {
                    filter.andGreaterThanEqFilters["UNIX_TIMESTAMP(date)"] = Util.ToUnixTime(DateTime.Today);
                }
                else
                {
                    //Pull the day out then and search for that many days in the future/past
                    int Day = int.Parse(StringDay);
                    DateTime SearchedDay = DateTime.Today.AddDays(Day);
                    //We only look at one day at a time
                    DateTime NextDay = SearchedDay.AddDays(1);
                    filter.andGreaterThanEqFilters["UNIX_TIMESTAMP(date)"] = Util.ToUnixTime(SearchedDay);
                    filter.andLessThanEqFilters["UNIX_TIMESTAMP(date)"] = Util.ToUnixTime(NextDay);
                    filter.andLessThanEqFilters["flags"] = (int) eventFlags;
                }
            }
            else
            {
                filter.andLikeFilters["name"] = "%" + queryText + "%";
            }
            if (scopeID != UUID.Zero)
                filter.andFilters["scopeID"] = scopeID;

            List<string> retVal = GD.Query(new[]
                                               {
                                                   "EID",
                                                   "creator",
                                                   "date",
                                                   "maturity",
                                                   "flags",
                                                   "name"
                                               }, "asevents", filter, null, (uint) StartQuery, 50);

            if (retVal.Count > 0)
            {
                for (int i = 0; i < retVal.Count; i += 6)
                {
                    DirEventsReplyData replyData = new DirEventsReplyData
                                                       {
                                                           eventID = Convert.ToUInt32(retVal[i]),
                                                           ownerID = new UUID(retVal[i + 1]),
                                                           name = retVal[i + 5],
                                                       };
                    DateTime date = DateTime.Parse(retVal[i + 2]);
                    replyData.date = date.ToString(new DateTimeFormatInfo());
                    replyData.unixTime = (uint) Util.ToUnixTime(date);
                    replyData.eventFlags = Convert.ToUInt32(retVal[i + 4]);

                    //Check the maturity levels
                    uint maturity = Convert.ToUInt32(retVal[i + 3]);
                    if (
                        (maturity == 0 && (eventFlags & (uint) EventFlags.PG) == (uint) EventFlags.PG) ||
                        (maturity == 1 && (eventFlags & (uint) EventFlags.Mature) == (uint) EventFlags.Mature) ||
                        (maturity == 2 && (eventFlags & (uint) EventFlags.Adult) == (uint) EventFlags.Adult)
                        )
                    {
                        Data.Add(replyData);
                    }
                }
            }

            return Data;
        }
        public List<DirEventsReplyData> FindAllEventsInRegion(string regionName, int maturity)
        {
            object remoteValue = DoRemote(regionName, maturity);
            if (remoteValue != null || m_doRemoteOnly)
                return (List<DirEventsReplyData>) remoteValue;

            List<DirEventsReplyData> Data = new List<DirEventsReplyData>();

            IRegionData regiondata = Framework.Utilities.DataManager.RequestPlugin<IRegionData>();
            if (regiondata != null)
            {
                List<GridRegion> regions = regiondata.Get(regionName, null, null, null);
                if (regions.Count >= 1)
                {
                    QueryFilter filter = new QueryFilter();
                    filter.andFilters["region"] = regions[0].RegionID.ToString();
                    filter.andFilters["maturity"] = maturity;

                    List<string> retVal = GD.Query(new[]
                                                       {
                                                           "EID",
                                                           "creator",
                                                           "date",
                                                           "maturity",
                                                           "flags",
                                                           "name"
                                                       }, "asevents", filter, null, null, null);

                    if (retVal.Count > 0)
                    {
                        for (int i = 0; i < retVal.Count; i += 6)
                        {
                            DirEventsReplyData replyData = new DirEventsReplyData
                                                               {
                                                                   eventID = Convert.ToUInt32(retVal[i]),
                                                                   ownerID = new UUID(retVal[i + 1]),
                                                                   name = retVal[i + 5],
                                                               };
                            DateTime date = DateTime.Parse(retVal[i + 2]);
                            replyData.date = date.ToString(new DateTimeFormatInfo());
                            replyData.unixTime = (uint) Util.ToUnixTime(date);
                            replyData.eventFlags = Convert.ToUInt32(retVal[i + 4]);

                            Data.Add(replyData);
                        }
                    }
                }
            }

            return Data;
        }