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,13 +246,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
return;
|
||||
}
|
||||
|
||||
if(m_UseNewAvnCode)
|
||||
{
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
if (scene == null)
|
||||
scene = m_SceneList[0];
|
||||
|
||||
UUID scopeID = scene.RegionInfo.ScopeID;
|
||||
SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
|
||||
"POST", m_RestURL+"/SaveMessage/?scope=" +
|
||||
scene.RegionInfo.ScopeID.ToString(), im);
|
||||
"POST", m_RestURL+"/SaveMessage/?scope=" + scopeID.ToString(), im, 20000);
|
||||
|
||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
{
|
||||
|
@ -258,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
if (client == null)
|
||||
return;
|
||||
|
||||
if (reply.Message == String.Empty)
|
||||
if (string.IsNullOrEmpty(reply.Message))
|
||||
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
|
||||
|
||||
bool sendReply = true;
|
||||
|
@ -269,9 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
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))
|
||||
|
@ -292,6 +294,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
||||
"POST", m_RestURL+"/SaveMessage/", im, 20000);
|
||||
|
||||
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,
|
||||
"User is not logged in. "+
|
||||
(success ? "Message saved." : "Message not saved"),
|
||||
false, new Vector3()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue