aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs89
1 files changed, 38 insertions, 51 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index d9dcee7..3373bd5 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -172,10 +172,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
172 private void RetrieveInstantMessages(IClientAPI client) 172 private void RetrieveInstantMessages(IClientAPI client)
173 { 173 {
174 if (m_RestURL == String.Empty) 174 if (m_RestURL == String.Empty)
175 { 175 {
176 return; 176 return;
177 } 177 }
178 else 178 else
179 { 179 {
180 m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId); 180 m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId);
181 181
@@ -183,64 +183,51 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
183 = SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>( 183 = SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>(
184 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); 184 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
185 185
186 if (msglist != null) 186 if (msglist != null)
187 {
188 foreach (GridInstantMessage im in msglist)
189 { 187 {
190 // client.SendInstantMessage(im); 188 foreach (GridInstantMessage im in msglist)
191 189 {
192 // Send through scene event manager so all modules get a chance 190 // client.SendInstantMessage(im);
193 // to look at this message before it gets delivered. 191
194 // 192 // Send through scene event manager so all modules get a chance
195 // Needed for proper state management for stored group 193 // to look at this message before it gets delivered.
196 // invitations 194 //
197 // 195 // Needed for proper state management for stored group
198 196 // invitations
199 im.offline = 1; 197 //
200 198
201 Scene s = FindScene(client.AgentId); 199 im.offline = 1;
202 if (s != null) 200
203 s.EventManager.TriggerIncomingInstantMessage(im); 201 Scene s = FindScene(client.AgentId);
202 if (s != null)
203 s.EventManager.TriggerIncomingInstantMessage(im);
204 }
204 } 205 }
205 } 206 }
206 } 207 }
207 208
208 private void UndeliveredMessage(GridInstantMessage im) 209 private void UndeliveredMessage(GridInstantMessage im)
209 { 210 {
210 if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && 211 if ((im.offline != 0)
211 im.dialog != (byte)InstantMessageDialog.MessageFromAgent && 212 && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
212 im.dialog != (byte)InstantMessageDialog.GroupNotice &&
213 im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
214 im.dialog != (byte)InstantMessageDialog.InventoryOffered)
215 { 213 {
216 bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( 214 bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
217 "POST", m_RestURL+"/SaveMessage/", im); 215 "POST", m_RestURL + "/SaveMessage/", im);
218 return;
219 }
220
221 // It's not delivered. Make sure the scope id is saved
222 // We don't need the imSessionID here anymore, overwrite it
223 Scene scene = FindScene(new UUID(im.fromAgentID));
224 if (scene == null)
225 scene = m_SceneList[0];
226
227 bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
228 "POST", m_RestURL+"/SaveMessage/?scope=" +
229 scene.RegionInfo.ScopeID.ToString(), im);
230 216
231 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) 217 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
232 { 218 {
233 IClientAPI client = FindClient(new UUID(im.fromAgentID)); 219 IClientAPI client = FindClient(new UUID(im.fromAgentID));
234 if (client == null) 220 if (client == null)
235 return; 221 return;
236 222
237 client.SendInstantMessage(new GridInstantMessage( 223 client.SendInstantMessage(new GridInstantMessage(
238 null, new UUID(im.toAgentID), 224 null, new UUID(im.toAgentID),
239 "System", new UUID(im.fromAgentID), 225 "System", new UUID(im.fromAgentID),
240 (byte)InstantMessageDialog.MessageFromAgent, 226 (byte)InstantMessageDialog.MessageFromAgent,
241 "User is not logged in. "+ 227 "User is not logged in. " +
242 (success ? "Message saved." : "Message not saved"), 228 (success ? "Message saved." : "Message not saved"),
243 false, new Vector3())); 229 false, new Vector3()));
230 }
244 } 231 }
245 } 232 }
246 } 233 }