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