コード例 #1
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an GroupSessionAgentUpdate
            if (message.ContainsKey("Method") && message ["Method"] == "GroupSessionAgentUpdate")
            {
                //COMES IN ON WhiteCore.SERVER SIDE
                //Send it on to whomever it concerns
                OSDMap innerMessage = (OSDMap)message ["Message"];
                if (innerMessage ["message"] == "ChatterBoxSessionAgentListUpdates")
                // ONLY forward on this type of message
                {
                    UUID agentID                 = message ["AgentID"];
                    IEventQueueService eqs       = m_registry.RequestModuleInterface <IEventQueueService> ();
                    IAgentInfoService  agentInfo = m_registry.RequestModuleInterface <IAgentInfoService> ();
                    if (agentInfo != null)
                    {
                        UserInfo user = agentInfo.GetUserInfo(agentID.ToString());
                        if (user != null && user.IsOnline)
                        {
                            eqs.Enqueue(innerMessage, agentID, user.CurrentRegionID);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message ["Method"] == "FixGroupRoleTitles")
            {
                // This message comes in on WhiteCore.Server side from the region
                UUID groupID = message ["GroupID"].AsUUID();
                UUID agentID = message ["AgentID"].AsUUID();
                UUID roleID  = message ["RoleID"].AsUUID();
                byte type    = (byte)message ["Type"].AsInteger();
                IGroupsServiceConnector     con     = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();
                List <GroupRoleMembersData> members = con.GetGroupRoleMembers(agentID, groupID);
                List <GroupRolesData>       roles   = con.GetGroupRoles(agentID, groupID);
                GroupRolesData everyone             = null;

                foreach (GroupRolesData role in roles.Where(role => role.Name == "Everyone"))
                {
                    everyone = role;
                }

                List <UserInfo> regionsToBeUpdated = new List <UserInfo> ();
                foreach (GroupRoleMembersData data in members)
                {
                    if (data.RoleID == roleID)
                    {
                        // They were affected by the change
                        switch ((GroupRoleUpdate)type)
                        {
                        case GroupRoleUpdate.Create:
                        case GroupRoleUpdate.NoUpdate:     // No changes...
                            break;

                        case GroupRoleUpdate.UpdatePowers: // Possible we don't need to send this?
                        case GroupRoleUpdate.UpdateAll:
                        case GroupRoleUpdate.UpdateData:
                        case GroupRoleUpdate.Delete:
                            if (type == (byte)GroupRoleUpdate.Delete)
                            {
                                // Set them to the most limited role since their role is gone
                                con.SetAgentGroupSelectedRole(data.MemberID, groupID, everyone.RoleID);
                            }

                            // Need to update their title inworld
                            IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                            UserInfo          info;
                            if (agentInfoService != null &&
                                (info = agentInfoService.GetUserInfo(agentID.ToString())) != null && info.IsOnline)
                            {
                                // Forward the message
                                regionsToBeUpdated.Add(info);
                            }
                            break;
                        }
                    }
                }
                if (regionsToBeUpdated.Count != 0)
                {
                    ISyncMessagePosterService messagePost = m_registry.RequestModuleInterface <ISyncMessagePosterService> ();
                    if (messagePost != null)
                    {
                        foreach (UserInfo userInfo in regionsToBeUpdated)
                        {
                            OSDMap outgoingMessage = new OSDMap();
                            outgoingMessage ["Method"]   = "ForceUpdateGroupTitles";
                            outgoingMessage ["GroupID"]  = groupID;
                            outgoingMessage ["RoleID"]   = roleID;
                            outgoingMessage ["RegionID"] = userInfo.CurrentRegionID;
                            messagePost.Post(userInfo.CurrentRegionURI, outgoingMessage);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message ["Method"] == "ForceUpdateGroupTitles")
            {
                // This message comes in on the region side from WhiteCore.Server
                UUID          groupID  = message ["GroupID"].AsUUID();
                UUID          roleID   = message ["RoleID"].AsUUID();
                UUID          regionID = message ["RegionID"].AsUUID();
                IGroupsModule gm       = m_registry.RequestModuleInterface <IGroupsModule> ();
                if (gm != null)
                {
                    gm.UpdateUsersForExternalRoleUpdate(groupID, roleID, regionID);
                }
            }
            return(null);
        }
コード例 #2
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an GroupSessionAgentUpdate
            if (message.ContainsKey("Method") && message["Method"] == "GroupSessionAgentUpdate")
            {
                //COMES IN ON AURORA.SERVER SIDE
                //Send it on to whomever it concerns
                OSDMap innerMessage = (OSDMap)message["Message"];
                if (innerMessage["message"] == "ChatterBoxSessionAgentListUpdates")
                //ONLY forward on this type of message
                {
                    UUID agentID            = message["AgentID"];
                    IEventQueueService eqs  = m_registry.RequestModuleInterface <IEventQueueService>();
                    ICapsService       caps = m_registry.RequestModuleInterface <ICapsService>();
                    if (caps != null)
                    {
                        IClientCapsService clientCaps = caps.GetClientCapsService(agentID);
                        if (clientCaps != null && clientCaps.GetRootCapsService() != null)
                        {
                            eqs.Enqueue(innerMessage, agentID, clientCaps.GetRootCapsService().RegionHandle);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FixGroupRoleTitles")
            {
                //COMES IN ON AURORA.SERVER SIDE FROM REGION
                UUID groupID = message["GroupID"].AsUUID();
                UUID agentID = message["AgentID"].AsUUID();
                UUID roleID  = message["RoleID"].AsUUID();
                byte type    = (byte)message["Type"].AsInteger();
                IGroupsServiceConnector     con     = DataManager.RequestPlugin <IGroupsServiceConnector>();
                List <GroupRoleMembersData> members = con.GetGroupRoleMembers(agentID, groupID);
                List <GroupRolesData>       roles   = con.GetGroupRoles(agentID, groupID);
                GroupRolesData everyone             = null;
#if (!ISWIN)
                foreach (GroupRolesData role in roles)
                {
                    if (role.Name == "Everyone")
                    {
                        everyone = role;
                    }
                }
#else
                foreach (GroupRolesData role in roles.Where(role => role.Name == "Everyone"))
                {
                    everyone = role;
                }
#endif

                List <ulong> regionsToBeUpdated = new List <ulong>();
                foreach (GroupRoleMembersData data in members)
                {
                    if (data.RoleID == roleID)
                    {
                        //They were affected by the change
                        switch ((GroupRoleUpdate)type)
                        {
                        case GroupRoleUpdate.Create:
                        case GroupRoleUpdate.NoUpdate:
                            //No changes...
                            break;

                        case GroupRoleUpdate.UpdatePowers:     //Possible we don't need to send this?
                        case GroupRoleUpdate.UpdateAll:
                        case GroupRoleUpdate.UpdateData:
                        case GroupRoleUpdate.Delete:
                            if (type == (byte)GroupRoleUpdate.Delete)
                            {
                                //Set them to the most limited role since their role is gone
                                con.SetAgentGroupSelectedRole(data.MemberID, groupID, everyone.RoleID);
                            }
                            //Need to update their title inworld
                            ICapsService caps = m_registry.RequestModuleInterface <ICapsService>();
                            if (caps != null)
                            {
                                IClientCapsService clientCaps = caps.GetClientCapsService(agentID);
                                if (clientCaps != null && clientCaps.GetRootCapsService() != null)
                                {
                                    regionsToBeUpdated.Add(clientCaps.GetRootCapsService().RegionHandle);
                                }
                            }
                            break;
                        }
                    }
                }
                if (regionsToBeUpdated.Count != 0)
                {
                    IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>();
                    if (messagePost != null)
                    {
                        foreach (ulong regionhandle in regionsToBeUpdated)
                        {
                            OSDMap outgoingMessage = new OSDMap();
                            outgoingMessage["Method"]   = "ForceUpdateGroupTitles";
                            outgoingMessage["GroupID"]  = groupID;
                            outgoingMessage["RoleID"]   = roleID;
                            outgoingMessage["RegionID"] = regionhandle;
                            messagePost.Post(regionhandle, outgoingMessage);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "ForceUpdateGroupTitles")
            {
                //COMES IN ON REGION SIDE FROM AURORA.SERVER
                UUID          groupID  = message["GroupID"].AsUUID();
                UUID          roleID   = message["RoleID"].AsUUID();
                ulong         regionID = message["RegionID"].AsULong();
                IGroupsModule gm       = m_registry.RequestModuleInterface <IGroupsModule>();
                if (gm != null)
                {
                    gm.UpdateUsersForExternalRoleUpdate(groupID, roleID, regionID);
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "SendGroupNoticeToUsers")
            {
                //COMES IN ON REGION SIDE FROM AURORA.SERVER
                GroupNoticeInfo notice = new GroupNoticeInfo();
                notice.FromOSD((OSDMap)message["Notice"]);
                IGroupsModule gm = m_registry.RequestModuleInterface <IGroupsModule>();
                if (gm != null)
                {
                    gm.SendGroupNoticeToUsers(null, notice, true);
                }
            }
            return(null);
        }