diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
8 files changed, 192 insertions, 64 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 28c50ab..9807ea5 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; |
@@ -224,11 +225,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
224 | public UUID RezSingleAttachmentFromInventory( | 225 | public UUID RezSingleAttachmentFromInventory( |
225 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 226 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
226 | { | 227 | { |
227 | m_log.DebugFormat( | 228 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); |
228 | "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", | 229 | } |
229 | (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); | 230 | |
230 | 231 | public UUID RezSingleAttachmentFromInventory( | |
231 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 232 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) |
233 | { | ||
234 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); | ||
232 | 235 | ||
233 | if (updateInventoryStatus) | 236 | if (updateInventoryStatus) |
234 | { | 237 | { |
@@ -245,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
245 | } | 248 | } |
246 | 249 | ||
247 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 250 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
248 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 251 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
249 | { | 252 | { |
250 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 253 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
251 | if (invAccess != null) | 254 | if (invAccess != null) |
@@ -279,13 +282,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
279 | if (tainted) | 282 | if (tainted) |
280 | objatt.HasGroupChanged = true; | 283 | objatt.HasGroupChanged = true; |
281 | 284 | ||
285 | if (doc != null) | ||
286 | { | ||
287 | objatt.LoadScriptState(doc); | ||
288 | objatt.ResetOwnerChangeFlag(); | ||
289 | } | ||
290 | |||
282 | // Fire after attach, so we don't get messy perms dialogs | 291 | // Fire after attach, so we don't get messy perms dialogs |
283 | // 4 == AttachedRez | 292 | // 4 == AttachedRez |
284 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | 293 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); |
285 | objatt.ResumeScripts(); | 294 | objatt.ResumeScripts(); |
286 | 295 | ||
287 | // Do this last so that event listeners have access to all the effects of the attachment | 296 | // 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); | 297 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
289 | } | 298 | } |
290 | else | 299 | else |
291 | { | 300 | { |
@@ -322,9 +331,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
322 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 331 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
323 | { | 332 | { |
324 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 333 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
325 | item = m_scene.InventoryService.GetItem(item); | 334 | if (m_scene.InventoryService != null) |
335 | item = m_scene.InventoryService.GetItem(item); | ||
326 | 336 | ||
327 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 337 | if (presence.Appearance != null) |
338 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
328 | } | 339 | } |
329 | 340 | ||
330 | return att.UUID; | 341 | return att.UUID; |
@@ -367,6 +378,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
367 | { | 378 | { |
368 | // XXYY!! | 379 | // XXYY!! |
369 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 380 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
381 | if (item == null) | ||
382 | m_log.Error("[ATTACHMENT]: item == null"); | ||
383 | if (m_scene == null) | ||
384 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
385 | if (m_scene.InventoryService == null) | ||
386 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
370 | item = m_scene.InventoryService.GetItem(item); | 387 | item = m_scene.InventoryService.GetItem(item); |
371 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 388 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
372 | 389 | ||
@@ -458,6 +475,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
458 | if (group.GetFromItemID() == itemID) | 475 | if (group.GetFromItemID() == itemID) |
459 | { | 476 | { |
460 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 477 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
478 | // CM / XMREngine!!!! Needed to conclude attach event | ||
479 | SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
461 | group.DetachToInventoryPrep(); | 480 | group.DetachToInventoryPrep(); |
462 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 481 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
463 | UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); | 482 | 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 ef5efdd..2a590f1 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 | } |
@@ -268,25 +294,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
268 | } | 294 | } |
269 | 295 | ||
270 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 296 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
271 | 297 | if (c.Scene != null) | |
272 | ((Scene)c.Scene).ForEachScenePresence( | 298 | { |
273 | delegate(ScenePresence presence) | 299 | ((Scene)c.Scene).ForEachScenePresence |
274 | { | 300 | ( |
275 | // ignore chat from child agents | 301 | delegate(ScenePresence presence) |
276 | if (presence.IsChildAgent) return; | 302 | { |
277 | 303 | // ignore chat from child agents | |
278 | IClientAPI client = presence.ControllingClient; | 304 | if (presence.IsChildAgent) return; |
279 | 305 | ||
280 | // don't forward SayOwner chat from objects to | 306 | IClientAPI client = presence.ControllingClient; |
281 | // non-owner agents | 307 | |
282 | if ((c.Type == ChatTypeEnum.Owner) && | 308 | // don't forward SayOwner chat from objects to |
283 | (null != c.SenderObject) && | 309 | // non-owner agents |
284 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 310 | if ((c.Type == ChatTypeEnum.Owner) && |
285 | return; | 311 | (null != c.SenderObject) && |
286 | 312 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | |
287 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 313 | return; |
288 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 314 | |
289 | }); | 315 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
316 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
317 | } | ||
318 | ); | ||
319 | } | ||
290 | } | 320 | } |
291 | 321 | ||
292 | 322 | ||
@@ -315,5 +345,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
315 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 345 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, |
316 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); | 346 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); |
317 | } | 347 | } |
348 | |||
349 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
350 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
351 | { | ||
352 | System.Threading.Timer Timer; | ||
353 | if (flags == 0) | ||
354 | { | ||
355 | FreezeCache.Add(target.ToString()); | ||
356 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
357 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
358 | Timers.Add(target, Timer); | ||
359 | } | ||
360 | else | ||
361 | { | ||
362 | FreezeCache.Remove(target.ToString()); | ||
363 | Timers.TryGetValue(target, out Timer); | ||
364 | Timers.Remove(target); | ||
365 | Timer.Dispose(); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | private void OnEndParcelFrozen(object avatar) | ||
370 | { | ||
371 | UUID target = (UUID)avatar; | ||
372 | FreezeCache.Remove(target.ToString()); | ||
373 | System.Threading.Timer Timer; | ||
374 | Timers.TryGetValue(target, out Timer); | ||
375 | Timers.Remove(target); | ||
376 | Timer.Dispose(); | ||
377 | } | ||
318 | } | 378 | } |
319 | } | 379 | } |
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 7a21d5e..21ed9dc 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); |
@@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
701 | // we're done | 701 | // we're done |
702 | return true; | 702 | return true; |
703 | } | 703 | } |
704 | 704 | ||
705 | return false; | 705 | return false; |
706 | } | 706 | } |
707 | 707 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index af39565..347708d 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 | if (client != null) | 186 | if (client != null) |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 918fa04..d8e0f96 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. |