diff options
author | Melanie Thielker | 2008-11-22 20:29:00 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-22 20:29:00 +0000 |
commit | bf885b20354ff6074918bb7c3c427996ca0581f1 (patch) | |
tree | 5cba24a83fbf520eedf9034f48bf2de8bbb86060 /OpenSim/Region/Environment/Modules/Avatar | |
parent | Change the presence event signatures (diff) | |
download | opensim-SC_OLD-bf885b20354ff6074918bb7c3c427996ca0581f1.zip opensim-SC_OLD-bf885b20354ff6074918bb7c3c427996ca0581f1.tar.gz opensim-SC_OLD-bf885b20354ff6074918bb7c3c427996ca0581f1.tar.bz2 opensim-SC_OLD-bf885b20354ff6074918bb7c3c427996ca0581f1.tar.xz |
Adding region up/down notifications to the PresenceModule. Messaging
Server portion remains to be implemented
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs index 7c0f25d..439b082 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private bool m_Enabled = false; | ||
49 | private bool m_Gridmode = false; | 50 | private bool m_Gridmode = false; |
50 | private List<Scene> m_Scenes = new List<Scene>(); | 51 | private List<Scene> m_Scenes = new List<Scene>(); |
51 | 52 | ||
@@ -64,12 +65,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
64 | if (cnf != null) | 65 | if (cnf != null) |
65 | m_Gridmode = cnf.GetBoolean("gridmode", false); | 66 | m_Gridmode = cnf.GetBoolean("gridmode", false); |
66 | 67 | ||
68 | m_Enabled = true; | ||
69 | |||
67 | lock (m_Scenes) | 70 | lock (m_Scenes) |
68 | { | 71 | { |
69 | if (m_Scenes.Count == 0) | 72 | if (m_Scenes.Count == 0) |
70 | { | 73 | { |
71 | } | 74 | } |
72 | 75 | ||
76 | if (m_Gridmode) | ||
77 | NotifyMessageServerOfStartup(scene); | ||
73 | scene.RegisterModuleInterface<IPresenceModule>(this); | 78 | scene.RegisterModuleInterface<IPresenceModule>(this); |
74 | m_Scenes.Add(scene); | 79 | m_Scenes.Add(scene); |
75 | } | 80 | } |
@@ -81,6 +86,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
81 | 86 | ||
82 | public void Close() | 87 | public void Close() |
83 | { | 88 | { |
89 | if (!m_Gridmode || !m_Enabled) | ||
90 | return; | ||
91 | |||
92 | foreach (Scene scene in m_Scenes) | ||
93 | NotifyMessageServerOfShutdown(scene); | ||
84 | } | 94 | } |
85 | 95 | ||
86 | public string Name | 96 | public string Name |
@@ -96,5 +106,37 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
96 | public void RequestBulkPresenceData(UUID[] users) | 106 | public void RequestBulkPresenceData(UUID[] users) |
97 | { | 107 | { |
98 | } | 108 | } |
109 | |||
110 | private void NotifyMessageServerOfStartup(Scene scene) | ||
111 | { | ||
112 | Hashtable xmlrpcdata = new Hashtable(); | ||
113 | xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; | ||
114 | ArrayList SendParams = new ArrayList(); | ||
115 | SendParams.Add(xmlrpcdata); | ||
116 | XmlRpcRequest UpRequest = new XmlRpcRequest("region_startup", SendParams); | ||
117 | XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); | ||
118 | |||
119 | Hashtable responseData = (Hashtable)resp.Value; | ||
120 | if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") | ||
121 | { | ||
122 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | private void NotifyMessageServerOfShutdown(Scene scene) | ||
127 | { | ||
128 | Hashtable xmlrpcdata = new Hashtable(); | ||
129 | xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; | ||
130 | ArrayList SendParams = new ArrayList(); | ||
131 | SendParams.Add(xmlrpcdata); | ||
132 | XmlRpcRequest DownRequest = new XmlRpcRequest("region_shutdown", SendParams); | ||
133 | XmlRpcResponse resp = DownRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); | ||
134 | |||
135 | Hashtable responseData = (Hashtable)resp.Value; | ||
136 | if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") | ||
137 | { | ||
138 | m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName); | ||
139 | } | ||
140 | } | ||
99 | } | 141 | } |
100 | } | 142 | } |