diff options
author | Melanie | 2012-03-21 00:26:02 +0000 |
---|---|---|
committer | Melanie | 2012-03-21 00:26:02 +0000 |
commit | ee9210f656f754e2caa40cb6ff39463cbf286347 (patch) | |
tree | 8097bad8a37e210bfbdeff113a9ab00d853ad9ac /OpenSim/Services/Connectors/Hypergrid | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Refix the fixed fix! (diff) | |
download | opensim-SC_OLD-ee9210f656f754e2caa40cb6ff39463cbf286347.zip opensim-SC_OLD-ee9210f656f754e2caa40cb6ff39463cbf286347.tar.gz opensim-SC_OLD-ee9210f656f754e2caa40cb6ff39463cbf286347.tar.bz2 opensim-SC_OLD-ee9210f656f754e2caa40cb6ff39463cbf286347.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid')
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs | 67 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | 61 |
2 files changed, 119 insertions, 9 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs index af4b0da..e3f3260 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs | |||
@@ -40,7 +40,7 @@ using OpenMetaverse; | |||
40 | 40 | ||
41 | namespace OpenSim.Services.Connectors.Hypergrid | 41 | namespace OpenSim.Services.Connectors.Hypergrid |
42 | { | 42 | { |
43 | public class HGFriendsServicesConnector | 43 | public class HGFriendsServicesConnector : FriendsSimConnector |
44 | { | 44 | { |
45 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -66,6 +66,11 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
66 | m_SessionID = sessionID; | 66 | m_SessionID = sessionID; |
67 | } | 67 | } |
68 | 68 | ||
69 | protected override string ServicePath() | ||
70 | { | ||
71 | return "hgfriends"; | ||
72 | } | ||
73 | |||
69 | #region IFriendsService | 74 | #region IFriendsService |
70 | 75 | ||
71 | public uint GetFriendPerms(UUID PrincipalID, UUID friendID) | 76 | public uint GetFriendPerms(UUID PrincipalID, UUID friendID) |
@@ -187,23 +192,69 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
187 | { | 192 | { |
188 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 193 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
189 | 194 | ||
190 | if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null)) | 195 | if (replyData.ContainsKey("RESULT")) |
191 | { | 196 | { |
192 | bool success = false; | 197 | if (replyData["RESULT"].ToString().ToLower() == "true") |
193 | Boolean.TryParse(replyData["Result"].ToString(), out success); | 198 | return true; |
194 | return success; | 199 | else |
200 | return false; | ||
195 | } | 201 | } |
196 | else | 202 | else |
197 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Delete {0} {1} received null response", | 203 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: reply data does not contain result field"); |
198 | PrincipalID, Friend); | 204 | |
199 | } | 205 | } |
200 | else | 206 | else |
201 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: DeleteFriend received null reply"); | 207 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: received empty reply"); |
202 | 208 | ||
203 | return false; | 209 | return false; |
204 | 210 | ||
205 | } | 211 | } |
206 | 212 | ||
213 | public bool ValidateFriendshipOffered(UUID fromID, UUID toID) | ||
214 | { | ||
215 | FriendInfo finfo = new FriendInfo(); | ||
216 | finfo.PrincipalID = fromID; | ||
217 | finfo.Friend = toID.ToString(); | ||
218 | |||
219 | Dictionary<string, object> sendData = finfo.ToKeyValuePairs(); | ||
220 | |||
221 | sendData["METHOD"] = "validate_friendship_offered"; | ||
222 | |||
223 | string reply = string.Empty; | ||
224 | string uri = m_ServerURI + "/hgfriends"; | ||
225 | try | ||
226 | { | ||
227 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
228 | uri, | ||
229 | ServerUtils.BuildQueryString(sendData)); | ||
230 | } | ||
231 | catch (Exception e) | ||
232 | { | ||
233 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); | ||
234 | return false; | ||
235 | } | ||
236 | |||
237 | if (reply != string.Empty) | ||
238 | { | ||
239 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
240 | |||
241 | if (replyData.ContainsKey("RESULT")) | ||
242 | { | ||
243 | if (replyData["RESULT"].ToString().ToLower() == "true") | ||
244 | return true; | ||
245 | else | ||
246 | return false; | ||
247 | } | ||
248 | else | ||
249 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: reply data does not contain result field"); | ||
250 | |||
251 | } | ||
252 | else | ||
253 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: received empty reply"); | ||
254 | |||
255 | return false; | ||
256 | |||
257 | } | ||
207 | #endregion | 258 | #endregion |
208 | } | 259 | } |
209 | } \ No newline at end of file | 260 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index d617aee..c07c6a6 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -787,13 +787,72 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
787 | } | 787 | } |
788 | catch | 788 | catch |
789 | { | 789 | { |
790 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); | 790 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response."); |
791 | // reason = "Exception: " + e.Message; | 791 | // reason = "Exception: " + e.Message; |
792 | } | 792 | } |
793 | 793 | ||
794 | return uui; | 794 | return uui; |
795 | } | 795 | } |
796 | 796 | ||
797 | public UUID GetUUID(String first, String last) | ||
798 | { | ||
799 | Hashtable hash = new Hashtable(); | ||
800 | hash["first"] = first; | ||
801 | hash["last"] = last; | ||
802 | |||
803 | IList paramList = new ArrayList(); | ||
804 | paramList.Add(hash); | ||
805 | |||
806 | XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList); | ||
807 | // string reason = string.Empty; | ||
808 | |||
809 | // Send and get reply | ||
810 | UUID uuid = UUID.Zero; | ||
811 | XmlRpcResponse response = null; | ||
812 | try | ||
813 | { | ||
814 | response = request.Send(m_ServerURL, 10000); | ||
815 | } | ||
816 | catch | ||
817 | { | ||
818 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL); | ||
819 | // reason = "Exception: " + e.Message; | ||
820 | return uuid; | ||
821 | } | ||
822 | |||
823 | if (response.IsFault) | ||
824 | { | ||
825 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString); | ||
826 | // reason = "XMLRPC Fault"; | ||
827 | return uuid; | ||
828 | } | ||
829 | |||
830 | hash = (Hashtable)response.Value; | ||
831 | //foreach (Object o in hash) | ||
832 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
833 | try | ||
834 | { | ||
835 | if (hash == null) | ||
836 | { | ||
837 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
838 | // reason = "Internal error 1"; | ||
839 | return uuid; | ||
840 | } | ||
841 | |||
842 | // Here's the actual response | ||
843 | if (hash.ContainsKey("UUID")) | ||
844 | UUID.TryParse(hash["UUID"].ToString(), out uuid); | ||
845 | |||
846 | } | ||
847 | catch | ||
848 | { | ||
849 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response."); | ||
850 | // reason = "Exception: " + e.Message; | ||
851 | } | ||
852 | |||
853 | return uuid; | ||
854 | } | ||
855 | |||
797 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) | 856 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) |
798 | { | 857 | { |
799 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); | 858 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); |