aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2011-06-02 07:26:40 -0700
committerDiva Canto2011-06-02 07:26:40 -0700
commitf2f30a78908c93e1397be52e476da9fb5c44282d (patch)
treeaed2a68dce99194b148e1ababaeb312eaddfddda /OpenSim
parentThis is the better solution: make the combined key be only on the first 36 ch... (diff)
downloadopensim-SC_OLD-f2f30a78908c93e1397be52e476da9fb5c44282d.zip
opensim-SC_OLD-f2f30a78908c93e1397be52e476da9fb5c44282d.tar.gz
opensim-SC_OLD-f2f30a78908c93e1397be52e476da9fb5c44282d.tar.bz2
opensim-SC_OLD-f2f30a78908c93e1397be52e476da9fb5c44282d.tar.xz
HG Friends bug fix: connector was shrinking principalID to UUID.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs19
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs24
2 files changed, 28 insertions, 15 deletions
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 9969086..fc97d8c 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -160,9 +160,9 @@ namespace OpenSim.Server.Handlers.Friends
160 160
161 byte[] StoreFriend(Dictionary<string, object> request) 161 byte[] StoreFriend(Dictionary<string, object> request)
162 { 162 {
163 FriendInfo friend = new FriendInfo(request); 163 string principalID = string.Empty, friend = string.Empty; int flags = 0;
164 164 FromKeyValuePairs(request, out principalID, out friend, out flags);
165 bool success = m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, friend.MyFlags); 165 bool success = m_FriendsService.StoreFriend(principalID, friend, flags);
166 166
167 if (success) 167 if (success)
168 return SuccessResult(); 168 return SuccessResult();
@@ -275,6 +275,19 @@ namespace OpenSim.Server.Handlers.Friends
275 return ms.ToArray(); 275 return ms.ToArray();
276 } 276 }
277 277
278 void FromKeyValuePairs(Dictionary<string, object> kvp, out string principalID, out string friend, out int flags)
279 {
280 principalID = string.Empty;
281 if (kvp.ContainsKey("PrincipalID") && kvp["PrincipalID"] != null)
282 principalID = kvp["PrincipalID"].ToString();
283 friend = string.Empty;
284 if (kvp.ContainsKey("Friend") && kvp["Friend"] != null)
285 friend = kvp["Friend"].ToString();
286 flags = 0;
287 if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null)
288 Int32.TryParse(kvp["MyFlags"].ToString(), out flags);
289 }
290
278 #endregion 291 #endregion
279 } 292 }
280} 293}
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
index 08f1dc3..c5ae0c0 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
@@ -161,19 +161,8 @@ namespace OpenSim.Services.Connectors.Friends
161 161
162 public bool StoreFriend(string PrincipalID, string Friend, int flags) 162 public bool StoreFriend(string PrincipalID, string Friend, int flags)
163 { 163 {
164 FriendInfo finfo = new FriendInfo();
165 try
166 {
167 finfo.PrincipalID = new UUID(PrincipalID);
168 }
169 catch
170 {
171 return false;
172 }
173 finfo.Friend = Friend;
174 finfo.MyFlags = flags;
175 164
176 Dictionary<string, object> sendData = finfo.ToKeyValuePairs(); 165 Dictionary<string, object> sendData = ToKeyValuePairs(PrincipalID, Friend, flags);
177 166
178 sendData["METHOD"] = "storefriend"; 167 sendData["METHOD"] = "storefriend";
179 168
@@ -267,5 +256,16 @@ namespace OpenSim.Services.Connectors.Friends
267 } 256 }
268 257
269 #endregion 258 #endregion
259
260 public Dictionary<string, object> ToKeyValuePairs(string principalID, string friend, int flags)
261 {
262 Dictionary<string, object> result = new Dictionary<string, object>();
263 result["PrincipalID"] = principalID;
264 result["Friend"] = friend;
265 result["MyFlags"] = flags;
266
267 return result;
268 }
269
270 } 270 }
271} \ No newline at end of file 271} \ No newline at end of file