HG Friends bug fix: connector was shrinking principalID to UUID.
parent
c13acdf5a1
commit
f2f30a7890
|
@ -160,9 +160,9 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
|
||||
byte[] StoreFriend(Dictionary<string, object> request)
|
||||
{
|
||||
FriendInfo friend = new FriendInfo(request);
|
||||
|
||||
bool success = m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, friend.MyFlags);
|
||||
string principalID = string.Empty, friend = string.Empty; int flags = 0;
|
||||
FromKeyValuePairs(request, out principalID, out friend, out flags);
|
||||
bool success = m_FriendsService.StoreFriend(principalID, friend, flags);
|
||||
|
||||
if (success)
|
||||
return SuccessResult();
|
||||
|
@ -275,6 +275,19 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
return ms.ToArray();
|
||||
}
|
||||
|
||||
void FromKeyValuePairs(Dictionary<string, object> kvp, out string principalID, out string friend, out int flags)
|
||||
{
|
||||
principalID = string.Empty;
|
||||
if (kvp.ContainsKey("PrincipalID") && kvp["PrincipalID"] != null)
|
||||
principalID = kvp["PrincipalID"].ToString();
|
||||
friend = string.Empty;
|
||||
if (kvp.ContainsKey("Friend") && kvp["Friend"] != null)
|
||||
friend = kvp["Friend"].ToString();
|
||||
flags = 0;
|
||||
if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null)
|
||||
Int32.TryParse(kvp["MyFlags"].ToString(), out flags);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,19 +161,8 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
|
||||
public bool StoreFriend(string PrincipalID, string Friend, int flags)
|
||||
{
|
||||
FriendInfo finfo = new FriendInfo();
|
||||
try
|
||||
{
|
||||
finfo.PrincipalID = new UUID(PrincipalID);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finfo.Friend = Friend;
|
||||
finfo.MyFlags = flags;
|
||||
|
||||
Dictionary<string, object> sendData = finfo.ToKeyValuePairs();
|
||||
Dictionary<string, object> sendData = ToKeyValuePairs(PrincipalID, Friend, flags);
|
||||
|
||||
sendData["METHOD"] = "storefriend";
|
||||
|
||||
|
@ -267,5 +256,16 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Dictionary<string, object> ToKeyValuePairs(string principalID, string friend, int flags)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
result["PrincipalID"] = principalID;
|
||||
result["Friend"] = friend;
|
||||
result["MyFlags"] = flags;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue