diff options
author | Diva Canto | 2010-01-10 20:17:37 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-10 20:17:37 -0800 |
commit | 5cf6d6fa79dada85bd56530551409809d338b7d2 (patch) | |
tree | 24f89393fc9b25f138caed27919800230dafe70d /OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs | |
parent | OpenSim.Region.Communications.* is no more. Thanks to everyone who contribute... (diff) | |
download | opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.zip opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.tar.gz opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.tar.bz2 opensim-SC-5cf6d6fa79dada85bd56530551409809d338b7d2.tar.xz |
All grid servers deleted, including user server. They served us well.
Diffstat (limited to 'OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs')
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs deleted file mode 100644 index 56e52a0..0000000 --- a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using Nwc.XmlRpc; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Communications; | ||
38 | using OpenSim.Framework.Servers; | ||
39 | using OpenSim.Framework.Servers.HttpServer; | ||
40 | using OpenSim.Grid.Framework; | ||
41 | |||
42 | namespace OpenSim.Grid.UserServer.Modules | ||
43 | { | ||
44 | public class UserServerFriendsModule | ||
45 | { | ||
46 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private UserDataBaseService m_userDataBaseService; | ||
49 | |||
50 | private BaseHttpServer m_httpServer; | ||
51 | |||
52 | public UserServerFriendsModule(UserDataBaseService userDataBaseService) | ||
53 | { | ||
54 | m_userDataBaseService = userDataBaseService; | ||
55 | } | ||
56 | |||
57 | public void Initialise(IGridServiceCore core) | ||
58 | { | ||
59 | |||
60 | } | ||
61 | |||
62 | public void PostInitialise() | ||
63 | { | ||
64 | |||
65 | } | ||
66 | |||
67 | public void RegisterHandlers(BaseHttpServer httpServer) | ||
68 | { | ||
69 | m_httpServer = httpServer; | ||
70 | |||
71 | m_httpServer.AddXmlRPCHandler("add_new_user_friend", XmlRpcResponseXmlRPCAddUserFriend); | ||
72 | m_httpServer.AddXmlRPCHandler("remove_user_friend", XmlRpcResponseXmlRPCRemoveUserFriend); | ||
73 | m_httpServer.AddXmlRPCHandler("update_user_friend_perms", XmlRpcResponseXmlRPCUpdateUserFriendPerms); | ||
74 | m_httpServer.AddXmlRPCHandler("get_user_friend_list", XmlRpcResponseXmlRPCGetUserFriendList); | ||
75 | } | ||
76 | |||
77 | public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers) | ||
78 | { | ||
79 | XmlRpcResponse response = new XmlRpcResponse(); | ||
80 | Hashtable responseData = new Hashtable(); | ||
81 | // Query Result Information | ||
82 | |||
83 | responseData["avcount"] = returnUsers.Count.ToString(); | ||
84 | |||
85 | for (int i = 0; i < returnUsers.Count; i++) | ||
86 | { | ||
87 | responseData["ownerID" + i] = returnUsers[i].FriendListOwner.ToString(); | ||
88 | responseData["friendID" + i] = returnUsers[i].Friend.ToString(); | ||
89 | responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); | ||
90 | responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); | ||
91 | } | ||
92 | response.Value = responseData; | ||
93 | |||
94 | return response; | ||
95 | } | ||
96 | |||
97 | public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request, IPEndPoint remoteClient) | ||
98 | { | ||
99 | XmlRpcResponse response = new XmlRpcResponse(); | ||
100 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
101 | Hashtable responseData = new Hashtable(); | ||
102 | string returnString = "FALSE"; | ||
103 | // Query Result Information | ||
104 | |||
105 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && | ||
106 | requestData.Contains("friendPerms")) | ||
107 | { | ||
108 | // UserManagerBase.AddNewuserFriend | ||
109 | m_userDataBaseService.AddNewUserFriend(new UUID((string)requestData["ownerID"]), | ||
110 | new UUID((string)requestData["friendID"]), | ||
111 | (uint)Convert.ToInt32((string)requestData["friendPerms"])); | ||
112 | returnString = "TRUE"; | ||
113 | } | ||
114 | responseData["returnString"] = returnString; | ||
115 | response.Value = responseData; | ||
116 | return response; | ||
117 | } | ||
118 | |||
119 | public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request, IPEndPoint remoteClient) | ||
120 | { | ||
121 | XmlRpcResponse response = new XmlRpcResponse(); | ||
122 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
123 | Hashtable responseData = new Hashtable(); | ||
124 | string returnString = "FALSE"; | ||
125 | // Query Result Information | ||
126 | |||
127 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) | ||
128 | { | ||
129 | // UserManagerBase.AddNewuserFriend | ||
130 | m_userDataBaseService.RemoveUserFriend(new UUID((string)requestData["ownerID"]), | ||
131 | new UUID((string)requestData["friendID"])); | ||
132 | returnString = "TRUE"; | ||
133 | } | ||
134 | responseData["returnString"] = returnString; | ||
135 | response.Value = responseData; | ||
136 | return response; | ||
137 | } | ||
138 | |||
139 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request, IPEndPoint remoteClient) | ||
140 | { | ||
141 | XmlRpcResponse response = new XmlRpcResponse(); | ||
142 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
143 | Hashtable responseData = new Hashtable(); | ||
144 | string returnString = "FALSE"; | ||
145 | |||
146 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && | ||
147 | requestData.Contains("friendPerms")) | ||
148 | { | ||
149 | m_userDataBaseService.UpdateUserFriendPerms(new UUID((string)requestData["ownerID"]), | ||
150 | new UUID((string)requestData["friendID"]), | ||
151 | (uint)Convert.ToInt32((string)requestData["friendPerms"])); | ||
152 | // UserManagerBase. | ||
153 | returnString = "TRUE"; | ||
154 | } | ||
155 | responseData["returnString"] = returnString; | ||
156 | response.Value = responseData; | ||
157 | return response; | ||
158 | } | ||
159 | |||
160 | public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request, IPEndPoint remoteClient) | ||
161 | { | ||
162 | // XmlRpcResponse response = new XmlRpcResponse(); | ||
163 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
164 | // Hashtable responseData = new Hashtable(); | ||
165 | |||
166 | List<FriendListItem> returndata = new List<FriendListItem>(); | ||
167 | |||
168 | if (requestData.Contains("ownerID")) | ||
169 | { | ||
170 | returndata = m_userDataBaseService.GetUserFriendList(new UUID((string)requestData["ownerID"])); | ||
171 | } | ||
172 | |||
173 | return FriendListItemListtoXmlRPCResponse(returndata); | ||
174 | } | ||
175 | } | ||
176 | } | ||