aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs102
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs42
2 files changed, 44 insertions, 100 deletions
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
281 281
282 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 282 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
283 { 283 {
284 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 284 GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray();
285
286 //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray();
287 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
288 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); 285 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
289 } 286 }
290 287
@@ -488,7 +485,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
488 bucket[18] = 0; //dunno 485 bucket[18] = 0; //dunno
489 } 486 }
490 487
491
492 m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); 488 m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket);
493 if (OnNewGroupNotice != null) 489 if (OnNewGroupNotice != null)
494 { 490 {
@@ -498,20 +494,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
498 // Send notice out to everyone that wants notices 494 // Send notice out to everyone that wants notices
499 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) 495 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID))
500 { 496 {
501 if (m_debugEnabled) 497 if (member.AcceptNotices)
502 {
503 UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID);
504 if (targetUserProfile != null)
505 {
506 m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices);
507 }
508 else
509 {
510 m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices);
511 }
512 }
513
514 if (member.AcceptNotices)
515 { 498 {
516 // Build notice IIM 499 // Build notice IIM
517 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); 500 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
@@ -631,6 +614,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
631 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 614 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
632 615
633 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); 616 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID);
617 if (m_debugEnabled)
618 {
619 foreach (GroupMembersData member in data)
620 {
621 m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title);
622 }
623 }
634 624
635 return data; 625 return data;
636 626
@@ -642,6 +632,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
642 632
643 List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); 633 List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID);
644 634
635 if (m_debugEnabled)
636 {
637 foreach (GroupRolesData member in data)
638 {
639 m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members);
640 }
641 }
642
645 return data; 643 return data;
646 644
647 } 645 }
@@ -652,6 +650,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
652 650
653 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); 651 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID);
654 652
653 if (m_debugEnabled)
654 {
655 foreach (GroupRoleMembersData member in data)
656 {
657 m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID);
658 }
659 }
660
655 return data; 661 return data;
656 662
657 663
@@ -802,7 +808,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
802 { 808 {
803 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 809 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
804 810
805 // Security Checks are handled in the Groups Service. 811 // TODO: Security Checks?
806 812
807 GroupRequestID grID = GetClientGroupRequestID(remoteClient); 813 GroupRequestID grID = GetClientGroupRequestID(remoteClient);
808 814
@@ -819,11 +825,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
819 case OpenMetaverse.GroupRoleUpdate.UpdateAll: 825 case OpenMetaverse.GroupRoleUpdate.UpdateAll:
820 case OpenMetaverse.GroupRoleUpdate.UpdateData: 826 case OpenMetaverse.GroupRoleUpdate.UpdateData:
821 case OpenMetaverse.GroupRoleUpdate.UpdatePowers: 827 case OpenMetaverse.GroupRoleUpdate.UpdatePowers:
822 if (m_debugEnabled)
823 {
824 GroupPowers gp = (GroupPowers)powers;
825 m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString());
826 }
827 m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); 828 m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers);
828 break; 829 break;
829 830
@@ -1194,16 +1195,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1194 1195
1195 foreach (GroupMembershipData membership in data) 1196 foreach (GroupMembershipData membership in data)
1196 { 1197 {
1197 if (remoteClient.AgentId != dataForAgentID)
1198 {
1199 if (!membership.ListInProfile)
1200 {
1201 // If we're sending group info to remoteclient about another agent,
1202 // filter out groups the other agent doesn't want to share.
1203 continue;
1204 }
1205 }
1206
1207 OSDMap GroupDataMap = new OSDMap(6); 1198 OSDMap GroupDataMap = new OSDMap(6);
1208 OSDMap NewGroupDataMap = new OSDMap(1); 1199 OSDMap NewGroupDataMap = new OSDMap(1);
1209 1200
@@ -1290,46 +1281,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1290 // to the core Groups Stub 1281 // to the core Groups Stub
1291 remoteClient.SendGroupMembership(new GroupMembershipData[0]); 1282 remoteClient.SendGroupMembership(new GroupMembershipData[0]);
1292 1283
1293 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); 1284 GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray();
1294 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
1295 remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
1296 1285
1297 } 1286 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData);
1298 1287 remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData);
1299 /// <summary>
1300 /// Get a list of groups memberships for the agent that are marked "ListInProfile"
1301 /// </summary>
1302 /// <param name="dataForAgentID"></param>
1303 /// <returns></returns>
1304 private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID)
1305 {
1306 List<GroupMembershipData> membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID);
1307 GroupMembershipData[] membershipArray;
1308
1309 if (requestingClient.AgentId != dataForAgentID)
1310 {
1311 Predicate<GroupMembershipData> showInProfile = delegate(GroupMembershipData membership)
1312 {
1313 return membership.ListInProfile;
1314 };
1315
1316 membershipArray = membershipData.FindAll(showInProfile).ToArray();
1317 }
1318 else
1319 {
1320 membershipArray = membershipData.ToArray();
1321 }
1322
1323 if (m_debugEnabled)
1324 {
1325 m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId);
1326 foreach (GroupMembershipData membership in membershipArray)
1327 {
1328 m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle);
1329 }
1330 }
1331 1288
1332 return membershipArray;
1333 } 1289 }
1334 1290
1335 private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) 1291 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
855 IList parameters = new ArrayList(); 855 IList parameters = new ArrayList();
856 parameters.Add(param); 856 parameters.Add(param);
857 857
858 ConfigurableKeepAliveXmlRpcRequest req; 858 XmlRpcRequest req;
859 req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); 859 if (!m_disableKeepAlive)
860 {
861 req = new XmlRpcRequest(function, parameters);
862 }
863 else
864 {
865 // This seems to solve a major problem on some windows servers
866 req = new NoKeepAliveXmlRpcRequest(function, parameters);
867 }
860 868
861 XmlRpcResponse resp = null; 869 XmlRpcResponse resp = null;
862 870
@@ -866,16 +874,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
866 } 874 }
867 catch (Exception e) 875 catch (Exception e)
868 { 876 {
869
870
871 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); 877 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
872 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); 878 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
873 879
874 foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) 880
875 {
876 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
877 }
878
879 foreach (string key in param.Keys) 881 foreach (string key in param.Keys)
880 { 882 {
881 m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); 883 m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
@@ -959,24 +961,20 @@ namespace Nwc.XmlRpc
959 using System.Reflection; 961 using System.Reflection;
960 962
961 /// <summary>Class supporting the request side of an XML-RPC transaction.</summary> 963 /// <summary>Class supporting the request side of an XML-RPC transaction.</summary>
962 public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest 964 public class NoKeepAliveXmlRpcRequest : XmlRpcRequest
963 { 965 {
964 private Encoding _encoding = new ASCIIEncoding(); 966 private Encoding _encoding = new ASCIIEncoding();
965 private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); 967 private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
966 private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); 968 private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
967 private bool _disableKeepAlive = true;
968
969 public string RequestResponse = String.Empty;
970 969
971 /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary> 970 /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary>
972 /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request 971 /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request
973 /// should be directed to.</param> 972 /// should be directed to.</param>
974 /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param> 973 /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param>
975 public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) 974 public NoKeepAliveXmlRpcRequest(String methodName, IList parameters)
976 { 975 {
977 MethodName = methodName; 976 MethodName = methodName;
978 _params = parameters; 977 _params = parameters;
979 _disableKeepAlive = disableKeepAlive;
980 } 978 }
981 979
982 /// <summary>Send the request to the server.</summary> 980 /// <summary>Send the request to the server.</summary>
@@ -991,7 +989,7 @@ namespace Nwc.XmlRpc
991 request.Method = "POST"; 989 request.Method = "POST";
992 request.ContentType = "text/xml"; 990 request.ContentType = "text/xml";
993 request.AllowWriteStreamBuffering = true; 991 request.AllowWriteStreamBuffering = true;
994 request.KeepAlive = !_disableKeepAlive; 992 request.KeepAlive = false;
995 993
996 Stream stream = request.GetRequestStream(); 994 Stream stream = request.GetRequestStream();
997 XmlTextWriter xml = new XmlTextWriter(stream, _encoding); 995 XmlTextWriter xml = new XmlTextWriter(stream, _encoding);
@@ -1002,17 +1000,7 @@ namespace Nwc.XmlRpc
1002 HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 1000 HttpWebResponse response = (HttpWebResponse)request.GetResponse();
1003 StreamReader input = new StreamReader(response.GetResponseStream()); 1001 StreamReader input = new StreamReader(response.GetResponseStream());
1004 1002
1005 string inputXml = input.ReadToEnd(); 1003 XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input);
1006 XmlRpcResponse resp;
1007 try
1008 {
1009 resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml);
1010 }
1011 catch (Exception e)
1012 {
1013 RequestResponse = inputXml;
1014 throw e;
1015 }
1016 input.Close(); 1004 input.Close();
1017 response.Close(); 1005 response.Close();
1018 return resp; 1006 return resp;