diff options
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 257c221..3e86848 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -28,6 +28,7 @@ using System; | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -40,7 +41,8 @@ using OpenSim.Region.Framework.Scenes; | |||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 42 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
42 | { | 43 | { |
43 | public class OfflineMessageModule : IRegionModule | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
45 | public class OfflineMessageModule : ISharedRegionModule | ||
44 | { | 46 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
@@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
49 | private string m_RestURL = String.Empty; | 51 | private string m_RestURL = String.Empty; |
50 | private bool m_ForwardOfflineGroupMessages = true; | 52 | private bool m_ForwardOfflineGroupMessages = true; |
51 | 53 | ||
52 | public void Initialise(Scene scene, IConfigSource config) | 54 | public void Initialise(IConfigSource config) |
53 | { | 55 | { |
54 | if (!enabled) | 56 | if (!enabled) |
55 | return; | 57 | return; |
@@ -83,14 +85,23 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
83 | return; | 85 | return; |
84 | } | 86 | } |
85 | } | 87 | } |
86 | if (!m_SceneList.Contains(scene)) | ||
87 | m_SceneList.Add(scene); | ||
88 | |||
89 | scene.EventManager.OnNewClient += OnNewClient; | ||
90 | } | 88 | } |
91 | } | 89 | } |
92 | 90 | ||
93 | public void PostInitialise() | 91 | public Type ReplaceableInterface |
92 | { | ||
93 | get { return null; } | ||
94 | } | ||
95 | |||
96 | public void AddRegion(Scene scene) | ||
97 | { | ||
98 | if (!m_SceneList.Contains(scene)) | ||
99 | m_SceneList.Add(scene); | ||
100 | |||
101 | scene.EventManager.OnNewClient += OnNewClient; | ||
102 | } | ||
103 | |||
104 | public void RegionLoaded(Scene scene) | ||
94 | { | 105 | { |
95 | if (!enabled) | 106 | if (!enabled) |
96 | return; | 107 | return; |
@@ -120,16 +131,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
120 | m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled"); | 131 | m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled"); |
121 | } | 132 | } |
122 | 133 | ||
123 | public string Name | 134 | public void RemoveRegion(Scene scene) |
124 | { | 135 | { |
125 | get { return "OfflineMessageModule"; } | 136 | if (m_SceneList.Contains(scene)) |
137 | m_SceneList.Remove(scene); | ||
138 | scene.EventManager.OnNewClient -= OnNewClient; | ||
126 | } | 139 | } |
127 | 140 | ||
128 | public bool IsSharedModule | 141 | public void PostInitialise() |
129 | { | 142 | { |
130 | get { return true; } | ||
131 | } | 143 | } |
132 | 144 | ||
145 | public string Name | ||
146 | { | ||
147 | get { return "OfflineMessageModule"; } | ||
148 | } | ||
149 | |||
133 | public void Close() | 150 | public void Close() |
134 | { | 151 | { |
135 | } | 152 | } |
@@ -163,10 +180,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
163 | 180 | ||
164 | private void RetrieveInstantMessages(IClientAPI client) | 181 | private void RetrieveInstantMessages(IClientAPI client) |
165 | { | 182 | { |
166 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | 183 | if (m_RestURL != "") |
184 | { | ||
185 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
167 | 186 | ||
168 | List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 187 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( |
169 | "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); | 188 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
170 | 189 | ||
171 | if (msglist != null) | 190 | if (msglist != null) |
172 | { | 191 | { |