Example #1
0
        private void ProcessDirFindQuery_Groups(ViewerAgent agent, SceneInterface scene, DirFindQuery req)
        {
            DirGroupsReply res = null;

            var groupsService = scene.GroupsService;

            if (groupsService == null)
            {
                res = new DirGroupsReply
                {
                    AgentID = req.AgentID,
                    QueryID = req.QueryID
                };
                agent.SendMessageAlways(res, scene.ID);
                return;
            }

            var gis = groupsService.Groups.GetGroupsByName(agent.Owner, req.QueryText);

            if (gis.Count == 0)
            {
                res = new DirGroupsReply
                {
                    AgentID = req.AgentID,
                    QueryID = req.QueryID
                };
                agent.SendMessageAlways(res, scene.ID);
                return;
            }
            var t = new UDPPacket();

            foreach (var gi in gis)
            {
                if (res == null)
                {
                    res = new DirGroupsReply
                    {
                        AgentID = req.AgentID,
                        QueryID = req.QueryID
                    };
                }

                var d = new DirGroupsReply.QueryReplyData
                {
                    GroupID     = gi.ID.ID,
                    GroupName   = gi.ID.GroupName,
                    Members     = gi.MemberCount,
                    SearchOrder = gi.SearchOrder
                };
                res.QueryReplies.Add(d);

                t.Reset();
                res.Serialize(t);
                if (t.DataLength >= 1400)
                {
                    agent.SendMessageAlways(res, scene.ID);
                    res = null;
                }
            }
            if (res != null)
            {
                agent.SendMessageAlways(res, scene.ID);
            }
        }
Example #2
0
 private void ProcessDirFindQuery_Events(ViewerAgent agent, SceneInterface scene, DirFindQuery req)
 {
 }
Example #3
0
        private void ProcessDirFindQuery_People(ViewerAgent agent, SceneInterface scene, DirFindQuery req)
        {
            DirPeopleReply res = null;
            var            t   = new UDPPacket();

            foreach (UGUIWithName uui in scene.AvatarNameService.Search(req.QueryText.Split(new char[] { ' ' }, 2)))
            {
                if (res == null)
                {
                    res = new DirPeopleReply
                    {
                        AgentID = req.AgentID,
                        QueryID = req.QueryID
                    };
                }

                var d = new DirPeopleReply.QueryReplyData
                {
                    AgentID = uui.ID
                };
                string[] parts = uui.FullName.Split(' ');
                d.FirstName = parts[0];
                if (parts.Length > 1)
                {
                    d.LastName = parts[1];
                }
                //d.Group
                //d.Online
                d.Reputation = 0;
                res.QueryReplies.Add(d);

                t.Reset();
                res.Serialize(t);
                if (t.DataLength >= 1400)
                {
                    agent.SendMessageAlways(res, scene.ID);
                    res = null;
                }
            }
            if (res != null)
            {
                agent.SendMessageAlways(res, scene.ID);
            }
        }