diff options
author | Justin Clark-Casey (justincc) | 2010-07-30 19:54:27 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-30 19:54:27 +0100 |
commit | ce358db159e1b2e89339fd483ebfab574792660f (patch) | |
tree | 7cb47b3c57509f1a4809214f3febfc4437dfd062 | |
parent | remove unused FriendRegionInfo (diff) | |
download | opensim-SC_OLD-ce358db159e1b2e89339fd483ebfab574792660f.zip opensim-SC_OLD-ce358db159e1b2e89339fd483ebfab574792660f.tar.gz opensim-SC_OLD-ce358db159e1b2e89339fd483ebfab574792660f.tar.bz2 opensim-SC_OLD-ce358db159e1b2e89339fd483ebfab574792660f.tar.xz |
remove long superseded HGNetworkServersInfo
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/HGNetworkServersInfo.cs | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/OpenSim/Framework/HGNetworkServersInfo.cs b/OpenSim/Framework/HGNetworkServersInfo.cs deleted file mode 100644 index 0865576..0000000 --- a/OpenSim/Framework/HGNetworkServersInfo.cs +++ /dev/null | |||
@@ -1,107 +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 | |||
28 | using System.Net; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | public class HGNetworkServersInfo | ||
33 | { | ||
34 | |||
35 | public readonly string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI; | ||
36 | |||
37 | private static HGNetworkServersInfo m_singleton; | ||
38 | public static HGNetworkServersInfo Singleton | ||
39 | { | ||
40 | get { return m_singleton; } | ||
41 | } | ||
42 | |||
43 | public static void Init(string assetserver, string inventoryserver, string userserver) | ||
44 | { | ||
45 | m_singleton = new HGNetworkServersInfo(assetserver, inventoryserver, userserver); | ||
46 | |||
47 | } | ||
48 | |||
49 | private HGNetworkServersInfo(string a, string i, string u) | ||
50 | { | ||
51 | LocalAssetServerURI = ServerURI(a); | ||
52 | LocalInventoryServerURI = ServerURI(i); | ||
53 | LocalUserServerURI = ServerURI(u); | ||
54 | } | ||
55 | |||
56 | public bool IsLocalUser(string userserver) | ||
57 | { | ||
58 | string userServerURI = ServerURI(userserver); | ||
59 | bool ret = (((userServerURI == null) || (userServerURI == "") || (userServerURI == LocalUserServerURI))); | ||
60 | //m_log.Debug("-------------> HGNetworkServersInfo.IsLocalUser? " + ret + "(userServer=" + userServerURI + "; localuserserver=" + LocalUserServerURI + ")"); | ||
61 | return ret; | ||
62 | } | ||
63 | |||
64 | public bool IsLocalUser(UserProfileData userData) | ||
65 | { | ||
66 | if (userData != null) | ||
67 | { | ||
68 | if (userData is ForeignUserProfileData) | ||
69 | return IsLocalUser(((ForeignUserProfileData)userData).UserServerURI); | ||
70 | else | ||
71 | return true; | ||
72 | } | ||
73 | else | ||
74 | // Something fishy; ignore it | ||
75 | return true; | ||
76 | } | ||
77 | |||
78 | public static string ServerURI(string uri) | ||
79 | { | ||
80 | // Get rid of eventual slashes at the end | ||
81 | try | ||
82 | { | ||
83 | if (uri.EndsWith("/")) | ||
84 | uri = uri.Substring(0, uri.Length - 1); | ||
85 | } | ||
86 | catch { } | ||
87 | |||
88 | IPAddress ipaddr1 = null; | ||
89 | string port1 = ""; | ||
90 | try | ||
91 | { | ||
92 | ipaddr1 = Util.GetHostFromURL(uri); | ||
93 | } | ||
94 | catch { } | ||
95 | |||
96 | try | ||
97 | { | ||
98 | port1 = uri.Split(new char[] { ':' })[2]; | ||
99 | } | ||
100 | catch { } | ||
101 | |||
102 | // We tried our best to convert the domain names to IP addresses | ||
103 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | ||
104 | } | ||
105 | |||
106 | } | ||
107 | } | ||