mantis 8131: make the new Offline IM code optional and disabled by default, since it is not compatible with current central servers, like in osgrid.
parent
07c39624ef
commit
efed73b2c3
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool enabled = true;
|
private bool enabled = true;
|
||||||
|
private bool m_UseNewAvnCode = false;
|
||||||
private List<Scene> m_SceneList = new List<Scene>();
|
private List<Scene> m_SceneList = new List<Scene>();
|
||||||
private string m_RestURL = String.Empty;
|
private string m_RestURL = String.Empty;
|
||||||
IMessageTransferModule m_TransferModule = null;
|
IMessageTransferModule m_TransferModule = null;
|
||||||
|
@ -82,6 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
|
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
|
||||||
|
m_UseNewAvnCode = cnf.GetBoolean("UseNewAvnCode", m_UseNewAvnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
|
@ -244,51 +246,72 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
if(m_UseNewAvnCode)
|
||||||
if (scene == null)
|
|
||||||
scene = m_SceneList[0];
|
|
||||||
|
|
||||||
SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
|
|
||||||
"POST", m_RestURL+"/SaveMessage/?scope=" +
|
|
||||||
scene.RegionInfo.ScopeID.ToString(), im);
|
|
||||||
|
|
||||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
|
||||||
{
|
{
|
||||||
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||||
if (client == null)
|
if (scene == null)
|
||||||
return;
|
scene = m_SceneList[0];
|
||||||
|
|
||||||
if (reply.Message == String.Empty)
|
UUID scopeID = scene.RegionInfo.ScopeID;
|
||||||
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
|
SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
|
||||||
|
"POST", m_RestURL+"/SaveMessage/?scope=" + scopeID.ToString(), im, 20000);
|
||||||
|
|
||||||
bool sendReply = true;
|
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||||
|
|
||||||
switch (reply.Disposition)
|
|
||||||
{
|
{
|
||||||
case 0: // Normal
|
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
||||||
break;
|
if (client == null)
|
||||||
case 1: // Only once per user
|
return;
|
||||||
if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
|
|
||||||
|
if (string.IsNullOrEmpty(reply.Message))
|
||||||
|
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
|
||||||
|
|
||||||
|
bool sendReply = true;
|
||||||
|
|
||||||
|
switch (reply.Disposition)
|
||||||
{
|
{
|
||||||
sendReply = false;
|
case 0: // Normal
|
||||||
|
break;
|
||||||
|
case 1: // Only once per user
|
||||||
|
if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
|
||||||
|
sendReply = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_repliesSent.ContainsKey(client))
|
||||||
|
m_repliesSent[client] = new List<UUID>();
|
||||||
|
m_repliesSent[client].Add(new UUID(im.toAgentID));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (sendReply)
|
||||||
{
|
{
|
||||||
if (!m_repliesSent.ContainsKey(client))
|
client.SendInstantMessage(new GridInstantMessage(
|
||||||
m_repliesSent[client] = new List<UUID>();
|
null, new UUID(im.toAgentID),
|
||||||
m_repliesSent[client].Add(new UUID(im.toAgentID));
|
"System", new UUID(im.fromAgentID),
|
||||||
|
(byte)InstantMessageDialog.MessageFromAgent,
|
||||||
|
reply.Message,
|
||||||
|
false, new Vector3()));
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
||||||
|
"POST", m_RestURL+"/SaveMessage/", im, 20000);
|
||||||
|
|
||||||
if (sendReply)
|
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||||
{
|
{
|
||||||
|
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
||||||
|
if (client == null)
|
||||||
|
return;
|
||||||
|
|
||||||
client.SendInstantMessage(new GridInstantMessage(
|
client.SendInstantMessage(new GridInstantMessage(
|
||||||
null, new UUID(im.toAgentID),
|
null, new UUID(im.toAgentID),
|
||||||
"System", new UUID(im.fromAgentID),
|
"System", new UUID(im.fromAgentID),
|
||||||
(byte)InstantMessageDialog.MessageFromAgent,
|
(byte)InstantMessageDialog.MessageFromAgent,
|
||||||
reply.Message,
|
"User is not logged in. "+
|
||||||
false, new Vector3()));
|
(success ? "Message saved." : "Message not saved"),
|
||||||
|
false, new Vector3()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue