aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGroupsModule.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs119
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs7
3 files changed, 121 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
index 0d1f4f4..61db1b8 100644
--- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
@@ -92,6 +92,7 @@ namespace OpenSim.Region.Framework.Interfaces
92 GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog); 92 GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog);
93 void SendAgentGroupDataUpdate(IClientAPI remoteClient); 93 void SendAgentGroupDataUpdate(IClientAPI remoteClient);
94 void JoinGroupRequest(IClientAPI remoteClient, UUID GroupID); 94 void JoinGroupRequest(IClientAPI remoteClient, UUID GroupID);
95 void JoinGroup(string agentID, UUID GroupID);
95 void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); 96 void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID);
96 void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); 97 void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID);
97 void EjectGroupMember(IClientAPI remoteClient, UUID agentID, UUID GroupID, UUID EjecteeID); 98 void EjectGroupMember(IClientAPI remoteClient, UUID agentID, UUID GroupID, UUID EjecteeID);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f3b76c8..b0a7300 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -334,6 +334,9 @@ namespace OpenSim.Region.Framework.Scenes
334 protected ICapabilitiesModule m_capsModule; 334 protected ICapabilitiesModule m_capsModule;
335 protected IGroupsModule m_groupsModule; 335 protected IGroupsModule m_groupsModule;
336 336
337 // The lists of groups to automatically add to logging in users.
338 private Dictionary<string, string[]> m_AutoGroups;
339
337 private Dictionary<string, string> m_extraSettings; 340 private Dictionary<string, string> m_extraSettings;
338 341
339 /// <summary> 342 /// <summary>
@@ -1137,6 +1140,50 @@ namespace OpenSim.Region.Framework.Scenes
1137 1140
1138 #endregion Interest Management 1141 #endregion Interest Management
1139 1142
1143 #region Group
1144
1145 IConfig groupsConfig = m_config.Configs["Groups"];
1146 m_AutoGroups = new Dictionary<string, string[]>();
1147 if (groupsConfig != null)
1148 {
1149 string groups = groupsConfig.GetString("AddDefaultGroup", string.Empty);
1150 if (groups.Length > 0)
1151 {
1152 try
1153 {
1154 m_AutoGroups.Add("local", groups.Split('|'));
1155 }
1156 catch (ArgumentException)
1157 {
1158 m_log.Warn("[SCENE]: Duplicated AddDefaultGroup option.");
1159 }
1160 }
1161 string[] keys = groupsConfig.GetKeys();
1162 if (0 < keys.Length)
1163 {
1164 foreach (string k in keys)
1165 {
1166 if (k.StartsWith("AddHGDefaultGroup_"))
1167 {
1168 groups = groupsConfig.GetString(k, string.Empty);
1169 if (groups.Length > 0)
1170 {
1171 try
1172 {
1173 m_AutoGroups.Add(k.Substring(18), groups.Split('|'));
1174 }
1175 catch (ArgumentException)
1176 {
1177 m_log.WarnFormat("[SCENE]: Duplicated {0} option.", k);
1178 }
1179 }
1180 }
1181 }
1182 }
1183 }
1184
1185 #endregion Group
1186
1140 StatsReporter = new SimStatsReporter(this); 1187 StatsReporter = new SimStatsReporter(this);
1141 1188
1142 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 1189 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
@@ -4346,6 +4393,72 @@ namespace OpenSim.Region.Framework.Scenes
4346 return false; 4393 return false;
4347 } 4394 }
4348 4395
4396 List<UUID> agentGroups = new List<UUID>();
4397 GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
4398
4399 if (null != GroupMembership)
4400 {
4401 for(int i = 0;i < GroupMembership.Length;i++)
4402 agentGroups.Add(GroupMembership[i].GroupID);
4403 // We get called twice, the first time the name is set to a single space.
4404// if (" " != agent.Name)
4405 {
4406 try
4407 {
4408 // Check for auto add groups here and add them if needed.
4409 if (UserManagementModule.IsLocalGridUser(agent.AgentID))
4410 {
4411 string[] groupIDs = m_AutoGroups["local"];
4412 foreach(string name in groupIDs)
4413 {
4414 GroupRecord g = m_groupsModule.GetGroupRecord(name);
4415 if (null != g)
4416 {
4417 UUID group = g.GroupID;
4418 if(!agentGroups.Contains(group))
4419 {
4420 m_groupsModule.JoinGroup(agent.AgentID.ToString(), group);
4421 agentGroups.Add(group);
4422 m_log.InfoFormat("[CONNECTION BEGIN]: Automatically added {0} to group {1}.", agent.AgentID, name);
4423 }
4424 }
4425 else
4426 m_log.ErrorFormat("[CONNECTION BEGIN]: Bogus group {0}, not adding {1}.", name, agent.AgentID);
4427 }
4428 }
4429 else
4430 {
4431 // agent.AgentID should look like this - @grid.com:8002 01234567-89ab-cdef-0123-456789abcdef
4432 string grid = agent.AgentID.ToString().Split(':')[0];
4433 grid = grid.Substring(1);
4434 m_log.InfoFormat("[CONNECTION BEGIN]: HYPERGRID agent {0} from grid {1}, checking auto groups.", agent.AgentID, grid);
4435 string[] groupIDs = m_AutoGroups[grid];
4436 foreach(string name in groupIDs)
4437 {
4438 GroupRecord g = m_groupsModule.GetGroupRecord(name);
4439 if (null != g)
4440 {
4441 UUID group = g.GroupID;
4442 if(!agentGroups.Contains(group))
4443 {
4444 m_groupsModule.JoinGroup(agent.AgentID.ToString(), group);
4445 agentGroups.Add(group);
4446 m_log.InfoFormat("[CONNECTION BEGIN]: Automatically added HYPERGRIDDER {0} @ {1} to group {2}.", agent.AgentID, grid, name);
4447 }
4448 }
4449 else
4450 m_log.ErrorFormat("[CONNECTION BEGIN]: Bogus group {0} for HYPERGRIDDERS, not adding {1}.", name, agent.AgentID);
4451 }
4452 }
4453 }
4454 catch (KeyNotFoundException)
4455 {
4456 // Do nothing.
4457 }
4458
4459 }
4460 }
4461
4349 // public access 4462 // public access
4350 if (RegionInfo.EstateSettings.PublicAccess) 4463 if (RegionInfo.EstateSettings.PublicAccess)
4351 return true; 4464 return true;
@@ -4372,9 +4485,6 @@ namespace OpenSim.Region.Framework.Scenes
4372 if(estateGroups.Length == 0) 4485 if(estateGroups.Length == 0)
4373 goto Label_GroupsDone; 4486 goto Label_GroupsDone;
4374 4487
4375 List<UUID> agentGroups = new List<UUID>();
4376 GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
4377
4378 if(GroupMembership == null) 4488 if(GroupMembership == null)
4379 { 4489 {
4380 m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!"); 4490 m_log.ErrorFormat("[CONNECTION BEGIN]: GroupMembership is null!");
@@ -4384,9 +4494,6 @@ namespace OpenSim.Region.Framework.Scenes
4384 if(GroupMembership.Length == 0) 4494 if(GroupMembership.Length == 0)
4385 goto Label_GroupsDone; 4495 goto Label_GroupsDone;
4386 4496
4387 for(int i = 0;i < GroupMembership.Length;i++)
4388 agentGroups.Add(GroupMembership[i].GroupID);
4389
4390 foreach(UUID group in estateGroups) 4497 foreach(UUID group in estateGroups)
4391 { 4498 {
4392 if(agentGroups.Contains(group)) 4499 if(agentGroups.Contains(group))
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 65d50bb..20b7c5e 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -1113,6 +1113,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1113 SendAgentGroupDataUpdate(remoteClient, true); 1113 SendAgentGroupDataUpdate(remoteClient, true);
1114 } 1114 }
1115 1115
1116 public void JoinGroup(string agentID, UUID groupID)
1117 {
1118 // Should check to see if OpenEnrollment, or if there's an outstanding invitation
1119 UUID u = new UUID(agentID);
1120 m_groupData.AddAgentToGroup(u, u, groupID, UUID.Zero);
1121 }
1122
1116 public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID) 1123 public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID)
1117 { 1124 {
1118 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1125 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);