From f42d085ab17098709bcba0c816c9742a213d3c01 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 16 Sep 2009 15:06:08 -0700 Subject: SceneObjectGroup cleanup. Removes the default constructor and unnecessary null checks on m_rootPart --- .../Region/Examples/SimpleModule/ComplexObject.cs | 4 - .../Region/Framework/Scenes/SceneObjectGroup.cs | 110 ++++++--------------- .../Scenes/Serialization/SceneObjectSerializer.cs | 53 +++++----- .../Framework/Scenes/Tests/EntityManagerTests.cs | 4 +- .../Framework/Scenes/Tests/ScenePresenceTests.cs | 3 +- .../ContentManagementSystem/PointMetaEntity.cs | 3 +- 6 files changed, 53 insertions(+), 124 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs index f9c3fa6..3809749 100644 --- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs @@ -73,10 +73,6 @@ namespace OpenSim.Region.Examples.SimpleModule base.UpdateMovement(); } - public ComplexObject() - { - } - public ComplexObject(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos) : base(ownerID, pos, PrimitiveBaseShape.Default) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6ba7e41..3c17bbe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -250,16 +250,7 @@ namespace OpenSim.Region.Framework.Scenes /// public override Vector3 AbsolutePosition { - get - { - if (m_rootPart == null) - { - throw new NullReferenceException( - string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid)); - } - - return m_rootPart.GroupPosition; - } + get { return m_rootPart.GroupPosition; } set { Vector3 val = value; @@ -291,41 +282,19 @@ namespace OpenSim.Region.Framework.Scenes public override uint LocalId { - get - { - if (m_rootPart == null) - { - m_log.Error("[SCENE OBJECT GROUP]: Unable to find the rootpart for a LocalId Request!"); - return 0; - } - - return m_rootPart.LocalId; - } + get { return m_rootPart.LocalId; } set { m_rootPart.LocalId = value; } } public override UUID UUID { - get { - if (m_rootPart == null) - { - m_log.Error("Got a null rootpart while requesting UUID. Called from: ", new Exception()); - return UUID.Zero; - } - else return m_rootPart.UUID; - } + get { return m_rootPart.UUID; } set { m_rootPart.UUID = value; } } public UUID OwnerID { - get - { - if (m_rootPart == null) - return UUID.Zero; - - return m_rootPart.OwnerID; - } + get { return m_rootPart.OwnerID; } set { m_rootPart.OwnerID = value; } } @@ -366,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes { m_isSelected = value; // Tell physics engine that group is selected - if (m_rootPart != null && m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor != null) { m_rootPart.PhysActor.Selected = value; // Pass it on to the children. @@ -399,13 +368,6 @@ namespace OpenSim.Region.Framework.Scenes #region Constructors /// - /// Constructor - /// - public SceneObjectGroup() - { - } - - /// /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart. /// The original SceneObjectPart will be used rather than a copy, preserving /// its existing localID and UUID. @@ -419,9 +381,8 @@ namespace OpenSim.Region.Framework.Scenes /// Constructor. This object is added to the scene later via AttachToScene() /// public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) - { - Vector3 rootOffset = new Vector3(0, 0, 0); - SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, rootOffset)); + { + SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero)); } /// @@ -462,11 +423,7 @@ namespace OpenSim.Region.Framework.Scenes public UUID GetFromItemID() { - if (m_rootPart != null) - { - return m_rootPart.FromItemID; - } - return UUID.Zero; + return m_rootPart.FromItemID; } /// @@ -958,11 +915,7 @@ namespace OpenSim.Region.Framework.Scenes public byte GetAttachmentPoint() { - if (m_rootPart != null) - { - return m_rootPart.Shape.State; - } - return (byte)0; + return m_rootPart.Shape.State; } public void ClearPartAttachmentData() @@ -1071,7 +1024,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// public void SetRootPart(SceneObjectPart part) - { + { + if (part == null) + throw new ArgumentNullException("Cannot give SceneObjectGroup a null root SceneObjectPart"); + part.SetParent(this); m_rootPart = part; if (!IsAttachment) @@ -1224,7 +1180,7 @@ namespace OpenSim.Region.Framework.Scenes if (!silent) { - if (m_rootPart != null && part == m_rootPart) + if (part == m_rootPart) avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); } } @@ -1447,7 +1403,7 @@ namespace OpenSim.Region.Framework.Scenes /// internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) { - if (m_rootPart != null && m_rootPart.UUID == part.UUID) + if (m_rootPart.UUID == part.UUID) { if (IsAttachment) { @@ -1881,12 +1837,6 @@ namespace OpenSim.Region.Framework.Scenes if (m_isDeleted) return; - // This is what happens when an orphanced link set child prim's - // group was queued when it was linked - // - if (m_rootPart == null) - return; - // Even temporary objects take part in physics (e.g. temp-on-rez bullets) //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) // return; @@ -3129,26 +3079,22 @@ namespace OpenSim.Region.Framework.Scenes int yaxis = 4; int zaxis = 8; - if (m_rootPart != null) - { - setX = ((axis & xaxis) != 0) ? true : false; - setY = ((axis & yaxis) != 0) ? true : false; - setZ = ((axis & zaxis) != 0) ? true : false; + setX = ((axis & xaxis) != 0) ? true : false; + setY = ((axis & yaxis) != 0) ? true : false; + setZ = ((axis & zaxis) != 0) ? true : false; - float setval = (rotate10 > 0) ? 1f : 0f; + float setval = (rotate10 > 0) ? 1f : 0f; - if (setX) - m_rootPart.RotationAxis.X = setval; - if (setY) - m_rootPart.RotationAxis.Y = setval; - if (setZ) - m_rootPart.RotationAxis.Z = setval; - - if (setX || setY || setZ) - { - m_rootPart.SetPhysicsAxisRotation(); - } + if (setX) + m_rootPart.RotationAxis.X = setval; + if (setY) + m_rootPart.RotationAxis.Y = setval; + if (setZ) + m_rootPart.RotationAxis.Z = setval; + if (setX || setY || setZ) + { + m_rootPart.SetPhysicsAxisRotation(); } } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 5ae81cd..fe74158 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -65,8 +65,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); //int time = System.Environment.TickCount; - SceneObjectGroup sceneObject = new SceneObjectGroup(); - // libomv.types changes UUID to Guid xmlData = xmlData.Replace("", ""); xmlData = xmlData.Replace("", ""); @@ -88,17 +86,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization parts = doc.GetElementsByTagName("RootPart"); if (parts.Count == 0) - { throw new Exception("Invalid Xml format - no root part"); - } - else - { - sr = new StringReader(parts[0].InnerXml); - reader = new XmlTextReader(sr); - sceneObject.SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); - reader.Close(); - sr.Close(); - } + + sr = new StringReader(parts[0].InnerXml); + reader = new XmlTextReader(sr); + SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); + reader.Close(); + sr.Close(); parts = doc.GetElementsByTagName("Part"); @@ -119,16 +113,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(doc); + + return sceneObject; } catch (Exception e) { m_log.ErrorFormat( "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); + return null; } - - //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); - - return sceneObject; } /// @@ -194,8 +187,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); //int time = System.Environment.TickCount; - - SceneObjectGroup sceneObject = new SceneObjectGroup(); // libomv.types changes UUID to Guid xmlData = xmlData.Replace("", ""); @@ -212,21 +203,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); - // Process the root part first - if (parts.Count > 0) + if (parts.Count == 0) { - StringReader sr = new StringReader(parts[0].OuterXml); - XmlTextReader reader = new XmlTextReader(sr); - sceneObject.SetRootPart(SceneObjectPart.FromXml(reader)); - reader.Close(); - sr.Close(); + m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData); + return null; } + StringReader sr = new StringReader(parts[0].OuterXml); + XmlTextReader reader = new XmlTextReader(sr); + SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); + reader.Close(); + sr.Close(); + // Then deal with the rest for (int i = 1; i < parts.Count; i++) { - StringReader sr = new StringReader(parts[i].OuterXml); - XmlTextReader reader = new XmlTextReader(sr); + sr = new StringReader(parts[i].OuterXml); + reader = new XmlTextReader(sr); SceneObjectPart part = SceneObjectPart.FromXml(reader); sceneObject.AddPart(part); part.StoreUndoState(); @@ -238,15 +231,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // ever a problem. sceneObject.LoadScriptState(doc); + return sceneObject; } catch (Exception e) { m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); + return null; } - - //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); - - return sceneObject; } /// diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index bb8f27d..3b0e77f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -128,7 +128,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests private SceneObjectGroup NewSOG() { - SceneObjectGroup sog = new SceneObjectGroup(); SceneObjectPart sop = new SceneObjectPart(UUID.Random(), PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); sop.Name = RandomName(); sop.Description = sop.Name; @@ -136,9 +135,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests sop.SitName = RandomName(); sop.TouchName = RandomName(); sop.ObjectFlags |= (uint)PrimFlags.Phantom; - - sog.SetRootPart(sop); + SceneObjectGroup sog = new SceneObjectGroup(sop); scene.AddNewSceneObject(sog, false); return sog; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 7fb2d25..19c0fea 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -407,9 +407,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests sop.Shape.State = 1; sop.OwnerID = agent; - SceneObjectGroup sog = new SceneObjectGroup(); + SceneObjectGroup sog = new SceneObjectGroup(sop); sog.SetScene(scene); - sog.SetRootPart(sop); return sog; } diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs index 59b7289..fbe43d6 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs @@ -66,7 +66,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos) { - SceneObjectGroup x = new SceneObjectGroup(); SceneObjectPart y = new SceneObjectPart(); //Initialize part @@ -93,8 +92,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement y.TrimPermissions(); //Initialize group and add part as root part + SceneObjectGroup x = new SceneObjectGroup(y); x.SetScene(scene); - x.SetRootPart(y); x.RegionHandle = scene.RegionInfo.RegionHandle; x.SetScene(scene); -- cgit v1.1 From 69ef95693ae6451e2c754b22190557f3bf15777b Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 17 Sep 2009 15:38:17 +0100 Subject: Thank you, mcortez, for a patch to address showing users in group list Removed patch 0005, which was unrelated and likely accidental, and further didn't apply. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 102 +++++++++++++++------ .../XmlRpcGroupsServicesConnectorModule.cs | 42 ++++++--- 2 files changed, 100 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 37e1ed4..d5cbfd4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -281,7 +281,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { - GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); } @@ -485,6 +488,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups bucket[18] = 0; //dunno } + m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); if (OnNewGroupNotice != null) { @@ -494,7 +498,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Send notice out to everyone that wants notices foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) { - if (member.AcceptNotices) + if (m_debugEnabled) + { + UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID); + if (targetUserProfile != null) + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices); + } + else + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); + } + } + + if (member.AcceptNotices) { // Build notice IIM GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); @@ -614,13 +631,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); List data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title); - } - } return data; @@ -632,14 +642,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRolesData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members); - } - } - return data; } @@ -650,14 +652,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRoleMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID); - } - } - return data; @@ -808,7 +802,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - // TODO: Security Checks? + // Security Checks are handled in the Groups Service. GroupRequestID grID = GetClientGroupRequestID(remoteClient); @@ -825,6 +819,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups case OpenMetaverse.GroupRoleUpdate.UpdateAll: case OpenMetaverse.GroupRoleUpdate.UpdateData: case OpenMetaverse.GroupRoleUpdate.UpdatePowers: + if (m_debugEnabled) + { + GroupPowers gp = (GroupPowers)powers; + m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); + } m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); break; @@ -1195,6 +1194,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (GroupMembershipData membership in data) { + if (remoteClient.AgentId != dataForAgentID) + { + if (!membership.ListInProfile) + { + // If we're sending group info to remoteclient about another agent, + // filter out groups the other agent doesn't want to share. + continue; + } + } + OSDMap GroupDataMap = new OSDMap(6); OSDMap NewGroupDataMap = new OSDMap(1); @@ -1281,11 +1290,46 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); + GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); + } + + /// + /// Get a list of groups memberships for the agent that are marked "ListInProfile" + /// + /// + /// + private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) + { + List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); + GroupMembershipData[] membershipArray; + + if (requestingClient.AgentId != dataForAgentID) + { + Predicate showInProfile = delegate(GroupMembershipData membership) + { + return membership.ListInProfile; + }; + + membershipArray = membershipData.FindAll(showInProfile).ToArray(); + } + else + { + membershipArray = membershipData.ToArray(); + } + + if (m_debugEnabled) + { + m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); + foreach (GroupMembershipData membership in membershipArray) + { + m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); + } + } + return membershipArray; } private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index b3eaa37..805c3d4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -855,16 +855,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups IList parameters = new ArrayList(); parameters.Add(param); - XmlRpcRequest req; - if (!m_disableKeepAlive) - { - req = new XmlRpcRequest(function, parameters); - } - else - { - // This seems to solve a major problem on some windows servers - req = new NoKeepAliveXmlRpcRequest(function, parameters); - } + ConfigurableKeepAliveXmlRpcRequest req; + req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); XmlRpcResponse resp = null; @@ -874,10 +866,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } catch (Exception e) { + + m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); - + foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) + { + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); + } + foreach (string key in param.Keys) { m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); @@ -961,20 +959,24 @@ namespace Nwc.XmlRpc using System.Reflection; /// Class supporting the request side of an XML-RPC transaction. - public class NoKeepAliveXmlRpcRequest : XmlRpcRequest + public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest { private Encoding _encoding = new ASCIIEncoding(); private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); + private bool _disableKeepAlive = true; + + public string RequestResponse = String.Empty; /// Instantiate an XmlRpcRequest for a specified method and parameters. /// String designating the object.method on the server the request /// should be directed to. /// ArrayList of XML-RPC type parameters to invoke the request with. - public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) + public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) { MethodName = methodName; _params = parameters; + _disableKeepAlive = disableKeepAlive; } /// Send the request to the server. @@ -989,7 +991,7 @@ namespace Nwc.XmlRpc request.Method = "POST"; request.ContentType = "text/xml"; request.AllowWriteStreamBuffering = true; - request.KeepAlive = false; + request.KeepAlive = !_disableKeepAlive; Stream stream = request.GetRequestStream(); XmlTextWriter xml = new XmlTextWriter(stream, _encoding); @@ -1000,7 +1002,17 @@ namespace Nwc.XmlRpc HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); - XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); + string inputXml = input.ReadToEnd(); + XmlRpcResponse resp; + try + { + resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); + } + catch (Exception e) + { + RequestResponse = inputXml; + throw e; + } input.Close(); response.Close(); return resp; -- cgit v1.1 From 88294d9ebfcbaf1a382bb71a1fcacbe90913fbd8 Mon Sep 17 00:00:00 2001 From: Alan M Webb Date: Wed, 16 Sep 2009 17:31:14 -0400 Subject: While running a test case I had written to pursue problems with llDie() not always completely working, I discovered I was getting a lot (60+ over 6000 iterations of the test case) null pointer exceptions in various physics related checks in SceneObjectPart. It was apparent that the (frequent) checks for PhysActor being non-null is an insufficient protection in a highly asynchronous environment. The null reference exceptions are one example of failure, but it could also happen that a sequence started with one instance of a PhysicsActor might finish with another? Anyway, I have implemented a safer mechanism that should stop the errors. I re-ran my test case with the fix in place, and completed nearly 1000 iterations without a single occurrence. SceneObjectPart is seriously in need of rejigging, if not for this reason, then for its ridiculous size. Signed-off-by: dr scofield (aka dirk husemann) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 265 ++++++++++++--------- 1 file changed, 152 insertions(+), 113 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b0d279c..51bb114 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -415,9 +415,10 @@ namespace OpenSim.Region.Framework.Scenes set { m_name = value; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.SOPName = value; + pa.SOPName = value; } } } @@ -427,10 +428,11 @@ namespace OpenSim.Region.Framework.Scenes get { return (byte) m_material; } set { + PhysicsActor pa = PhysActor; m_material = (Material)value; - if (PhysActor != null) + if (pa != null) { - PhysActor.SetMaterial((int)value); + pa.SetMaterial((int)value); } } } @@ -501,11 +503,12 @@ namespace OpenSim.Region.Framework.Scenes get { // If this is a linkset, we don't want the physics engine mucking up our group position here. - if (PhysActor != null && _parentID == 0) + PhysicsActor pa = PhysActor; + if (pa != null && _parentID == 0) { - m_groupPosition.X = PhysActor.Position.X; - m_groupPosition.Y = PhysActor.Position.Y; - m_groupPosition.Z = PhysActor.Position.Z; + m_groupPosition.X = pa.Position.X; + m_groupPosition.Y = pa.Position.Y; + m_groupPosition.Z = pa.Position.Z; } if (IsAttachment) @@ -525,26 +528,27 @@ namespace OpenSim.Region.Framework.Scenes m_groupPosition = value; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { try { // Root prim actually goes at Position if (_parentID == 0) { - PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); + pa.Position = new PhysicsVector(value.X, value.Y, value.Z); } else { // To move the child prim in respect to the group position and rotation we have to calculate Vector3 resultingposition = GetWorldPosition(); - PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); + pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); Quaternion resultingrot = GetWorldRotation(); - PhysActor.Orientation = resultingrot; + pa.Orientation = resultingrot; } // Tell the physics engines that this prim changed. - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } catch (Exception e) { @@ -577,15 +581,16 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup != null && !ParentGroup.IsDeleted) { - if (_parentID != 0 && PhysActor != null) + PhysicsActor pa = PhysActor; + if (_parentID != 0 && pa != null) { Vector3 resultingposition = GetWorldPosition(); - PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); + pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); Quaternion resultingrot = GetWorldRotation(); - PhysActor.Orientation = resultingrot; + pa.Orientation = resultingrot; // Tell the physics engines that this prim changed. - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -595,13 +600,14 @@ namespace OpenSim.Region.Framework.Scenes { get { + PhysicsActor pa = PhysActor; // We don't want the physics engine mucking up the rotations in a linkset - if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (PhysActor != null)) + if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (pa != null)) { - if (PhysActor.Orientation.X != 0 || PhysActor.Orientation.Y != 0 - || PhysActor.Orientation.Z != 0 || PhysActor.Orientation.W != 0) + if (pa.Orientation.X != 0 || pa.Orientation.Y != 0 + || pa.Orientation.Z != 0 || pa.Orientation.W != 0) { - m_rotationOffset = PhysActor.Orientation; + m_rotationOffset = pa.Orientation; } } @@ -610,27 +616,28 @@ namespace OpenSim.Region.Framework.Scenes set { + PhysicsActor pa = PhysActor; StoreUndoState(); m_rotationOffset = value; - if (PhysActor != null) + if (pa != null) { try { // Root prim gets value directly if (_parentID == 0) { - PhysActor.Orientation = value; + pa.Orientation = value; //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); } else { // Child prim we have to calculate it's world rotationwel Quaternion resultingrotation = GetWorldRotation(); - PhysActor.Orientation = resultingrotation; + pa.Orientation = resultingrotation; //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); } - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); //} } catch (Exception ex) @@ -650,13 +657,14 @@ namespace OpenSim.Region.Framework.Scenes //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0 //|| PhysActor.Velocity.Z != 0) //{ - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - if (PhysActor.IsPhysical) + if (pa.IsPhysical) { - m_velocity.X = PhysActor.Velocity.X; - m_velocity.Y = PhysActor.Velocity.Y; - m_velocity.Z = PhysActor.Velocity.Z; + m_velocity.X = pa.Velocity.X; + m_velocity.Y = pa.Velocity.Y; + m_velocity.Z = pa.Velocity.Z; } } @@ -666,12 +674,13 @@ namespace OpenSim.Region.Framework.Scenes set { m_velocity = value; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - if (PhysActor.IsPhysical) + if (pa.IsPhysical) { - PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.Velocity = new PhysicsVector(value.X, value.Y, value.Z); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -688,9 +697,10 @@ namespace OpenSim.Region.Framework.Scenes { get { - if ((PhysActor != null) && PhysActor.IsPhysical) + PhysicsActor pa = PhysActor; + if ((pa != null) && pa.IsPhysical) { - m_angularVelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0); + m_angularVelocity.FromBytes(pa.RotationalVelocity.GetBytes(), 0); } return m_angularVelocity; } @@ -709,10 +719,11 @@ namespace OpenSim.Region.Framework.Scenes get { return m_description; } set { + PhysicsActor pa = PhysActor; m_description = value; - if (PhysActor != null) + if (pa != null) { - PhysActor.SOPDescription = value; + pa.SOPDescription = value; } } } @@ -806,14 +817,15 @@ namespace OpenSim.Region.Framework.Scenes if (m_shape != null) { m_shape.Scale = value; - if (PhysActor != null && m_parentGroup != null) + PhysicsActor pa = PhysActor; + if (pa != null && m_parentGroup != null) { if (m_parentGroup.Scene != null) { if (m_parentGroup.Scene.PhysicsScene != null) { - PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -1343,13 +1355,14 @@ if (m_shape != null) { RigidBody); // Basic Physics returns null.. joy joy joy. - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info - PhysActor.SOPDescription = this.Description; - PhysActor.LocalID = LocalId; + pa.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info + pa.SOPDescription = this.Description; + pa.LocalID = LocalId; DoPhysicsPropertyUpdate(RigidBody, true); - PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); + pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0); } } } @@ -1563,23 +1576,24 @@ if (m_shape != null) { } else { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - if (UsePhysics != PhysActor.IsPhysical || isNew) + if (UsePhysics != pa.IsPhysical || isNew) { - if (PhysActor.IsPhysical) // implies UsePhysics==false for this block + if (pa.IsPhysical) // implies UsePhysics==false for this block { if (!isNew) ParentGroup.Scene.RemovePhysicalPrim(1); - PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; - PhysActor.delink(); + pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; + pa.OnOutOfBounds -= PhysicsOutOfBounds; + pa.delink(); if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew)) { // destroy all joints connected to this now deactivated body - m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); + m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa); } // stop client-side interpolation of all joint proxy objects that have just been deleted @@ -1598,7 +1612,7 @@ if (m_shape != null) { //RotationalVelocity = new Vector3(0, 0, 0); } - PhysActor.IsPhysical = UsePhysics; + pa.IsPhysical = UsePhysics; // If we're not what we're supposed to be in the physics scene, recreate ourselves. @@ -1612,19 +1626,19 @@ if (m_shape != null) { { ParentGroup.Scene.AddPhysicalPrim(1); - PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds += PhysicsOutOfBounds; + pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; + pa.OnOutOfBounds += PhysicsOutOfBounds; if (_parentID != 0 && _parentID != LocalId) { if (ParentGroup.RootPart.PhysActor != null) { - PhysActor.link(ParentGroup.RootPart.PhysActor); + pa.link(ParentGroup.RootPart.PhysActor); } } } } } - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -1690,9 +1704,10 @@ if (m_shape != null) { public Vector3 GetGeometricCenter() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z); + return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); } else { @@ -1702,9 +1717,10 @@ if (m_shape != null) { public float GetMass() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - return PhysActor.Mass; + return pa.Mass; } else { @@ -1714,8 +1730,9 @@ if (m_shape != null) { public PhysicsVector GetForce() { - if (PhysActor != null) - return PhysActor.Force; + PhysicsActor pa = PhysActor; + if (pa != null) + return pa.Force; else return new PhysicsVector(); } @@ -2094,11 +2111,15 @@ if (m_shape != null) { public void PhysicsRequestingTerseUpdate() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); + Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); - if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) + if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | + m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | + m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | + m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) { m_parentGroup.AbsolutePosition = newpos; return; @@ -2294,14 +2315,15 @@ if (m_shape != null) { if (texture != null) m_shape.SculptData = texture.Data; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { // Tricks physics engine into thinking we've changed the part shape. PrimitiveBaseShape m_newshape = m_shape.Copy(); - PhysActor.Shape = m_newshape; + pa.Shape = m_newshape; m_shape = m_newshape; - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -2520,9 +2542,10 @@ if (m_shape != null) { public void SetBuoyancy(float fvalue) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.Buoyancy = fvalue; + pa.Buoyancy = fvalue; } } @@ -2538,56 +2561,62 @@ if (m_shape != null) { public void SetFloatOnWater(int floatYN) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { if (floatYN == 1) { - PhysActor.FloatOnWater = true; + pa.FloatOnWater = true; } else { - PhysActor.FloatOnWater = false; + pa.FloatOnWater = false; } } } public void SetForce(PhysicsVector force) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.Force = force; + pa.Force = force; } } public void SetVehicleType(int type) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleType = type; + pa.VehicleType = type; } } public void SetVehicleFloatParam(int param, float value) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleFloatParam(param, value); + pa.VehicleFloatParam(param, value); } } public void SetVehicleVectorParam(int param, PhysicsVector value) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleVectorParam(param, value); + pa.VehicleVectorParam(param, value); } } public void SetVehicleRotationParam(int param, Quaternion rotation) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleRotationParam(param, rotation); + pa.VehicleRotationParam(param, rotation); } } @@ -2615,10 +2644,11 @@ if (m_shape != null) { public void SetPhysicsAxisRotation() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.LockAngularMotion(RotationAxis); - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.LockAngularMotion(RotationAxis); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } @@ -3350,8 +3380,9 @@ if (m_shape != null) { { IsVD = false; // Switch it of for the course of this routine VolumeDetectActive = false; // and also permanently - if (PhysActor != null) - PhysActor.SetVolumeDetect(0); // Let physics know about it too + PhysicsActor pa = PhysActor; + if (pa != null) + pa.SetVolumeDetect(0); // Let physics know about it too } else { @@ -3399,18 +3430,21 @@ if (m_shape != null) { if (IsPhantom || IsAttachment) // note: this may have been changed above in the case of joints { AddFlag(PrimFlags.Phantom); - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); + m_parentGroup.Scene.PhysicsScene.RemovePrim(pa); /// that's not wholesome. Had to make Scene public - PhysActor = null; + pa = null; } } else // Not phantom { RemFlag(PrimFlags.Phantom); - if (PhysActor == null) + // This is NOT safe!! + PhysicsActor pa = PhysActor; + if (pa == null) { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( @@ -3421,9 +3455,9 @@ if (m_shape != null) { RotationOffset, UsePhysics); - if (PhysActor != null) + if (pa != null) { - PhysActor.LocalID = LocalId; + pa.LocalID = LocalId; DoPhysicsPropertyUpdate(UsePhysics, true); if (m_parentGroup != null) { @@ -3442,14 +3476,14 @@ if (m_shape != null) { (CollisionSound != UUID.Zero) ) { - PhysActor.OnCollisionUpdate += PhysicsCollision; - PhysActor.SubscribeEvents(1000); + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(1000); } } } else // it already has a physical representation { - PhysActor.IsPhysical = UsePhysics; + pa.IsPhysical = UsePhysics; DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim if (m_parentGroup != null) @@ -3472,9 +3506,10 @@ if (m_shape != null) { // Defensive programming calls for a check here. // Better would be throwing an exception that could be catched by a unit test as the internal // logic should make sure, this Physactor is always here. - if (this.PhysActor != null) + PhysicsActor pa = this.PhysActor; + if (pa != null) { - PhysActor.SetVolumeDetect(1); + pa.SetVolumeDetect(1); AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active this.VolumeDetectActive = true; } @@ -3482,10 +3517,11 @@ if (m_shape != null) { } else { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like - // (mumbles, well, at least if you have infinte CPU powers :-)) - if (this.PhysActor != null) + // (mumbles, well, at least if you have infinte CPU powers :-) ) + PhysicsActor pa = this.PhysActor; + if (pa != null) { - PhysActor.SetVolumeDetect(0); + pa.SetVolumeDetect(0); } this.VolumeDetectActive = false; } @@ -3543,10 +3579,11 @@ if (m_shape != null) { m_shape.PathTaperY = shapeBlock.PathTaperY; m_shape.PathTwist = shapeBlock.PathTwist; m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.Shape = m_shape; - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.Shape = m_shape; + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } // This is what makes vehicle trailers work @@ -3647,19 +3684,21 @@ if (m_shape != null) { ) { // subscribe to physics updates. - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.OnCollisionUpdate += PhysicsCollision; - PhysActor.SubscribeEvents(1000); + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(1000); } } else { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.UnSubscribeEvents(); - PhysActor.OnCollisionUpdate -= PhysicsCollision; + pa.UnSubscribeEvents(); + pa.OnCollisionUpdate -= PhysicsCollision; } } -- cgit v1.1 From 56edbe9b60e5ed5f1388e2d1d4d2a0d82cdeaf6d Mon Sep 17 00:00:00 2001 From: nlin Date: Fri, 18 Sep 2009 11:26:52 +0900 Subject: Alternate algorithm for fixing avatar capsule tilt (Mantis #2905) Eliminate dynamic capsule wobble. Instead introduce a small, fixed tilt, and allow the tilt to rotate with the avatar while moving; the tilt always faces away from the direction of avatar movement. The rotation while moving should eliminate direction-dependent behavior (e.g. only being able to climb on top of prims from certain directions). Falling animation is still too frequently invoked. Ideally the tilt should be completely eliminated, but doing so currently causes the avatar to fall through the terrain. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 132 ++++++++++++----------- 2 files changed, 73 insertions(+), 61 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 23fe2d3..6772f75 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2269,7 +2269,7 @@ namespace OpenSim.Region.Framework.Scenes { //Record the time we enter this state so we know whether to "land" or not m_animPersistUntil = DateTime.Now.Ticks; - return "FALLDOWN"; + return "FALLDOWN"; // this falling animation is invoked too frequently when capsule tilt correction is used - why? } } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index dd58a4e..a00ba11 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -107,6 +107,7 @@ namespace OpenSim.Region.Physics.OdePlugin public float MinimumGroundFlightOffset = 3f; private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. + private float m_tiltMagnitudeWhenProjectedOnXYPlane = 0.1131371f; // used to introduce a fixed tilt because a straight-up capsule falls through terrain, probably a bug in terrain collider private float m_buoyancy = 0f; @@ -477,7 +478,71 @@ namespace OpenSim.Region.Physics.OdePlugin } } } - + + private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector) + { + movementVector.Z = 0f; + float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y)); + if (magnitude < 0.1f) return; + + // normalize the velocity vector + float invMagnitude = 1.0f / magnitude; + movementVector.X *= invMagnitude; + movementVector.Y *= invMagnitude; + + // if we change the capsule heading too often, the capsule can fall down + // therefore we snap movement vector to just 1 of 4 predefined directions (ne, nw, se, sw), + // meaning only 4 possible capsule tilt orientations + if (movementVector.X > 0) + { + // east + if (movementVector.Y > 0) + { + // northeast + movementVector.X = (float)Math.Sqrt(2.0); + movementVector.Y = (float)Math.Sqrt(2.0); + } + else + { + // southeast + movementVector.X = (float)Math.Sqrt(2.0); + movementVector.Y = -(float)Math.Sqrt(2.0); + } + } + else + { + // west + if (movementVector.Y > 0) + { + // northwest + movementVector.X = -(float)Math.Sqrt(2.0); + movementVector.Y = (float)Math.Sqrt(2.0); + } + else + { + // southwest + movementVector.X = -(float)Math.Sqrt(2.0); + movementVector.Y = -(float)Math.Sqrt(2.0); + } + } + + + // movementVector.Z is zero + + // calculate tilt components based on desired amount of tilt and current (snapped) heading. + // the "-" sign is to force the tilt to be OPPOSITE the direction of movement. + float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane; + float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane; + + //m_log.Debug("[PHYSICS] changing avatar tilt"); + d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent); + d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced + d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent); + d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, yTiltComponent); // same as lowstop + d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f); + d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop + } + /// /// This creates the Avatar's physical Surrogate at the position supplied /// @@ -576,71 +641,13 @@ namespace OpenSim.Region.Physics.OdePlugin // (with -0..0 motor stops) falls into the terrain for reasons yet // to be comprehended in their entirety. #endregion + AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0)); d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop - #region Documentation of capsule motor StopERP and StopCFM parameters - // In addition to the above tilt, we allow a dynamic tilt, or - // wobble, to emerge as the capsule is pushed around the environment. - // We do this with an experimentally determined combination of - // StopERP and StopCFM which make the above motor stops soft. - // The softness of the stops should be tweaked according to two - // requirements: - // - // 1. Motor stops should be weak enough to allow enough wobble such - // that the capsule can tilt slightly more when moving, to allow - // "gliding" over obstacles: - // - // - // .-. - // / / - // / / - // _ / / _ - // / \ .-. / / / \ - // | | ----> / / / / | | - // | | / / `-' | | - // | | / / +------+ | | - // | | / / | | | | - // | | / / | | | | - // \_/ `-' +------+ \_/ - // ---------------------------------------------------------- - // - // Note that requirement 1 is made complicated by the ever-present - // slight avatar tilt (assigned in the above code to prevent avatar - // from falling through terrain), which introduces a direction-dependent - // bias into the wobble (wobbling against the existing tilt is harder - // than wobbling with the tilt), which makes it easier to walk over - // prims from some directions. I have tried to minimize this effect by - // minimizing the avatar tilt to the minimum that prevents the avatar from - // falling through the terrain. - // - // 2. Motor stops should be strong enough to prevent the capsule - // from being forced all the way to the ground; otherwise the - // capsule could slip underneath obstacles like this: - // _ _ - // / \ +------+ / \ - // | | ----> | | | | - // | | | | | | - // | | .--.___ +------+ | | - // | | `--.__`--.__ | | - // | | `--.__`--. | | - // \_/ `--' \_/ - // ---------------------------------------------------------- - // - // - // It is strongly recommended you enable USE_DRAWSTUFF if you want to - // tweak these values, to see how the capsule is reacting in various - // situations. - #endregion - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0.0035f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0.0035f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0.0035f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f); } // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the @@ -939,6 +946,7 @@ namespace OpenSim.Region.Physics.OdePlugin PhysicsVector vec = new PhysicsVector(); d.Vector3 vel = d.BodyGetLinearVel(Body); + float movementdivisor = 1f; if (!m_alwaysRun) @@ -1052,6 +1060,10 @@ namespace OpenSim.Region.Physics.OdePlugin if (PhysicsVector.isFinite(vec)) { doForce(vec); + if (!_zeroFlag) + { + AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z)); + } } else { -- cgit v1.1 From 4f3975f04e7bbaf7b7b8e286831714240ced5e6d Mon Sep 17 00:00:00 2001 From: Rob Smart Date: Fri, 18 Sep 2009 14:11:38 +0100 Subject: addition of a new script function osSetParcelSIPAddress(string SIPAddress), now including iVoiceModule This patch allows the land owner to dynamically set the SIP address of a particular land parcel from script. This allows predetermined SIP addresses to be used, making it easier to allow non OpenSim users to join a regions voice channel. Signed-off-by: dr scofield (aka dirk husemann) --- .../Region/Framework/Interfaces/IVoiceModule.cs | 45 ++++++++++++++++++ .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 55 ++++++++++++++++++++-- .../Shared/Api/Implementation/OSSL_Api.cs | 29 ++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++ 5 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Region/Framework/Interfaces/IVoiceModule.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs b/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs new file mode 100644 index 0000000..2e555fa --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IVoiceModule.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 OpenSimulator 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.IO; +using OpenMetaverse; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface IVoiceModule + { + + /// + /// Set the SIP url to be used by a parcel, this will allow manual setting of a SIP address + /// for a particular piece of land, allowing region owners to use preconfigured SIP conference channels. + /// This is used by osSetParcelSIPAddress + /// + void setLandSIPAddress(string SIPAddress,UUID GlobalID); + + } +} diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 65c5274..6b30959 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -53,7 +53,7 @@ using System.Text.RegularExpressions; namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { - public class FreeSwitchVoiceModule : IRegionModule + public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -101,13 +101,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice private FreeSwitchDialplan m_FreeSwitchDialplan; private readonly Dictionary m_UUIDName = new Dictionary(); + private Dictionary m_ParcelAddress = new Dictionary(); + + private Scene m_scene; private IConfig m_config; public void Initialise(Scene scene, IConfigSource config) { - + m_scene = scene; m_config = config.Configs["FreeSwitchVoice"]; if (null == m_config) @@ -230,6 +233,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { OnRegisterCaps(scene, agentID, caps); }; + + try { @@ -255,6 +260,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public void PostInitialise() { + if(m_pluginEnabled) + { + m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); + + // register the voice interface for this module, so the script engine can call us + m_scene.RegisterModuleInterface(this); + } } public void Close() @@ -270,7 +282,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { get { return true; } } - + + // + // implementation of IVoiceModule, called by osSetParcelSIPAddress script function + // + public void setLandSIPAddress(string SIPAddress,UUID GlobalID) + { + m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}", + GlobalID, SIPAddress); + + lock (m_ParcelAddress) + { + if (m_ParcelAddress.ContainsKey(GlobalID.ToString())) + { + m_ParcelAddress[GlobalID.ToString()] = SIPAddress; + } + else + { + m_ParcelAddress.Add(GlobalID.ToString(), SIPAddress); + } + } + } // // OnRegisterCaps is invoked via the scene.EventManager @@ -776,6 +808,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same // as the directory ID. Otherwise, it reflects the parcel's ID. + + lock (m_ParcelAddress) + { + if (m_ParcelAddress.ContainsKey( land.GlobalID.ToString() )) + { + m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}", + land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]); + return m_ParcelAddress[land.GlobalID.ToString()]; + } + } if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) { @@ -797,6 +839,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); + lock (m_ParcelAddress) + { + if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString())) + { + m_ParcelAddress.Add(land.GlobalID.ToString(),channelUri); + } + } return channelUri; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 726b37a..ccdd4c5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1164,6 +1164,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api land.SetMediaUrl(url); } + + public void osSetParcelSIPAddress(string SIPAddress) + { + // What actually is the difference to the LL function? + // + CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); + + m_host.AddScriptLPS(1); + + + ILandObject land + = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.landData.OwnerID != m_host.ObjectOwner) + { + OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); + return; + } + + // get the voice module + IVoiceModule voiceModule = World.RequestModuleInterface(); + + if (voiceModule != null) + voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID); + else + OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); + + + } public string osGetScriptEngineName() { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 49aa45a..d8d3c31 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -75,6 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces bool osConsoleCommand(string Command); void osSetParcelMediaURL(string url); void osSetPrimFloatOnWater(int floatYN); + void osSetParcelSIPAddress(string SIPAddress); // Avatar Info Commands string osGetAgentIP(string agent); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 8f52d99..d0df390 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -183,6 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osSetParcelMediaURL(url); } + + public void osSetParcelSIPAddress(string SIPAddress) + { + m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress); + } public void osSetPrimFloatOnWater(int floatYN) { -- cgit v1.1 From 0cb012aae5799ec746384c36d4bc99ca699edfe7 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Fri, 18 Sep 2009 12:06:33 -0700 Subject: Revert "Thank you, mcortez, for a patch to address showing users in group list" This reverts commit 69ef95693ae6451e2c754b22190557f3bf15777b. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 102 ++++++--------------- .../XmlRpcGroupsServicesConnectorModule.cs | 42 +++------ 2 files changed, 44 insertions(+), 100 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index d5cbfd4..37e1ed4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -281,10 +281,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - - //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); - GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); + GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); } @@ -488,7 +485,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups bucket[18] = 0; //dunno } - m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); if (OnNewGroupNotice != null) { @@ -498,20 +494,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Send notice out to everyone that wants notices foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) { - if (m_debugEnabled) - { - UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID); - if (targetUserProfile != null) - { - m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices); - } - else - { - m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); - } - } - - if (member.AcceptNotices) + if (member.AcceptNotices) { // Build notice IIM GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); @@ -631,6 +614,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); List data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); + if (m_debugEnabled) + { + foreach (GroupMembersData member in data) + { + m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title); + } + } return data; @@ -642,6 +632,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); + if (m_debugEnabled) + { + foreach (GroupRolesData member in data) + { + m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members); + } + } + return data; } @@ -652,6 +650,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); + if (m_debugEnabled) + { + foreach (GroupRoleMembersData member in data) + { + m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID); + } + } + return data; @@ -802,7 +808,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - // Security Checks are handled in the Groups Service. + // TODO: Security Checks? GroupRequestID grID = GetClientGroupRequestID(remoteClient); @@ -819,11 +825,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups case OpenMetaverse.GroupRoleUpdate.UpdateAll: case OpenMetaverse.GroupRoleUpdate.UpdateData: case OpenMetaverse.GroupRoleUpdate.UpdatePowers: - if (m_debugEnabled) - { - GroupPowers gp = (GroupPowers)powers; - m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); - } m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); break; @@ -1194,16 +1195,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (GroupMembershipData membership in data) { - if (remoteClient.AgentId != dataForAgentID) - { - if (!membership.ListInProfile) - { - // If we're sending group info to remoteclient about another agent, - // filter out groups the other agent doesn't want to share. - continue; - } - } - OSDMap GroupDataMap = new OSDMap(6); OSDMap NewGroupDataMap = new OSDMap(1); @@ -1290,46 +1281,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); + GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); - } - - /// - /// Get a list of groups memberships for the agent that are marked "ListInProfile" - /// - /// - /// - private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) - { - List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); - GroupMembershipData[] membershipArray; - - if (requestingClient.AgentId != dataForAgentID) - { - Predicate showInProfile = delegate(GroupMembershipData membership) - { - return membership.ListInProfile; - }; - - membershipArray = membershipData.FindAll(showInProfile).ToArray(); - } - else - { - membershipArray = membershipData.ToArray(); - } - - if (m_debugEnabled) - { - m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); - foreach (GroupMembershipData membership in membershipArray) - { - m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); - } - } + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); - return membershipArray; } private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 805c3d4..b3eaa37 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -855,8 +855,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups IList parameters = new ArrayList(); parameters.Add(param); - ConfigurableKeepAliveXmlRpcRequest req; - req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); + XmlRpcRequest req; + if (!m_disableKeepAlive) + { + req = new XmlRpcRequest(function, parameters); + } + else + { + // This seems to solve a major problem on some windows servers + req = new NoKeepAliveXmlRpcRequest(function, parameters); + } XmlRpcResponse resp = null; @@ -866,16 +874,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } catch (Exception e) { - - m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); - foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) - { - m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); - } - + foreach (string key in param.Keys) { m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); @@ -959,24 +961,20 @@ namespace Nwc.XmlRpc using System.Reflection; /// Class supporting the request side of an XML-RPC transaction. - public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest + public class NoKeepAliveXmlRpcRequest : XmlRpcRequest { private Encoding _encoding = new ASCIIEncoding(); private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); - private bool _disableKeepAlive = true; - - public string RequestResponse = String.Empty; /// Instantiate an XmlRpcRequest for a specified method and parameters. /// String designating the object.method on the server the request /// should be directed to. /// ArrayList of XML-RPC type parameters to invoke the request with. - public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) + public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) { MethodName = methodName; _params = parameters; - _disableKeepAlive = disableKeepAlive; } /// Send the request to the server. @@ -991,7 +989,7 @@ namespace Nwc.XmlRpc request.Method = "POST"; request.ContentType = "text/xml"; request.AllowWriteStreamBuffering = true; - request.KeepAlive = !_disableKeepAlive; + request.KeepAlive = false; Stream stream = request.GetRequestStream(); XmlTextWriter xml = new XmlTextWriter(stream, _encoding); @@ -1002,17 +1000,7 @@ namespace Nwc.XmlRpc HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); - string inputXml = input.ReadToEnd(); - XmlRpcResponse resp; - try - { - resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); - } - catch (Exception e) - { - RequestResponse = inputXml; - throw e; - } + XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); input.Close(); response.Close(); return resp; -- cgit v1.1 From 61699275ed941565f3ede2a7ce6c00607fb70837 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 19 Aug 2009 07:37:39 -0700 Subject: Add additional debugging to help track down bug with notices not going to group owner/founder. --- .../OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 37e1ed4..daba7bc 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -494,7 +494,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Send notice out to everyone that wants notices foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) { - if (member.AcceptNotices) + if (m_debugEnabled) + { + UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID); + if (targetUserProfile != null) + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices); + } + else + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); + } + } + + if (member.AcceptNotices) { // Build notice IIM GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); -- cgit v1.1 From 0e07a7ef1044f5987c0d8871972204bce3155a68 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 19 Aug 2009 08:17:29 -0700 Subject: Adding additional debug to output the group powers specified when updating a group role. This will be used to solve some issues with the Group Powers enum. --- .../Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index daba7bc..fd74168 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -485,6 +485,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups bucket[18] = 0; //dunno } + m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); if (OnNewGroupNotice != null) { @@ -821,7 +822,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - // TODO: Security Checks? + // Security Checks are handled in the Groups Service. GroupRequestID grID = GetClientGroupRequestID(remoteClient); @@ -838,6 +839,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups case OpenMetaverse.GroupRoleUpdate.UpdateAll: case OpenMetaverse.GroupRoleUpdate.UpdateData: case OpenMetaverse.GroupRoleUpdate.UpdatePowers: + if (m_debugEnabled) + { + GroupPowers gp = (GroupPowers)powers; + m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); + } m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); break; -- cgit v1.1 From 841cd69af7020f663d040bb0b7e01c03712af322 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 19 Aug 2009 08:50:20 -0700 Subject: Remove debug messages from some areas that have been highly tested, and debug info is no longer nessesary. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 23 ---------------------- 1 file changed, 23 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index fd74168..36adfad 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -628,13 +628,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); List data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title); - } - } return data; @@ -646,14 +639,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRolesData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members); - } - } - return data; } @@ -664,14 +649,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRoleMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID); - } - } - return data; -- cgit v1.1 From 247fdd1a4df55315de7184081ca025ce32e7140d Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Thu, 20 Aug 2009 09:41:14 -0700 Subject: Add additional instrumentation so that when there is an xmlrpc call failure, the actual xml that was returned from the groups service can be logged. --- .../XmlRpcGroupsServicesConnectorModule.cs | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index b3eaa37..805c3d4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -855,16 +855,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups IList parameters = new ArrayList(); parameters.Add(param); - XmlRpcRequest req; - if (!m_disableKeepAlive) - { - req = new XmlRpcRequest(function, parameters); - } - else - { - // This seems to solve a major problem on some windows servers - req = new NoKeepAliveXmlRpcRequest(function, parameters); - } + ConfigurableKeepAliveXmlRpcRequest req; + req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); XmlRpcResponse resp = null; @@ -874,10 +866,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } catch (Exception e) { + + m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); - + foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) + { + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); + } + foreach (string key in param.Keys) { m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); @@ -961,20 +959,24 @@ namespace Nwc.XmlRpc using System.Reflection; /// Class supporting the request side of an XML-RPC transaction. - public class NoKeepAliveXmlRpcRequest : XmlRpcRequest + public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest { private Encoding _encoding = new ASCIIEncoding(); private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); + private bool _disableKeepAlive = true; + + public string RequestResponse = String.Empty; /// Instantiate an XmlRpcRequest for a specified method and parameters. /// String designating the object.method on the server the request /// should be directed to. /// ArrayList of XML-RPC type parameters to invoke the request with. - public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) + public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) { MethodName = methodName; _params = parameters; + _disableKeepAlive = disableKeepAlive; } /// Send the request to the server. @@ -989,7 +991,7 @@ namespace Nwc.XmlRpc request.Method = "POST"; request.ContentType = "text/xml"; request.AllowWriteStreamBuffering = true; - request.KeepAlive = false; + request.KeepAlive = !_disableKeepAlive; Stream stream = request.GetRequestStream(); XmlTextWriter xml = new XmlTextWriter(stream, _encoding); @@ -1000,7 +1002,17 @@ namespace Nwc.XmlRpc HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); - XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); + string inputXml = input.ReadToEnd(); + XmlRpcResponse resp; + try + { + resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); + } + catch (Exception e) + { + RequestResponse = inputXml; + throw e; + } input.Close(); response.Close(); return resp; -- cgit v1.1 From 3b511d51388fa355c5ba4889cb7bc74c9c554b89 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 16 Sep 2009 15:39:52 -0700 Subject: Try to filter the groups list returns for User A, when sending to User B, based on User A's preferences for ShowInProfile. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 36adfad..79d7477 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -1277,10 +1277,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); + List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID); + GroupMembershipData[] membershipArray; - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); + if (remoteClient.AgentId != dataForAgentID) + { + Predicate showInProfile = delegate(GroupMembershipData membership) + { + return membership.ListInProfile; + }; + + membershipArray = membershipData.FindAll(showInProfile).ToArray(); + } else { + membershipArray = membershipData.ToArray(); + } + + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); } -- cgit v1.1 From 65b9084c65f61e5ddb2d4e106aff6ce4f899f2b6 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 16 Sep 2009 16:12:23 -0700 Subject: Add a little debugging for filtered groups lists based on requester --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 79d7477..9d56ba8 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -1191,6 +1191,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (GroupMembershipData membership in data) { + if (remoteClient.AgentId != dataForAgentID) + { + if (!membership.ListInProfile) + { + // If we're sending group info to remoteclient about another agent, + // filter out groups the other agent doesn't want to share. + continue; + } + } + OSDMap GroupDataMap = new OSDMap(6); OSDMap NewGroupDataMap = new OSDMap(1); @@ -1292,6 +1302,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups membershipArray = membershipData.ToArray(); } + if (m_debugEnabled) + { + m_log.InfoFormat("[GROUPS]: Sending group membership information for {0} to {1}", dataForAgentID, remoteClient.AgentId); + foreach (GroupMembershipData membership in membershipArray) + { + m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); + } + } + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); -- cgit v1.1 From 4eb07232e0e8ff36388c21c3b5522b81ee8ef156 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 16 Sep 2009 16:51:22 -0700 Subject: Group Membership information is sent out from two different locations, refactored out the filtered membership list code and used it in both locations. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 9d56ba8..d5cbfd4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -281,7 +281,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { - GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); } @@ -1287,10 +1290,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID); + GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); + + } + + /// + /// Get a list of groups memberships for the agent that are marked "ListInProfile" + /// + /// + /// + private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) + { + List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); GroupMembershipData[] membershipArray; - if (remoteClient.AgentId != dataForAgentID) + if (requestingClient.AgentId != dataForAgentID) { Predicate showInProfile = delegate(GroupMembershipData membership) { @@ -1298,22 +1314,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; membershipArray = membershipData.FindAll(showInProfile).ToArray(); - } else { + } + else + { membershipArray = membershipData.ToArray(); } if (m_debugEnabled) { - m_log.InfoFormat("[GROUPS]: Sending group membership information for {0} to {1}", dataForAgentID, remoteClient.AgentId); + m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); foreach (GroupMembershipData membership in membershipArray) { m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); } } - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); - + return membershipArray; } private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) -- cgit v1.1 From 33ea86374a19e9d74d673f363b7981b84afe177c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 22:22:00 +0100 Subject: provide intelligble warning of why load/save iar doesn't work on grid mode, pending a fix --- .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 9f49da9..dc201e1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -324,6 +324,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) { CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); + //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName); if (null == userInfo) { m_log.ErrorFormat( @@ -333,6 +334,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); + + if (userInfo.UserProfile.PasswordHash == null || userInfo.UserProfile.PasswordHash == String.Empty) + { + m_log.ErrorFormat( + "[INVENTORY ARCHIVER]: Sorry, the grid mode service is not providing password hash details for the check. This will be fixed in an OpenSim git revision soon"); + + return null; + } + +// m_log.DebugFormat( +// "[INVENTORY ARCHIVER]: received salt {0}, hash {1}, supplied hash {2}", +// userInfo.UserProfile.PasswordSalt, userInfo.UserProfile.PasswordHash, md5PasswdHash); + if (userInfo.UserProfile.PasswordHash != md5PasswdHash) { m_log.ErrorFormat( -- cgit v1.1 From 967cbde055948f7ccbe1908a296a4d155e646009 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 22:25:32 +0100 Subject: correct off-by-one error in save iar command handling --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index dc201e1..196205c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) { - if (cmdparams.Length < 5) + if (cmdparams.Length < 6) { m_log.Error( "[INVENTORY ARCHIVER]: usage is save iar []"); -- cgit v1.1