aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorJohan Berntsson2008-03-18 01:38:07 +0000
committerJohan Berntsson2008-03-18 01:38:07 +0000
commit040a887b9c5f22a79de3fdff3947b69d87221379 (patch)
tree401793a60499cd010ed360b6fbf991d42eb87798 /OpenSim/Framework/Communications
parent* Move missing texture request forward so that we don't actually ask the Asse... (diff)
downloadopensim-SC_OLD-040a887b9c5f22a79de3fdff3947b69d87221379.zip
opensim-SC_OLD-040a887b9c5f22a79de3fdff3947b69d87221379.tar.gz
opensim-SC_OLD-040a887b9c5f22a79de3fdff3947b69d87221379.tar.bz2
opensim-SC_OLD-040a887b9c5f22a79de3fdff3947b69d87221379.tar.xz
Last position will be stored in the DB on logout, and the avatar can continue from the same position in the next login (only with MySQL at the moment)
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs4
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs57
2 files changed, 53 insertions, 8 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 3bf6096..fc02ff6 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -154,6 +154,10 @@ namespace OpenSim.Framework.UserManagement
154 154
155 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) 155 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
156 { 156 {
157 //TODO: The following statements can cause trouble:
158 // If agentOnline could not turn from true back to false normally
159 // because of some problem, for instance, the crashment of server or client,
160 // the user cannot log in any longer.
157 userProfile.currentAgent = null; 161 userProfile.currentAgent = null;
158 m_userManager.CommitAgent(ref userProfile); 162 m_userManager.CommitAgent(ref userProfile);
159 163
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 3380e90..b8e3114 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Reflection; 32using System.Reflection;
32using System.Security.Cryptography; 33using System.Security.Cryptography;
@@ -337,7 +338,7 @@ namespace OpenSim.Framework.UserManagement
337 /// <param name="request">The users loginrequest</param> 338 /// <param name="request">The users loginrequest</param>
338 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 339 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
339 { 340 {
340 //Hashtable requestData = (Hashtable) request.Params[0]; 341 Hashtable requestData = (Hashtable) request.Params[0];
341 342
342 UserAgentData agent = new UserAgentData(); 343 UserAgentData agent = new UserAgentData();
343 344
@@ -362,9 +363,24 @@ namespace OpenSim.Framework.UserManagement
362 agent.currentPos = profile.homeLocation; 363 agent.currentPos = profile.homeLocation;
363 364
364 // If user specified additional start, use that 365 // If user specified additional start, use that
365// if (requestData.ContainsKey("start")) 366 if (requestData.ContainsKey("start"))
366// { 367 {
367// string startLoc = ((string) requestData["start"]).Trim(); 368 string startLoc = ((string)requestData["start"]).Trim();
369 if (("last" == startLoc) && (profile.currentAgent != null))
370 {
371 if ((profile.currentAgent.currentPos.X > 0)
372 && (profile.currentAgent.currentPos.Y > 0)
373 && (profile.currentAgent.currentPos.Z > 0)
374 )
375 {
376 // TODO: Right now, currentRegion has not been used in GridServer for requesting region.
377 // TODO: It is only using currentHandle.
378 agent.currentRegion = profile.currentAgent.currentRegion;
379 agent.currentHandle = profile.currentAgent.currentHandle;
380 agent.currentPos = profile.currentAgent.currentPos;
381 }
382 }
383
368// if (!(startLoc == "last" || startLoc == "home")) 384// if (!(startLoc == "last" || startLoc == "home"))
369// { 385// {
370// // Format: uri:Ahern&162&213&34 386// // Format: uri:Ahern&162&213&34
@@ -381,7 +397,7 @@ namespace OpenSim.Framework.UserManagement
381// { 397// {
382// } 398// }
383// } 399// }
384// } 400 }
385 401
386 // What time did the user login? 402 // What time did the user login?
387 agent.loginTime = Util.UnixTimeSinceEpoch(); 403 agent.loginTime = Util.UnixTimeSinceEpoch();
@@ -424,7 +440,7 @@ namespace OpenSim.Framework.UserManagement
424 { 440 {
425 userAgent.agentOnline = false; 441 userAgent.agentOnline = false;
426 userAgent.logoutTime = Util.UnixTimeSinceEpoch(); 442 userAgent.logoutTime = Util.UnixTimeSinceEpoch();
427 userAgent.sessionID = LLUUID.Zero; 443 //userAgent.sessionID = LLUUID.Zero;
428 if (regionid != null) 444 if (regionid != null)
429 { 445 {
430 userAgent.currentRegion = regionid; 446 userAgent.currentRegion = regionid;
@@ -493,8 +509,12 @@ namespace OpenSim.Framework.UserManagement
493 /// <returns>Successful?</returns> 509 /// <returns>Successful?</returns>
494 public bool CommitAgent(ref UserProfileData profile) 510 public bool CommitAgent(ref UserProfileData profile)
495 { 511 {
496 // TODO: how is this function different from setUserProfile? 512 // TODO: how is this function different from setUserProfile? -> Add AddUserAgent() here and commit both tables "users" and "agents"
497 return setUserProfile(profile); 513 // TODO: what is the logic should be?
514 bool ret = false;
515 ret = AddUserAgent(profile.currentAgent);
516 ret = ret & setUserProfile(profile);
517 return ret;
498 } 518 }
499 519
500 #endregion 520 #endregion
@@ -558,5 +578,26 @@ namespace OpenSim.Framework.UserManagement
558 public abstract UserProfileData SetupMasterUser(string firstName, string lastName); 578 public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
559 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); 579 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
560 public abstract UserProfileData SetupMasterUser(LLUUID uuid); 580 public abstract UserProfileData SetupMasterUser(LLUUID uuid);
581
582 /// <summary>
583 /// Add agent to DB
584 /// </summary>
585 /// <param name="agentdata">The agent data to be added</param>
586 public bool AddUserAgent(UserAgentData agentdata)
587 {
588 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
589 {
590 try
591 {
592 plugin.Value.AddNewUserAgent(agentdata);
593 return true;
594 }
595 catch (Exception e)
596 {
597 m_log.Info("[USERSTORAGE]: Unable to add agent via " + plugin.Key + "(" + e.ToString() + ")");
598 }
599 }
600 return false;
601 }
561 } 602 }
562} 603}