aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs68
1 files changed, 38 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index d05b1f6..1ee2a7b 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -47,6 +47,7 @@ using OpenSim.Services.Interfaces;
47using Mono.Addins; 47using Mono.Addins;
48using OpenSim.Services.Connectors.Hypergrid; 48using OpenSim.Services.Connectors.Hypergrid;
49using OpenSim.Framework.Servers.HttpServer; 49using OpenSim.Framework.Servers.HttpServer;
50using OpenSim.Services.UserProfilesService;
50 51
51namespace OpenSim.Region.CoreModules.Avatar.UserProfiles 52namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
52{ 53{
@@ -64,6 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
64 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>(); 65 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>();
65 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); 66 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>();
66 67
68 private JsonRpcRequestManager rpc = new JsonRpcRequestManager();
69
67 public Scene Scene 70 public Scene Scene
68 { 71 {
69 get; private set; 72 get; private set;
@@ -113,7 +116,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
113 set; 116 set;
114 } 117 }
115 118
116 JsonRpcRequestManager rpc = new JsonRpcRequestManager();
117 119
118 #region IRegionModuleBase implementation 120 #region IRegionModuleBase implementation
119 /// <summary> 121 /// <summary>
@@ -919,7 +921,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
919 921
920 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 922 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
921 { 923 {
922 if ( String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) 924 if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString()))
923 { 925 {
924 // Looking for a reason that some viewers are sending null Id's 926 // Looking for a reason that some viewers are sending null Id's
925 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); 927 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID);
@@ -997,29 +999,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
997 999
998 props.UserId = avatarID; 1000 props.UserId = avatarID;
999 1001
1000 try 1002 if (!GetProfileData(ref props, foreign, out result))
1001 {
1002 GetProfileData(ref props, out result);
1003 }
1004 catch (Exception e)
1005 { 1003 {
1006 if (foreign) 1004 m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result);
1007 { 1005 return;
1008 // Check if the foreign grid is using OpenProfile.
1009 // If any error occurs then discard it, and report the original error.
1010 try
1011 {
1012 OpenProfileClient client = new OpenProfileClient(serverURI);
1013 if (!client.RequestAvatarPropertiesUsingOpenProfile(ref props))
1014 throw e;
1015 }
1016 catch (Exception)
1017 {
1018 throw e;
1019 }
1020 }
1021 else
1022 throw;
1023 } 1006 }
1024 1007
1025 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags, 1008 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags,
@@ -1073,10 +1056,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1073 /// <returns> 1056 /// <returns>
1074 /// The profile data. 1057 /// The profile data.
1075 /// </returns> 1058 /// </returns>
1076 /// <param name='userID'> 1059 bool GetProfileData(ref UserProfileProperties properties, bool foreign, out string message)
1077 /// User I.
1078 /// </param>
1079 bool GetProfileData(ref UserProfileProperties properties, out string message)
1080 { 1060 {
1081 // Can't handle NPC yet... 1061 // Can't handle NPC yet...
1082 ScenePresence p = FindPresence(properties.UserId); 1062 ScenePresence p = FindPresence(properties.UserId);
@@ -1095,14 +1075,42 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1095 1075
1096 // This is checking a friend on the home grid 1076 // This is checking a friend on the home grid
1097 // Not HG friend 1077 // Not HG friend
1098 if ( String.IsNullOrEmpty(serverURI)) 1078 if (String.IsNullOrEmpty(serverURI))
1099 { 1079 {
1100 message = "No Presence - foreign friend"; 1080 message = "No Presence - foreign friend";
1101 return false; 1081 return false;
1102 } 1082 }
1103 1083
1104 object Prop = (object)properties; 1084 object Prop = (object)properties;
1105 rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()); 1085 if (!rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()))
1086 {
1087 // If it's a foreign user then try again using OpenProfile, in case that's what the grid is using
1088 bool secondChanceSuccess = false;
1089 if (foreign)
1090 {
1091 try
1092 {
1093 OpenProfileClient client = new OpenProfileClient(serverURI);
1094 if (client.RequestAvatarPropertiesUsingOpenProfile(ref properties))
1095 secondChanceSuccess = true;
1096 }
1097 catch (Exception e)
1098 {
1099 m_log.Debug(string.Format("Request using the OpenProfile API to {0} failed", serverURI), e);
1100 // Allow the return 'message' to say "JsonRpcRequest" and not "OpenProfile", because
1101 // the most likely reason that OpenProfile failed is that the remote server
1102 // doesn't support OpenProfile, and that's not very interesting.
1103 }
1104 }
1105
1106 if (!secondChanceSuccess)
1107 {
1108 message = string.Format("JsonRpcRequest to {0} failed", serverURI);
1109 return false;
1110 }
1111 // else, continue below
1112 }
1113
1106 properties = (UserProfileProperties)Prop; 1114 properties = (UserProfileProperties)Prop;
1107 1115
1108 message = "Success"; 1116 message = "Success";