aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/UserServer/Main.cs13
-rw-r--r--OpenSim/Grid/UserServer/MessageServersConnector.cs97
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs12
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs11
4 files changed, 113 insertions, 20 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 3a3b8b6..fcf9de6 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -98,6 +98,7 @@ namespace OpenSim.Grid.UserServer
98 m_messagesService = new MessageServersConnector(); 98 m_messagesService = new MessageServersConnector();
99 99
100 m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; 100 m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
101 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
101 102
102 m_log.Info("[REGION]: Starting HTTP process"); 103 m_log.Info("[REGION]: Starting HTTP process");
103 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); 104 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
@@ -225,10 +226,18 @@ namespace OpenSim.Grid.UserServer
225 m_console.Notice("response got"); 226 m_console.Notice("response got");
226 } 227 }
227 228
228 public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) 229 public void NotifyMessageServersUserLoggOff(LLUUID agentID)
230 {
231 m_messagesService.TellMessageServersAboutUserLogoff(agentID);
232 }
233
234 public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
235 ulong regionhandle, float positionX, float positionY,
236 float positionZ, string firstname, string lastname)
229 { 237 {
230 238
231 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, Position); 239 m_messagesService.TellMessageServersAboutUser( agentID, sessionID, RegionID, regionhandle, positionX,
240 positionY, positionZ, firstname, lastname);
232 } 241 }
233 242
234 /*private void ConfigDB(IGenericConfig configData) 243 /*private void ConfigDB(IGenericConfig configData)
diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs
index 6535247..79d1147 100644
--- a/OpenSim/Grid/UserServer/MessageServersConnector.cs
+++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs
@@ -52,12 +52,20 @@ namespace OpenSim.Grid.UserServer
52 52
53 public void RegisterMessageServer(string URI, MessageServerInfo serverData) 53 public void RegisterMessageServer(string URI, MessageServerInfo serverData)
54 { 54 {
55 MessageServers.Add(URI, serverData); 55 lock (MessageServers)
56 {
57 if (!MessageServers.ContainsKey(URI))
58 MessageServers.Add(URI, serverData);
59 }
56 } 60 }
57 61
58 public void DeRegisterMessageServer(string URI) 62 public void DeRegisterMessageServer(string URI)
59 { 63 {
60 MessageServers.Remove(URI); 64 lock (MessageServers)
65 {
66 if (MessageServers.ContainsKey(URI))
67 MessageServers.Remove(URI);
68 }
61 } 69 }
62 70
63 public void AddResponsibleRegion(string URI, ulong regionhandle) 71 public void AddResponsibleRegion(string URI, ulong regionhandle)
@@ -150,24 +158,73 @@ namespace OpenSim.Grid.UserServer
150 return response; 158 return response;
151 } 159 }
152 160
153 public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) 161 public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
162 ulong regionhandle, float positionX, float positionY,
163 float positionZ, string firstname, string lastname)
154 { 164 {
155 // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) 165 // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D )
156 if (MessageServers.Count > 0) 166 lock (MessageServers)
157 { 167 {
158 m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers"); 168 if (MessageServers.Count > 0)
169 {
170 m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers");
171 }
172 else
173 {
174 m_log.Info("[MSGCONNECTOR]: No Message Servers registered, ignoring");
175 }
176 foreach (MessageServerInfo serv in MessageServers.Values)
177 {
178 NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID,
179 regionhandle, positionX, positionY, positionZ,
180 firstname, lastname);
181 }
159 } 182 }
160 else 183 }
184
185 public void TellMessageServersAboutUserLogoff(LLUUID agentID)
186 {
187 lock (MessageServers)
188 {
189 if (MessageServers.Count > 0)
190 {
191 m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers");
192 }
193 else
194 {
195 m_log.Info("[MSGCONNECTOR]: No Message Servers registered, ignoring");
196 }
197 foreach (MessageServerInfo serv in MessageServers.Values)
198 {
199 NotifyMessageServerAboutUserLogoff(serv,agentID);
200 }
201 }
202 }
203
204 private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, LLUUID agentID)
205 {
206 Hashtable reqparams = new Hashtable();
207 reqparams["sendkey"] = serv.sendkey;
208 reqparams["agentid"] = agentID.ToString();
209 ArrayList SendParams = new ArrayList();
210 SendParams.Add(reqparams);
211
212 XmlRpcRequest GridReq = new XmlRpcRequest("logout_of_simulator", SendParams);
213 try
161 { 214 {
162 m_log.Info("[MSGCONNECTOR]: No Message Servers registered, ignoring"); 215 XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000);
163 } 216 }
164 foreach (MessageServerInfo serv in MessageServers.Values) 217 catch (System.Net.WebException)
165 { 218 {
166 NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, regionhandle, Position); 219 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about log out. Other users might still think this user is online");
167 } 220 }
221 m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
168 } 222 }
169 223
170 private void NotifyMessageServerAboutUser(MessageServerInfo serv, LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) 224 private void NotifyMessageServerAboutUser(MessageServerInfo serv,
225 LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
226 ulong regionhandle, float positionX, float positionY, float positionZ,
227 string firstname, string lastname)
171 { 228 {
172 Hashtable reqparams = new Hashtable(); 229 Hashtable reqparams = new Hashtable();
173 reqparams["sendkey"] = serv.sendkey; 230 reqparams["sendkey"] = serv.sendkey;
@@ -175,14 +232,28 @@ namespace OpenSim.Grid.UserServer
175 reqparams["sessionid"] = sessionID.ToString(); 232 reqparams["sessionid"] = sessionID.ToString();
176 reqparams["regionid"] = RegionID.ToString(); 233 reqparams["regionid"] = RegionID.ToString();
177 reqparams["regionhandle"] = regionhandle.ToString(); 234 reqparams["regionhandle"] = regionhandle.ToString();
178 reqparams["position"] = Position.ToString(); 235 reqparams["positionx"] = positionX.ToString();
236 reqparams["positiony"] = positionY.ToString();
237 reqparams["positionz"] = positionZ.ToString();
238 reqparams["firstname"] = firstname;
239 reqparams["lastname"] = lastname;
240
241 //reqparams["position"] = Position.ToString();
179 242
180 ArrayList SendParams = new ArrayList(); 243 ArrayList SendParams = new ArrayList();
181 SendParams.Add(reqparams); 244 SendParams.Add(reqparams);
182 245
183 XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams); 246 XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams);
184 XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000); 247 try
185 m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login"); 248 {
249 XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000);
250 m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login");
251 }
252 catch (System.Net.WebException)
253 {
254 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user");
255 }
256
186 } 257 }
187 } 258 }
188} 259}
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index a82b978..143c990 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -44,7 +44,9 @@ using InventoryFolder=OpenSim.Framework.InventoryFolder;
44 44
45namespace OpenSim.Grid.UserServer 45namespace OpenSim.Grid.UserServer
46{ 46{
47 public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position); 47
48 public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
49 ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname);
48 50
49 public class UserLoginService : LoginService 51 public class UserLoginService : LoginService
50 { 52 {
@@ -149,7 +151,9 @@ namespace OpenSim.Grid.UserServer
149 if (handler001 != null) 151 if (handler001 != null)
150 { 152 {
151 m_log.Info("[LOGIN]: Letting other objects know about login"); 153 m_log.Info("[LOGIN]: Letting other objects know about login");
152 handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos); 154 handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion,
155 theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos.X,theUser.currentAgent.currentPos.Y,theUser.currentAgent.currentPos.Z,
156 theUser.username,theUser.surname);
153 } 157 }
154 } 158 }
155 catch (Exception) 159 catch (Exception)
@@ -226,7 +230,9 @@ namespace OpenSim.Grid.UserServer
226 if (handler001 != null) 230 if (handler001 != null)
227 { 231 {
228 m_log.Info("[LOGIN]: Letting other objects know about login"); 232 m_log.Info("[LOGIN]: Letting other objects know about login");
229 handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos); 233 handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion,
234 theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos.X, theUser.currentAgent.currentPos.Y, theUser.currentAgent.currentPos.Z,
235 theUser.username, theUser.surname);
230 } 236 }
231 } 237 }
232 238
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 8f2d83c..5806f5f 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -37,10 +37,13 @@ using OpenSim.Framework.UserManagement;
37 37
38namespace OpenSim.Grid.UserServer 38namespace OpenSim.Grid.UserServer
39{ 39{
40 public delegate void logOffUser(LLUUID AgentID);
41
40 public class UserManager : UserManagerBase 42 public class UserManager : UserManagerBase
41 { 43 {
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 45 public event logOffUser OnLogOffUser;
46 private logOffUser handler001 = null;
44 /// <summary> 47 /// <summary>
45 /// Deletes an active agent session 48 /// Deletes an active agent session
46 /// </summary> 49 /// </summary>
@@ -327,7 +330,11 @@ namespace OpenSim.Grid.UserServer
327 float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]); 330 float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]);
328 float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]); 331 float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]);
329 float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]); 332 float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]);
330 333
334 handler001 = OnLogOffUser;
335 if (handler001 != null)
336 handler001(userUUID);
337
331 LogOffUser(userUUID, RegionID, regionhandle, posx, posy, posz); 338 LogOffUser(userUUID, RegionID, regionhandle, posx, posy, posz);
332 } 339 }
333 catch (FormatException) 340 catch (FormatException)