diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 252 |
1 files changed, 133 insertions, 119 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index cc2d1e2..4a48a80 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -2755,44 +2755,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2755 | 2755 | ||
2756 | public void SendGroupMembership(GroupMembershipData[] GroupMembership) | 2756 | public void SendGroupMembership(GroupMembershipData[] GroupMembership) |
2757 | { | 2757 | { |
2758 | m_groupPowers.Clear(); | ||
2759 | 2758 | ||
2760 | AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); | 2759 | UpdateGroupMembership(GroupMembership); |
2761 | AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[GroupMembership.Length]; | 2760 | SendAgentGroupDataUpdate(AgentId,GroupMembership); |
2762 | for (int i = 0; i < GroupMembership.Length; i++) | ||
2763 | { | ||
2764 | m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers; | ||
2765 | |||
2766 | AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock(); | ||
2767 | Group.AcceptNotices = GroupMembership[i].AcceptNotices; | ||
2768 | Group.Contribution = GroupMembership[i].Contribution; | ||
2769 | Group.GroupID = GroupMembership[i].GroupID; | ||
2770 | Group.GroupInsigniaID = GroupMembership[i].GroupPicture; | ||
2771 | Group.GroupName = Util.StringToBytes256(GroupMembership[i].GroupName); | ||
2772 | Group.GroupPowers = GroupMembership[i].GroupPowers; | ||
2773 | Groups[i] = Group; | ||
2774 | |||
2775 | |||
2776 | } | ||
2777 | Groupupdate.GroupData = Groups; | ||
2778 | Groupupdate.AgentData = new AgentGroupDataUpdatePacket.AgentDataBlock(); | ||
2779 | Groupupdate.AgentData.AgentID = AgentId; | ||
2780 | //OutPacket(Groupupdate, ThrottleOutPacketType.Task); | ||
2781 | |||
2782 | try | ||
2783 | { | ||
2784 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
2785 | if (eq != null) | ||
2786 | { | ||
2787 | eq.GroupMembership(Groupupdate, this.AgentId); | ||
2788 | } | ||
2789 | } | ||
2790 | catch (Exception ex) | ||
2791 | { | ||
2792 | m_log.Error("Unable to send group membership data via eventqueue - exception: " + ex.ToString()); | ||
2793 | m_log.Warn("sending group membership data via UDP"); | ||
2794 | OutPacket(Groupupdate, ThrottleOutPacketType.Task); | ||
2795 | } | ||
2796 | } | 2761 | } |
2797 | 2762 | ||
2798 | public void SendPartPhysicsProprieties(ISceneEntity entity) | 2763 | public void SendPartPhysicsProprieties(ISceneEntity entity) |
@@ -3423,41 +3388,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3423 | 3388 | ||
3424 | public void SendAgentGroupDataUpdate(UUID avatarID, GroupMembershipData[] data) | 3389 | public void SendAgentGroupDataUpdate(UUID avatarID, GroupMembershipData[] data) |
3425 | { | 3390 | { |
3391 | if(avatarID != AgentId) | ||
3392 | m_log.Debug("[CLIENT]: SendAgentGroupDataUpdate avatarID != AgentId"); | ||
3393 | |||
3426 | IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>(); | 3394 | IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>(); |
3427 | 3395 | if(eq != null) | |
3428 | // use UDP if no caps | ||
3429 | if (eq == null) | ||
3430 | { | 3396 | { |
3431 | SendGroupMembership(data); | 3397 | eq.GroupMembershipData(avatarID,data); |
3432 | } | 3398 | } |
3433 | 3399 | else | |
3434 | OSDMap llsd = new OSDMap(3); | ||
3435 | OSDArray AgentData = new OSDArray(1); | ||
3436 | OSDMap AgentDataMap = new OSDMap(1); | ||
3437 | AgentDataMap.Add("AgentID", OSD.FromUUID(this.AgentId)); | ||
3438 | AgentDataMap.Add("AvatarID", OSD.FromUUID(avatarID)); | ||
3439 | AgentData.Add(AgentDataMap); | ||
3440 | llsd.Add("AgentData", AgentData); | ||
3441 | OSDArray GroupData = new OSDArray(data.Length); | ||
3442 | OSDArray NewGroupData = new OSDArray(data.Length); | ||
3443 | foreach (GroupMembershipData m in data) | ||
3444 | { | 3400 | { |
3445 | OSDMap GroupDataMap = new OSDMap(6); | 3401 | // use UDP if no caps |
3446 | OSDMap NewGroupDataMap = new OSDMap(1); | 3402 | AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); |
3447 | GroupDataMap.Add("GroupPowers", OSD.FromULong(m.GroupPowers)); | 3403 | AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[data.Length]; |
3448 | GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(m.AcceptNotices)); | 3404 | for (int i = 0; i < data.Length; i++) |
3449 | GroupDataMap.Add("GroupTitle", OSD.FromString(m.GroupTitle)); | 3405 | { |
3450 | GroupDataMap.Add("GroupID", OSD.FromUUID(m.GroupID)); | 3406 | AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock(); |
3451 | GroupDataMap.Add("GroupName", OSD.FromString(m.GroupName)); | 3407 | Group.AcceptNotices = data[i].AcceptNotices; |
3452 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(m.GroupPicture)); | 3408 | Group.Contribution = data[i].Contribution; |
3453 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(m.ListInProfile)); | 3409 | Group.GroupID = data[i].GroupID; |
3454 | GroupData.Add(GroupDataMap); | 3410 | Group.GroupInsigniaID = data[i].GroupPicture; |
3455 | NewGroupData.Add(NewGroupDataMap); | 3411 | Group.GroupName = Util.StringToBytes256(data[i].GroupName); |
3412 | Group.GroupPowers = data[i].GroupPowers; | ||
3413 | Groups[i] = Group; | ||
3414 | } | ||
3415 | Groupupdate.GroupData = Groups; | ||
3416 | Groupupdate.AgentData = new AgentGroupDataUpdatePacket.AgentDataBlock(); | ||
3417 | Groupupdate.AgentData.AgentID = avatarID; | ||
3418 | OutPacket(Groupupdate, ThrottleOutPacketType.Task); | ||
3456 | } | 3419 | } |
3457 | llsd.Add("GroupData", GroupData); | ||
3458 | llsd.Add("NewGroupData", NewGroupData); | ||
3459 | |||
3460 | eq.Enqueue(BuildEvent("AgentGroupDataUpdate", llsd), this.AgentId); | ||
3461 | } | 3420 | } |
3462 | 3421 | ||
3463 | public void SendJoinGroupReply(UUID groupID, bool success) | 3422 | public void SendJoinGroupReply(UUID groupID, bool success) |
@@ -5642,9 +5601,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5642 | if (groupID == ActiveGroupId) | 5601 | if (groupID == ActiveGroupId) |
5643 | return ActiveGroupPowers; | 5602 | return ActiveGroupPowers; |
5644 | 5603 | ||
5645 | if (m_groupPowers.ContainsKey(groupID)) | 5604 | lock(m_groupPowers) |
5646 | return m_groupPowers[groupID]; | 5605 | { |
5647 | 5606 | if (m_groupPowers.ContainsKey(groupID)) | |
5607 | return m_groupPowers[groupID]; | ||
5608 | } | ||
5648 | return 0; | 5609 | return 0; |
5649 | } | 5610 | } |
5650 | 5611 | ||
@@ -11011,7 +10972,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11011 | if (m_GroupsModule != null) | 10972 | if (m_GroupsModule != null) |
11012 | { | 10973 | { |
11013 | m_GroupsModule.ActivateGroup(this, activateGroupPacket.AgentData.GroupID); | 10974 | m_GroupsModule.ActivateGroup(this, activateGroupPacket.AgentData.GroupID); |
11014 | m_GroupsModule.SendAgentGroupDataUpdate(this); | ||
11015 | } | 10975 | } |
11016 | return true; | 10976 | return true; |
11017 | 10977 | ||
@@ -11136,11 +11096,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11136 | } | 11096 | } |
11137 | return true; | 11097 | return true; |
11138 | } | 11098 | } |
11099 | |||
11100 | UUID lastGroupProfileRequestID = UUID.Zero; | ||
11101 | double lastGroupProfileRequestTS = Util.GetTimeStampMS(); | ||
11102 | |||
11139 | private bool HandleGroupProfileRequest(IClientAPI sender, Packet Pack) | 11103 | private bool HandleGroupProfileRequest(IClientAPI sender, Packet Pack) |
11140 | { | 11104 | { |
11105 | if(m_GroupsModule == null) | ||
11106 | return true; | ||
11107 | |||
11141 | GroupProfileRequestPacket groupProfileRequest = | 11108 | GroupProfileRequestPacket groupProfileRequest = |
11142 | (GroupProfileRequestPacket)Pack; | 11109 | (GroupProfileRequestPacket)Pack; |
11143 | 11110 | ||
11111 | |||
11144 | #region Packet Session and User Check | 11112 | #region Packet Session and User Check |
11145 | if (m_checkPackets) | 11113 | if (m_checkPackets) |
11146 | { | 11114 | { |
@@ -11150,50 +11118,62 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11150 | } | 11118 | } |
11151 | #endregion | 11119 | #endregion |
11152 | 11120 | ||
11153 | if (m_GroupsModule != null) | 11121 | UUID grpID = groupProfileRequest.GroupData.GroupID; |
11154 | { | 11122 | double ts = Util.GetTimeStampMS(); |
11155 | GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply); | 11123 | if(grpID == lastGroupProfileRequestID && ts - lastGroupProfileRequestTS < 10000) |
11156 | 11124 | return true; | |
11157 | groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock(); | 11125 | |
11158 | groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock(); | 11126 | lastGroupProfileRequestID = grpID; |
11159 | groupProfileReply.AgentData.AgentID = AgentId; | 11127 | lastGroupProfileRequestTS = ts; |
11160 | 11128 | ||
11161 | GroupProfileData d = m_GroupsModule.GroupProfileRequest(this, | 11129 | GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply); |
11162 | groupProfileRequest.GroupData.GroupID); | 11130 | |
11163 | 11131 | groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock(); | |
11164 | groupProfileReply.GroupData.GroupID = d.GroupID; | 11132 | groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock(); |
11165 | groupProfileReply.GroupData.Name = Util.StringToBytes256(d.Name); | 11133 | groupProfileReply.AgentData.AgentID = AgentId; |
11166 | groupProfileReply.GroupData.Charter = Util.StringToBytes1024(d.Charter); | 11134 | |
11167 | groupProfileReply.GroupData.ShowInList = d.ShowInList; | 11135 | GroupProfileData d = m_GroupsModule.GroupProfileRequest(this, |
11168 | groupProfileReply.GroupData.MemberTitle = Util.StringToBytes256(d.MemberTitle); | 11136 | groupProfileRequest.GroupData.GroupID); |
11169 | groupProfileReply.GroupData.PowersMask = d.PowersMask; | 11137 | |
11170 | groupProfileReply.GroupData.InsigniaID = d.InsigniaID; | 11138 | if(d.GroupID == UUID.Zero) // don't send broken data |
11171 | groupProfileReply.GroupData.FounderID = d.FounderID; | 11139 | return true; |
11172 | groupProfileReply.GroupData.MembershipFee = d.MembershipFee; | 11140 | |
11173 | groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment; | 11141 | groupProfileReply.GroupData.GroupID = d.GroupID; |
11174 | groupProfileReply.GroupData.Money = d.Money; | 11142 | groupProfileReply.GroupData.Name = Util.StringToBytes256(d.Name); |
11175 | groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount; | 11143 | groupProfileReply.GroupData.Charter = Util.StringToBytes1024(d.Charter); |
11176 | groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount; | 11144 | groupProfileReply.GroupData.ShowInList = d.ShowInList; |
11177 | groupProfileReply.GroupData.AllowPublish = d.AllowPublish; | 11145 | groupProfileReply.GroupData.MemberTitle = Util.StringToBytes256(d.MemberTitle); |
11178 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 11146 | groupProfileReply.GroupData.PowersMask = d.PowersMask; |
11179 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 11147 | groupProfileReply.GroupData.InsigniaID = d.InsigniaID; |
11180 | 11148 | groupProfileReply.GroupData.FounderID = d.FounderID; | |
11181 | Scene scene = (Scene)m_scene; | 11149 | groupProfileReply.GroupData.MembershipFee = d.MembershipFee; |
11182 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | 11150 | groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment; |
11183 | { | 11151 | groupProfileReply.GroupData.Money = d.Money; |
11184 | ScenePresence p; | 11152 | groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount; |
11185 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | 11153 | groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount; |
11154 | groupProfileReply.GroupData.AllowPublish = d.AllowPublish; | ||
11155 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | ||
11156 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | ||
11157 | |||
11158 | Scene scene = (Scene)m_scene; | ||
11159 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
11160 | { | ||
11161 | ScenePresence p; | ||
11162 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
11163 | { | ||
11164 | if (p.GodLevel >= 200) | ||
11186 | { | 11165 | { |
11187 | if (p.GodLevel >= 200) | 11166 | groupProfileReply.GroupData.OpenEnrollment = true; |
11188 | { | 11167 | groupProfileReply.GroupData.MembershipFee = 0; |
11189 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
11190 | groupProfileReply.GroupData.MembershipFee = 0; | ||
11191 | } | ||
11192 | } | 11168 | } |
11193 | } | 11169 | } |
11194 | |||
11195 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | ||
11196 | } | 11170 | } |
11171 | |||
11172 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | ||
11173 | |||
11174 | if(grpID == lastGroupProfileRequestID) | ||
11175 | lastGroupProfileRequestTS = Util.GetTimeStampMS() - 7000; | ||
11176 | |||
11197 | return true; | 11177 | return true; |
11198 | } | 11178 | } |
11199 | private bool HandleGroupMembersRequest(IClientAPI sender, Packet Pack) | 11179 | private bool HandleGroupMembersRequest(IClientAPI sender, Packet Pack) |
@@ -12955,23 +12935,57 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12955 | 12935 | ||
12956 | public void RefreshGroupMembership() | 12936 | public void RefreshGroupMembership() |
12957 | { | 12937 | { |
12958 | if (m_GroupsModule != null) | 12938 | lock(m_groupPowers) |
12959 | { | 12939 | { |
12960 | GroupMembershipData[] GroupMembership = | 12940 | if (m_GroupsModule != null) |
12941 | { | ||
12942 | GroupMembershipData[] GroupMembership = | ||
12961 | m_GroupsModule.GetMembershipData(AgentId); | 12943 | m_GroupsModule.GetMembershipData(AgentId); |
12962 | 12944 | ||
12963 | m_groupPowers.Clear(); | 12945 | m_groupPowers.Clear(); |
12964 | 12946 | ||
12965 | if (GroupMembership != null) | 12947 | if (GroupMembership != null) |
12966 | { | ||
12967 | for (int i = 0; i < GroupMembership.Length; i++) | ||
12968 | { | 12948 | { |
12969 | m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers; | 12949 | for (int i = 0; i < GroupMembership.Length; i++) |
12950 | { | ||
12951 | m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers; | ||
12952 | } | ||
12970 | } | 12953 | } |
12971 | } | 12954 | } |
12972 | } | 12955 | } |
12973 | } | 12956 | } |
12974 | 12957 | ||
12958 | public void UpdateGroupMembership(GroupMembershipData[] data) | ||
12959 | { | ||
12960 | lock(m_groupPowers) | ||
12961 | { | ||
12962 | m_groupPowers.Clear(); | ||
12963 | |||
12964 | if (data != null) | ||
12965 | { | ||
12966 | for (int i = 0; i < data.Length; i++) | ||
12967 | m_groupPowers[data[i].GroupID] = data[i].GroupPowers; | ||
12968 | } | ||
12969 | } | ||
12970 | } | ||
12971 | |||
12972 | public void GroupMembershipRemove(UUID GroupID) | ||
12973 | { | ||
12974 | lock(m_groupPowers) | ||
12975 | { | ||
12976 | if(m_groupPowers.ContainsKey(GroupID)) | ||
12977 | m_groupPowers.Remove(GroupID); | ||
12978 | } | ||
12979 | } | ||
12980 | |||
12981 | public void GroupMembershipAddReplace(UUID GroupID,ulong GroupPowers) | ||
12982 | { | ||
12983 | lock(m_groupPowers) | ||
12984 | { | ||
12985 | m_groupPowers[GroupID] = GroupPowers; | ||
12986 | } | ||
12987 | } | ||
12988 | |||
12975 | public string Report() | 12989 | public string Report() |
12976 | { | 12990 | { |
12977 | return m_udpClient.GetStats(); | 12991 | return m_udpClient.GetStats(); |