aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs104
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs50
2 files changed, 0 insertions, 154 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
deleted file mode 100644
index 41897eb..0000000
--- a/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
+++ /dev/null
@@ -1,104 +0,0 @@
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.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nini.Config;
35using Nwc.XmlRpc;
36using OpenSim.Server.Base;
37using OpenSim.Server.Handlers.Inventory;
38using OpenSim.Services.Interfaces;
39using OpenSim.Framework;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Server.Handlers.Base;
42using OpenMetaverse;
43
44namespace OpenSim.Server.Handlers.Hypergrid
45{
46 public class HGInventoryServiceInConnector : InventoryServiceInConnector
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 //private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs
51 //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
52
53 private IUserAgentService m_UserAgentService;
54
55 public HGInventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
56 base(config, server, configName)
57 {
58 IConfig serverConfig = config.Configs[m_ConfigName];
59 if (serverConfig == null)
60 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
61
62 string userAgentService = serverConfig.GetString("UserAgentService", string.Empty);
63 string m_userserver_url = serverConfig.GetString("UserAgentURI", String.Empty);
64 if (m_userserver_url != string.Empty)
65 {
66 Object[] args = new Object[] { m_userserver_url };
67 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args);
68 }
69
70 AddHttpHandlers(server);
71 m_log.Debug("[HG INVENTORY HANDLER]: handlers initialized");
72 }
73
74 /// <summary>
75 /// Check that the source of an inventory request for a particular agent is a current session belonging to
76 /// that agent.
77 /// </summary>
78 /// <param name="session_id"></param>
79 /// <param name="avatar_id"></param>
80 /// <returns></returns>
81 public override bool CheckAuthSession(string session_id, string avatar_id)
82 {
83 //m_log.InfoFormat("[HG INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id);
84 // This doesn't work
85
86 // if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
87 // {
88 // //cache miss, ask userserver
89 // m_UserAgentService.VerifyAgent(session_id, ???);
90 // }
91 // else
92 // {
93 // // cache hits
94 // m_log.Info("[HG INVENTORY IN CONNECTOR]: got authed session from cache");
95 // return true;
96 // }
97
98 // m_log.Warn("[HG INVENTORY IN CONNECTOR]: unknown session_id, request rejected");
99 // return false;
100
101 return true;
102 }
103 }
104}
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 16b05df..b0fee6d 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -144,8 +144,6 @@ namespace OpenSim.Server.Handlers.Asset
144 return HandleGetActiveGestures(request); 144 return HandleGetActiveGestures(request);
145 case "GETASSETPERMISSIONS": 145 case "GETASSETPERMISSIONS":
146 return HandleGetAssetPermissions(request); 146 return HandleGetAssetPermissions(request);
147 case "GETSYSTEMFOLDERS":
148 return HandleGetSystemFolders(request);
149 } 147 }
150 m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); 148 m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
151 } 149 }
@@ -575,29 +573,6 @@ namespace OpenSim.Server.Handlers.Asset
575 return encoding.GetBytes(xmlString); 573 return encoding.GetBytes(xmlString);
576 } 574 }
577 575
578 byte[] HandleGetSystemFolders(Dictionary<string, object> request)
579 {
580 Dictionary<string, object> result = new Dictionary<string, object>();
581 UUID principal = UUID.Zero;
582 UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
583
584 Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal);
585 //m_log.DebugFormat("[XXX]: SystemFolders got {0} folders", sfolders.Count);
586
587 Dictionary<string, object> folders = new Dictionary<string, object>();
588 int i = 0;
589 foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders)
590 {
591 folders["folder_" + i.ToString()] = EncodeFolder(kvp.Value);
592 i++;
593 }
594 result["FOLDERS"] = folders;
595
596 string xmlString = ServerUtils.BuildXmlResponse(result);
597 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
598 UTF8Encoding encoding = new UTF8Encoding();
599 return encoding.GetBytes(xmlString);
600 }
601 576
602 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) 577 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
603 { 578 {
@@ -683,30 +658,5 @@ namespace OpenSim.Server.Handlers.Asset
683 return item; 658 return item;
684 } 659 }
685 660
686 #region Extra
687 private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
688 {
689 InventoryFolderBase root = m_InventoryService.GetRootFolder(userID);
690 if (root != null)
691 {
692 InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID);
693 if (content != null)
694 {
695 Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
696 foreach (InventoryFolderBase folder in content.Folders)
697 {
698 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
699 folders[(AssetType)folder.Type] = folder;
700 }
701 // Put the root folder there, as type Folder
702 folders[AssetType.Folder] = root;
703 return folders;
704 }
705 }
706 m_log.WarnFormat("[XINVENTORY SERVICE]: System folders for {0} not found", userID);
707 return new Dictionary<AssetType, InventoryFolderBase>();
708 }
709 #endregion
710
711 } 661 }
712} 662}