aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs4
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs4
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs4
-rw-r--r--OpenSim/Data/UserDataBase.cs2
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs7
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs15
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs15
-rw-r--r--OpenSim/Framework/IRegionCommsListener.cs3
-rw-r--r--OpenSim/Framework/IUserData.cs7
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs13
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs1
-rw-r--r--OpenSim/Grid/UserServer/Main.cs63
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs59
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs48
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs10
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs26
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs34
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs1
21 files changed, 344 insertions, 17 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs
index 0d3563f..aa8c2ed 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs
@@ -321,9 +321,9 @@ namespace OpenSim.Data.MSSQL
321 321
322 #endregion 322 #endregion
323 323
324 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) 324 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
325 { 325 {
326 m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); 326 //m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called");
327 } 327 }
328 328
329 329
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index bcfd7c3..f717609 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -382,9 +382,9 @@ namespace OpenSim.Data.MySQL
382 382
383 #endregion 383 #endregion
384 384
385 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) 385 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
386 { 386 {
387 m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called"); 387 //m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called");
388 } 388 }
389 389
390 override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 390 override public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index b757496..af9020d 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -295,7 +295,7 @@ namespace OpenSim.Data.NHibernate
295 } 295 }
296 296
297 // TODO: actually implement these 297 // TODO: actually implement these
298 public override void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) {return;} 298 public override void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) { return; }
299 public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) {return;} 299 public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) {return;}
300 public override void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) {return;} 300 public override void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) {return;}
301 public override void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) {return;} 301 public override void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) {return;}
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 85dd47b..c9ef3c2 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -238,9 +238,9 @@ namespace OpenSim.Data.SQLite
238 238
239 #endregion 239 #endregion
240 240
241 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) 241 override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
242 { 242 {
243 m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called"); 243 //m_log.Info("[USER DB]: Stub UpdateUserCUrrentRegion called");
244 } 244 }
245 245
246 246
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs
index cbf24a7..384dd19 100644
--- a/OpenSim/Data/UserDataBase.cs
+++ b/OpenSim/Data/UserDataBase.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Data
47 public abstract void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey); 47 public abstract void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey);
48 public abstract void AddNewUserProfile(UserProfileData user); 48 public abstract void AddNewUserProfile(UserProfileData user);
49 public abstract bool UpdateUserProfile(UserProfileData user); 49 public abstract bool UpdateUserProfile(UserProfileData user);
50 public abstract void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid); 50 public abstract void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
51 public abstract void AddNewUserAgent(UserAgentData agent); 51 public abstract void AddNewUserAgent(UserAgentData agent);
52 public abstract void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms); 52 public abstract void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms);
53 public abstract void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend); 53 public abstract void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend);
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index 67a8c78..59ad188 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -113,6 +113,13 @@ namespace OpenSim.Framework.Communications
113 /// Get's the User Appearance 113 /// Get's the User Appearance
114 AvatarAppearance GetUserAppearance(LLUUID user); 114 AvatarAppearance GetUserAppearance(LLUUID user);
115 115
116 /// <summary>
117 /// Updates the current region the User is in
118 /// </summary>
119 /// <param name="avatarid">User Region the Avatar is IN</param>
120 /// <param name="retionuuid">User Region the Avatar is IN</param>
121 void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
122
116 void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); 123 void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
117 124
118 void AddAttachment(LLUUID user, LLUUID attach); 125 void AddAttachment(LLUUID user, LLUUID attach);
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index bd0fa53..08b071f 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -79,7 +79,15 @@ namespace OpenSim.Framework.Communications
79 /// <param name="response">The existing response</param> 79 /// <param name="response">The existing response</param>
80 /// <param name="theUser">The user profile</param> 80 /// <param name="theUser">The user profile</param>
81 public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest); 81 public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
82
83 /// <summary>
84 /// If the user is already logged in, try to notify the region that the user they've got is dead.
85 /// </summary>
86 /// <param name="theUser"></param>
87 public virtual void LogOffUser(UserProfileData theUser, string message)
88 {
82 89
90 }
83 /// <summary> 91 /// <summary>
84 /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user. 92 /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
85 /// </summary> 93 /// </summary>
@@ -196,9 +204,14 @@ namespace OpenSim.Framework.Communications
196 // because of some problem, for instance, the crashment of server or client, 204 // because of some problem, for instance, the crashment of server or client,
197 // the user cannot log in any longer. 205 // the user cannot log in any longer.
198 userProfile.CurrentAgent.AgentOnline = false; 206 userProfile.CurrentAgent.AgentOnline = false;
199 m_userManager.CommitAgent(ref userProfile);
200 207
208 m_userManager.CommitAgent(ref userProfile);
209
210 // try to tell the region that their user is dead.
211 LogOffUser(userProfile, "You were logged off because you logged in from another location");
212
201 // Reject the login 213 // Reject the login
214
202 215
203 m_log.InfoFormat( 216 m_log.InfoFormat(
204 "[LOGIN END]: Notifying user {0} {1} that they are already logged in", 217 "[LOGIN END]: Notifying user {0} {1} that they are already logged in",
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 87e06f1..8985bb6 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -187,6 +187,21 @@ namespace OpenSim.Framework.Communications
187 return null; 187 return null;
188 } 188 }
189 189
190 public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
191 {
192 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
193 {
194 try
195 {
196 plugin.Value.UpdateUserCurrentRegion(avatarid, regionuuid, regionhandle);
197 }
198 catch (Exception e)
199 {
200 m_log.Info("[USERSTORAGE]: Unable to updateuser location via " + plugin.Key + "(" + e.ToString() + ")");
201 }
202 }
203 }
204
190 /// <summary> 205 /// <summary>
191 /// Loads a user's friend list 206 /// Loads a user's friend list
192 /// </summary> 207 /// </summary>
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 1476855..ce84a40 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Framework
50 50
51 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData); 51 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
52 52
53 public delegate void LogOffUser(ulong regionHandle, LLUUID agentID, LLUUID regionSecret, string message);
54
53 public interface IRegionCommsListener 55 public interface IRegionCommsListener
54 { 56 {
55 event ExpectUserDelegate OnExpectUser; 57 event ExpectUserDelegate OnExpectUser;
@@ -63,5 +65,6 @@ namespace OpenSim.Framework
63 event CloseAgentConnection OnCloseAgentConnection; 65 event CloseAgentConnection OnCloseAgentConnection;
64 event RegionUp OnRegionUp; 66 event RegionUp OnRegionUp;
65 event ChildAgentUpdate OnChildAgentUpdate; 67 event ChildAgentUpdate OnChildAgentUpdate;
68 event LogOffUser OnLogOffUser;
66 } 69 }
67} \ No newline at end of file 70} \ No newline at end of file
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index 0b25f7e..5952713 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -98,13 +98,8 @@ namespace OpenSim.Framework
98 /// <param name="user">UserProfile to update</param> 98 /// <param name="user">UserProfile to update</param>
99 bool UpdateUserProfile(UserProfileData user); 99 bool UpdateUserProfile(UserProfileData user);
100 100
101 /// <summary>
102 /// Updates the current region the User is in
103 /// </summary>
104 /// <param name="avatarid">User Region the Avatar is IN</param>
105 /// <param name="retionuuid">User Region the Avatar is IN</param>
106 void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid);
107 101
102 void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
108 /// <summary> 103 /// <summary>
109 /// Adds a new agent to the database 104 /// Adds a new agent to the database
110 /// </summary> 105 /// </summary>
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index c4c5813..4045b44 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Framework
45 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; 45 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
46 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 46 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
47 private RegionUp handlerRegionUp = null; // OnRegionUp; 47 private RegionUp handlerRegionUp = null; // OnRegionUp;
48 private LogOffUser handlerLogOffUser = null;
48 49
49 #region IRegionCommsListener Members 50 #region IRegionCommsListener Members
50 51
@@ -59,6 +60,7 @@ namespace OpenSim.Framework
59 public event CloseAgentConnection OnCloseAgentConnection; 60 public event CloseAgentConnection OnCloseAgentConnection;
60 public event RegionUp OnRegionUp; 61 public event RegionUp OnRegionUp;
61 public event ChildAgentUpdate OnChildAgentUpdate; 62 public event ChildAgentUpdate OnChildAgentUpdate;
63 public event LogOffUser OnLogOffUser;
62 64
63 #endregion 65 #endregion
64 66
@@ -79,6 +81,17 @@ namespace OpenSim.Framework
79 return false; 81 return false;
80 } 82 }
81 83
84 // From User Server
85 public virtual void TriggerLogOffUser(ulong regionHandle, LLUUID agentID, LLUUID RegionSecret, string message)
86 {
87 handlerLogOffUser = OnLogOffUser;
88 if (handlerLogOffUser != null)
89 {
90 handlerLogOffUser(regionHandle, agentID, RegionSecret, message);
91 }
92
93 }
94
82 95
83 public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) 96 public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod)
84 { 97 {
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index fcbc5a1..60c6883 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -84,6 +84,7 @@ namespace OpenSim.Framework.Servers
84 84
85 Notice("show uptime - show server startup and uptime."); 85 Notice("show uptime - show server startup and uptime.");
86 Notice("shutdown - shutdown the server.\n"); 86 Notice("shutdown - shutdown the server.\n");
87
87 break; 88 break;
88 89
89 case "show": 90 case "show":
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
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 628c471..d538d36 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -60,6 +60,65 @@ namespace OpenSim.Grid.UserServer
60 { 60 {
61 m_config = config; 61 m_config = config;
62 } 62 }
63 public override void LogOffUser(UserProfileData theUser, string message)
64 {
65 RegionProfileData SimInfo = null;
66 try
67 {
68 SimInfo = RegionProfileData.RequestSimProfileData(
69 theUser.CurrentAgent.Handle, m_config.GridServerURL,
70 m_config.GridSendKey, m_config.GridRecvKey);
71 if (SimInfo == null)
72 {
73 m_log.Error("[GRID]: Region user was in isn't currently logged in");
74 return;
75 }
76
77 }
78 catch (Exception)
79 {
80 m_log.Error("[GRID]: Unable to look up region to log user off");
81 return;
82 }
83 // Prepare notification
84 Hashtable SimParams = new Hashtable();
85 SimParams["agent_id"] = theUser.ID.ToString();
86 SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString();
87 //SimParams["region_secret"] = SimInfo.regionSecret;
88 //m_log.Info(SimInfo.regionSecret);
89 SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
90 SimParams["message"] = message;
91 ArrayList SendParams = new ArrayList();
92 SendParams.Add(SimParams);
93
94 // Update agent with target sim
95
96 m_log.InfoFormat(
97 "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
98 SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, theUser.FirstName + " " + theUser.SurName);
99 try
100 {
101 XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
102 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
103
104 if (GridResp.IsFault)
105 {
106 m_log.ErrorFormat(
107 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
108 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
109 }
110 }
111 catch (Exception)
112 {
113 m_log.Error("[LOGIN]: Error telling region to logout user!");
114 }
115
116 //base.LogOffUser(theUser);
117 }
118 //public override void LogOffUser(UserProfileData theUser)
119 //{
120
121 //}
63 122
64 /// <summary> 123 /// <summary>
65 /// Customises the login response and fills in missing values. 124 /// Customises the login response and fills in missing values.
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index a82505d..1b47289 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -179,6 +179,54 @@ namespace OpenSim.Grid.UserServer
179 return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); 179 return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar);
180 } 180 }
181 181
182 public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request)
183 {
184 XmlRpcResponse response = new XmlRpcResponse();
185 Hashtable requestData = (Hashtable)request.Params[0];
186 Hashtable responseData = new Hashtable();
187 string returnstring = "FALSE";
188
189 if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && requestData.Contains("region_uuid"))
190 {
191 ulong cregionhandle = 0;
192 LLUUID regionUUID = LLUUID.Zero;
193 LLUUID AvatarID = LLUUID.Zero;
194
195 Helpers.TryParse((string)requestData["avatar_id"], out AvatarID);
196 Helpers.TryParse((string)requestData["region_uuid"], out regionUUID);
197 try
198 {
199 cregionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
200 }
201 catch (ArgumentException)
202 {
203 }
204 catch (OverflowException)
205 {
206 }
207 catch (FormatException)
208 {
209 }
210
211 if (AvatarID != LLUUID.Zero)
212 {
213 UserProfileData userProfile = GetUserProfile(new LLUUID((string)requestData["avatar_id"]));
214 userProfile.CurrentAgent.Region = new LLUUID((string)requestData["region_uuid"]);
215 userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
216 //userProfile.CurrentAgent.
217 CommitAgent(ref userProfile);
218 //setUserProfile(userProfile);
219
220
221 returnstring = "TRUE";
222 }
223
224 }
225 responseData.Add("returnString", returnstring);
226 response.Value = responseData;
227 return response;
228 }
229
182 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) 230 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
183 { 231 {
184 XmlRpcResponse response = new XmlRpcResponse(); 232 XmlRpcResponse response = new XmlRpcResponse();
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 0203821..989f08a 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -419,6 +419,16 @@ namespace OpenSim.Region.Communications.Local
419 } 419 }
420 } 420 }
421 421
422 public void TriggerLogOffUser(ulong regionHandle, LLUUID agentID, LLUUID RegionSecret, string message)
423 {
424 if (m_regionListeners.ContainsKey(regionHandle))
425 {
426 //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
427
428 m_regionListeners[regionHandle].TriggerLogOffUser(regionHandle, agentID, RegionSecret, message);
429 }
430 }
431
422 public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) 432 public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod)
423 { 433 {
424 if (m_regionListeners.ContainsKey(regionHandle)) 434 if (m_regionListeners.ContainsKey(regionHandle))
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 309a795..2e892c2 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -86,6 +86,7 @@ namespace OpenSim.Region.Communications.OGS1
86 httpServer = httpServe; 86 httpServer = httpServe;
87 //Respond to Grid Services requests 87 //Respond to Grid Services requests
88 httpServer.AddXmlRPCHandler("expect_user", ExpectUser); 88 httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
89 httpServer.AddXmlRPCHandler("logoff_user", LogOffUser);
89 httpServer.AddXmlRPCHandler("check", PingCheckReply); 90 httpServer.AddXmlRPCHandler("check", PingCheckReply);
90 91
91 StartRemoting(); 92 StartRemoting();
@@ -603,6 +604,31 @@ namespace OpenSim.Region.Communications.OGS1
603 604
604 return new XmlRpcResponse(); 605 return new XmlRpcResponse();
605 } 606 }
607 // Grid Request Processing
608 /// <summary>
609 /// Ooops, our Agent must be dead if we're getting this request!
610 /// </summary>
611 /// <param name="request"></param>
612 /// <returns></returns>
613 public XmlRpcResponse LogOffUser(XmlRpcRequest request)
614 {
615 m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called ");
616 Hashtable requestData = (Hashtable)request.Params[0];
617 string message = (string)requestData["message"];
618 LLUUID agentID = LLUUID.Zero;
619 LLUUID RegionSecret = LLUUID.Zero;
620 Helpers.TryParse((string)requestData["agent_id"], out agentID);
621 Helpers.TryParse((string)requestData["region_secret"], out RegionSecret);
622
623 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
624
625
626 m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message);
627
628
629
630 return new XmlRpcResponse();
631 }
606 632
607 #region m_interRegion Comms 633 #region m_interRegion Comms
608 634
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 8807eab..e0e17df 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -196,6 +196,36 @@ namespace OpenSim.Region.Communications.OGS1
196 return GetUserProfile(firstName + " " + lastName); 196 return GetUserProfile(firstName + " " + lastName);
197 } 197 }
198 198
199 public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
200 {
201 Hashtable param = new Hashtable();
202 param.Add("avatar_id", avatarid.ToString());
203 param.Add("region_uuid", regionuuid.ToString());
204 param.Add("region_handle", regionhandle.ToString());
205 IList parameters = new ArrayList();
206 parameters.Add(param);
207 XmlRpcRequest req = new XmlRpcRequest("update_user_current_region", parameters);
208 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
209 Hashtable respData = (Hashtable)resp.Value;
210 if (respData.ContainsKey("returnString"))
211 {
212 if ((string)respData["returnString"] == "TRUE")
213 {
214 m_log.Info("[OSG1 USER SERVICES]: Successfully updated user record");
215 }
216 else
217 {
218 m_log.Error("[OSG1 USER SERVICES]: Error updating user record");
219 }
220 }
221 else
222 {
223 m_log.Warn("[OSG1 USER SERVICES]: Error updating user record, Grid server may not be updated.");
224 }
225
226
227 }
228
199 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) 229 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
200 { 230 {
201 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); 231 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 6916c6d..c74dca4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2003,8 +2003,8 @@ namespace OpenSim.Region.Environment.Scenes
2003 m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 2003 m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
2004 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; 2004 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
2005 m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 2005 m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
2006 2006 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
2007 m_sceneGridService.KillObject = SendKillObject; 2007 m_sceneGridService.KillObject += SendKillObject;
2008 } 2008 }
2009 2009
2010 /// <summary> 2010 /// <summary>
@@ -2012,6 +2012,8 @@ namespace OpenSim.Region.Environment.Scenes
2012 /// </summary> 2012 /// </summary>
2013 public void UnRegisterReginWithComms() 2013 public void UnRegisterReginWithComms()
2014 { 2014 {
2015 m_sceneGridService.KillObject -= SendKillObject;
2016 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
2015 m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 2017 m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
2016 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; 2018 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
2017 m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 2019 m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
@@ -2064,6 +2066,34 @@ namespace OpenSim.Region.Environment.Scenes
2064 } 2066 }
2065 } 2067 }
2066 2068
2069 protected void HandleLogOffUserFromGrid(ulong regionHandle, LLUUID AvatarID, LLUUID RegionSecret, string message)
2070 {
2071 if (RegionInfo.RegionHandle == regionHandle)
2072 {
2073 ScenePresence loggingOffUser = null;
2074 loggingOffUser = GetScenePresence(AvatarID);
2075 if (loggingOffUser != null)
2076 {
2077 if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId)
2078 {
2079 loggingOffUser.ControllingClient.Kick(message);
2080 // Give them a second to receive the message!
2081 System.Threading.Thread.Sleep(1000);
2082 loggingOffUser.ControllingClient.Close(true);
2083 }
2084 else
2085 {
2086 m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate");
2087 }
2088 }
2089 else
2090 {
2091 m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
2092 }
2093 }
2094
2095
2096 }
2067 /// <summary> 2097 /// <summary>
2068 /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent, 2098 /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent,
2069 /// then it is replaced by a new CAPS handler. 2099 /// then it is replaced by a new CAPS handler.
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index d2d75e8..e841ad4 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Region.Environment.Scenes
58 public event RegionUp OnRegionUp; 58 public event RegionUp OnRegionUp;
59 public event ChildAgentUpdate OnChildAgentUpdate; 59 public event ChildAgentUpdate OnChildAgentUpdate;
60 public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; 60 public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
61 public event LogOffUser OnLogOffUser;
61 62
62 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; 63 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
63 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; 64 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
@@ -67,6 +68,7 @@ namespace OpenSim.Region.Environment.Scenes
67 private RegionUp handlerRegionUp = null; // OnRegionUp; 68 private RegionUp handlerRegionUp = null; // OnRegionUp;
68 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 69 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
69 private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; 70 private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
71 private LogOffUser handlerLogOffUser = null;
70 72
71 public KillObjectDelegate KillObject; 73 public KillObjectDelegate KillObject;
72 public string _debugRegionName = String.Empty; 74 public string _debugRegionName = String.Empty;
@@ -105,6 +107,7 @@ namespace OpenSim.Region.Environment.Scenes
105 regionCommsHost.OnCloseAgentConnection += CloseConnection; 107 regionCommsHost.OnCloseAgentConnection += CloseConnection;
106 regionCommsHost.OnRegionUp += newRegionUp; 108 regionCommsHost.OnRegionUp += newRegionUp;
107 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; 109 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
110 regionCommsHost.OnLogOffUser += GridLogOffUser;
108 } 111 }
109 else 112 else
110 { 113 {
@@ -121,6 +124,7 @@ namespace OpenSim.Region.Environment.Scenes
121 { 124 {
122 if (regionCommsHost != null) 125 if (regionCommsHost != null)
123 { 126 {
127 regionCommsHost.OnLogOffUser -= GridLogOffUser;
124 regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; 128 regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
125 regionCommsHost.OnRegionUp -= newRegionUp; 129 regionCommsHost.OnRegionUp -= newRegionUp;
126 regionCommsHost.OnExpectUser -= NewUserConnection; 130 regionCommsHost.OnExpectUser -= NewUserConnection;
@@ -150,6 +154,15 @@ namespace OpenSim.Region.Environment.Scenes
150 } 154 }
151 } 155 }
152 156
157 protected void GridLogOffUser(ulong regionHandle, LLUUID AgentID, LLUUID RegionSecret, string message)
158 {
159 handlerLogOffUser = OnLogOffUser;
160 if (handlerLogOffUser != null)
161 {
162 handlerLogOffUser(regionHandle, AgentID, RegionSecret, message);
163 }
164 }
165
153 protected bool newRegionUp(RegionInfo region) 166 protected bool newRegionUp(RegionInfo region)
154 { 167 {
155 handlerRegionUp = OnRegionUp; 168 handlerRegionUp = OnRegionUp;
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 30075da..0fdd720 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -596,6 +596,7 @@ namespace OpenSim.Region.Environment.Scenes
596 m_scene.SendAllSceneObjectsToClient(this); 596 m_scene.SendAllSceneObjectsToClient(this);
597 597
598 m_scene.EventManager.TriggerOnMakeRootAgent(this); 598 m_scene.EventManager.TriggerOnMakeRootAgent(this);
599 m_scene.CommsManager.UserService.UpdateUserCurrentRegion(UUID, m_scene.RegionInfo.RegionID, m_scene.RegionInfo.RegionHandle);
599 600
600 //m_gotAllObjectsInScene = true; 601 //m_gotAllObjectsInScene = true;
601 //} 602 //}