minor change to getdisplaynames cap url

melanie
UbitUmarov 2016-11-16 00:42:08 +00:00
parent 8196f21af9
commit 8dd9601fdc
2 changed files with 5 additions and 46 deletions

View File

@ -120,14 +120,13 @@ namespace OpenSim.Region.ClientStack.Linden
public virtual void RegisterCaps(UUID agentID, Caps caps)
{
UUID capID = UUID.Random();
if (m_URL == "localhost")
{
m_log.DebugFormat("[GET_DISPLAY_NAMES]: /CAPS/agents/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
string capUrl = "/CAPS/" + UUID.Random() + "/";
// m_log.DebugFormat("[GET_DISPLAY_NAMES]: {0} in region {1}", capUrl, m_scene.RegionInfo.RegionName);
caps.RegisterHandler(
"GetDisplayNames",
new GetDisplayNamesHandler("/CAPS/agents" + capID + "/", m_UserManager, "GetDisplayNames", agentID.ToString()));
new GetDisplayNamesHandler(capUrl, m_UserManager, "GetDisplayNames", agentID.ToString()));
}
else
{

View File

@ -45,10 +45,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private static readonly ILog m_log = LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
protected Timer m_logTimer = new Timer(10000);
protected List<GridInstantMessage> m_logData = new List<GridInstantMessage>();
protected string m_restUrl;
/// <value>
/// Is this module enabled?
/// </value>
@ -68,12 +64,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
"InstantMessageModule", "InstantMessageModule") !=
"InstantMessageModule")
return;
m_restUrl = config.Configs["Messaging"].GetString("LogURL", String.Empty);
}
m_enabled = true;
m_logTimer.AutoReset = false;
m_logTimer.Elapsed += LogTimerElapsed;
}
public virtual void AddRegion(Scene scene)
@ -153,20 +146,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
#endregion
/*
public virtual void OnViewerInstantMessage(IClientAPI client, GridInstantMessage im)
{
im.fromAgentName = client.FirstName + " " + client.LastName;
OnInstantMessage(client, im);
}
*/
public virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
byte dialog = im.dialog;
if (client != null && dialog == (byte)InstantMessageDialog.MessageFromAgent)
LogInstantMesssage(im);
if (dialog != (byte)InstantMessageDialog.MessageFromAgent
&& dialog != (byte)InstantMessageDialog.StartTyping
&& dialog != (byte)InstantMessageDialog.StopTyping
@ -243,35 +233,5 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
//
OnInstantMessage(null, msg);
}
protected virtual void LogInstantMesssage(GridInstantMessage im)
{
if (m_logData.Count < 20)
{
// Restart the log write timer
m_logTimer.Stop();
}
if (!m_logTimer.Enabled)
m_logTimer.Start();
lock (m_logData)
{
m_logData.Add(im);
}
}
protected virtual void LogTimerElapsed(object source, ElapsedEventArgs e)
{
lock (m_logData)
{
if (m_restUrl != String.Empty && m_logData.Count > 0)
{
bool success = SynchronousRestObjectRequester.MakeRequest<List<GridInstantMessage>, bool>("POST", m_restUrl + "/LogMessages/", m_logData);
if (!success)
m_log.ErrorFormat("[INSTANT MESSAGE]: Failed to save log data");
}
m_logData.Clear();
}
}
}
}