aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs137
1 files changed, 137 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..fdbe10a
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs
@@ -0,0 +1,137 @@
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.Reflection;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenMetaverse;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Server.Base;
38using OpenSim.Services.Interfaces;
39using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
40
41namespace 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 // Don't bother potentially making a useless network call if we not going to ask for any users anyway.
129 if (userIDs.Length == 0)
130 return new PresenceInfo[0];
131
132 return m_PresenceService.GetAgents(userIDs);
133 }
134
135 #endregion
136 }
137} \ No newline at end of file