diff --git a/OpenSim/Framework/GroupData.cs b/OpenSim/Framework/GroupData.cs index 66b1875b96..76034c0d89 100644 --- a/OpenSim/Framework/GroupData.cs +++ b/OpenSim/Framework/GroupData.cs @@ -52,6 +52,61 @@ namespace OpenSim.Framework // public bool AcceptNotices = true; public int Contribution = 0; - public uint GroupPowers = 0; + public ulong GroupPowers = 0; + public bool Active = false; + public UUID ActiveRole = UUID.Zero; + } + + public struct GroupTitlesData + { + public string Name; + public UUID UUID; + public bool Selected; + } + + public struct GroupProfileData + { + public UUID GroupID; + public string Name; + public string Charter; + public bool ShowInList; + public string MemberTitle; + public ulong PowersMask; + public UUID InsigniaID; + public UUID FounderID; + public int MembershipFee; + public bool OpenEnrollment; + public int Money; + public int GroupMembershipCount; + public int GroupRolesCount; + public bool AllowPublish; + public bool MaturePublish; + public UUID OwnerRole; + } + + public struct GroupMembersData + { + public UUID AgentID; + public int Contribution; + public string OnlineStatus; + public ulong AgentPowers; + public string Title; + public bool IsOwner; + } + + public struct GroupRolesData + { + public UUID RoleID; + public string Name; + public string Title; + public string Description; + public ulong Powers; + public int Members; + } + + public struct GroupRoleMembersData + { + public UUID RoleID; + public UUID MemberID; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6801310b84..207f221c21 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -41,6 +41,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Statistics; using OpenSim.Region.ClientStack.LindenUDP; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Scenes; using Timer = System.Timers.Timer; @@ -6483,6 +6484,260 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; + case PacketType.ActivateGroup: + ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack; + IGroupsModule grps = m_scene.RequestModuleInterface(); + if (grps != null) + { + grps.ActivateGroup(this, activateGroupPacket.AgentData.GroupID); + } + break; + + case PacketType.GroupTitlesRequest: + GroupTitlesRequestPacket groupTitlesRequest = + (GroupTitlesRequestPacket)Pack; + + IGroupsModule grps2 = m_scene.RequestModuleInterface(); + if (grps2 != null) + { + GroupTitlesReplyPacket groupTitlesReply = (GroupTitlesReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupTitlesReply); + + groupTitlesReply.AgentData = + new GroupTitlesReplyPacket.AgentDataBlock(); + + groupTitlesReply.AgentData.AgentID = AgentId; + groupTitlesReply.AgentData.GroupID = + groupTitlesRequest.AgentData.GroupID; + + groupTitlesReply.AgentData.RequestID = + groupTitlesRequest.AgentData.RequestID; + + List titles = + grps2.GroupTitlesRequest(this, + groupTitlesRequest.AgentData.GroupID); + + groupTitlesReply.GroupData = + new GroupTitlesReplyPacket. + GroupDataBlock[titles.Count]; + + int i = 0; + foreach (GroupTitlesData d in titles) + { + groupTitlesReply.GroupData[i] = + new GroupTitlesReplyPacket. + GroupDataBlock(); + + groupTitlesReply.GroupData[i].Title = + Utils.StringToBytes(d.Name); + groupTitlesReply.GroupData[i].RoleID = + d.UUID; + groupTitlesReply.GroupData[i].Selected = + d.Selected; + i++; + } + + OutPacket(groupTitlesReply, ThrottleOutPacketType.Task); + } + break; + + case PacketType.GroupProfileRequest: + GroupProfileRequestPacket groupProfileRequest = + (GroupProfileRequestPacket)Pack; + + IGroupsModule grps3 = m_scene.RequestModuleInterface(); + if (grps3 != null) + { + GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply); + + groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock(); + groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock(); + groupProfileReply.AgentData.AgentID = AgentId; + + GroupProfileData d = grps3.GroupProfileRequest(this, + groupProfileRequest.GroupData.GroupID); + + groupProfileReply.GroupData.GroupID = d.GroupID; + groupProfileReply.GroupData.Name = Utils.StringToBytes(d.Name); + groupProfileReply.GroupData.Charter = Utils.StringToBytes(d.Charter); + groupProfileReply.GroupData.ShowInList = d.ShowInList; + groupProfileReply.GroupData.MemberTitle = Utils.StringToBytes(d.MemberTitle); + groupProfileReply.GroupData.PowersMask = d.PowersMask; + groupProfileReply.GroupData.InsigniaID = d.InsigniaID; + groupProfileReply.GroupData.FounderID = d.FounderID; + groupProfileReply.GroupData.MembershipFee = d.MembershipFee; + groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment; + groupProfileReply.GroupData.Money = d.Money; + groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount; + groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount; + groupProfileReply.GroupData.AllowPublish = d.AllowPublish; + groupProfileReply.GroupData.MaturePublish = d.MaturePublish; + groupProfileReply.GroupData.OwnerRole = d.OwnerRole; + + OutPacket(groupProfileReply, ThrottleOutPacketType.Task); + } + break; + + case PacketType.GroupMembersRequest: + GroupMembersRequestPacket groupMembersRequestPacket = + (GroupMembersRequestPacket)Pack; + + IGroupsModule grps4 = m_scene.RequestModuleInterface(); + List members = + grps4.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID); + + if (grps4 != null) + { + GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply); + + groupMembersReply.AgentData = + new GroupMembersReplyPacket.AgentDataBlock(); + groupMembersReply.GroupData = + new GroupMembersReplyPacket.GroupDataBlock(); + groupMembersReply.MemberData = + new GroupMembersReplyPacket.MemberDataBlock[ + members.Count]; + + groupMembersReply.AgentData.AgentID = AgentId; + groupMembersReply.GroupData.GroupID = + groupMembersRequestPacket.GroupData.GroupID; + groupMembersReply.GroupData.RequestID = + groupMembersRequestPacket.GroupData.RequestID; + groupMembersReply.GroupData.MemberCount = members.Count; + + int i = 0; + foreach (GroupMembersData m in members) + { + groupMembersReply.MemberData[i] = + new GroupMembersReplyPacket.MemberDataBlock(); + groupMembersReply.MemberData[i].AgentID = + m.AgentID; + groupMembersReply.MemberData[i].Contribution = + m.Contribution; + groupMembersReply.MemberData[i].OnlineStatus = + Utils.StringToBytes(m.OnlineStatus); + groupMembersReply.MemberData[i].AgentPowers = + m.AgentPowers; + groupMembersReply.MemberData[i].Title = + Utils.StringToBytes(m.Title); + groupMembersReply.MemberData[i].IsOwner = + m.IsOwner; + i++; + } + + OutPacket(groupMembersReply, ThrottleOutPacketType.Task); + } + break; + + case PacketType.GroupRoleDataRequest: + GroupRoleDataRequestPacket groupRolesRequest = + (GroupRoleDataRequestPacket)Pack; + + IGroupsModule grps5 = m_scene.RequestModuleInterface(); + if (grps5 != null) + { + GroupRoleDataReplyPacket groupRolesReply = (GroupRoleDataReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleDataReply); + + groupRolesReply.AgentData = + new GroupRoleDataReplyPacket.AgentDataBlock(); + + groupRolesReply.AgentData.AgentID = AgentId; + + groupRolesReply.GroupData = + new GroupRoleDataReplyPacket. + GroupDataBlock(); + + groupRolesReply.GroupData.GroupID = + groupRolesRequest.GroupData.GroupID; + + groupRolesReply.GroupData.RequestID = + groupRolesRequest.GroupData.RequestID; + + List titles = + grps5.GroupRoleDataRequest(this, + groupRolesRequest.GroupData.GroupID); + + groupRolesReply.GroupData.RoleCount = + titles.Count; + + groupRolesReply.RoleData = + new GroupRoleDataReplyPacket. + RoleDataBlock[titles.Count]; + + int i = 0; + foreach (GroupRolesData d in titles) + { + groupRolesReply.RoleData[i] = + new GroupRoleDataReplyPacket. + RoleDataBlock(); + + groupRolesReply.RoleData[i].RoleID = + d.RoleID; + groupRolesReply.RoleData[i].Name = + Utils.StringToBytes(d.Name); + groupRolesReply.RoleData[i].Title = + Utils.StringToBytes(d.Title); + groupRolesReply.RoleData[i].Description = + Utils.StringToBytes(d.Description); + groupRolesReply.RoleData[i].Powers = + d.Powers; + groupRolesReply.RoleData[i].Members = + (uint)d.Members; + + i++; + } + +Console.WriteLine(groupRolesReply.ToString()); + OutPacket(groupRolesReply, ThrottleOutPacketType.Task); + } + break; + + case PacketType.GroupRoleMembersRequest: + GroupRoleMembersRequestPacket groupRoleMembersRequest = + (GroupRoleMembersRequestPacket)Pack; + + IGroupsModule grps6 = m_scene.RequestModuleInterface(); + if (grps6 != null) + { + GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply); + groupRoleMembersReply.AgentData = + new GroupRoleMembersReplyPacket.AgentDataBlock(); + groupRoleMembersReply.AgentData.AgentID = + AgentId; + groupRoleMembersReply.AgentData.GroupID = + groupRoleMembersRequest.GroupData.GroupID; + groupRoleMembersReply.AgentData.RequestID = + groupRoleMembersRequest.GroupData.RequestID; + + List mappings = + grps6.GroupRoleMembersRequest(this, + groupRoleMembersRequest.GroupData.GroupID); + + groupRoleMembersReply.AgentData.TotalPairs = + (uint)mappings.Count; + + groupRoleMembersReply.MemberData = + new GroupRoleMembersReplyPacket. + MemberDataBlock[mappings.Count]; + + int i = 0; + foreach (GroupRoleMembersData d in mappings) + { + groupRoleMembersReply.MemberData[i] = + new GroupRoleMembersReplyPacket. + MemberDataBlock(); + + groupRoleMembersReply.MemberData[i].RoleID = + d.RoleID; + groupRoleMembersReply.MemberData[i].MemberID = + d.MemberID; + i++; + } + + + OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task); + } + break; + default: m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString()); break; diff --git a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs index 0bb3c321cb..18241345e1 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs @@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups { UUID ActiveGroupID; string ActiveGroupName; - uint ActiveGroupPowers; + ulong ActiveGroupPowers; string firstname = remoteClient.FirstName; string lastname = remoteClient.LastName; diff --git a/OpenSim/Region/Interfaces/IGroupsModule.cs b/OpenSim/Region/Interfaces/IGroupsModule.cs new file mode 100644 index 0000000000..17daf3e5bf --- /dev/null +++ b/OpenSim/Region/Interfaces/IGroupsModule.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Region.Interfaces +{ + public interface IGroupsModule + { + void ActivateGroup(IClientAPI remoteClient, UUID groupID); + List GroupTitlesRequest(IClientAPI remoteClient, UUID groupID); + List GroupMembersRequest(IClientAPI remoteClient, UUID groupID); + List GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); + List GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); + GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); + + } +} diff --git a/prebuild.xml b/prebuild.xml index 961a56e8aa..438736e401 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -960,6 +960,7 @@ +