示例#1
0
        void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
        {
            if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
            {
                m_log.InfoFormat("[Groups] {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);

                List <DirGroupsReplyData> ReplyData = new List <DirGroupsReplyData>();
                int order = 0;
                foreach (osGroup group in m_Groups.Values)
                {
                    if (group.Name.ToLower().Contains(queryText.ToLower()))
                    {
                        if (queryStart <= order)
                        {
                            DirGroupsReplyData data = new DirGroupsReplyData();
                            data.groupID     = group.GroupID;
                            data.groupName   = group.Name;
                            data.members     = group.GroupMembershipCount;
                            data.searchOrder = order;
                            ReplyData.Add(data);
                        }

                        order += 1;
                    }
                }

                remoteClient.SendDirGroupsReply(queryID, ReplyData.ToArray());
            }
        }
示例#2
0
        void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
        {
            queryText = queryText.Trim();

            if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People)
            {
                if (string.IsNullOrEmpty(queryText))
                {
                    remoteClient.SendDirPeopleReply(queryID, new DirPeopleReplyData[0]);
                }

                List <UserAccount>   accounts = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, queryText);
                DirPeopleReplyData[] hits     = new DirPeopleReplyData[accounts.Count];
                int i = 0;
                foreach (UserAccount acc in accounts)
                {
                    DirPeopleReplyData d = new DirPeopleReplyData();
                    d.agentID   = acc.PrincipalID;
                    d.firstName = acc.FirstName;
                    d.lastName  = acc.LastName;
                    d.online    = false;

                    hits[i++] = d;
                }

                // TODO: This currently ignores pretty much all the query flags including Mature and sort order
                remoteClient.SendDirPeopleReply(queryID, hits);
            }
            else if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
            {
                if (m_GroupsService == null)
                {
                    m_log.Warn("[BASIC SEARCH MODULE]: Groups service is not available. Unable to search groups.");
                    remoteClient.SendAlertMessage("Groups search is not enabled");
                    return;
                }

                if (string.IsNullOrEmpty(queryText))
                {
                    remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]);
                }

                // TODO: This currently ignores pretty much all the query flags including Mature and sort order
                remoteClient.SendDirGroupsReply(queryID, m_GroupsService.FindGroups(remoteClient, queryText).ToArray());
            }
        }
示例#3
0
        /*
         * This becomes very problematic in a shared module.  In a shared module you may have more then one
         * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
         * The OnClientClosed event does not provide anything to indicate which one of those should be closed
         * nor does it provide what scene it was from so that the specific reference can be looked up.
         * The InstantMessageModule.cs does not currently worry about unregistering the handles, 
         * and it should be an issue, since it's the client that references us not the other way around
         * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
        private void OnClientClosed(UUID AgentId)
        {
            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            lock (m_ActiveClients)
            {
                if (m_ActiveClients.ContainsKey(AgentId))
                {
                    IClientAPI client = m_ActiveClients[AgentId];
                    client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
                    client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
                    client.OnDirFindQuery -= OnDirFindQuery;
                    client.OnInstantMessage -= OnInstantMessage;

                    m_ActiveClients.Remove(AgentId);
                }
                else
                {
                    if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here.");
                }

                
            }
        }
        */

        void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
        {
            if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
            {
                if (m_debugEnabled) 
                    m_log.DebugFormat(
                        "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", 
                        System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);

                // TODO: This currently ignores pretty much all the query flags including Mature and sort order
                remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentID(remoteClient), queryText).ToArray());
            }
            
        }
示例#4
0
        /*
         * This becomes very problematic in a shared module.  In a shared module you may have more then one
         * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
         * The OnClientClosed event does not provide anything to indicate which one of those should be closed
         * nor does it provide what scene it was from so that the specific reference can be looked up.
         * The InstantMessageModule.cs does not currently worry about unregistering the handles, 
         * and it should be an issue, since it's the client that references us not the other way around
         * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
        private void OnClientClosed(UUID AgentId)
        {
            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            lock (m_ActiveClients)
            {
                if (m_ActiveClients.ContainsKey(AgentId))
                {
                    IClientAPI client = m_ActiveClients[AgentId];
                    client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
                    client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
                    client.OnDirFindQuery -= OnDirFindQuery;
                    client.OnInstantMessage -= OnInstantMessage;

                    m_ActiveClients.Remove(AgentId);
                }
                else
                {
                    if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here.");
                }

                
            }
        }
        */

        void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
        {
            if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
            {
                if (m_debugEnabled)
                    m_log.DebugFormat(
                        "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})",
                        System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);

                remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentID(remoteClient), queryText, queryStart, queryFlags).ToArray());
            }
        }
示例#5
0
        /*
         * This becomes very problematic in a shared module.  In a shared module you may have more then one
         * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
         * The OnClientClosed event does not provide anything to indicate which one of those should be closed
         * nor does it provide what scene it was from so that the specific reference can be looked up.
         * The InstantMessageModule.cs does not currently worry about unregistering the handles,
         * and it should be an issue, since it's the client that references us not the other way around
         * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
        private void OnClientClosed(UUID AgentId)
        {
            if (m_debugEnabled) MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            lock (m_ActiveClients)
            {
                if (m_ActiveClients.ContainsKey(AgentId))
                {
                    IClientAPI client = m_ActiveClients[AgentId];
                    client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
                    client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
                    client.OnDirFindQuery -= OnDirFindQuery;
                    client.OnInstantMessage -= OnInstantMessage;

                    m_ActiveClients.Remove(AgentId);
                }
                else
                {
                    if (m_debugEnabled) MainConsole.Instance.WarnFormat("[GROUPS]: Client closed that wasn't registered here.");
                }

            }
        }
        */
        private void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags,
            int queryStart)
        {
            if (((DirectoryManager.DirFindFlags) queryFlags & DirectoryManager.DirFindFlags.Groups) ==
                DirectoryManager.DirFindFlags.Groups)
            {
                if (m_debugEnabled)
                    MainConsole.Instance.DebugFormat(
                        "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})",
                        MethodBase.GetCurrentMethod().Name, queryText, (DirectoryManager.DirFindFlags) queryFlags,
                        queryStart);

                remoteClient.SendDirGroupsReply(queryID,
                                                m_groupData.FindGroups(GetRequestingAgentID(remoteClient), queryText,
                                                                       (uint) queryStart, 50, queryFlags).ToArray());
            }
        }
示例#6
0
        public void DirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
        {
            m_log.InfoFormat("[OPEN SEARCH MODULE]: DirFindQuery Flags = {0}", queryFlags);

            /*
             * DirFindFlags
             *      People = 1,
             *      Online = 2,
             *      Events = 8,
             *      Groups = 16,
             *      DateEvents = 32,
             *      AgentOwned = 64,
             *      ForSale = 128,
             *      GroupOwned = 256,
             *      DwellSort = 1024,
             *      PgSimsOnly = 2048,
             *      PicturesOnly = 4096,
             *      PgEventsOnly = 8192,
             *      MatureSimsOnly = 16384,
             *      SortAsc = 32768,
             *      PricesSort = 65536,
             *      PerMeterSort = 131072,
             *      AreaSort = 262144,
             *      NameSort = 524288,
             *      LimitByPrice = 1048576,
             *      LimitByArea = 2097152,
             *      FilterMature = 4194304,
             *      PGOnly = 8388608,
             *      IncludePG = 16777216,
             *      IncludeMature = 33554432,
             *      IncludeAdult = 67108864,
             *      AdultOnly = 134217728,
             */

            //
            if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People)
            {
                m_log.InfoFormat("[OPEN SEARCH MODULE]: DirFindQuery.People");
                DirPeopleQuery(remoteClient, queryID, queryText, queryFlags, queryStart);
                return;
            }
            else if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
            {
                m_log.InfoFormat("[OPEN SEARCH MODULE]: DirFindQuery.Groups");
                if (m_GroupsService == null)
                {
                    m_log.Warn("[OPEN SEARCH MODULE]: Groups service is not available. Unable to search groups.");
                    remoteClient.SendAlertMessage("Groups search is not enabled");
                    return;
                }

                if (string.IsNullOrEmpty(queryText))
                {
                    remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]);
                }
                remoteClient.SendDirGroupsReply(queryID, m_GroupsService.FindGroups(remoteClient, queryText).ToArray());
                return;
            }
            else if (((DirFindFlags)queryFlags & DirFindFlags.DateEvents) == DirFindFlags.DateEvents)
            {
                m_log.InfoFormat("[OPEN SEARCH MODULE]: DirFindQuery.DateEvents");
                DirEventsQuery(remoteClient, queryID, queryText, queryFlags, queryStart);
                return;
            }
        }
