diff options
author | UbitUmarov | 2018-12-30 22:31:32 +0000 |
---|---|---|
committer | UbitUmarov | 2018-12-30 22:31:32 +0000 |
commit | ffca7de65d2c19081899dae75303a3f98833c665 (patch) | |
tree | a5b91c89b9421f8ff68ef64eedaf4b139dc5ee56 /OpenSim/Region | |
parent | mantis 8436: fix lludp message (diff) | |
download | opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.zip opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.tar.gz opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.tar.bz2 opensim-SC-ffca7de65d2c19081899dae75303a3f98833c665.tar.xz |
add some persistence (mysql only)
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 17 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 106 |
3 files changed, 105 insertions, 32 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 794162e..cbe2324 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -2424,8 +2424,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2424 | } | 2424 | } |
2425 | 2425 | ||
2426 | /// <summary> | 2426 | /// <summary> |
2427 | /// Send an alert message to the client. On the Linden client (tested 1.19.1.4), this pops up a brief duration | 2427 | /// Send an alert message to the client. This pops up a brief duration information box at a corner |
2428 | /// blue information box in the bottom right hand corner. | ||
2429 | /// </summary> | 2428 | /// </summary> |
2430 | /// <param name="message"></param> | 2429 | /// <param name="message"></param> |
2431 | public void SendAlertMessage(string message) | 2430 | public void SendAlertMessage(string message) |
@@ -2464,17 +2463,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2464 | /// the AlertMessage packet).</param> | 2463 | /// the AlertMessage packet).</param> |
2465 | public void SendAgentAlertMessage(string message, bool modal) | 2464 | public void SendAgentAlertMessage(string message, bool modal) |
2466 | { | 2465 | { |
2467 | OutPacket(BuildAgentAlertPacket(message, modal), ThrottleOutPacketType.Task); | ||
2468 | } | ||
2469 | |||
2470 | /// <summary> | ||
2471 | /// Construct an agent alert packet | ||
2472 | /// </summary> | ||
2473 | /// <param name="message"></param> | ||
2474 | /// <param name="modal"></param> | ||
2475 | /// <returns></returns> | ||
2476 | public AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal) | ||
2477 | { | ||
2478 | // Prepend a slash to make the message come up in the top right | 2466 | // Prepend a slash to make the message come up in the top right |
2479 | // again. | 2467 | // again. |
2480 | // Allow special formats to be sent from aware modules. | 2468 | // Allow special formats to be sent from aware modules. |
@@ -2484,8 +2472,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2484 | alertPack.AgentData.AgentID = AgentId; | 2472 | alertPack.AgentData.AgentID = AgentId; |
2485 | alertPack.AlertData.Message = Util.StringToBytes256(message); | 2473 | alertPack.AlertData.Message = Util.StringToBytes256(message); |
2486 | alertPack.AlertData.Modal = modal; | 2474 | alertPack.AlertData.Modal = modal; |
2487 | 2475 | OutPacket(alertPack, ThrottleOutPacketType.Task); | |
2488 | return alertPack; | ||
2489 | } | 2476 | } |
2490 | 2477 | ||
2491 | public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, | 2478 | public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e5aa21e..c32e01b 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -64,21 +64,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
64 | 64 | ||
65 | public delegate void SynchronizeSceneHandler(Scene scene); | 65 | public delegate void SynchronizeSceneHandler(Scene scene); |
66 | 66 | ||
67 | protected static int m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0x5fffafL); | ||
68 | 67 | ||
69 | public int NextObjectAnimationSequenceNumber | ||
70 | { | ||
71 | get | ||
72 | { | ||
73 | int ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
74 | if (ret <= 0 ) | ||
75 | { | ||
76 | m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0xafff5fL); | ||
77 | ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
78 | } | ||
79 | return ret; | ||
80 | } | ||
81 | } | ||
82 | #region Fields | 68 | #region Fields |
83 | 69 | ||
84 | /// <summary> | 70 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fd3a96b..479fb91 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -32,6 +32,8 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Runtime.Serialization; | 33 | using System.Runtime.Serialization; |
34 | using System.Security.Permissions; | 34 | using System.Security.Permissions; |
35 | using System.Threading; | ||
36 | using System.Text; | ||
35 | using System.Xml; | 37 | using System.Xml; |
36 | using System.Xml.Serialization; | 38 | using System.Xml.Serialization; |
37 | using log4net; | 39 | using log4net; |
@@ -5657,13 +5659,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
5657 | UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false); | 5659 | UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false); |
5658 | } | 5660 | } |
5659 | 5661 | ||
5662 | protected static int m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0x5fffafL); | ||
5663 | public static int NextObjectAnimationSequenceNumber | ||
5664 | { | ||
5665 | get | ||
5666 | { | ||
5667 | int ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
5668 | if (ret <= 0) | ||
5669 | { | ||
5670 | m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0xafff5fL); | ||
5671 | ret = Interlocked.Increment(ref m_animationSequenceNumber); | ||
5672 | } | ||
5673 | return ret; | ||
5674 | } | ||
5675 | } | ||
5676 | |||
5660 | private object animsLock = new object(); | 5677 | private object animsLock = new object(); |
5661 | public Dictionary<UUID, int> Animations = null; | 5678 | public Dictionary<UUID, int> Animations = null; |
5662 | public Dictionary<UUID, string> AnimationsNames = null; | 5679 | public Dictionary<UUID, string> AnimationsNames = null; |
5663 | 5680 | ||
5664 | public bool AddAnimation(UUID animId, string animName) | 5681 | public bool AddAnimation(UUID animId, string animName) |
5665 | { | 5682 | { |
5666 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | 5683 | if (animId == UUID.Zero || string.IsNullOrEmpty(animName) || |
5684 | ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | ||
5667 | return false; | 5685 | return false; |
5668 | 5686 | ||
5669 | lock (animsLock) | 5687 | lock (animsLock) |
@@ -5676,7 +5694,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5676 | if (Animations.ContainsKey(animId)) | 5694 | if (Animations.ContainsKey(animId)) |
5677 | return false; | 5695 | return false; |
5678 | 5696 | ||
5679 | Animations[animId] = ParentGroup.Scene.NextObjectAnimationSequenceNumber; | 5697 | Animations[animId] = NextObjectAnimationSequenceNumber; |
5680 | AnimationsNames[animId] = animName; | 5698 | AnimationsNames[animId] = animName; |
5681 | ScheduleUpdate(PrimUpdateFlags.Animations); | 5699 | ScheduleUpdate(PrimUpdateFlags.Animations); |
5682 | } | 5700 | } |
@@ -5685,7 +5703,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5685 | 5703 | ||
5686 | public bool RemoveAnimation(UUID animId) | 5704 | public bool RemoveAnimation(UUID animId) |
5687 | { | 5705 | { |
5688 | if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) | 5706 | if (animId == UUID.Zero || ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit) |
5689 | return false; | 5707 | return false; |
5690 | 5708 | ||
5691 | lock (animsLock) | 5709 | lock (animsLock) |
@@ -5726,5 +5744,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
5726 | return Animations.Count; | 5744 | return Animations.Count; |
5727 | } | 5745 | } |
5728 | } | 5746 | } |
5747 | |||
5748 | public Byte[] SerializeAnimations() | ||
5749 | { | ||
5750 | if (AnimationsNames == null) | ||
5751 | return null; | ||
5752 | |||
5753 | |||
5754 | lock (animsLock) | ||
5755 | { | ||
5756 | if (AnimationsNames.Count == 0) | ||
5757 | return new byte[] { 0 }; | ||
5758 | |||
5759 | using (MemoryStream ms = new MemoryStream()) | ||
5760 | { | ||
5761 | byte[] tmp = Utils.UInt16ToBytes((ushort)Animations.Count); | ||
5762 | ms.Write(tmp, 0, 2); | ||
5763 | |||
5764 | foreach(KeyValuePair<UUID,string> kvp in AnimationsNames) | ||
5765 | { | ||
5766 | tmp = kvp.Key.GetBytes(); | ||
5767 | ms.Write(tmp, 0, 16); | ||
5768 | if(string.IsNullOrEmpty(kvp.Value)) | ||
5769 | ms.WriteByte(0); | ||
5770 | else | ||
5771 | { | ||
5772 | byte[] str = Util.StringToBytes(kvp.Value, 64); | ||
5773 | int len = str.Length - 1; | ||
5774 | ms.WriteByte((byte)len); | ||
5775 | ms.Write(str, 0 , len); | ||
5776 | } | ||
5777 | } | ||
5778 | return ms.ToArray(); | ||
5779 | } | ||
5780 | } | ||
5781 | } | ||
5782 | |||
5783 | public void DeSerializeAnimations(Byte[] data) | ||
5784 | { | ||
5785 | if(data == null) | ||
5786 | { | ||
5787 | Animations = null; | ||
5788 | AnimationsNames = null; | ||
5789 | return; | ||
5790 | } | ||
5791 | |||
5792 | if (data.Length < 2) | ||
5793 | { | ||
5794 | Animations = new Dictionary<UUID, int>(); | ||
5795 | AnimationsNames = new Dictionary<UUID, string>(); | ||
5796 | return; | ||
5797 | } | ||
5798 | |||
5799 | try | ||
5800 | { | ||
5801 | int count = (int)Utils.BytesToUInt16(data, 0); | ||
5802 | if(count == 0) | ||
5803 | return; | ||
5804 | |||
5805 | Animations = new Dictionary<UUID, int>(count); | ||
5806 | AnimationsNames = new Dictionary<UUID, string>(count); | ||
5807 | int pos = 2; | ||
5808 | while(--count >= 0) | ||
5809 | { | ||
5810 | UUID id = new UUID(data, pos); | ||
5811 | if(id == UUID.Zero) | ||
5812 | break; | ||
5813 | pos += 16; | ||
5814 | int strlen = data[pos++]; | ||
5815 | string name = UTF8Encoding.UTF8.GetString(data, pos, strlen); | ||
5816 | if(string.IsNullOrEmpty(name)) | ||
5817 | break; | ||
5818 | pos += strlen; | ||
5819 | Animations[id] = NextObjectAnimationSequenceNumber; | ||
5820 | AnimationsNames[id] = name; | ||
5821 | } | ||
5822 | return; | ||
5823 | } | ||
5824 | catch { } | ||
5825 | |||
5826 | Animations = null; | ||
5827 | AnimationsNames = null; | ||
5828 | } | ||
5729 | } | 5829 | } |
5730 | } | 5830 | } |