diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index a2dc91f..feeb9e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -192,6 +192,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
192 | // Needed for proper state management for stored group | 192 | // Needed for proper state management for stored group |
193 | // invitations | 193 | // invitations |
194 | // | 194 | // |
195 | |||
196 | im.offline = 1; | ||
197 | |||
198 | // Reconstruct imSessionID | ||
199 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | ||
200 | { | ||
201 | UUID fromAgentID = new UUID(im.fromAgentID); | ||
202 | UUID sessionID = fromAgentID ^ client.AgentId; | ||
203 | im.imSessionID = new Guid(sessionID.ToString()); | ||
204 | } | ||
205 | |||
195 | Scene s = FindScene(client.AgentId); | 206 | Scene s = FindScene(client.AgentId); |
196 | if (s != null) | 207 | if (s != null) |
197 | s.EventManager.TriggerIncomingInstantMessage(im); | 208 | s.EventManager.TriggerIncomingInstantMessage(im); |
@@ -201,35 +212,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
201 | 212 | ||
202 | private void UndeliveredMessage(GridInstantMessage im) | 213 | private void UndeliveredMessage(GridInstantMessage im) |
203 | { | 214 | { |
204 | if (im.dialog == 19) | 215 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
205 | im.offline = 1; // We want them pushed out to the server | 216 | im.dialog != (byte)InstantMessageDialog.MessageFromAgent && |
206 | if ((im.offline != 0) | 217 | im.dialog != (byte)InstantMessageDialog.GroupNotice && |
207 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 218 | im.dialog != (byte)InstantMessageDialog.InventoryOffered) |
208 | { | 219 | { |
209 | // It's not delivered. Make sure the scope id is saved | 220 | return; |
210 | // We don't need the imSessionID here anymore, overwrite it | 221 | } |
211 | Scene scene = FindScene(new UUID(im.fromAgentID)); | ||
212 | if (scene == null) | ||
213 | scene = m_SceneList[0]; | ||
214 | im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString()); | ||
215 | 222 | ||
216 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( | 223 | // It's not delivered. Make sure the scope id is saved |
217 | "POST", m_RestURL+"/SaveMessage/", im); | 224 | // We don't need the imSessionID here anymore, overwrite it |
225 | Scene scene = FindScene(new UUID(im.fromAgentID)); | ||
226 | if (scene == null) | ||
227 | scene = m_SceneList[0]; | ||
228 | im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString()); | ||
218 | 229 | ||
219 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 230 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( |
220 | { | 231 | "POST", m_RestURL+"/SaveMessage/", im); |
221 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | 232 | |
222 | if (client == null) | 233 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
223 | return; | 234 | { |
224 | 235 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | |
225 | client.SendInstantMessage(new GridInstantMessage( | 236 | if (client == null) |
226 | null, new UUID(im.toAgentID), | 237 | return; |
227 | "System", new UUID(im.fromAgentID), | 238 | |
228 | (byte)InstantMessageDialog.MessageFromAgent, | 239 | client.SendInstantMessage(new GridInstantMessage( |
229 | "User is not logged in. "+ | 240 | null, new UUID(im.toAgentID), |
230 | (success ? "Message saved." : "Message not saved"), | 241 | "System", new UUID(im.fromAgentID), |
231 | false, new Vector3())); | 242 | (byte)InstantMessageDialog.MessageFromAgent, |
232 | } | 243 | "User is not logged in. "+ |
244 | (success ? "Message saved." : "Message not saved"), | ||
245 | false, new Vector3())); | ||
233 | } | 246 | } |
234 | } | 247 | } |
235 | } | 248 | } |