diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
8 files changed, 190 insertions, 59 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 5604f49..e1c0949 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Xml; | ||
31 | using log4net; | 32 | using log4net; |
32 | using Mono.Addins; | 33 | using Mono.Addins; |
33 | using Nini.Config; | 34 | using Nini.Config; |
@@ -226,7 +227,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
226 | public UUID RezSingleAttachmentFromInventory( | 227 | public UUID RezSingleAttachmentFromInventory( |
227 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 228 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
228 | { | 229 | { |
229 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 230 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); |
231 | } | ||
232 | |||
233 | public UUID RezSingleAttachmentFromInventory( | ||
234 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
235 | { | ||
236 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); | ||
230 | 237 | ||
231 | if (updateInventoryStatus) | 238 | if (updateInventoryStatus) |
232 | { | 239 | { |
@@ -245,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
245 | } | 252 | } |
246 | 253 | ||
247 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 254 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
248 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 255 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
249 | { | 256 | { |
250 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 257 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
251 | if (invAccess != null) | 258 | if (invAccess != null) |
@@ -279,13 +286,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
279 | if (tainted) | 286 | if (tainted) |
280 | objatt.HasGroupChanged = true; | 287 | objatt.HasGroupChanged = true; |
281 | 288 | ||
289 | if (doc != null) | ||
290 | { | ||
291 | objatt.LoadScriptState(doc); | ||
292 | objatt.ResetOwnerChangeFlag(); | ||
293 | } | ||
294 | |||
282 | // Fire after attach, so we don't get messy perms dialogs | 295 | // Fire after attach, so we don't get messy perms dialogs |
283 | // 4 == AttachedRez | 296 | // 4 == AttachedRez |
284 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | 297 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); |
285 | objatt.ResumeScripts(); | 298 | objatt.ResumeScripts(); |
286 | 299 | ||
287 | // Do this last so that event listeners have access to all the effects of the attachment | 300 | // Do this last so that event listeners have access to all the effects of the attachment |
288 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 301 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
289 | } | 302 | } |
290 | else | 303 | else |
291 | { | 304 | { |
@@ -314,7 +327,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
314 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 327 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
315 | { | 328 | { |
316 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 329 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
317 | item = m_scene.InventoryService.GetItem(item); | 330 | if (m_scene.InventoryService != null) |
331 | item = m_scene.InventoryService.GetItem(item); | ||
318 | 332 | ||
319 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 333 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); |
320 | } | 334 | } |
@@ -359,6 +373,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
359 | { | 373 | { |
360 | // XXYY!! | 374 | // XXYY!! |
361 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 375 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
376 | if (item == null) | ||
377 | m_log.Error("[ATTACHMENT]: item == null"); | ||
378 | if (m_scene == null) | ||
379 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
380 | if (m_scene.InventoryService == null) | ||
381 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
362 | item = m_scene.InventoryService.GetItem(item); | 382 | item = m_scene.InventoryService.GetItem(item); |
363 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 383 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
364 | 384 | ||
@@ -447,6 +467,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
447 | if (group.GetFromItemID() == itemID) | 467 | if (group.GetFromItemID() == itemID) |
448 | { | 468 | { |
449 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 469 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
470 | // CM / XMREngine!!!! Needed to conclude attach event | ||
471 | SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
450 | group.DetachToInventoryPrep(); | 472 | group.DetachToInventoryPrep(); |
451 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 473 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
452 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); | 474 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 02f0968..06b1b00 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
49 | private int m_shoutdistance = 100; | 49 | private int m_shoutdistance = 100; |
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | private List<string> FreezeCache = new List<string>(); | |
53 | private string m_adminPrefix = ""; | ||
53 | internal object m_syncy = new object(); | 54 | internal object m_syncy = new object(); |
54 | 55 | ||
55 | internal IConfig m_config; | 56 | internal IConfig m_config; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 77 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 78 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 79 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
80 | m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | public virtual void AddRegion(Scene scene) | 83 | public virtual void AddRegion(Scene scene) |
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
171 | return; | 173 | return; |
172 | } | 174 | } |
173 | 175 | ||
174 | DeliverChatToAvatars(ChatSourceType.Agent, c); | 176 | if (FreezeCache.Contains(c.Sender.AgentId.ToString())) |
177 | { | ||
178 | if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) | ||
179 | c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | DeliverChatToAvatars(ChatSourceType.Agent, c); | ||
184 | } | ||
175 | } | 185 | } |
176 | 186 | ||
177 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) | 187 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) |
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
185 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) | 195 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) |
186 | { | 196 | { |
187 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | ||
188 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
189 | string message = c.Message; | 200 | string message = c.Message; |
190 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
207 | fromPos = avatar.AbsolutePosition; | 218 | fromPos = avatar.AbsolutePosition; |
208 | fromName = avatar.Name; | 219 | fromName = avatar.Name; |
209 | fromID = c.Sender.AgentId; | 220 | fromID = c.Sender.AgentId; |
210 | 221 | if (avatar.GodLevel >= 200) | |
222 | { | ||
223 | fromNamePrefix = m_adminPrefix; | ||
224 | } | ||
211 | break; | 225 | break; |
212 | 226 | ||
213 | case ChatSourceType.Object: | 227 | case ChatSourceType.Object: |
@@ -227,7 +241,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
227 | s.ForEachScenePresence( | 241 | s.ForEachScenePresence( |
228 | delegate(ScenePresence presence) | 242 | delegate(ScenePresence presence) |
229 | { | 243 | { |
230 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); | 244 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
245 | if (Presencecheck != null) | ||
246 | { | ||
247 | // This will pass all chat from objects. Not | ||
248 | // perfect, but it will do. For now. Better | ||
249 | // than the prior behavior of muting all | ||
250 | // objects on a parcel with access restrictions | ||
251 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) | ||
252 | { | ||
253 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); | ||
254 | } | ||
255 | } | ||
256 | |||
231 | } | 257 | } |
232 | ); | 258 | ); |
233 | } | 259 | } |
@@ -270,25 +296,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
270 | } | 296 | } |
271 | 297 | ||
272 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 298 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
273 | 299 | if (c.Scene != null) | |
274 | ((Scene)c.Scene).ForEachScenePresence( | 300 | { |
275 | delegate(ScenePresence presence) | 301 | ((Scene)c.Scene).ForEachScenePresence |
276 | { | 302 | ( |
277 | // ignore chat from child agents | 303 | delegate(ScenePresence presence) |
278 | if (presence.IsChildAgent) return; | 304 | { |
279 | 305 | // ignore chat from child agents | |
280 | IClientAPI client = presence.ControllingClient; | 306 | if (presence.IsChildAgent) return; |
281 | 307 | ||
282 | // don't forward SayOwner chat from objects to | 308 | IClientAPI client = presence.ControllingClient; |
283 | // non-owner agents | 309 | |
284 | if ((c.Type == ChatTypeEnum.Owner) && | 310 | // don't forward SayOwner chat from objects to |
285 | (null != c.SenderObject) && | 311 | // non-owner agents |
286 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 312 | if ((c.Type == ChatTypeEnum.Owner) && |
287 | return; | 313 | (null != c.SenderObject) && |
288 | 314 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | |
289 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 315 | return; |
290 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 316 | |
291 | }); | 317 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
318 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
319 | } | ||
320 | ); | ||
321 | } | ||
292 | } | 322 | } |
293 | 323 | ||
294 | 324 | ||
@@ -317,5 +347,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
317 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 347 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, |
318 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); | 348 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); |
319 | } | 349 | } |
350 | |||
351 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
352 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
353 | { | ||
354 | System.Threading.Timer Timer; | ||
355 | if (flags == 0) | ||
356 | { | ||
357 | FreezeCache.Add(target.ToString()); | ||
358 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
359 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
360 | Timers.Add(target, Timer); | ||
361 | } | ||
362 | else | ||
363 | { | ||
364 | FreezeCache.Remove(target.ToString()); | ||
365 | Timers.TryGetValue(target, out Timer); | ||
366 | Timers.Remove(target); | ||
367 | Timer.Dispose(); | ||
368 | } | ||
369 | } | ||
370 | |||
371 | private void OnEndParcelFrozen(object avatar) | ||
372 | { | ||
373 | UUID target = (UUID)avatar; | ||
374 | FreezeCache.Remove(target.ToString()); | ||
375 | System.Threading.Timer Timer; | ||
376 | Timers.TryGetValue(target, out Timer); | ||
377 | Timers.Remove(target); | ||
378 | Timer.Dispose(); | ||
379 | } | ||
320 | } | 380 | } |
321 | } | 381 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 2b3d2a9..a514a83 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -239,4 +239,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
239 | return result; | 239 | return result; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } \ No newline at end of file | 242 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 4e4eee9..a49e71e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -273,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
273 | 273 | ||
274 | // Inform the friends that this user is online | 274 | // Inform the friends that this user is online |
275 | StatusChange(agentID, true); | 275 | StatusChange(agentID, true); |
276 | 276 | ||
277 | // Register that we need to send the list of online friends to this user | 277 | // Register that we need to send the list of online friends to this user |
278 | lock (m_NeedsListOfFriends) | 278 | lock (m_NeedsListOfFriends) |
279 | m_NeedsListOfFriends.Add(agentID); | 279 | m_NeedsListOfFriends.Add(agentID); |
@@ -662,7 +662,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
662 | // we're done | 662 | // we're done |
663 | return true; | 663 | return true; |
664 | } | 664 | } |
665 | 665 | ||
666 | return false; | 666 | return false; |
667 | } | 667 | } |
668 | 668 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 420e3ca..fc1afaf 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -156,6 +156,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | 158 | ||
159 | DateTime dt = DateTime.UtcNow; | ||
160 | |||
161 | // Ticks from UtcNow, but make it look like local. Evil, huh? | ||
162 | dt = DateTime.SpecifyKind(dt, DateTimeKind.Local); | ||
163 | |||
164 | try | ||
165 | { | ||
166 | // Convert that to the PST timezone | ||
167 | TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); | ||
168 | dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo); | ||
169 | } | ||
170 | catch | ||
171 | { | ||
172 | //m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp."); | ||
173 | } | ||
174 | |||
175 | // And make it look local again to fool the unix time util | ||
176 | dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); | ||
177 | |||
178 | im.timestamp = (uint)Util.ToUnixTime(dt); | ||
179 | |||
180 | // If client is null, this message comes from storage and IS offline | ||
181 | if (client != null) | ||
182 | im.offline = 0; | ||
183 | |||
159 | if (m_TransferModule != null) | 184 | if (m_TransferModule != null) |
160 | { | 185 | { |
161 | m_TransferModule.SendInstantMessage(im, | 186 | m_TransferModule.SendInstantMessage(im, |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 43bbf0d..a6894ff 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -145,8 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
145 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 145 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
146 | if (!user.IsChildAgent) | 146 | if (!user.IsChildAgent) |
147 | { | 147 | { |
148 | // Local message | 148 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
149 | m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); | ||
150 | user.ControllingClient.SendInstantMessage(im); | 149 | user.ControllingClient.SendInstantMessage(im); |
151 | 150 | ||
152 | // Message sent | 151 | // Message sent |
@@ -168,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
168 | // Local message | 167 | // Local message |
169 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 168 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
170 | 169 | ||
171 | m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); | 170 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
172 | user.ControllingClient.SendInstantMessage(im); | 171 | user.ControllingClient.SendInstantMessage(im); |
173 | 172 | ||
174 | // Message sent | 173 | // Message sent |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index fdfcd10..feeb9e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -172,13 +172,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
172 | 172 | ||
173 | private void RetrieveInstantMessages(IClientAPI client) | 173 | private void RetrieveInstantMessages(IClientAPI client) |
174 | { | 174 | { |
175 | if (m_RestURL != "") | 175 | if (m_RestURL == String.Empty) |
176 | { | 176 | return; |
177 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
178 | 177 | ||
179 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 178 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); |
179 | |||
180 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | ||
180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 181 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
181 | 182 | ||
183 | if (msglist != null) | ||
184 | { | ||
182 | foreach (GridInstantMessage im in msglist) | 185 | foreach (GridInstantMessage im in msglist) |
183 | { | 186 | { |
184 | // client.SendInstantMessage(im); | 187 | // client.SendInstantMessage(im); |
@@ -189,6 +192,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
189 | // Needed for proper state management for stored group | 192 | // Needed for proper state management for stored group |
190 | // invitations | 193 | // invitations |
191 | // | 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 | |||
192 | Scene s = FindScene(client.AgentId); | 206 | Scene s = FindScene(client.AgentId); |
193 | if (s != null) | 207 | if (s != null) |
194 | s.EventManager.TriggerIncomingInstantMessage(im); | 208 | s.EventManager.TriggerIncomingInstantMessage(im); |
@@ -198,26 +212,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
198 | 212 | ||
199 | private void UndeliveredMessage(GridInstantMessage im) | 213 | private void UndeliveredMessage(GridInstantMessage im) |
200 | { | 214 | { |
201 | if ((im.offline != 0) | 215 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
202 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 216 | im.dialog != (byte)InstantMessageDialog.MessageFromAgent && |
217 | im.dialog != (byte)InstantMessageDialog.GroupNotice && | ||
218 | im.dialog != (byte)InstantMessageDialog.InventoryOffered) | ||
203 | { | 219 | { |
204 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( | 220 | return; |
205 | "POST", m_RestURL+"/SaveMessage/", im); | 221 | } |
206 | 222 | ||
207 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 223 | // It's not delivered. Make sure the scope id is saved |
208 | { | 224 | // We don't need the imSessionID here anymore, overwrite it |
209 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | 225 | Scene scene = FindScene(new UUID(im.fromAgentID)); |
210 | if (client == null) | 226 | if (scene == null) |
211 | return; | 227 | scene = m_SceneList[0]; |
212 | 228 | im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString()); | |
213 | client.SendInstantMessage(new GridInstantMessage( | 229 | |
214 | null, new UUID(im.toAgentID), | 230 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( |
215 | "System", new UUID(im.fromAgentID), | 231 | "POST", m_RestURL+"/SaveMessage/", im); |
216 | (byte)InstantMessageDialog.MessageFromAgent, | 232 | |
217 | "User is not logged in. "+ | 233 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
218 | (success ? "Message saved." : "Message not saved"), | 234 | { |
219 | false, new Vector3())); | 235 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); |
220 | } | 236 | if (client == null) |
237 | return; | ||
238 | |||
239 | client.SendInstantMessage(new GridInstantMessage( | ||
240 | null, new UUID(im.toAgentID), | ||
241 | "System", new UUID(im.fromAgentID), | ||
242 | (byte)InstantMessageDialog.MessageFromAgent, | ||
243 | "User is not logged in. "+ | ||
244 | (success ? "Message saved." : "Message not saved"), | ||
245 | false, new Vector3())); | ||
221 | } | 246 | } |
222 | } | 247 | } |
223 | } | 248 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index d1274e9..a08a628 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -159,10 +159,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
159 | 159 | ||
160 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 160 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
161 | { | 161 | { |
162 | m_log.DebugFormat( | 162 | //m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog); |
163 | "[INVENTORY TRANSFER]: {0} IM type received from {1}", | 163 | |
164 | (InstantMessageDialog)im.dialog, client.Name); | ||
165 | |||
166 | Scene scene = FindClientScene(client.AgentId); | 164 | Scene scene = FindClientScene(client.AgentId); |
167 | 165 | ||
168 | if (scene == null) // Something seriously wrong here. | 166 | if (scene == null) // Something seriously wrong here. |
@@ -248,6 +246,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
248 | im.imSessionID = itemID.Guid; | 246 | im.imSessionID = itemID.Guid; |
249 | } | 247 | } |
250 | 248 | ||
249 | im.offline = 1; // Remember these | ||
250 | |||
251 | // Send the IM to the recipient. The item is already | 251 | // Send the IM to the recipient. The item is already |
252 | // in their inventory, so it will not be lost if | 252 | // in their inventory, so it will not be lost if |
253 | // they are offline. | 253 | // they are offline. |