aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/RemoteMuteListServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/RemoteMuteListServiceConnector.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/RemoteMuteListServiceConnector.cs143
1 files changed, 143 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/RemoteMuteListServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/RemoteMuteListServiceConnector.cs
new file mode 100644
index 0000000..a5dec64
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MuteList/RemoteMuteListServiceConnector.cs
@@ -0,0 +1,143 @@
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 */
27using System;
28using System.Collections.Generic;
29using System.Reflection;
30using OpenSim.Framework;
31using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Server.Base;
34using OpenSim.Services.Interfaces;
35using OpenSim.Services.Connectors;
36
37using OpenMetaverse;
38using log4net;
39using Mono.Addins;
40using Nini.Config;
41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MuteList
43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteMuteListServicesConnector")]
45 public class RemoteMuteListServicesConnector : ISharedRegionModule, IMuteListService
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 #region ISharedRegionModule
50
51 private bool m_Enabled = false;
52
53 private IMuteListService m_remoteConnector;
54
55 public Type ReplaceableInterface
56 {
57 get { return null; }
58 }
59
60 public string Name
61 {
62 get { return "RemoteMuteListServicesConnector"; }
63 }
64
65 public void Initialise(IConfigSource source)
66 {
67 // only active for core mute lists module
68 IConfig moduleConfig = source.Configs["Messaging"];
69 if (moduleConfig == null)
70 return;
71
72 if (moduleConfig.GetString("MuteListModule", "None") != "MuteListModuleTst")
73 return;
74
75 moduleConfig = source.Configs["Modules"];
76 if (moduleConfig != null)
77 {
78 string name = moduleConfig.GetString("MuteListService", "");
79 if (name == Name)
80 {
81 m_remoteConnector = new MuteListServicesConnector(source);
82 m_Enabled = true;
83 }
84 }
85 }
86
87 public void PostInitialise()
88 {
89 }
90
91 public void Close()
92 {
93 }
94
95 public void AddRegion(Scene scene)
96 {
97 if (!m_Enabled)
98 return;
99
100 scene.RegisterModuleInterface<IMuteListService>(this);
101 m_log.InfoFormat("[MUTELIST CONNECTOR]: Enabled for region {0}", scene.RegionInfo.RegionName);
102 }
103
104 public void RemoveRegion(Scene scene)
105 {
106 if (!m_Enabled)
107 return;
108 }
109
110 public void RegionLoaded(Scene scene)
111 {
112 if (!m_Enabled)
113 return;
114 }
115
116 #endregion
117
118 #region IMuteListService
119 public Byte[] MuteListRequest(UUID agentID, uint crc)
120 {
121 if (!m_Enabled)
122 return null;
123 return m_remoteConnector.MuteListRequest(agentID, crc);
124 }
125
126 public bool UpdateMute(MuteData mute)
127 {
128 if (!m_Enabled)
129 return false;
130 return m_remoteConnector.UpdateMute(mute);
131 }
132
133 public bool RemoveMute(UUID agentID, UUID muteID, string muteName)
134 {
135 if (!m_Enabled)
136 return false;
137 return m_remoteConnector.RemoveMute(agentID, muteID, muteName);
138 }
139
140 #endregion IMuteListService
141
142 }
143}