aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Handlers
diff options
context:
space:
mode:
authorMelanie Thielker2014-06-21 00:39:55 +0200
committerMelanie Thielker2014-06-21 00:39:55 +0200
commit159fcbf150b7da0e229b29aa7b94793484543d12 (patch)
treeb8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Capabilities/Handlers
parentMerge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-159fcbf150b7da0e229b29aa7b94793484543d12.zip
opensim-SC-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz
opensim-SC-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2
opensim-SC-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Capabilities/Handlers')
-rw-r--r--OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs116
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs4
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs3
-rw-r--r--OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs76
5 files changed, 197 insertions, 4 deletions
diff --git a/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
new file mode 100644
index 0000000..426174d
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/AvatarPickerSearch/AvatarPickerSearchHandler.cs
@@ -0,0 +1,116 @@
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.Generic;
30using System.Collections.Specialized;
31using System.IO;
32using System.Reflection;
33using System.Web;
34using log4net;
35using Nini.Config;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Capabilities;
39using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer;
41//using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Services.Interfaces;
43using Caps = OpenSim.Framework.Capabilities.Caps;
44
45namespace OpenSim.Capabilities.Handlers
46{
47 public class AvatarPickerSearchHandler : BaseStreamHandler
48 {
49 private static readonly ILog m_log =
50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private IPeople m_PeopleService;
52
53 public AvatarPickerSearchHandler(string path, IPeople peopleService, string name, string description)
54 : base("GET", path, name, description)
55 {
56 m_PeopleService = peopleService;
57 }
58
59 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
60 {
61 // Try to parse the texture ID from the request URL
62 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
63 string names = query.GetOne("names");
64 string psize = query.GetOne("page_size");
65 string pnumber = query.GetOne("page");
66
67 if (m_PeopleService == null)
68 return FailureResponse(names, (int)System.Net.HttpStatusCode.InternalServerError, httpResponse);
69
70 if (string.IsNullOrEmpty(names) || names.Length < 3)
71 return FailureResponse(names, (int)System.Net.HttpStatusCode.BadRequest, httpResponse);
72
73 m_log.DebugFormat("[AVATAR PICKER SEARCH]: search for {0}", names);
74
75 int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
76 int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
77
78 // Full content request
79 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
80 //httpResponse.ContentLength = ??;
81 httpResponse.ContentType = "application/llsd+xml";
82
83 List<UserData> users = m_PeopleService.GetUserData(names, page_size, page_number);
84
85 LLSDAvatarPicker osdReply = new LLSDAvatarPicker();
86 osdReply.next_page_url = httpRequest.RawUrl;
87 foreach (UserData u in users)
88 osdReply.agents.Array.Add(ConvertUserData(u));
89
90 string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
91 return System.Text.Encoding.UTF8.GetBytes(reply);
92 }
93
94 private LLSDPerson ConvertUserData(UserData user)
95 {
96 LLSDPerson p = new LLSDPerson();
97 p.legacy_first_name = user.FirstName;
98 p.legacy_last_name = user.LastName;
99 p.display_name = user.FirstName + " " + user.LastName;
100 if (user.LastName.StartsWith("@"))
101 p.username = user.FirstName.ToLower() + user.LastName.ToLower();
102 else
103 p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
104 p.id = user.Id;
105 p.is_display_name_default = false;
106 return p;
107 }
108
109 private byte[] FailureResponse(string names, int statuscode, IOSHttpResponse httpResponse)
110 {
111 m_log.Error("[AVATAR PICKER SEARCH]: Error searching for " + names);
112 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
113 return System.Text.Encoding.UTF8.GetBytes(string.Empty);
114 }
115 }
116} \ No newline at end of file
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
index c305797..d1503ee 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Capabilities.Handlers
46{ 46{
47 public class FetchInventory2Handler 47 public class FetchInventory2Handler
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private IInventoryService m_inventoryService; 51 private IInventoryService m_inventoryService;
52 52
@@ -121,4 +121,4 @@ namespace OpenSim.Capabilities.Handlers
121 return llsdItem; 121 return llsdItem;
122 } 122 }
123 } 123 }
124} 124} \ No newline at end of file
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index aa6203b..f3efb53 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Capabilities.Handlers
85// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID); 85// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
86 86
87 string[] formats; 87 string[] formats;
88 if (format != null && format != string.Empty) 88 if (!string.IsNullOrEmpty(format))
89 { 89 {
90 formats = new string[1] { format.ToLower() }; 90 formats = new string[1] { format.ToLower() };
91 } 91 }
@@ -174,6 +174,7 @@ namespace OpenSim.Capabilities.Handlers
174 174
175 newTexture.Flags = AssetFlags.Collectable; 175 newTexture.Flags = AssetFlags.Collectable;
176 newTexture.Temporary = true; 176 newTexture.Temporary = true;
177 newTexture.Local = true;
177 m_assetService.Store(newTexture); 178 m_assetService.Store(newTexture);
178 WriteTextureData(request, response, newTexture, format); 179 WriteTextureData(request, response, newTexture, format);
179 return true; 180 return true;
diff --git a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
index f8f63f4..0cf8bf4 100644
--- a/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
+++ b/OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.6.*")] 32[assembly: AssemblyVersion("0.8.0.*")]
33 33
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
new file mode 100644
index 0000000..10ea8ee
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs
@@ -0,0 +1,76 @@
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 Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base;
34using OpenMetaverse;
35
36namespace OpenSim.Capabilities.Handlers
37{
38 public class UploadBakedTextureServerConnector : ServiceConnector
39 {
40 private IAssetService m_AssetService;
41 private string m_ConfigName = "CapsService";
42
43 public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
44 base(config, server, configName)
45 {
46 if (configName != String.Empty)
47 m_ConfigName = configName;
48
49 IConfig serverConfig = config.Configs[m_ConfigName];
50 if (serverConfig == null)
51 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
52
53 string assetService = serverConfig.GetString("AssetService", String.Empty);
54
55 if (assetService == String.Empty)
56 throw new Exception("No AssetService in config file");
57
58 Object[] args = new Object[] { config };
59 m_AssetService =
60 ServerUtils.LoadPlugin<IAssetService>(assetService, args);
61
62 if (m_AssetService == null)
63 throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
64
65 // NEED TO FIX THIS
66 OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
67 server.AddStreamHandler(new RestStreamHandler(
68 "POST",
69 "/CAPS/UploadBakedTexture/",
70 new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
71 "UploadBakedTexture",
72 "Upload Baked Texture Capability"));
73
74 }
75 }
76} \ No newline at end of file