示例#7
0
        void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
        {
            if (!string.IsNullOrEmpty(queryText))
            {
                queryText = queryText.Trim();
                queryText = queryText.ToLowerInvariant();
            }

            if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People)
            {
                if (string.IsNullOrEmpty(queryText))
                {
                    remoteClient.SendDirPeopleReply(queryID, new DirPeopleReplyData[0]);
                }

                List <UserAccount> accounts;
                if (!queryPeopleCache.TryGetValue(queryText, out accounts))
                {
                    accounts = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, queryText);
                }

                queryPeopleCache.AddOrUpdate(queryText, accounts, 30.0);

                if (accounts.Count == 0)
                {
                    remoteClient.SendDirPeopleReply(queryID, new DirPeopleReplyData[0]);
                    return;
                }

                DirPeopleReplyData[] hits = new DirPeopleReplyData[accounts.Count];
                int count = 0;
                foreach (UserAccount acc in accounts)
                {
                    DirPeopleReplyData d = new DirPeopleReplyData();
                    d.agentID   = acc.PrincipalID;
                    d.firstName = acc.FirstName;
                    d.lastName  = acc.LastName;
                    d.online    = false;

                    hits[count++] = d;
                }

                // viewers don't sent sorting, so results they show are a nice mess
                if ((queryStart > 0) && (queryStart < count))
                {
                    int len = count - queryStart;
                    if (len > 101) // a viewer page is 100
                    {
                        len = 101;
                    }
                    DirPeopleReplyData[] tmp = new DirPeopleReplyData[len];
                    Array.Copy(hits, queryStart, tmp, 0, len);
                    hits = tmp;
                }
                else if (count > 101)
                {
                    DirPeopleReplyData[] tmp = new DirPeopleReplyData[101];
                    Array.Copy(hits, 0, tmp, 0, 101);
                    hits = tmp;
                }
                // TODO: This currently ignores pretty much all the query flags including Mature and sort order
                remoteClient.SendDirPeopleReply(queryID, hits);
            }
            else if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
            {
                if (m_GroupsService == null)
                {
                    m_log.Warn("[BASIC SEARCH MODULE]: Groups service is not available. Unable to search groups.");
                    remoteClient.SendAlertMessage("Groups search is not enabled");
                    return;
                }

                if (string.IsNullOrEmpty(queryText))
                {
                    remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]);
                }

                List <DirGroupsReplyData> answer;
                if (!queryGroupCache.TryGetValue(queryText, out answer))
                {
                    answer = m_GroupsService.FindGroups(remoteClient, queryText);
                }

                queryGroupCache.AddOrUpdate(queryText, answer, 30.0);

                if (answer.Count == 0)
                {
                    remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]);
                    return;
                }

                // filter out groups
                DirGroupsReplyData[] result = new DirGroupsReplyData[answer.Count];
                int count = 0;
                foreach (DirGroupsReplyData dgrd in answer)
                {
                    if (dgrd.members > 0)
                    {
                        result[count++] = dgrd;
                    }
                }
                answer = null;

                // viewers don't sent sorting, so results they show are a nice mess
                if ((queryStart > 0) && (queryStart < count))
                {
                    int len = count - queryStart;
                    if (len > 101) // a viewer page is 100
                    {
                        len = 101;
                    }
                    DirGroupsReplyData[] tmp = new DirGroupsReplyData[len];
                    Array.Copy(result, queryStart, tmp, 0, len);
                    result = tmp;
                }
                else if (count > 101)
                {
                    DirGroupsReplyData[] tmp = new DirGroupsReplyData[101];
                    Array.Copy(result, 0, tmp, 0, 101);
                    result = tmp;
                }

                // TODO: This currently ignores pretty much all the query flags including Mature and sort order
                remoteClient.SendDirGroupsReply(queryID, result);
            }
        }
示例#8
0
        void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
        {
            queryText = queryText.Trim();

            if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People)
            {
                if (string.IsNullOrEmpty(queryText))
                    remoteClient.SendDirPeopleReply(queryID, new DirPeopleReplyData[0]);

                List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, queryText);
                DirPeopleReplyData[] hits = new DirPeopleReplyData[accounts.Count];
                int i = 0;
                foreach (UserAccount acc in accounts)
                {
                    DirPeopleReplyData d = new DirPeopleReplyData();
                    d.agentID = acc.PrincipalID;
                    d.firstName = acc.FirstName;
                    d.lastName = acc.LastName;
                    d.online = false;

                    hits[i++] = d;
                }

                // TODO: This currently ignores pretty much all the query flags including Mature and sort order
                remoteClient.SendDirPeopleReply(queryID, hits);
            }
            else if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
            {
                if (m_GroupsService == null)
                {
                    m_log.Warn("[BASIC SEARCH MODULE]: Groups service is not available. Unable to search groups.");
                    remoteClient.SendAlertMessage("Groups search is not enabled");
                    return;
                }

                if (string.IsNullOrEmpty(queryText))
                    remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]);

                // TODO: This currently ignores pretty much all the query flags including Mature and sort order
                remoteClient.SendDirGroupsReply(queryID, m_GroupsService.FindGroups(remoteClient, queryText).ToArray());
            }

        }