silent ignore mutes on HG visitors, let viewers do it on cache only, proper HG suport is another story... and questionable

httptests
UbitUmarov 2018-01-20 01:28:00 +00:00
parent e89f1e635b
commit c34f07b6f3
2 changed files with 17 additions and 5 deletions

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
protected bool m_Enabled = false;
protected List<Scene> m_SceneList = new List<Scene>();
protected IMuteListService m_service = null;
private IUserManagement m_userManagementModule;
public void Initialise(IConfigSource config)
{
@ -89,10 +90,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
m_Enabled = false;
return;
}
lock (m_SceneList)
{
if(m_service == null)
m_service = srv;
if(m_userManagementModule == null)
m_userManagementModule = scene.RequestModuleInterface<IUserManagement>();
m_SceneList.Add(scene);
scene.EventManager.OnNewClient += OnNewClient;
}
@ -132,6 +136,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
}
private bool IsForeign(IClientAPI client)
{
if(m_userManagementModule == null)
return false; // we can't check
return !m_userManagementModule.IsLocalGridUser(client.AgentId);
}
private void OnNewClient(IClientAPI client)
{
client.OnMuteListRequest += OnMuteListRequest;
@ -141,7 +153,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private void OnMuteListRequest(IClientAPI client, uint crc)
{
if (!m_Enabled)
if (!m_Enabled || IsForeign(client))
{
if(crc == 0)
client.SendEmpytMuteList();
@ -192,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private void OnUpdateMuteListEntry(IClientAPI client, UUID muteID, string muteName, int muteType, uint muteFlags)
{
if (!m_Enabled)
if (!m_Enabled || IsForeign(client))
return;
UUID agentID = client.AgentId;
@ -220,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private void OnRemoveMuteListEntry(IClientAPI client, UUID muteID, string muteName)
{
if (!m_Enabled)
if (!m_Enabled || IsForeign(client))
return;
m_service.RemoveMute(client.AgentId, muteID, muteName);
}