From 5b4d7922ea304f638b6a9bd0a324abefd1403ec1 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 14 May 2008 06:58:32 +0000 Subject: * Adding the very bare minimum for the client to register user as having the group OpenSimulator Tester. This allows us to start examining and implementing the vary many unhandled group packets. --- OpenSim/Framework/IClientAPI.cs | 3 ++ OpenSim/Framework/LLGroup.cs | 52 ++++++++++++++++++++++ .../Region/ClientStack/LindenUDP/LLClientView.cs | 24 ++++++++++ .../Modules/Avatar/Groups/GroupsModule.cs | 47 ++++--------------- .../Environment/Modules/World/NPC/NPCAvatar.cs | 6 +++ .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 5 +++ 6 files changed, 99 insertions(+), 38 deletions(-) create mode 100644 OpenSim/Framework/LLGroup.cs (limited to 'OpenSim') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 690b04e..098e721 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -973,6 +973,9 @@ namespace OpenSim.Framework LLVector3 CameraAtOffset, LLVector3 CameraEyeOffset, bool ForceMouseLook); void SendAdminResponse(LLUUID Token, uint AdminLevel); + + void SendGroupMembership(GroupData[] GroupMembership); + byte[] GetThrottlesPacked(float multiplier); diff --git a/OpenSim/Framework/LLGroup.cs b/OpenSim/Framework/LLGroup.cs new file mode 100644 index 0000000..73d009a --- /dev/null +++ b/OpenSim/Framework/LLGroup.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections; +using libsecondlife; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework +{ + public class GroupData + { + public string ActiveGroupTitle; + public LLUUID GroupID; + public List GroupMembers; + public string groupName; + public uint groupPowers = (uint)(GroupPowers.LandAllowLandmark | GroupPowers.LandAllowSetHome); + public List GroupTitles; + public bool AcceptNotices = true; + public bool AllowPublish = true; + public string Charter = "Cool Group Yeah!"; + public int contribution = 0; + public LLUUID FounderID = LLUUID.Zero; + public int groupMembershipCost = 0; + public int groupRollsCount = 1; + public LLUUID GroupPicture = LLUUID.Zero; + public bool MaturePublish = true; + public int MembershipFee = 0; + public bool OpenEnrollment = true; + public bool ShowInList = true; + + public GroupData() + { + GroupTitles = new List(); + GroupMembers = new List(); + } + + public GroupPowers ActiveGroupPowers + { + set { groupPowers = (uint)value; } + get { return (GroupPowers)groupPowers; } + } + } + + public class GroupList + { + public List m_GroupList; + + public GroupList() + { + m_GroupList = new List(); + } + } +} diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 32432b4..395d555 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5758,6 +5758,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(avatarSitResponse, ThrottleOutPacketType.Task); } + public void SendAdminResponse(LLUUID Token, uint AdminLevel) { GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); @@ -5773,6 +5774,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP respondPacket.AgentData = adb; OutPacket(respondPacket, ThrottleOutPacketType.Task); } + + public void SendGroupMembership(GroupData[] GroupMembership) + { + AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); + AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[GroupMembership.Length]; + for (int i = 0; i < GroupMembership.Length; i++) + { + AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock(); + Group.AcceptNotices = GroupMembership[i].AcceptNotices; + Group.Contribution = GroupMembership[i].contribution; + Group.GroupID = GroupMembership[i].GroupID; + Group.GroupInsigniaID = GroupMembership[i].GroupPicture; + Group.GroupName = Helpers.StringToField(GroupMembership[i].groupName); + Group.GroupPowers = GroupMembership[i].groupPowers; + Groups[i] = Group; + Groupupdate.GroupData = Groups; + + } + Groupupdate.AgentData.AgentID = AgentId; + OutPacket(Groupupdate, ThrottleOutPacketType.Task); + + } + public ClientInfo GetClientInfo() { //MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN"); diff --git a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs index 0030350..5e87b49 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using libsecondlife; +using libsecondlife.Packets; using log4net; using Nini.Config; using OpenSim.Framework; @@ -98,12 +99,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups private void OnNewClient(IClientAPI client) { - // All friends establishment protocol goes over instant message - // There's no way to send a message from the sim - // to a user to 'add a friend' without causing dialog box spam - // - // The base set of friends are added when the user signs on in their XMLRPC response - // Generated by LoginService. The friends are retreived from the database by the UserManager // Subscribe to instant messages client.OnInstantMessage += OnInstantMessage; @@ -140,6 +135,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups } } m_log.Info("[GROUP]: Adding " + client.Name + " to OpenSimulator Tester group"); + GroupData[] updateGroups = new GroupData[1]; + updateGroups[0] = OpenSimulatorGroup; + + client.SendGroupMembership(updateGroups); + + } private void OnAgentDataUpdateRequest(IClientAPI remoteClient, LLUUID AgentID, LLUUID SessionID) @@ -150,8 +151,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups LLUUID ActiveGroupID = LLUUID.Zero; uint ActiveGroupPowers = 0; - string ActiveGroupName = ""; - string ActiveGroupTitle = ""; + string ActiveGroupName = "OpenSimulator Tester"; + string ActiveGroupTitle = "I IZ N0T"; bool foundUser = false; @@ -240,35 +241,5 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups } } - public class GroupData - { - public string ActiveGroupTitle; - public LLUUID GroupID; - public List GroupMembers; - public string groupName; - public uint groupPowers = (uint) (GroupPowers.LandAllowLandmark | GroupPowers.LandAllowSetHome); - public List GroupTitles; - - public GroupData() - { - GroupTitles = new List(); - GroupMembers = new List(); - } - public GroupPowers ActiveGroupPowers - { - set { groupPowers = (uint) value; } - get { return (GroupPowers) groupPowers; } - } - } - - public class GroupList - { - public List m_GroupList; - - public GroupList() - { - m_GroupList = new List(); - } - } } \ No newline at end of file diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 3126f1c..f37e12a 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -102,6 +102,12 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { } + + public void SendGroupMembership(GroupData[] GroupMembership) + { + + } + public LLUUID GetDefaultAnimation(string name) { return LLUUID.Zero; diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 68f3ecb..6087857 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -583,6 +583,11 @@ namespace OpenSim.Region.Examples.SimpleModule } + public void SendGroupMembership(GroupData[] GroupMembership) + { + + } + private void Update() { frame++; -- cgit v1.1