diff options
author | Teravus Ovares | 2008-05-31 12:18:29 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-31 12:18:29 +0000 |
commit | febe78d06249cd4d36a86e97610dd45ab518a757 (patch) | |
tree | 7b9733fc14045f09e874440b923cfe443b781b6a /OpenSim/Grid/UserServer/Main.cs | |
parent | Mantis#1425. Thank you kindly, Melanie for a patch that: (diff) | |
download | opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.zip opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.tar.gz opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.tar.bz2 opensim-SC_OLD-febe78d06249cd4d36a86e97610dd45ab518a757.tar.xz |
* Implements UserServer logoff in a few situations
* User tries to log-in but is already logged in. Userserver will send message to simulator user was in to log the user out there.
* From the UserServer, admin types 'logoff-user firstname lastname message'.
* Some regions may not get the message because they're not updated yet.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 810c24e..9d7421c 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -129,6 +129,7 @@ namespace OpenSim.Grid.UserServer | |||
129 | m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); | 129 | m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); |
130 | m_httpServer.AddXmlRPCHandler("get_avatar_appearance", m_userManager.XmlRPCGetAvatarAppearance); | 130 | m_httpServer.AddXmlRPCHandler("get_avatar_appearance", m_userManager.XmlRPCGetAvatarAppearance); |
131 | m_httpServer.AddXmlRPCHandler("update_avatar_appearance", m_userManager.XmlRPCUpdateAvatarAppearance); | 131 | m_httpServer.AddXmlRPCHandler("update_avatar_appearance", m_userManager.XmlRPCUpdateAvatarAppearance); |
132 | m_httpServer.AddXmlRPCHandler("update_user_current_region", m_userManager.XmlRPCAtRegion); | ||
132 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); | 133 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); |
133 | 134 | ||
134 | // Message Server ---> User Server | 135 | // Message Server ---> User Server |
@@ -221,6 +222,7 @@ namespace OpenSim.Grid.UserServer | |||
221 | { | 222 | { |
222 | case "help": | 223 | case "help": |
223 | m_console.Notice("create user - create a new user"); | 224 | m_console.Notice("create user - create a new user"); |
225 | m_console.Notice("logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid"); | ||
224 | break; | 226 | break; |
225 | 227 | ||
226 | case "create": | 228 | case "create": |
@@ -238,6 +240,67 @@ namespace OpenSim.Grid.UserServer | |||
238 | "RootFolders/", | 240 | "RootFolders/", |
239 | m_lastCreatedUser); | 241 | m_lastCreatedUser); |
240 | break; | 242 | break; |
243 | case "logoff-user": | ||
244 | |||
245 | if (cmdparams.Length >= 3) | ||
246 | { | ||
247 | string firstname = cmdparams[0]; | ||
248 | string lastname = cmdparams[1]; | ||
249 | string message = ""; | ||
250 | |||
251 | for (int i = 2; i < cmdparams.Length; i++) | ||
252 | message += " " + cmdparams[i]; | ||
253 | |||
254 | UserProfileData theUser = null; | ||
255 | try | ||
256 | { | ||
257 | theUser = m_loginService.GetTheUser(firstname, lastname); | ||
258 | } | ||
259 | catch (Exception) | ||
260 | { | ||
261 | m_log.Error("[LOGOFF]: Error getting user data from the database."); | ||
262 | } | ||
263 | |||
264 | if (theUser != null) | ||
265 | { | ||
266 | if (theUser.CurrentAgent != null) | ||
267 | { | ||
268 | if (theUser.CurrentAgent.AgentOnline) | ||
269 | { | ||
270 | m_log.Info("[LOGOFF]: Logging off requested user!"); | ||
271 | m_loginService.LogOffUser(theUser, message); | ||
272 | |||
273 | theUser.CurrentAgent.AgentOnline = false; | ||
274 | |||
275 | m_loginService.CommitAgent(ref theUser); | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | m_log.Info("[LOGOFF]: User Doesn't appear to be online, sending the logoff message anyway."); | ||
280 | m_loginService.LogOffUser(theUser, message); | ||
281 | |||
282 | theUser.CurrentAgent.AgentOnline = false; | ||
283 | |||
284 | m_loginService.CommitAgent(ref theUser); | ||
285 | } | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | m_log.Error("[LOGOFF]: Unable to logoff-user. User doesn't have an agent record so I can't find the simulator to notify"); | ||
290 | } | ||
291 | |||
292 | } | ||
293 | else | ||
294 | { | ||
295 | m_log.Info("[LOGOFF]: User doesn't exist in the database"); | ||
296 | } | ||
297 | } | ||
298 | else | ||
299 | { | ||
300 | m_log.Error("[LOGOFF]: Invalid amount of parameters. logoff-user takes at least three. Firstname, Lastname, and message"); | ||
301 | } | ||
302 | |||
303 | break; | ||
241 | } | 304 | } |
242 | } | 305 | } |
243 | 306 | ||