From 3738bc88999d4cf8060fa2535cb264e0cddcb8c7 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 2 Jan 2008 00:54:50 +0000 Subject: * Updates UserServer * Updates OSG1UserServices * Friends list is now persistent in grid mode. * You can add, new friends and remove them --- OpenSim/Grid/UserServer/UserManager.cs | 98 +++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer/UserManager.cs') diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index a50419e..c905ffe 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs @@ -87,10 +87,29 @@ namespace OpenSim.Grid.UserServer responseData["lastname" + i.ToString()] = returnUsers[i].lastName; } response.Value = responseData; - + return response; } + public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List 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; + } /// /// Converts a user profile to an XML element which can be returned /// @@ -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 returndata = new List(); + + + + if (requestData.Contains("ownerID")) + { + returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"])); + } + + return FriendListItemListtoXmlRPCResponse(returndata); + } + public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); -- cgit v1.1