aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorunknown2010-05-14 15:06:13 -0700
committerJustin Clark-Casey (justincc)2010-05-14 23:40:40 +0100
commit2c8d25a11029429aa7b146e3c2be57093046dd15 (patch)
tree4b8c1a32b9028b1095a24fbd966f0202c7242549 /OpenSim/Region
parentback port groups changes (diff)
downloadopensim-SC-2c8d25a11029429aa7b146e3c2be57093046dd15.zip
opensim-SC-2c8d25a11029429aa7b146e3c2be57093046dd15.tar.gz
opensim-SC-2c8d25a11029429aa7b146e3c2be57093046dd15.tar.bz2
opensim-SC-2c8d25a11029429aa7b146e3c2be57093046dd15.tar.xz
* Allows both old and new OpenSim.ini params for the XmlRpc Groups Service Connector
* Fix problem with RequestingAgentID not being sent correctly to server resulting in failed xmlrpc calls * Improved debug output
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs24
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs87
2 files changed, 80 insertions, 31 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index edd5af7..3e05732 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -342,7 +342,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
342 342
343 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 343 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
344 { 344 {
345 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 345 if (m_debugEnabled)
346 {
347 m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
348 m_log.DebugFormat("[GROUPS]: remoteClient ({0}) im ({1})", remoteClient, im);
349
350 }
351
346 352
347 // Group invitations 353 // Group invitations
348 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) 354 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
@@ -481,7 +487,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
481 if (member.AcceptNotices) 487 if (member.AcceptNotices)
482 { 488 {
483 // Build notice IIM 489 // Build notice IIM
484 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); 490 GridInstantMessage msg = CreateGroupNoticeIM(GetRequestingAgentID(remoteClient), NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
485 491
486 msg.toAgentID = member.AgentID.Guid; 492 msg.toAgentID = member.AgentID.Guid;
487 OutgoingInstantMessage(msg, member.AgentID); 493 OutgoingInstantMessage(msg, member.AgentID);
@@ -1024,12 +1030,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1024 1030
1025 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) 1031 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
1026 { 1032 {
1027 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1033 if (m_debugEnabled)
1034 {
1035 m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1036 m_log.DebugFormat("[GROUPS]: remoteClient({0}) groupID({0}) invitedAgentID({0}) roleID({0})", remoteClient, groupID, invitedAgentID, roleID);
1037 }
1038
1028 1039
1029 // Todo: Security check, probably also want to send some kind of notification 1040 // Todo: Security check, probably also want to send some kind of notification
1030 UUID InviteID = UUID.Random(); 1041 UUID InviteID = UUID.Random();
1031 1042
1032 m_groupData.AddAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID, groupID, roleID, invitedAgentID); 1043 UUID requestingAgentID = GetRequestingAgentID(remoteClient);
1044 if (requestingAgentID == UUID.Zero)
1045 {
1046 m_log.Error("[GROUPS] Group Invite Requires a valid requesting agent to be specified");
1047 }
1048 m_groupData.AddAgentToGroupInvite(requestingAgentID, InviteID, groupID, roleID, invitedAgentID);
1033 1049
1034 // Check to see if the invite went through, if it did not then it's possible 1050 // Check to see if the invite went through, if it did not then it's possible
1035 // the remoteClient did not validate or did not have permission to invite. 1051 // the remoteClient did not validate or did not have permission to invite.
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 2a60b00..861731c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -40,6 +40,7 @@ using OpenMetaverse;
40using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
41 41
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.Communications;
43using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
44 45
45namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 46namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
@@ -66,6 +67,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
66 private string m_groupReadKey = string.Empty; 67 private string m_groupReadKey = string.Empty;
67 private string m_groupWriteKey = string.Empty; 68 private string m_groupWriteKey = string.Empty;
68 69
70 private IUserService m_userService = null;
71 private CommunicationsManager m_commManager = null;
72
73 private bool m_debugEnabled = false;
74
69 75
70 // Used to track which agents are have dropped from a group chat session 76 // Used to track which agents are have dropped from a group chat session
71 // Should be reset per agent, on logon 77 // Should be reset per agent, on logon
@@ -110,7 +116,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
110 116
111 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); 117 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
112 118
113 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); 119 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", groupsConfig.GetString("XmlRpcServiceURL", string.Empty));
114 if ((m_groupsServerURI == null) || 120 if ((m_groupsServerURI == null) ||
115 (m_groupsServerURI == string.Empty)) 121 (m_groupsServerURI == string.Empty))
116 { 122 {
@@ -124,7 +130,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
124 m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); 130 m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
125 m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); 131 m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
126 132
127 133 m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
128 134
129 135
130 // If we got all the config options we need, lets start'er'up 136 // If we got all the config options we need, lets start'er'up
@@ -142,6 +148,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
142 if (m_connectorEnabled) 148 if (m_connectorEnabled)
143 { 149 {
144 scene.RegisterModuleInterface<IGroupsServicesConnector>(this); 150 scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
151
152 if (m_userService == null)
153 {
154 m_userService = scene.CommsManager.UserService;
155 m_commManager = scene.CommsManager;
156 }
145 } 157 }
146 } 158 }
147 159
@@ -912,7 +924,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
912 string UserService; 924 string UserService;
913 UUID SessionID; 925 UUID SessionID;
914 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); 926 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
915 param.Add("requestingAgentID", requestingAgentID.ToString()); 927 param.Add("RequestingAgentID", requestingAgentID.ToString());
916 param.Add("RequestingAgentUserService", UserService); 928 param.Add("RequestingAgentUserService", UserService);
917 param.Add("RequestingSessionID", SessionID.ToString()); 929 param.Add("RequestingSessionID", SessionID.ToString());
918 930
@@ -920,6 +932,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
920 param.Add("ReadKey", m_groupReadKey); 932 param.Add("ReadKey", m_groupReadKey);
921 param.Add("WriteKey", m_groupWriteKey); 933 param.Add("WriteKey", m_groupWriteKey);
922 934
935 if (m_debugEnabled)
936 {
937 m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:");
938 foreach (string key in param.Keys)
939 {
940 m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]);
941 }
942 }
923 943
924 IList parameters = new ArrayList(); 944 IList parameters = new ArrayList();
925 parameters.Add(param); 945 parameters.Add(param);
@@ -940,10 +960,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
940 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); 960 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
941 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); 961 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
942 962
943 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) 963 if ((req != null) && (req.RequestResponse != null))
964 {
965 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
944 { 966 {
945 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); 967 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
946 } 968 }
969 }
947 970
948 foreach (string key in param.Keys) 971 foreach (string key in param.Keys)
949 { 972 {
@@ -955,12 +978,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
955 return respData; 978 return respData;
956 } 979 }
957 980
981
958 if (resp.Value is Hashtable) 982 if (resp.Value is Hashtable)
959 { 983 {
960 Hashtable respData = (Hashtable)resp.Value; 984 Hashtable respData = (Hashtable)resp.Value;
961 if (respData.Contains("error") && !respData.Contains("succeed")) 985 if (respData.Contains("error") && !respData.Contains("succeed"))
962 { 986 {
963 LogRespDataToConsoleError(respData); 987 LogRespDataToConsoleError(function, respData);
964 } 988 }
965 989
966 return respData; 990 return respData;
@@ -988,18 +1012,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
988 return error; 1012 return error;
989 } 1013 }
990 1014
991 private void LogRespDataToConsoleError(Hashtable respData) 1015 private void LogRespDataToConsoleError(string function, Hashtable respData)
992 { 1016 {
1017 m_log.ErrorFormat("[XMLRPCGROUPDATA]: Error data from XmlRpcGroups server method: {0}", function);
993 m_log.Error("[XMLRPCGROUPDATA]: Error:"); 1018 m_log.Error("[XMLRPCGROUPDATA]: Error:");
994 1019
995 foreach (string key in respData.Keys) 1020 foreach (string key in respData.Keys)
996 { 1021 {
997 m_log.ErrorFormat("[XMLRPCGROUPDATA]: Key: {0}", key); 1022 m_log.ErrorFormat("[XMLRPCGROUPDATA]: Key: {0}", key);
998 1023
999 string[] lines = respData[key].ToString().Split(new char[] { '\n' }); 1024 if ((respData != null) && (respData.ContainsKey(key)) && (respData[key]!=null))
1000 foreach (string line in lines) 1025 {
1026 string[] lines = respData[key].ToString().Split(new char[] { '\n' });
1027 foreach (string line in lines)
1028 {
1029 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0}", line);
1030 }
1031 }
1032 else
1001 { 1033 {
1002 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0}", line); 1034 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} : Empty/NULL", key);
1003 } 1035 }
1004 1036
1005 } 1037 }
@@ -1015,23 +1047,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1015 /// <returns></returns> 1047 /// <returns></returns>
1016 private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID) 1048 private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID)
1017 { 1049 {
1018 UserServiceURL = ""; 1050 // Default to local grid user service
1019 SessionID = UUID.Zero; 1051 UserServiceURL = m_commManager.NetworkServersInfo.UserURL; ;
1020
1021 1052
1022 // Need to rework this based on changes to User Services 1053 // if AgentID == UUID, there will be no SessionID. This will be true when
1023 /* 1054 // the region is requesting information for region use (object permissions for example)
1024 UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); 1055 SessionID = UUID.Zero;
1025 if (userAccount == null)
1026 {
1027 // This should be impossible. If I've been passed a reference to a client
1028 // that client should be registered with the UserService. So something
1029 // is horribly wrong somewhere.
1030 1056
1031 m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID); 1057 // Attempt to get User Profile, for SessionID
1058 UserProfileData userProfile = m_userService.GetUserProfile(AgentID);
1032 1059
1033 } 1060 if ((userProfile != null) && (userProfile is ForeignUserProfileData))
1034 else if (userProfile is ForeignUserProfileData)
1035 { 1061 {
1036 // They aren't from around here 1062 // They aren't from around here
1037 ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; 1063 ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile;
@@ -1039,13 +1065,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1039 SessionID = fupd.CurrentAgent.SessionID; 1065 SessionID = fupd.CurrentAgent.SessionID;
1040 1066
1041 } 1067 }
1042 else 1068 else if (userProfile != null)
1043 { 1069 {
1044 // They're a local user, use this: 1070 // Local, just use the local SessionID
1045 UserServiceURL = m_commManager.NetworkServersInfo.UserURL;
1046 SessionID = userProfile.CurrentAgent.SessionID; 1071 SessionID = userProfile.CurrentAgent.SessionID;
1047 } 1072 }
1048 */ 1073 else if (AgentID != UUID.Zero)
1074 {
1075 // This should be impossible. If I've been passed a reference to a client
1076 // that client should be registered with the UserService. So something
1077 // is horribly wrong somewhere.
1078
1079 // m_log.WarnFormat("[XMLRPCGROUPDATA]: Could not find a UserServiceURL for {0}", AgentID);
1080
1081 }
1049 } 1082 }
1050 1083
1051 } 1084 }