diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs new file mode 100644 index 0000000..c84518d --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs | |||
@@ -0,0 +1,133 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Mono.Addins; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Server.Base; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | ||
42 | { | ||
43 | public class BasePresenceServiceConnector : IPresenceService | ||
44 | { | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | protected bool m_Enabled; | ||
48 | |||
49 | protected PresenceDetector m_PresenceDetector; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Underlying presence service. Do not use directly. | ||
53 | /// </summary> | ||
54 | public IPresenceService m_PresenceService; | ||
55 | |||
56 | public Type ReplaceableInterface | ||
57 | { | ||
58 | get { return null; } | ||
59 | } | ||
60 | |||
61 | public void AddRegion(Scene scene) | ||
62 | { | ||
63 | if (!m_Enabled) | ||
64 | return; | ||
65 | |||
66 | // m_log.DebugFormat( | ||
67 | // "[LOCAL PRESENCE CONNECTOR]: Registering IPresenceService to scene {0}", scene.RegionInfo.RegionName); | ||
68 | |||
69 | scene.RegisterModuleInterface<IPresenceService>(this); | ||
70 | m_PresenceDetector.AddRegion(scene); | ||
71 | |||
72 | m_log.InfoFormat("[BASE PRESENCE SERVICE CONNECTOR]: Enabled for region {0}", scene.Name); | ||
73 | } | ||
74 | |||
75 | public void RemoveRegion(Scene scene) | ||
76 | { | ||
77 | if (!m_Enabled) | ||
78 | return; | ||
79 | |||
80 | m_PresenceDetector.RemoveRegion(scene); | ||
81 | } | ||
82 | |||
83 | public void RegionLoaded(Scene scene) | ||
84 | { | ||
85 | if (!m_Enabled) | ||
86 | return; | ||
87 | |||
88 | } | ||
89 | |||
90 | public void PostInitialise() | ||
91 | { | ||
92 | } | ||
93 | |||
94 | public void Close() | ||
95 | { | ||
96 | } | ||
97 | |||
98 | #region IPresenceService | ||
99 | |||
100 | public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) | ||
101 | { | ||
102 | m_log.Warn("[BASE PRESENCE SERVICE CONNECTOR]: LoginAgent connector not implemented at the simulators"); | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | public bool LogoutAgent(UUID sessionID) | ||
107 | { | ||
108 | return m_PresenceService.LogoutAgent(sessionID); | ||
109 | } | ||
110 | |||
111 | public bool LogoutRegionAgents(UUID regionID) | ||
112 | { | ||
113 | return m_PresenceService.LogoutRegionAgents(regionID); | ||
114 | } | ||
115 | |||
116 | public bool ReportAgent(UUID sessionID, UUID regionID) | ||
117 | { | ||
118 | return m_PresenceService.ReportAgent(sessionID, regionID); | ||
119 | } | ||
120 | |||
121 | public PresenceInfo GetAgent(UUID sessionID) | ||
122 | { | ||
123 | return m_PresenceService.GetAgent(sessionID); | ||
124 | } | ||
125 | |||
126 | public PresenceInfo[] GetAgents(string[] userIDs) | ||
127 | { | ||
128 | return m_PresenceService.GetAgents(userIDs); | ||
129 | } | ||
130 | |||
131 | #endregion | ||
132 | } | ||
133 | } \ No newline at end of file | ||