aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs128
1 files changed, 128 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
new file mode 100644
index 0000000..98f9663
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
@@ -0,0 +1,128 @@
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.Reflection;
31using log4net;
32using Nini.Config;
33using Mono.Addins;
34using OpenMetaverse;
35using OpenMetaverse.StructuredData;
36using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces;
41using Caps = OpenSim.Framework.Capabilities.Caps;
42
43namespace OpenSim.Region.ClientStack.Linden
44{
45 /// <summary>
46 /// MeshUploadFlag capability. This is required for uploading Mesh.
47 /// </summary>
48 ///
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class MeshUploadFlagModule : ISharedRegionModule
51 {
52 private static readonly ILog m_log =
53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private Scene m_scene;
55 private UUID m_agentID;
56
57
58 #region ISharedRegionModule Members
59
60 public void Initialise(IConfigSource source)
61 {
62 IConfig config = source.Configs["MeshUploadFlag"];
63 if (config == null)
64 return;
65 }
66
67 public void AddRegion(Scene s)
68 {
69 m_scene = s;
70 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
71 }
72
73 public void RemoveRegion(Scene s)
74 {
75 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
76 }
77
78 public void RegionLoaded(Scene s)
79 {
80 }
81
82 public void PostInitialise()
83 {
84 }
85
86 public void Close() { }
87
88 public string Name { get { return "MeshUploadFlagModule"; } }
89
90 public Type ReplaceableInterface
91 {
92 get { return null; }
93 }
94
95 #endregion
96
97 public void RegisterCaps(UUID agentID, Caps caps)
98 {
99 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag);
100 caps.RegisterHandler("MeshUploadFlag", reqHandler);
101 m_agentID = agentID;
102 }
103
104 private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
105 {
106 m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request");
107 OSDMap data = new OSDMap();
108 ScenePresence sp = m_scene.GetScenePresence(m_agentID);
109 data["username"] = sp.Firstname + "." + sp.Lastname;
110 data["display_name_next_update"] = new OSDDate(DateTime.Now);
111 data["legacy_first_name"] = sp.Firstname;
112 data["mesh_upload_status"] = "valid";
113 data["display_name"] = sp.Firstname + " " + sp.Lastname;
114 data["legacy_last_name"] = sp.Lastname;
115 data["id"] = m_agentID;
116 data["is_display_name_default"] = true;
117
118 //Send back data
119 Hashtable responsedata = new Hashtable();
120 responsedata["int_response_code"] = 200;
121 responsedata["content_type"] = "text/plain";
122 responsedata["keepalive"] = false;
123 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
124 return responsedata;
125 }
126
127 }
128} \ No newline at end of file