aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Hypergrid
diff options
context:
space:
mode:
authorDiva Canto2011-05-22 16:51:03 -0700
committerDiva Canto2011-05-22 16:51:03 -0700
commit336665e03532cf9d7a1ad65d5071e7050bf6ecd0 (patch)
tree45c7c1145de1b5af3ff198bcb29564a2547e4575 /OpenSim/Services/Connectors/Hypergrid
parentFile to be removed (diff)
downloadopensim-SC-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.zip
opensim-SC-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.tar.gz
opensim-SC-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.tar.bz2
opensim-SC-336665e03532cf9d7a1ad65d5071e7050bf6ecd0.tar.xz
More on HG Friends. Added Delete(string, string) across the board. Added security to friendship identifiers so that they can safely be deleted across worlds. Had to change Get(string) to use LIKE because the secret in the identifier is not always known -- affects only HG visitors. BOTTOM LINE SO FAR: HG friendships established and deleted safely across grids, local rights working but not (yet?) being transmitted back.
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs50
1 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
index f823889..d699f59 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs
@@ -54,6 +54,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
54 { 54 {
55 } 55 }
56 56
57 public HGFriendsServicesConnector(string serverURI)
58 {
59 m_ServerURI = serverURI.TrimEnd('/');
60 }
61
57 public HGFriendsServicesConnector(string serverURI, UUID sessionID, string serviceKey) 62 public HGFriendsServicesConnector(string serverURI, UUID sessionID, string serviceKey)
58 { 63 {
59 m_ServerURI = serverURI.TrimEnd('/'); 64 m_ServerURI = serverURI.TrimEnd('/');
@@ -151,6 +156,51 @@ namespace OpenSim.Services.Connectors.Hypergrid
151 156
152 } 157 }
153 158
159 public bool DeleteFriendship(UUID PrincipalID, UUID Friend, string secret)
160 {
161 FriendInfo finfo = new FriendInfo();
162 finfo.PrincipalID = PrincipalID;
163 finfo.Friend = Friend.ToString();
164
165 Dictionary<string, object> sendData = finfo.ToKeyValuePairs();
166
167 sendData["METHOD"] = "deletefriendship";
168 sendData["SECRET"] = secret;
169
170 string reply = string.Empty;
171 try
172 {
173 reply = SynchronousRestFormsRequester.MakeRequest("POST",
174 m_ServerURI + "/hgfriends",
175 ServerUtils.BuildQueryString(sendData));
176 }
177 catch (Exception e)
178 {
179 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message);
180 return false;
181 }
182
183 if (reply != string.Empty)
184 {
185 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
186
187 if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null))
188 {
189 bool success = false;
190 Boolean.TryParse(replyData["Result"].ToString(), out success);
191 return success;
192 }
193 else
194 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Delete {0} {1} received null response",
195 PrincipalID, Friend);
196 }
197 else
198 m_log.DebugFormat("[HGFRIENDS CONNECTOR]: DeleteFriend received null reply");
199
200 return false;
201
202 }
203
154 #endregion 204 #endregion
155 } 205 }
156} \ No newline at end of file 206} \ No newline at end of file