示例#1
0
        public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
        {
            m_log.InfoFormat("[Groups] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            foreach (osGroup existingGroup in m_Groups.Values)
            {
                if (existingGroup.Name.ToLower().Trim().Equals(name.ToLower().Trim()))
                {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
                    return(UUID.Zero);
                }
            }

            osGroup newGroup = new osGroup();

            newGroup.GroupID        = UUID.Random();
            newGroup.Name           = name;
            newGroup.Charter        = charter;
            newGroup.ShowInList     = showInList;
            newGroup.InsigniaID     = insigniaID;
            newGroup.MembershipFee  = membershipFee;
            newGroup.OpenEnrollment = openEnrollment;
            newGroup.AllowPublish   = allowPublish;
            newGroup.MaturePublish  = maturePublish;

            newGroup.PowersMask = AllGroupPowers;
            newGroup.FounderID  = remoteClient.AgentId;


            // Setup members role
            osgRole everyoneRole = AddRole2Group(newGroup, "Everyone", "Everyone in the group is in the everyone role.", "Everyone Title", m_DefaultEveryonePowers, UUID.Zero);

            // Setup owners role
            osgRole ownerRole = AddRole2Group(newGroup, "Owners", "Owners of " + newGroup.Name, "Owner of " + newGroup.Name, AllGroupPowers);


            osGroupMemberInfo Member = AddAgentToGroup(remoteClient.AgentId, newGroup);

            // Put the founder in the owner and everyone role
            Member.Roles.Add(ownerRole.RoleID, ownerRole);

            // Add founder to owner & everyone's local lists of members
            ownerRole.RoleMembers.Add(Member.AgentID, Member);

            // Add group to module
            m_Groups.Add(newGroup.GroupID, newGroup);


            remoteClient.SendCreateGroupReply(newGroup.GroupID, true, "Group created successfullly");

            // Set this as the founder's active group
            ActivateGroup(remoteClient, newGroup.GroupID);

            // The above sends this out too as of 4/3/09
            // UpdateClientWithGroupInfo(remoteClient);


            return(newGroup.GroupID);
        }
示例#2
0
        private osgRole AddRole2Group(osGroup group, string name, string description, string title, GroupPowers powers, UUID roleid)
        {
            osgRole newRole = new osgRole();

            // everyoneRole.RoleID = UUID.Random();
            newRole.RoleID      = roleid;
            newRole.Name        = name;
            newRole.Description = description;
            newRole.Powers      = (GroupPowers)powers & group.PowersMask;
            newRole.Title       = title;
            newRole.Group       = group;

            group.Roles.Add(newRole.RoleID, newRole);

            return(newRole);
        }
示例#3
0
        private void UpdateClientWithGroupInfo(IClientAPI client)
        {
            OnAgentDataUpdateRequest(client, client.AgentId, UUID.Zero);


            // Need to send a group membership update to the client
            // UDP version doesn't seem to behave nicely
            // client.SendGroupMembership(GetMembershipData(client.AgentId));

            GroupMembershipData[] membershipData = GetMembershipData(client.AgentId);

            foreach (GroupMembershipData membership in membershipData)
            {
                osGroupMemberInfo memberInfo = m_GroupMemberInfo[client.AgentId][membership.GroupID];
                osgRole           roleInfo   = memberInfo.Roles[membership.ActiveRole];

                m_log.InfoFormat("[Groups] {0} member of {1} title active (2)", client.FirstName, membership.GroupName, roleInfo.Name, membership.Active);
            }

            SendGroupMembershipInfoViaCaps(client, membershipData);
            client.SendAvatarGroupsReply(client.AgentId, membershipData);
        }