* Updates UserServer
* Updates OSG1UserServices * Friends list is now persistent in grid mode. * You can add, new friends and remove themafrisby
parent
4d3a8f4b52
commit
3738bc8899
|
@ -205,7 +205,6 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
MainLog.Instance.Error(e.ToString());
|
||||
return;
|
||||
}
|
||||
MainLog.Instance.Verbose("FRIEND", "Stub AddNewUserFriend called");
|
||||
}
|
||||
|
||||
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
||||
|
@ -241,7 +240,6 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
MainLog.Instance.Error(e.ToString());
|
||||
return;
|
||||
}
|
||||
MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called");
|
||||
}
|
||||
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
|
@ -271,7 +269,6 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
MainLog.Instance.Error(e.ToString());
|
||||
return;
|
||||
}
|
||||
MainLog.Instance.Verbose("FRIEND", "Stub UpdateUserFriendPerms called");
|
||||
}
|
||||
|
||||
|
||||
|
@ -318,7 +315,6 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
return Lfli;
|
||||
}
|
||||
|
||||
MainLog.Instance.Verbose("FRIEND", "Stub GetUserFriendList called");
|
||||
return Lfli;
|
||||
}
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ namespace OpenSim.Framework.Servers
|
|||
response.StatusCode = 301;
|
||||
response.RedirectLocation = "secondlife:///app/login?first_name=" + keysvals["username"] + "&last_name=" +
|
||||
keysvals["lastname"] +
|
||||
"&location=home&grid=Other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458";
|
||||
"&location=home&grid=other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458";
|
||||
|
||||
response.OutputStream.Close();
|
||||
} // show_login_form == "FALSE"
|
||||
|
|
|
@ -101,6 +101,10 @@ namespace OpenSim.Grid.UserServer
|
|||
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
||||
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
||||
httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
|
||||
httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend);
|
||||
httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend);
|
||||
httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
|
||||
httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
|
||||
|
||||
|
||||
httpServer.AddStreamHandler(
|
||||
|
|
|
@ -91,6 +91,25 @@ namespace OpenSim.Grid.UserServer
|
|||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
// Query Result Information
|
||||
|
||||
responseData["avcount"] = (string)returnUsers.Count.ToString();
|
||||
|
||||
for (int i = 0; i < returnUsers.Count; i++)
|
||||
{
|
||||
responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString();
|
||||
responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString();
|
||||
responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString();
|
||||
responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString();
|
||||
}
|
||||
response.Value = responseData;
|
||||
|
||||
return response;
|
||||
}
|
||||
/// <summary>
|
||||
/// Converts a user profile to an XML element which can be returned
|
||||
/// </summary>
|
||||
|
@ -151,6 +170,83 @@ namespace OpenSim.Grid.UserServer
|
|||
return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar);
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable responseData = new Hashtable();
|
||||
string returnString = "FALSE";
|
||||
// Query Result Information
|
||||
|
||||
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
|
||||
{
|
||||
// UserManagerBase.AddNewuserFriend
|
||||
AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
|
||||
returnString = "TRUE";
|
||||
}
|
||||
responseData["returnString"] = returnString;
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable responseData = new Hashtable();
|
||||
string returnString = "FALSE";
|
||||
// Query Result Information
|
||||
|
||||
if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
|
||||
{
|
||||
// UserManagerBase.AddNewuserFriend
|
||||
RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]));
|
||||
returnString = "TRUE";
|
||||
}
|
||||
responseData["returnString"] = returnString;
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable responseData = new Hashtable();
|
||||
string returnString = "FALSE";
|
||||
|
||||
|
||||
|
||||
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
|
||||
{
|
||||
UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
|
||||
// UserManagerBase.
|
||||
returnString = "TRUE";
|
||||
}
|
||||
responseData["returnString"] = returnString;
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
List<FriendListItem> returndata = new List<FriendListItem>();
|
||||
|
||||
|
||||
|
||||
if (requestData.Contains("ownerID"))
|
||||
{
|
||||
returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
|
||||
}
|
||||
|
||||
return FriendListItemListtoXmlRPCResponse(returndata);
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
|
|
@ -109,6 +109,28 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
return pickerlist;
|
||||
}
|
||||
|
||||
public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
|
||||
{
|
||||
List<FriendListItem> buddylist = new List<FriendListItem>();
|
||||
int buddycount = Convert.ToInt32((string)data["avcount"]);
|
||||
|
||||
|
||||
for (int i = 0; i < buddycount; i++)
|
||||
{
|
||||
FriendListItem buddylistitem = new FriendListItem();
|
||||
|
||||
buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]);
|
||||
buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]);
|
||||
buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
|
||||
buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
|
||||
|
||||
buddylist.Add(buddylistitem);
|
||||
}
|
||||
|
||||
|
||||
return buddylist;
|
||||
}
|
||||
|
||||
public UserProfileData GetUserProfile(string firstName, string lastName)
|
||||
{
|
||||
return GetUserProfile(firstName + " " + lastName);
|
||||
|
@ -223,6 +245,48 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
||||
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
try
|
||||
{
|
||||
Hashtable param = new Hashtable();
|
||||
param["ownerID"] = friendlistowner.UUID.ToString();
|
||||
param["friendID"] = friend.UUID.ToString();
|
||||
param["friendPerms"] = perms.ToString();
|
||||
IList parameters = new ArrayList();
|
||||
parameters.Add(param);
|
||||
|
||||
XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters);
|
||||
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||
Hashtable respData = (Hashtable)resp.Value;
|
||||
if (respData != null)
|
||||
{
|
||||
if (respData.Contains("returnString"))
|
||||
{
|
||||
if ((string)respData["returnString"] == "TRUE")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to add new friend, User Server Reported an issue");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!");
|
||||
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
MainLog.Instance.Warn("GRID","Error when trying to AddNewUserFriend: " +
|
||||
e.Message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -233,7 +297,49 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
/// <param name="friend">The Ex-friend agent</param>
|
||||
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
||||
{
|
||||
try
|
||||
{
|
||||
Hashtable param = new Hashtable();
|
||||
param["ownerID"] = friendlistowner.UUID.ToString();
|
||||
param["friendID"] = friend.UUID.ToString();
|
||||
|
||||
|
||||
IList parameters = new ArrayList();
|
||||
parameters.Add(param);
|
||||
|
||||
XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters);
|
||||
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||
Hashtable respData = (Hashtable)resp.Value;
|
||||
if (respData != null)
|
||||
{
|
||||
if (respData.Contains("returnString"))
|
||||
{
|
||||
if ((string)respData["returnString"] == "TRUE")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to remove friend, User Server Reported an issue");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!");
|
||||
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Error when trying to RemoveUserFriend: " +
|
||||
e.Message);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -244,7 +350,48 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
||||
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||
{
|
||||
try
|
||||
{
|
||||
Hashtable param = new Hashtable();
|
||||
param["ownerID"] = friendlistowner.UUID.ToString();
|
||||
param["friendID"] = friend.UUID.ToString();
|
||||
param["friendPerms"] = perms.ToString();
|
||||
IList parameters = new ArrayList();
|
||||
parameters.Add(param);
|
||||
|
||||
XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters);
|
||||
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||
Hashtable respData = (Hashtable)resp.Value;
|
||||
if (respData != null)
|
||||
{
|
||||
if (respData.Contains("returnString"))
|
||||
{
|
||||
if ((string)respData["returnString"] == "TRUE")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, User Server Reported an issue");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!");
|
||||
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
MainLog.Instance.Warn("GRID", "Error when trying to update_user_friend_perms: " +
|
||||
e.Message);
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
|
||||
|
@ -252,7 +399,33 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
|
||||
{
|
||||
return new List<FriendListItem>();
|
||||
List<FriendListItem> buddylist = new List<FriendListItem>();
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable param = new Hashtable();
|
||||
param["ownerID"] = friendlistowner.UUID.ToString();
|
||||
|
||||
IList parameters = new ArrayList();
|
||||
parameters.Add(param);
|
||||
XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
|
||||
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
|
||||
Hashtable respData = (Hashtable) resp.Value;
|
||||
|
||||
if (respData.Contains("avcount"))
|
||||
{
|
||||
buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
|
||||
}
|
||||
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
MainLog.Instance.Warn("Error when trying to fetch Avatar's friends list: " +
|
||||
e.Message);
|
||||
// Return Empty list (no friends)
|
||||
}
|
||||
return buddylist;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in New Issue