Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
5cb7d8bc71
|
@ -389,6 +389,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public delegate void RegionUp(GridRegion region);
|
public delegate void RegionUp(GridRegion region);
|
||||||
public event RegionUp OnRegionUp;
|
public event RegionUp OnRegionUp;
|
||||||
|
|
||||||
|
public delegate void LoginsEnabled(string regionName);
|
||||||
|
public event LoginsEnabled OnLoginsEnabled;
|
||||||
|
|
||||||
public class MoneyTransferArgs : EventArgs
|
public class MoneyTransferArgs : EventArgs
|
||||||
{
|
{
|
||||||
public UUID sender;
|
public UUID sender;
|
||||||
|
@ -2218,5 +2221,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TriggerLoginsEnabled (string regionName)
|
||||||
|
{
|
||||||
|
LoginsEnabled handler = OnLoginsEnabled;
|
||||||
|
|
||||||
|
if ( handler != null)
|
||||||
|
{
|
||||||
|
foreach (LoginsEnabled d in handler.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d(regionName);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1376,9 +1376,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
IConfig startupConfig = m_config.Configs["Startup"];
|
IConfig startupConfig = m_config.Configs["Startup"];
|
||||||
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
|
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
|
||||||
{
|
{
|
||||||
|
// This handles a case of a region having no scripts for the RegionReady module
|
||||||
if (m_sceneGraph.GetActiveScriptsCount() == 0)
|
if (m_sceneGraph.GetActiveScriptsCount() == 0)
|
||||||
{
|
{
|
||||||
|
// need to be able to tell these have changed in RegionReady
|
||||||
LoginLock = false;
|
LoginLock = false;
|
||||||
|
EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
|
||||||
// For RegionReady lockouts
|
// For RegionReady lockouts
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
@ -54,6 +55,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
private int m_channelNotify = -1000;
|
private int m_channelNotify = -1000;
|
||||||
private bool m_enabled = false;
|
private bool m_enabled = false;
|
||||||
private bool m_disable_logins = false;
|
private bool m_disable_logins = false;
|
||||||
|
private string m_uri = string.Empty;
|
||||||
|
|
||||||
Scene m_scene = null;
|
Scene m_scene = null;
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
{
|
{
|
||||||
m_channelNotify = m_config.GetInt("channel_notify", m_channelNotify);
|
m_channelNotify = m_config.GetInt("channel_notify", m_channelNotify);
|
||||||
m_disable_logins = m_config.GetBoolean("login_disable", false);
|
m_disable_logins = m_config.GetBoolean("login_disable", false);
|
||||||
|
m_uri = m_config.GetString("alert_uri",string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +100,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
|
|
||||||
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
|
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
|
||||||
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
|
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
|
||||||
|
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
|
||||||
|
|
||||||
m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
@ -105,6 +109,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
scene.LoginLock = true;
|
scene.LoginLock = true;
|
||||||
scene.LoginsDisabled = true;
|
scene.LoginsDisabled = true;
|
||||||
m_log.InfoFormat("[RegionReady]: Logins disabled for {0}",m_scene.RegionInfo.RegionName);
|
m_log.InfoFormat("[RegionReady]: Logins disabled for {0}",m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
if(m_uri != string.Empty)
|
||||||
|
{
|
||||||
|
RRAlert("disabled");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,19 +170,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
c.SenderUUID = UUID.Zero;
|
c.SenderUUID = UUID.Zero;
|
||||||
c.Scene = m_scene;
|
c.Scene = m_scene;
|
||||||
|
|
||||||
if(m_disable_logins == true)
|
|
||||||
{
|
|
||||||
if(m_scene.StartDisabled == false)
|
|
||||||
{
|
|
||||||
m_scene.LoginsDisabled = false;
|
|
||||||
m_scene.LoginLock = false;
|
|
||||||
m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.InfoFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}",
|
m_log.InfoFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}",
|
||||||
m_scene.RegionInfo.RegionName, c.Message, m_channelNotify);
|
m_scene.RegionInfo.RegionName, c.Message, m_channelNotify);
|
||||||
m_scene.EventManager.TriggerOnChatBroadcast(this, c);
|
|
||||||
|
m_scene.EventManager.TriggerOnChatBroadcast(this, c);
|
||||||
|
m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,5 +189,69 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||||
m_lastOarLoadedOk = false;
|
m_lastOarLoadedOk = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnLoginsEnabled(string regionName)
|
||||||
|
{
|
||||||
|
if (m_disable_logins == true)
|
||||||
|
{
|
||||||
|
if (m_scene.StartDisabled == false)
|
||||||
|
{
|
||||||
|
m_scene.LoginsDisabled = false;
|
||||||
|
m_scene.LoginLock = false;
|
||||||
|
m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName);
|
||||||
|
if ( m_uri != string.Empty )
|
||||||
|
{
|
||||||
|
RRAlert("enabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RRAlert(string status)
|
||||||
|
{
|
||||||
|
string request_method = "POST";
|
||||||
|
string content_type = "application/json";
|
||||||
|
OSDMap RRAlert = new OSDMap();
|
||||||
|
|
||||||
|
RRAlert["alert"] = "region_ready";
|
||||||
|
RRAlert["login"] = status;
|
||||||
|
RRAlert["region_name"] = m_scene.RegionInfo.RegionName;
|
||||||
|
RRAlert["region_id"] = m_scene.RegionInfo.RegionID;
|
||||||
|
|
||||||
|
string strBuffer = "";
|
||||||
|
byte[] buffer = new byte[1];
|
||||||
|
try
|
||||||
|
{
|
||||||
|
strBuffer = OSDParser.SerializeJsonString(RRAlert);
|
||||||
|
Encoding str = Util.UTF8;
|
||||||
|
buffer = str.GetBytes(strBuffer);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[RegionReady]: Exception thrown on alert: {0}", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
WebRequest request = WebRequest.Create(m_uri);
|
||||||
|
request.Method = request_method;
|
||||||
|
request.ContentType = content_type;
|
||||||
|
|
||||||
|
Stream os = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
request.ContentLength = buffer.Length;
|
||||||
|
os = request.GetRequestStream();
|
||||||
|
os.Write(buffer, 0, strBuffer.Length);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[RegionReady]: Exception thrown sending alert: {0}", e.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (os != null)
|
||||||
|
os.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1174,7 +1174,10 @@
|
||||||
; - the third field is a number indicating how many scripts failed to compile
|
; - the third field is a number indicating how many scripts failed to compile
|
||||||
; - "oar error" if supplied, provides the error message from the OAR load
|
; - "oar error" if supplied, provides the error message from the OAR load
|
||||||
channel_notify = -800
|
channel_notify = -800
|
||||||
|
; - disallow logins while scripts are loading
|
||||||
login_disable = false
|
login_disable = false
|
||||||
|
; - send an alert as json to a service
|
||||||
|
; alert_uri = "http://myappserver.net/my_handler/"
|
||||||
|
|
||||||
|
|
||||||
[MRM]
|
[MRM]
|
||||||
|
|
Loading…
Reference in New Issue