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 bool enabled = true;
|
||||
private bool m_UseNewAvnCode = false;
|
||||
private List<Scene> m_SceneList = new List<Scene>();
|
||||
private string m_RestURL = String.Empty;
|
||||
IMessageTransferModule m_TransferModule = null;
|
||||
|
@ -82,6 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
|
||||
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
|
||||
m_UseNewAvnCode = cnf.GetBoolean("UseNewAvnCode", m_UseNewAvnCode);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
|
@ -244,51 +246,72 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
return;
|
||||
}
|
||||
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
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)
|
||||
if(m_UseNewAvnCode)
|
||||
{
|
||||
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
||||
if (client == null)
|
||||
return;
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
if (scene == null)
|
||||
scene = m_SceneList[0];
|
||||
|
||||
if (reply.Message == String.Empty)
|
||||
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
|
||||
UUID scopeID = scene.RegionInfo.ScopeID;
|
||||
SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
|
||||
"POST", m_RestURL+"/SaveMessage/?scope=" + scopeID.ToString(), im, 20000);
|
||||
|
||||
bool sendReply = true;
|
||||
|
||||
switch (reply.Disposition)
|
||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
{
|
||||
case 0: // Normal
|
||||
break;
|
||||
case 1: // Only once per user
|
||||
if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
|
||||
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
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))
|
||||
m_repliesSent[client] = new List<UUID>();
|
||||
m_repliesSent[client].Add(new UUID(im.toAgentID));
|
||||
client.SendInstantMessage(new GridInstantMessage(
|
||||
null, 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(
|
||||
null, new UUID(im.toAgentID),
|
||||
"System", new UUID(im.fromAgentID),
|
||||
(byte)InstantMessageDialog.MessageFromAgent,
|
||||
reply.Message,
|
||||
false, new Vector3()));
|
||||
null, new UUID(im.toAgentID),
|
||||
"System", new UUID(im.fromAgentID),
|
||||
(byte)InstantMessageDialog.MessageFromAgent,
|
||||
"User is not logged in. "+
|
||||
(success ? "Message saved." : "Message not saved"),
|
||||
false, new Vector3()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue