aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs4
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs26
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs4
-rw-r--r--OpenSim/Data/UserDataBase.cs2
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs8
-rw-r--r--OpenSim/Framework/IUserData.cs2
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs4
-rw-r--r--OpenSim/Grid/MessagingServer/MessageService.cs77
-rw-r--r--OpenSim/Grid/UserServer/Main.cs29
-rw-r--r--OpenSim/Grid/UserServer/MessageServersConnector.cs93
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs47
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs24
13 files changed, 307 insertions, 17 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs
index 0afe47c..5185659 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs
@@ -732,6 +732,10 @@ namespace OpenSim.Data.MSSQL
732 } 732 }
733 } 733 }
734 734
735 override public void LogoutUsers(UUID regionID)
736 {
737 }
738
735 #endregion 739 #endregion
736 740
737 #region Other public methods 741 #region Other public methods
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 288ca86..f203a66 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -891,5 +891,31 @@ namespace OpenSim.Data.MySQL
891 dbm.Release(); 891 dbm.Release();
892 } 892 }
893 } 893 }
894
895 public override void LogoutUsers(UUID regionID)
896 {
897 Dictionary<string, string> param = new Dictionary<string, string>();
898 param["?regionID"] = regionID.ToString();
899
900 MySQLSuperManager dbm = GetLockedConnection("LogoutUsers");
901
902 try
903 {
904 dbm.Manager.ExecuteParameterizedSql(
905 "update " + m_agentsTableName + " SET agentOnline = 0 " +
906 "where currentRegion = ?regionID",
907 param);
908 }
909 catch (Exception e)
910 {
911 dbm.Manager.Reconnect();
912 m_log.Error(e.ToString());
913 return;
914 }
915 finally
916 {
917 dbm.Release();
918 }
919 }
894 } 920 }
895} 921}
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index 5ef48c8..1bb2b14 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -308,6 +308,10 @@ namespace OpenSim.Data.NHibernate
308 { 308 {
309 } 309 }
310 310
311 public override void LogoutUsers(UUID regionID)
312 {
313 }
314
311 public override string Name { 315 public override string Name {
312 get { return "NHibernate"; } 316 get { return "NHibernate"; }
313 } 317 }
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 369fc51..b8f1a68 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -1037,5 +1037,9 @@ namespace OpenSim.Data.SQLite
1037 override public void ResetAttachments(UUID userID) 1037 override public void ResetAttachments(UUID userID)
1038 { 1038 {
1039 } 1039 }
1040
1041 override public void LogoutUsers(UUID regionID)
1042 {
1043 }
1040 } 1044 }
1041} 1045}
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs
index a5fc8c8..c1b320b 100644
--- a/OpenSim/Data/UserDataBase.cs
+++ b/OpenSim/Data/UserDataBase.cs
@@ -75,6 +75,8 @@ namespace OpenSim.Data
75 // } 75 // }
76 public abstract void ResetAttachments(UUID userID); 76 public abstract void ResetAttachments(UUID userID);
77 77
78 public abstract void LogoutUsers(UUID regionID);
79
78 public abstract string Version {get;} 80 public abstract string Version {get;}
79 public abstract string Name {get;} 81 public abstract string Name {get;}
80 public abstract void Initialise(string connect); 82 public abstract void Initialise(string connect);
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index bc1a593..46b28d7 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -87,6 +87,14 @@ namespace OpenSim.Framework.Communications
87 return null; 87 return null;
88 } 88 }
89 89
90 public void LogoutUsers(UUID regionID)
91 {
92 foreach (IUserDataPlugin plugin in _plugins)
93 {
94 plugin.LogoutUsers(regionID);
95 }
96 }
97
90 public void ResetAttachments(UUID userID) 98 public void ResetAttachments(UUID userID)
91 { 99 {
92 foreach (IUserDataPlugin plugin in _plugins) 100 foreach (IUserDataPlugin plugin in _plugins)
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index 07159cc..0936495 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -177,6 +177,8 @@ namespace OpenSim.Framework
177 void UpdateUserAppearance(UUID user, AvatarAppearance appearance); 177 void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
178 178
179 void ResetAttachments(UUID userID); 179 void ResetAttachments(UUID userID);
180
181 void LogoutUsers(UUID regionID);
180 } 182 }
181 183
182 public class UserDataInitialiser : PluginInitialiserBase 184 public class UserDataInitialiser : PluginInitialiserBase
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 8472571..5568f73 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -88,6 +88,10 @@ namespace OpenSim.Grid.MessagingServer
88 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); 88 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
89 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); 89 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
90 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); 90 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
91 m_httpServer.AddXmlRPCHandler("region_startup", msgsvc.RegionStartup);
92 m_httpServer.AddXmlRPCHandler("region_shutdown", msgsvc.RegionShutdown);
93 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
94 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
91 95
92 m_httpServer.Start(); 96 m_httpServer.Start();
93 m_log.Info("[SERVER]: Userserver registration was successful"); 97 m_log.Info("[SERVER]: Userserver registration was successful");
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index 66916b6..a4e54c7 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -558,24 +558,30 @@ namespace OpenSim.Grid.MessagingServer
558 558
559 public bool deregisterWithUserServer() 559 public bool deregisterWithUserServer()
560 { 560 {
561 Hashtable UserParams = new Hashtable(); 561 Hashtable request = new Hashtable();
562
563 return SendToUserServer(request, "deregister_messageserver");
564 }
565
566 public bool SendToUserServer(Hashtable request, string method)
567 {
562 // Login / Authentication 568 // Login / Authentication
563 569
564 if (m_cfg.HttpSSL) 570 if (m_cfg.HttpSSL)
565 { 571 {
566 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 572 request["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
567 } 573 }
568 else 574 else
569 { 575 {
570 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 576 request["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
571 } 577 }
572 578
573 UserParams["recvkey"] = m_cfg.UserRecvKey; 579 request["recvkey"] = m_cfg.UserRecvKey;
574 UserParams["sendkey"] = m_cfg.UserRecvKey; 580 request["sendkey"] = m_cfg.UserRecvKey;
575 581
576 // Package into an XMLRPC Request 582 // Package into an XMLRPC Request
577 ArrayList SendParams = new ArrayList(); 583 ArrayList SendParams = new ArrayList();
578 SendParams.Add(UserParams); 584 SendParams.Add(request);
579 585
580 bool success = true; 586 bool success = true;
581 string[] servers = m_cfg.UserServerURL.Split(' '); 587 string[] servers = m_cfg.UserServerURL.Split(' ');
@@ -585,7 +591,7 @@ namespace OpenSim.Grid.MessagingServer
585 { 591 {
586 try 592 try
587 { 593 {
588 XmlRpcRequest UserReq = new XmlRpcRequest("deregister_messageserver", SendParams); 594 XmlRpcRequest UserReq = new XmlRpcRequest(method, SendParams);
589 XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); 595 XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
590 // Process Response 596 // Process Response
591 Hashtable UserRespData = (Hashtable)UserResp.Value; 597 Hashtable UserRespData = (Hashtable)UserResp.Value;
@@ -603,5 +609,62 @@ namespace OpenSim.Grid.MessagingServer
603 } 609 }
604 610
605 #endregion 611 #endregion
612
613 public XmlRpcResponse RegionStartup(XmlRpcRequest request)
614 {
615 Hashtable requestData = (Hashtable)request.Params[0];
616 Hashtable result = new Hashtable();
617 result["success"] = "FALSE";
618
619 if(SendToUserServer(requestData, "region_startup"))
620 result["success"] = "TRUE";
621
622 XmlRpcResponse response = new XmlRpcResponse();
623 response.Value = result;
624 return response;
625 }
626
627 public XmlRpcResponse RegionShutdown(XmlRpcRequest request)
628 {
629 Hashtable requestData = (Hashtable)request.Params[0];
630 Hashtable result = new Hashtable();
631 result["success"] = "FALSE";
632
633 if(SendToUserServer(requestData, "region_shutdown"))
634 result["success"] = "TRUE";
635
636 XmlRpcResponse response = new XmlRpcResponse();
637 response.Value = result;
638 return response;
639 }
640
641 public XmlRpcResponse AgentLocation(XmlRpcRequest request)
642 {
643 Hashtable requestData = (Hashtable)request.Params[0];
644 Hashtable result = new Hashtable();
645 result["success"] = "FALSE";
646
647 if(SendToUserServer(requestData, "agent_location"))
648 result["success"] = "TRUE";
649
650
651 XmlRpcResponse response = new XmlRpcResponse();
652 response.Value = result;
653 return response;
654 }
655
656 public XmlRpcResponse AgentLeaving(XmlRpcRequest request)
657 {
658 Hashtable requestData = (Hashtable)request.Params[0];
659 Hashtable result = new Hashtable();
660 result["success"] = "FALSE";
661
662 if(SendToUserServer(requestData, "agent_leaving"))
663 result["success"] = "TRUE";
664
665 XmlRpcResponse response = new XmlRpcResponse();
666 response.Value = result;
667 return response;
668 }
606 } 669 }
607} 670}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index eb47259..f894ca0 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -110,6 +110,11 @@ namespace OpenSim.Grid.UserServer
110 m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; 110 m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
111 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; 111 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
112 112
113 m_messagesService.OnAgentLocation += HandleAgentLocation;
114 m_messagesService.OnAgentLeaving += HandleAgentLeaving;
115 m_messagesService.OnRegionStartup += HandleRegionStartup;
116 m_messagesService.OnRegionShutdown += HandleRegionShutdown;
117
113 m_log.Info("[REGION]: Starting HTTP process"); 118 m_log.Info("[REGION]: Starting HTTP process");
114 119
115 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 120 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
@@ -147,6 +152,10 @@ namespace OpenSim.Grid.UserServer
147 m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", m_userManager.XmlRPCGetAgentMethodUUID); 152 m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", m_userManager.XmlRPCGetAgentMethodUUID);
148 m_httpServer.AddXmlRPCHandler("check_auth_session", m_userManager.XmlRPCCheckAuthSession); 153 m_httpServer.AddXmlRPCHandler("check_auth_session", m_userManager.XmlRPCCheckAuthSession);
149 m_httpServer.AddXmlRPCHandler("set_login_params", m_loginService.XmlRPCSetLoginParams); 154 m_httpServer.AddXmlRPCHandler("set_login_params", m_loginService.XmlRPCSetLoginParams);
155 m_httpServer.AddXmlRPCHandler("region_startup", m_messagesService.RegionStartup);
156 m_httpServer.AddXmlRPCHandler("region_shutdown", m_messagesService.RegionShutdown);
157 m_httpServer.AddXmlRPCHandler("agent_location", m_messagesService.AgentLocation);
158 m_httpServer.AddXmlRPCHandler("agent_leaving", m_messagesService.AgentLeaving);
150 // Message Server ---> User Server 159 // Message Server ---> User Server
151 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); 160 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
152 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); 161 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
@@ -442,5 +451,25 @@ namespace OpenSim.Grid.UserServer
442 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX, 451 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
443 positionY, positionZ, firstname, lastname); 452 positionY, positionZ, firstname, lastname);
444 } 453 }
454
455 public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
456 {
457 m_userManager.HandleAgentLocation(agentID, regionID, regionHandle);
458 }
459
460 public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
461 {
462 m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle);
463 }
464
465 public void HandleRegionStartup(UUID regionID)
466 {
467 m_userManager.HandleRegionStartup(regionID);
468 }
469
470 public void HandleRegionShutdown(UUID regionID)
471 {
472 m_userManager.HandleRegionShutdown(regionID);
473 }
445 } 474 }
446} 475}
diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs
index 61f125e..6659617 100644
--- a/OpenSim/Grid/UserServer/MessageServersConnector.cs
+++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs
@@ -57,7 +57,13 @@ namespace OpenSim.Grid.UserServer
57 public float positionZ; 57 public float positionZ;
58 public string firstname; 58 public string firstname;
59 public string lastname; 59 public string lastname;
60 }; 60 }
61
62 public delegate void AgentLocationDelegate(UUID agentID, UUID regionID, ulong regionHandle);
63 public delegate void AgentLeavingDelegate(UUID agentID, UUID regionID, ulong regionHandle);
64 public delegate void RegionStartupDelegate(UUID regionID);
65 public delegate void RegionShutdownDelegate(UUID regionID);
66
61 67
62 public class MessageServersConnector 68 public class MessageServersConnector
63 { 69 {
@@ -70,6 +76,11 @@ namespace OpenSim.Grid.UserServer
70 76
71 Thread m_NotifyThread; 77 Thread m_NotifyThread;
72 78
79 public event AgentLocationDelegate OnAgentLocation;
80 public event AgentLeavingDelegate OnAgentLeaving;
81 public event RegionStartupDelegate OnRegionStartup;
82 public event RegionShutdownDelegate OnRegionShutdown;
83
73 public MessageServersConnector() 84 public MessageServersConnector()
74 { 85 {
75 MessageServers = new Dictionary<string, MessageServerInfo>(); 86 MessageServers = new Dictionary<string, MessageServerInfo>();
@@ -337,5 +348,85 @@ namespace OpenSim.Grid.UserServer
337 } 348 }
338 } 349 }
339 } 350 }
351
352 public XmlRpcResponse RegionStartup(XmlRpcRequest request)
353 {
354 Hashtable requestData = (Hashtable)request.Params[0];
355 Hashtable result = new Hashtable();
356
357 UUID regionID;
358 if (UUID.TryParse((string)requestData["RegionUUID"], out regionID))
359 {
360 if (OnRegionStartup != null)
361 OnRegionStartup(regionID);
362
363 result["responsestring"] = "TRUE";
364 }
365
366 XmlRpcResponse response = new XmlRpcResponse();
367 response.Value = result;
368 return response;
369 }
370
371 public XmlRpcResponse RegionShutdown(XmlRpcRequest request)
372 {
373 Hashtable requestData = (Hashtable)request.Params[0];
374 Hashtable result = new Hashtable();
375
376 UUID regionID;
377 if (UUID.TryParse((string)requestData["RegionUUID"], out regionID))
378 {
379 if (OnRegionShutdown != null)
380 OnRegionShutdown(regionID);
381
382 result["responsestring"] = "TRUE";
383 }
384
385 XmlRpcResponse response = new XmlRpcResponse();
386 response.Value = result;
387 return response;
388 }
389
390 public XmlRpcResponse AgentLocation(XmlRpcRequest request)
391 {
392 Hashtable requestData = (Hashtable)request.Params[0];
393 Hashtable result = new Hashtable();
394
395 UUID agentID;
396 UUID regionID;
397 ulong regionHandle;
398 if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle))
399 {
400 if (OnAgentLocation != null)
401 OnAgentLocation(agentID, regionID, regionHandle);
402
403 result["responsestring"] = "TRUE";
404 }
405
406 XmlRpcResponse response = new XmlRpcResponse();
407 response.Value = result;
408 return response;
409 }
410
411 public XmlRpcResponse AgentLeaving(XmlRpcRequest request)
412 {
413 Hashtable requestData = (Hashtable)request.Params[0];
414 Hashtable result = new Hashtable();
415
416 UUID agentID;
417 UUID regionID;
418 ulong regionHandle;
419 if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle))
420 {
421 if (OnAgentLeaving != null)
422 OnAgentLeaving(agentID, regionID, regionHandle);
423
424 result["responsestring"] = "TRUE";
425 }
426
427 XmlRpcResponse response = new XmlRpcResponse();
428 response.Value = result;
429 return response;
430 }
340 } 431 }
341} 432}
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index f7e4e3c..04510b2 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -758,5 +758,52 @@ namespace OpenSim.Grid.UserServer
758 { 758 {
759 throw new Exception("The method or operation is not implemented."); 759 throw new Exception("The method or operation is not implemented.");
760 } 760 }
761
762 public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
763 {
764 UserProfileData userProfile = GetUserProfile(agentID);
765 if (userProfile != null)
766 {
767 userProfile.CurrentAgent.Region = regionID;
768 userProfile.CurrentAgent.Handle = regionHandle;
769 CommitAgent(ref userProfile);
770 }
771 }
772
773 public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
774 {
775 UserProfileData userProfile = GetUserProfile(agentID);
776 if (userProfile != null)
777 {
778 if (userProfile.CurrentAgent.Region == regionID)
779 {
780 UserAgentData userAgent = userProfile.CurrentAgent;
781 if (userAgent != null && userAgent.AgentOnline)
782 {
783 userAgent.AgentOnline = false;
784 userAgent.LogoutTime = Util.UnixTimeSinceEpoch();
785 if (regionID != UUID.Zero)
786 {
787 userAgent.Region = regionID;
788 }
789 userAgent.Handle = regionHandle;
790 userProfile.LastLogin = userAgent.LogoutTime;
791
792 CommitAgent(ref userProfile);
793 }
794 }
795 }
796 }
797
798 public void HandleRegionStartup(UUID regionID)
799 {
800 LogoutUsers(regionID);
801 }
802
803 public void HandleRegionShutdown(UUID regionID)
804 {
805 LogoutUsers(regionID);
806 }
807
761 } 808 }
762} 809}
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs
index aa1db1d..7b358c2 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs
@@ -114,10 +114,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
114 public void OnNewClient(IClientAPI client) 114 public void OnNewClient(IClientAPI client)
115 { 115 {
116 client.OnConnectionClosed += OnConnectionClosed; 116 client.OnConnectionClosed += OnConnectionClosed;
117 client.OnLogout += OnConnectionClosed;
117 } 118 }
118 119
119 public void OnConnectionClosed(IClientAPI client) 120 public void OnConnectionClosed(IClientAPI client)
120 { 121 {
122 if (!(client.Scene is Scene))
123 return;
124
121 if (!(m_RootAgents.ContainsKey(client.AgentId))) 125 if (!(m_RootAgents.ContainsKey(client.AgentId)))
122 return; 126 return;
123 127
@@ -128,7 +132,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
128 132
129 m_RootAgents.Remove(client.AgentId); 133 m_RootAgents.Remove(client.AgentId);
130 134
131 NotifyMessageServerOfAgentLeaving(client.AgentId, scene.RegionInfo.RegionName); 135 NotifyMessageServerOfAgentLeaving(client.AgentId, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
132 } 136 }
133 137
134 public void OnSetRootAgentScene(UUID agentID, Scene scene) 138 public void OnSetRootAgentScene(UUID agentID, Scene scene)
@@ -139,13 +143,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
139 return; 143 return;
140 } 144 }
141 m_RootAgents[agentID] = scene; 145 m_RootAgents[agentID] = scene;
142 NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionName); 146 NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
143 } 147 }
144 148
145 private void NotifyMessageServerOfStartup(Scene scene) 149 private void NotifyMessageServerOfStartup(Scene scene)
146 { 150 {
147 Hashtable xmlrpcdata = new Hashtable(); 151 Hashtable xmlrpcdata = new Hashtable();
148 xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; 152 xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString();
149 ArrayList SendParams = new ArrayList(); 153 ArrayList SendParams = new ArrayList();
150 SendParams.Add(xmlrpcdata); 154 SendParams.Add(xmlrpcdata);
151 try 155 try
@@ -154,7 +158,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
154 XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); 158 XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000);
155 159
156 Hashtable responseData = (Hashtable)resp.Value; 160 Hashtable responseData = (Hashtable)resp.Value;
157 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") 161 if (responseData == null || (!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
158 { 162 {
159 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName); 163 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName);
160 } 164 }
@@ -168,7 +172,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
168 private void NotifyMessageServerOfShutdown(Scene scene) 172 private void NotifyMessageServerOfShutdown(Scene scene)
169 { 173 {
170 Hashtable xmlrpcdata = new Hashtable(); 174 Hashtable xmlrpcdata = new Hashtable();
171 xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; 175 xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString();
172 ArrayList SendParams = new ArrayList(); 176 ArrayList SendParams = new ArrayList();
173 SendParams.Add(xmlrpcdata); 177 SendParams.Add(xmlrpcdata);
174 try 178 try
@@ -188,11 +192,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
188 } 192 }
189 } 193 }
190 194
191 private void NotifyMessageServerOfAgentLocation(UUID agentID, string region) 195 private void NotifyMessageServerOfAgentLocation(UUID agentID, UUID region, ulong regionHandle)
192 { 196 {
193 Hashtable xmlrpcdata = new Hashtable(); 197 Hashtable xmlrpcdata = new Hashtable();
194 xmlrpcdata["AgentID"] = agentID.ToString(); 198 xmlrpcdata["AgentID"] = agentID.ToString();
195 xmlrpcdata["RegionName"] = region; 199 xmlrpcdata["RegionUUID"] = region.ToString();
200 xmlrpcdata["RegionHandle"] = regionHandle.ToString();
196 ArrayList SendParams = new ArrayList(); 201 ArrayList SendParams = new ArrayList();
197 SendParams.Add(xmlrpcdata); 202 SendParams.Add(xmlrpcdata);
198 try 203 try
@@ -212,11 +217,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
212 } 217 }
213 } 218 }
214 219
215 private void NotifyMessageServerOfAgentLeaving(UUID agentID, string region) 220 private void NotifyMessageServerOfAgentLeaving(UUID agentID, UUID region, ulong regionHandle)
216 { 221 {
217 Hashtable xmlrpcdata = new Hashtable(); 222 Hashtable xmlrpcdata = new Hashtable();
218 xmlrpcdata["AgentID"] = agentID.ToString(); 223 xmlrpcdata["AgentID"] = agentID.ToString();
219 xmlrpcdata["RegionName"] = region; 224 xmlrpcdata["RegionUUID"] = region.ToString();
225 xmlrpcdata["RegionHandle"] = regionHandle.ToString();
220 ArrayList SendParams = new ArrayList(); 226 ArrayList SendParams = new ArrayList();
221 SendParams.Add(xmlrpcdata); 227 SendParams.Add(xmlrpcdata);
222 try 228 try