aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs139
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs80
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs12
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs2
5 files changed, 220 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs
new file mode 100644
index 0000000..9f2aed0
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs
@@ -0,0 +1,139 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
33using System.Reflection;
34using System.IO;
35using System.Web;
36using log4net;
37using Nini.Config;
38using Mono.Addins;
39using OpenMetaverse;
40using OpenMetaverse.StructuredData;
41using OpenSim.Framework;
42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Services.Interfaces;
47using Caps = OpenSim.Framework.Capabilities.Caps;
48using OpenSim.Capabilities.Handlers;
49
50namespace OpenSim.Region.ClientStack.Linden
51{
52
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarPickerSearchModule")]
54 public class AvatarPickerSearchModule : INonSharedRegionModule
55 {
56 private static readonly ILog m_log =
57 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58
59 private Scene m_scene;
60 private IPeople m_People;
61 private bool m_Enabled = false;
62
63 private string m_URL;
64
65 #region ISharedRegionModule Members
66
67 public void Initialise(IConfigSource source)
68 {
69 IConfig config = source.Configs["ClientStack.LindenCaps"];
70 if (config == null)
71 return;
72
73 m_URL = config.GetString("Cap_AvatarPickerSearch", string.Empty);
74 // Cap doesn't exist
75 if (m_URL != string.Empty)
76 m_Enabled = true;
77 }
78
79 public void AddRegion(Scene s)
80 {
81 if (!m_Enabled)
82 return;
83
84 m_scene = s;
85 }
86
87 public void RemoveRegion(Scene s)
88 {
89 if (!m_Enabled)
90 return;
91
92 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
93 m_scene = null;
94 }
95
96 public void RegionLoaded(Scene s)
97 {
98 if (!m_Enabled)
99 return;
100
101 m_People = m_scene.RequestModuleInterface<IPeople>();
102 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
103 }
104
105 public void PostInitialise()
106 {
107 }
108
109 public void Close() { }
110
111 public string Name { get { return "AvatarPickerSearchModule"; } }
112
113 public Type ReplaceableInterface
114 {
115 get { return null; }
116 }
117
118 #endregion
119
120 public void RegisterCaps(UUID agentID, Caps caps)
121 {
122 UUID capID = UUID.Random();
123
124 if (m_URL == "localhost")
125 {
126 m_log.DebugFormat("[AVATAR PICKER SEARCH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
127 caps.RegisterHandler(
128 "AvatarPickerSearch",
129 new AvatarPickerSearchHandler("/CAPS/" + capID + "/", m_People, "AvatarPickerSearch", "Search for avatars by name"));
130 }
131 else
132 {
133 // m_log.DebugFormat("[AVATAR PICKER SEARCH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
134 caps.RegisterHandler("AvatarPickerSearch", m_URL);
135 }
136 }
137
138 }
139}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index 3995620..dfc4419 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -429,7 +429,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
429 if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("=")) 429 if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
430 assetServerURL = assetServerURL + "/"; 430 assetServerURL = assetServerURL + "/";
431 431
432 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", assetServerURL + id); 432// m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", assetServerURL + id);
433 AssetService.Get(assetServerURL + id, InventoryAccessModule, AssetReceived); 433 AssetService.Get(assetServerURL + id, InventoryAccessModule, AssetReceived);
434 return; 434 return;
435 } 435 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index eebb8ae..c78d552 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -84,6 +84,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
84 public event ModifyTerrain OnModifyTerrain; 84 public event ModifyTerrain OnModifyTerrain;
85 public event Action<IClientAPI> OnRegionHandShakeReply; 85 public event Action<IClientAPI> OnRegionHandShakeReply;
86 public event GenericCall1 OnRequestWearables; 86 public event GenericCall1 OnRequestWearables;
87 public event CachedTextureRequest OnCachedTextureRequest;
87 public event SetAppearance OnSetAppearance; 88 public event SetAppearance OnSetAppearance;
88 public event AvatarNowWearing OnAvatarNowWearing; 89 public event AvatarNowWearing OnAvatarNowWearing;
89 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; 90 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@@ -820,12 +821,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
820 handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); 821 handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType);
821 handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; 822 handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes;
822 823
823 handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[0]; 824 handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[1];
824// OutPacket(handshake, ThrottleOutPacketType.Task); 825 handshake.RegionInfo4[0] = new RegionHandshakePacket.RegionInfo4Block();
825 // use same as MoveAgentIntoRegion (both should be task ) 826 handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags;
827 handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported
828
826 OutPacket(handshake, ThrottleOutPacketType.Unknown); 829 OutPacket(handshake, ThrottleOutPacketType.Unknown);
827 } 830 }
828 831
832
829 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 833 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
830 { 834 {
831 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); 835 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
@@ -1580,7 +1584,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1580 OutPacket(pc, ThrottleOutPacketType.Unknown); 1584 OutPacket(pc, ThrottleOutPacketType.Unknown);
1581 } 1585 }
1582 1586
1583 public void SendKillObject(ulong regionHandle, List<uint> localIDs) 1587 public void SendKillObject(List<uint> localIDs)
1584 { 1588 {
1585// foreach (uint id in localIDs) 1589// foreach (uint id in localIDs)
1586// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); 1590// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
@@ -11717,8 +11721,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11717 } 11721 }
11718 11722
11719 /// <summary> 11723 /// <summary>
11720 /// Send a response back to a client when it asks the asset server (via the region server) if it has
11721 /// its appearance texture cached.
11722 /// </summary> 11724 /// </summary>
11723 /// <remarks> 11725 /// <remarks>
11724 /// At the moment, we always reply that there is no cached texture. 11726 /// At the moment, we always reply that there is no cached texture.
@@ -11726,6 +11728,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11726 /// <param name="simclient"></param> 11728 /// <param name="simclient"></param>
11727 /// <param name="packet"></param> 11729 /// <param name="packet"></param>
11728 /// <returns></returns> 11730 /// <returns></returns>
11731 // TODO: Convert old handler to use new method
11732 /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11733 {
11734 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11735
11736 if (cachedtex.AgentData.SessionID != SessionId)
11737 return false;
11738
11739
11740 List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>();
11741
11742 for (int i = 0; i < cachedtex.WearableData.Length; i++)
11743 {
11744 CachedTextureRequestArg arg = new CachedTextureRequestArg();
11745 arg.BakedTextureIndex = cachedtex.WearableData[i].TextureIndex;
11746 arg.WearableHashID = cachedtex.WearableData[i].ID;
11747
11748 requestArgs.Add(arg);
11749 }
11750
11751 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
11752 if (handlerCachedTextureRequest != null)
11753 {
11754 handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs);
11755 }
11756
11757 return true;
11758 }*/
11759
11729 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 11760 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11730 { 11761 {
11731 //m_log.Debug("texture cached: " + packet.ToString()); 11762 //m_log.Debug("texture cached: " + packet.ToString());
@@ -11884,6 +11915,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11884 return true; 11915 return true;
11885 } 11916 }
11886 11917
11918 /// <summary>
11919 /// Send a response back to a client when it asks the asset server (via the region server) if it has
11920 /// its appearance texture cached.
11921 /// </summary>
11922 /// <param name="avatar"></param>
11923 /// <param name="serial"></param>
11924 /// <param name="cachedTextures"></param>
11925 /// <returns></returns>
11926 public void SendCachedTextureResponse(ISceneEntity avatar, int serial, List<CachedTextureResponseArg> cachedTextures)
11927 {
11928 ScenePresence presence = avatar as ScenePresence;
11929 if (presence == null)
11930 return;
11931
11932 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
11933
11934 // TODO: don't create new blocks if recycling an old packet
11935 cachedresp.AgentData.AgentID = m_agentId;
11936 cachedresp.AgentData.SessionID = m_sessionId;
11937 cachedresp.AgentData.SerialNum = serial;
11938 cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedTextures.Count];
11939
11940 for (int i = 0; i < cachedTextures.Count; i++)
11941 {
11942 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11943 cachedresp.WearableData[i].TextureIndex = (byte)cachedTextures[i].BakedTextureIndex;
11944 cachedresp.WearableData[i].TextureID = cachedTextures[i].BakedTextureID;
11945 cachedresp.WearableData[i].HostName = new byte[0];
11946 }
11947
11948 cachedresp.Header.Zerocoded = true;
11949 OutPacket(cachedresp, ThrottleOutPacketType.Task);
11950 }
11951
11887 protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet) 11952 protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet)
11888 { 11953 {
11889 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; 11954 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
@@ -11909,8 +11974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11909 if (part == null) 11974 if (part == null)
11910 { 11975 {
11911 // It's a ghost! tell the client to delete it from view. 11976 // It's a ghost! tell the client to delete it from view.
11912 simClient.SendKillObject(Scene.RegionInfo.RegionHandle, 11977 simClient.SendKillObject(new List<uint> { localId });
11913 new List<uint> { localId });
11914 } 11978 }
11915 else 11979 else
11916 { 11980 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 4154ef2..d008702 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -62,11 +62,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
62 m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager); 62 m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager);
63 } 63 }
64 64
65 public void NetworkStop()
66 {
67 m_udpServer.Stop();
68 }
69
70 public void AddScene(IScene scene) 65 public void AddScene(IScene scene)
71 { 66 {
72 m_udpServer.AddScene(scene); 67 m_udpServer.AddScene(scene);
@@ -1421,7 +1416,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1421 1416
1422 // We only want to send initial data to new clients, not ones which are being converted from child to root. 1417 // We only want to send initial data to new clients, not ones which are being converted from child to root.
1423 if (client != null) 1418 if (client != null)
1424 client.SceneAgent.SendInitialDataToMe(); 1419 {
1420 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
1421 bool tp = (aCircuit.teleportFlags > 0);
1422 if (!tp)
1423 client.SceneAgent.SendInitialDataToMe();
1424 }
1425 1425
1426 // Now we know we can handle more data 1426 // Now we know we can handle more data
1427 Thread.Sleep(200); 1427 Thread.Sleep(200);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index 7d9f581..a0e0078 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -75,6 +75,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
75 [SetUp] 75 [SetUp]
76 public void SetUp() 76 public void SetUp()
77 { 77 {
78 base.SetUp();
79
78 UUID userId = TestHelpers.ParseTail(0x3); 80 UUID userId = TestHelpers.ParseTail(0x3);
79 81
80 J2KDecoderModule j2kdm = new J2KDecoderModule(); 82 J2KDecoderModule j2kdm = new J2KDecoderModule();