aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/GroupData.cs (renamed from OpenSim/Framework/LLGroup.cs)45
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs217
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
6 files changed, 100 insertions, 176 deletions
diff --git a/OpenSim/Framework/LLGroup.cs b/OpenSim/Framework/GroupData.cs
index 7405b97..66b1875 100644
--- a/OpenSim/Framework/LLGroup.cs
+++ b/OpenSim/Framework/GroupData.cs
@@ -34,47 +34,24 @@ using System.Text;
34 34
35namespace OpenSim.Framework 35namespace OpenSim.Framework
36{ 36{
37 public class GroupData 37 public class GroupMembershipData
38 { 38 {
39 public string ActiveGroupTitle; 39 // Group base data
40 //
40 public UUID GroupID; 41 public UUID GroupID;
41 public List<UUID> GroupMembers; 42 public string GroupName;
42 public string groupName;
43 public uint groupPowers = (uint)(GroupPowers.AllowLandmark | GroupPowers.AllowSetHome);
44 public List<string> GroupTitles;
45 public bool AcceptNotices = true;
46 public bool AllowPublish = true; 43 public bool AllowPublish = true;
47 public string Charter = "Cool Group Yeah!"; 44 public bool MaturePublish = true;
48 public int contribution = 0; 45 public UUID Charter = UUID.Zero;
49 public UUID FounderID = UUID.Zero; 46 public UUID FounderID = UUID.Zero;
50 public int groupMembershipCost = 0;
51 public int groupRollsCount = 1;
52 public UUID GroupPicture = UUID.Zero; 47 public UUID GroupPicture = UUID.Zero;
53 public bool MaturePublish = true;
54 public int MembershipFee = 0; 48 public int MembershipFee = 0;
55 public bool OpenEnrollment = true; 49 public bool OpenEnrollment = true;
56 public bool ShowInList = true;
57 50
58 public GroupData() 51 // Per user data
59 { 52 //
60 GroupTitles = new List<string>(); 53 public bool AcceptNotices = true;
61 GroupMembers = new List<UUID>(); 54 public int Contribution = 0;
62 } 55 public uint GroupPowers = 0;
63
64 public GroupPowers ActiveGroupPowers
65 {
66 set { groupPowers = (uint)value; }
67 get { return (GroupPowers)groupPowers; }
68 }
69 }
70
71 public class GroupList
72 {
73 public List<UUID> m_GroupList;
74
75 public GroupList()
76 {
77 m_GroupList = new List<UUID>();
78 }
79 } 56 }
80} 57}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index bf31a78..a8813c9 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -845,7 +845,7 @@ namespace OpenSim.Framework
845 845
846 void SendAdminResponse(UUID Token, uint AdminLevel); 846 void SendAdminResponse(UUID Token, uint AdminLevel);
847 847
848 void SendGroupMembership(GroupData[] GroupMembership); 848 void SendGroupMembership(GroupMembershipData[] GroupMembership);
849 849
850 void SendGroupNameReply(UUID groupLLUID, string GroupName); 850 void SendGroupNameReply(UUID groupLLUID, string GroupName);
851 851
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 19983dc..6801310 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6632,7 +6632,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6632 OutPacket(respondPacket, ThrottleOutPacketType.Task); 6632 OutPacket(respondPacket, ThrottleOutPacketType.Task);
6633 } 6633 }
6634 6634
6635 public void SendGroupMembership(GroupData[] GroupMembership) 6635 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
6636 { 6636 {
6637 AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); 6637 AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket();
6638 AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[GroupMembership.Length]; 6638 AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[GroupMembership.Length];
@@ -6640,11 +6640,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6640 { 6640 {
6641 AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock(); 6641 AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock();
6642 Group.AcceptNotices = GroupMembership[i].AcceptNotices; 6642 Group.AcceptNotices = GroupMembership[i].AcceptNotices;
6643 Group.Contribution = GroupMembership[i].contribution; 6643 Group.Contribution = GroupMembership[i].Contribution;
6644 Group.GroupID = GroupMembership[i].GroupID; 6644 Group.GroupID = GroupMembership[i].GroupID;
6645 Group.GroupInsigniaID = GroupMembership[i].GroupPicture; 6645 Group.GroupInsigniaID = GroupMembership[i].GroupPicture;
6646 Group.GroupName = Utils.StringToBytes(GroupMembership[i].groupName); 6646 Group.GroupName = Utils.StringToBytes(GroupMembership[i].GroupName);
6647 Group.GroupPowers = GroupMembership[i].groupPowers; 6647 Group.GroupPowers = GroupMembership[i].GroupPowers;
6648 Groups[i] = Group; 6648 Groups[i] = Group;
6649 Groupupdate.GroupData = Groups; 6649 Groupupdate.GroupData = Groups;
6650 6650
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs
index 5495f5a..0bb3c32 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs
@@ -39,15 +39,22 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
39{ 39{
40 public class GroupsModule : IRegionModule 40 public class GroupsModule : IRegionModule
41 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log =
43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 44
44 private Dictionary<UUID, GroupList> m_grouplistmap = new Dictionary<UUID, GroupList>(); 45 private Dictionary<UUID, GroupMembershipData> m_GroupMap =
45 private Dictionary<UUID, GroupData> m_groupmap = new Dictionary<UUID, GroupData>(); 46 new Dictionary<UUID, GroupMembershipData>();
46 private Dictionary<UUID, IClientAPI> m_iclientmap = new Dictionary<UUID, IClientAPI>();
47 private Dictionary<UUID, GroupData> m_groupUUIDGroup = new Dictionary<UUID, GroupData>();
48 private UUID opensimulatorGroupID = new UUID("00000000-68f9-1111-024e-222222111123");
49 47
50 private List<Scene> m_scene = new List<Scene>(); 48 private Dictionary<UUID, IClientAPI> m_ClientMap =
49 new Dictionary<UUID, IClientAPI>();
50
51 private UUID opensimulatorGroupID =
52 new UUID("00000000-68f9-1111-024e-222222111123");
53
54 private List<Scene> m_SceneList = new List<Scene>();
55
56 private static GroupMembershipData osGroup =
57 new GroupMembershipData();
51 58
52 #region IRegionModule Members 59 #region IRegionModule Members
53 60
@@ -73,26 +80,27 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
73 80
74 m_log.Info("[GROUPS] Activated default groups module"); 81 m_log.Info("[GROUPS] Activated default groups module");
75 82
76 lock (m_scene) 83 lock (m_SceneList)
77 { 84 {
78 m_scene.Add(scene); 85 if (!m_SceneList.Contains(scene))
86 {
87 if (m_SceneList.Count == 0)
88 {
89 osGroup.GroupID = opensimulatorGroupID;
90 osGroup.GroupName = "OpenSimulator Testing";
91 osGroup.GroupPowers =
92 (uint)(GroupPowers.AllowLandmark |
93 GroupPowers.AllowSetHome);
94 m_GroupMap[opensimulatorGroupID] = osGroup;
95 }
96 m_SceneList.Add(scene);
97 }
79 } 98 }
99
80 scene.EventManager.OnNewClient += OnNewClient; 100 scene.EventManager.OnNewClient += OnNewClient;
81 scene.EventManager.OnClientClosed += OnClientClosed; 101 scene.EventManager.OnClientClosed += OnClientClosed;
82 scene.EventManager.OnGridInstantMessageToGroupsModule += OnGridInstantMessage; 102 scene.EventManager.OnGridInstantMessageToGroupsModule +=
83 lock (m_groupUUIDGroup) 103 OnGridInstantMessage;
84 {
85
86 GroupData OpenSimulatorGroup = new GroupData();
87 OpenSimulatorGroup.ActiveGroupTitle = "OpenSimulator Tester";
88 OpenSimulatorGroup.GroupID = opensimulatorGroupID;
89 OpenSimulatorGroup.groupName = "OpenSimulator Testing";
90 OpenSimulatorGroup.ActiveGroupPowers = GroupPowers.AllowSetHome;
91 OpenSimulatorGroup.GroupTitles.Add("OpenSimulator Tester");
92 if (!m_groupUUIDGroup.ContainsKey(opensimulatorGroupID))
93 m_groupUUIDGroup.Add(opensimulatorGroupID, OpenSimulatorGroup);
94 }
95 //scene.EventManager.
96 } 104 }
97 105
98 public void PostInitialise() 106 public void PostInitialise()
@@ -102,21 +110,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
102 public void Close() 110 public void Close()
103 { 111 {
104 m_log.Info("[GROUP]: Shutting down group module."); 112 m_log.Info("[GROUP]: Shutting down group module.");
105 lock (m_iclientmap) 113 lock (m_ClientMap)
106 { 114 {
107 m_iclientmap.Clear(); 115 m_ClientMap.Clear();
108 } 116 }
109 117
110 lock (m_groupmap) 118 lock (m_GroupMap)
111 { 119 {
112 m_groupmap.Clear(); 120 m_GroupMap.Clear();
113 } 121 }
114
115 lock (m_grouplistmap)
116 {
117 m_grouplistmap.Clear();
118 }
119 GC.Collect();
120 } 122 }
121 123
122 public string Name 124 public string Name
@@ -138,159 +140,104 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
138 client.OnInstantMessage += OnInstantMessage; 140 client.OnInstantMessage += OnInstantMessage;
139 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; 141 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
140 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; 142 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
141 lock (m_iclientmap) 143 lock (m_ClientMap)
142 {
143 if (!m_iclientmap.ContainsKey(client.AgentId))
144 {
145 m_iclientmap.Add(client.AgentId, client);
146 }
147 }
148 GroupData OpenSimulatorGroup = null;
149 lock (m_groupUUIDGroup)
150 { 144 {
151 OpenSimulatorGroup = m_groupUUIDGroup[opensimulatorGroupID]; 145 if (!m_ClientMap.ContainsKey(client.AgentId))
152 if (!OpenSimulatorGroup.GroupMembers.Contains(client.AgentId))
153 { 146 {
154 OpenSimulatorGroup.GroupMembers.Add(client.AgentId); 147 m_ClientMap.Add(client.AgentId, client);
155 m_groupUUIDGroup[opensimulatorGroupID] = OpenSimulatorGroup;
156 } 148 }
157
158 } 149 }
159 150
160 lock (m_groupmap) 151 m_log.Info("[GROUP]: Adding " + client.Name + " to " +
161 { 152 osGroup.GroupName + " ");
162 if (!m_groupmap.ContainsKey(client.AgentId))
163 {
164 m_groupmap.Add(client.AgentId, OpenSimulatorGroup);
165 }
166 }
167 GroupList testGroupList = new GroupList();
168 testGroupList.m_GroupList.Add(OpenSimulatorGroup.GroupID);
169 153
170 lock (m_grouplistmap) 154 GroupMembershipData[] updateGroups = new GroupMembershipData[1];
171 { 155 updateGroups[0] = osGroup;
172 if (!m_grouplistmap.ContainsKey(client.AgentId))
173 {
174 m_grouplistmap.Add(client.AgentId, testGroupList);
175 }
176 }
177 m_log.Info("[GROUP]: Adding " + client.Name + " to " + OpenSimulatorGroup.groupName + " ");
178 GroupData[] updateGroups = new GroupData[1];
179 updateGroups[0] = OpenSimulatorGroup;
180 156
181 client.SendGroupMembership(updateGroups); 157 client.SendGroupMembership(updateGroups);
182 } 158 }
183 159
184 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID AgentID, UUID SessionID) 160 private void OnAgentDataUpdateRequest(IClientAPI remoteClient,
161 UUID AgentID, UUID SessionID)
185 { 162 {
186 // Adam, this is one of those impossible to refactor items without resorting to .Split hackery 163 UUID ActiveGroupID;
164 string ActiveGroupName;
165 uint ActiveGroupPowers;
166
187 string firstname = remoteClient.FirstName; 167 string firstname = remoteClient.FirstName;
188 string lastname = remoteClient.LastName; 168 string lastname = remoteClient.LastName;
189 169
190 UUID ActiveGroupID = UUID.Zero;
191 uint ActiveGroupPowers = 0;
192 string ActiveGroupName = "OpenSimulator Tester";
193 string ActiveGroupTitle = "I IZ N0T"; 170 string ActiveGroupTitle = "I IZ N0T";
194 171
195 bool foundUser = false; 172 ActiveGroupID = osGroup.GroupID;
173 ActiveGroupName = osGroup.GroupName;
174 ActiveGroupPowers = osGroup.GroupPowers;
196 175
197 lock (m_iclientmap) 176 remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname,
198 { 177 lastname, ActiveGroupPowers, ActiveGroupName,
199 if (m_iclientmap.ContainsKey(remoteClient.AgentId)) 178 ActiveGroupTitle);
200 {
201 foundUser = true;
202 }
203 }
204 if (foundUser)
205 {
206 lock (m_groupmap)
207 {
208 if (m_groupmap.ContainsKey(remoteClient.AgentId))
209 {
210 GroupData grp = m_groupmap[remoteClient.AgentId];
211 if (grp != null)
212 {
213 ActiveGroupID = grp.GroupID;
214 ActiveGroupName = grp.groupName;
215 ActiveGroupPowers = grp.groupPowers;
216 ActiveGroupTitle = grp.ActiveGroupTitle;
217 }
218
219 remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, lastname, ActiveGroupPowers, ActiveGroupName, ActiveGroupTitle);
220 }
221 }
222 }
223 } 179 }
224 180
225 private void OnInstantMessage(IClientAPI client, UUID fromAgentID, 181 private void OnInstantMessage(IClientAPI client, UUID fromAgentID,
226 UUID fromAgentSession, UUID toAgentID, 182 UUID fromAgentSession, UUID toAgentID,
227 UUID imSessionID, uint timestamp, string fromAgentName, 183 UUID imSessionID, uint timestamp, string fromAgentName,
228 string message, byte dialog, bool fromGroup, byte offline, 184 string message, byte dialog, bool fromGroup, byte offline,
229 uint ParentEstateID, Vector3 Position, UUID RegionID, 185 uint ParentEstateID, Vector3 Position, UUID RegionID,
230 byte[] binaryBucket) 186 byte[] binaryBucket)
231 { 187 {
232 } 188 }
233 189
234 private void OnGridInstantMessage(GridInstantMessage msg) 190 private void OnGridInstantMessage(GridInstantMessage msg)
235 { 191 {
236 // Trigger the above event handler 192 // Trigger the above event handler
237 OnInstantMessage(null, new UUID(msg.fromAgentID), new UUID(msg.fromAgentSession), 193 OnInstantMessage(null, new UUID(msg.fromAgentID),
238 new UUID(msg.toAgentID), new UUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, 194 new UUID(msg.fromAgentSession),
239 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, 195 new UUID(msg.toAgentID), new UUID(msg.imSessionID),
240 new Vector3(msg.Position.X, msg.Position.Y, msg.Position.Z), new UUID(msg.RegionID), 196 msg.timestamp, msg.fromAgentName,
241 msg.binaryBucket); 197 msg.message, msg.dialog, msg.fromGroup, msg.offline,
198 msg.ParentEstateID,
199 new Vector3(msg.Position.X, msg.Position.Y, msg.Position.Z),
200 new UUID(msg.RegionID),
201 msg.binaryBucket);
242 } 202 }
203
243 private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client) 204 private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
244 { 205 {
245 string groupnamereply = "Unknown"; 206 string groupnamereply = "Unknown";
246 UUID groupUUID = UUID.Zero; 207 UUID groupUUID = UUID.Zero;
247 208
248 lock (m_groupUUIDGroup) 209 lock (m_GroupMap)
249 { 210 {
250 if (m_groupUUIDGroup.ContainsKey(id)) 211 if (m_GroupMap.ContainsKey(id))
251 { 212 {
252 GroupData grp = m_groupUUIDGroup[id]; 213 GroupMembershipData grp = m_GroupMap[id];
253 groupnamereply = grp.groupName; 214 groupnamereply = grp.GroupName;
254 groupUUID = grp.GroupID; 215 groupUUID = grp.GroupID;
255 } 216 }
256 } 217 }
257 remote_client.SendGroupNameReply(groupUUID, groupnamereply); 218 remote_client.SendGroupNameReply(groupUUID, groupnamereply);
258 } 219 }
220
259 private void OnClientClosed(UUID agentID) 221 private void OnClientClosed(UUID agentID)
260 { 222 {
261 lock (m_iclientmap) 223 lock (m_ClientMap)
262 { 224 {
263 if (m_iclientmap.ContainsKey(agentID)) 225 if (m_ClientMap.ContainsKey(agentID))
264 { 226 {
265 IClientAPI cli = m_iclientmap[agentID]; 227 IClientAPI cli = m_ClientMap[agentID];
266 if (cli != null) 228 if (cli != null)
267 { 229 {
268 m_log.Info("[GROUP]: Removing all reference to groups for " + cli.Name); 230 m_log.Info("[GROUP]: Removing all reference to groups "+
231 "for " + cli.Name);
269 } 232 }
270 else 233 else
271 { 234 {
272 m_log.Info("[GROUP]: Removing all reference to groups for " + agentID.ToString()); 235 m_log.Info("[GROUP]: Removing all reference to groups "+
236 "for " + agentID.ToString());
273 } 237 }
274 m_iclientmap.Remove(agentID); 238 m_ClientMap.Remove(agentID);
275 }
276 }
277
278 lock (m_groupmap)
279 {
280 if (m_groupmap.ContainsKey(agentID))
281 {
282 m_groupmap.Remove(agentID);
283 }
284 }
285
286 lock (m_grouplistmap)
287 {
288 if (m_grouplistmap.ContainsKey(agentID))
289 {
290 m_grouplistmap.Remove(agentID);
291 } 239 }
292 } 240 }
293 GC.Collect();
294 } 241 }
295 } 242 }
296} 243}
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index 9aa0403..8617605 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -109,7 +109,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
109 109
110 } 110 }
111 111
112 public void SendGroupMembership(GroupData[] GroupMembership) 112 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
113 { 113 {
114 114
115 } 115 }
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 5e7523f..2d479be 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -667,7 +667,7 @@ namespace OpenSim.Region.Examples.SimpleModule
667 667
668 } 668 }
669 669
670 public void SendGroupMembership(GroupData[] GroupMembership) 670 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
671 { 671 {
672 672
673 } 673 }