Port the Avination offline messaging system to Core

remove-scene-viewer
Melanie 2011-11-02 23:50:47 +00:00
parent c5fb39e21f
commit 08fcf958c2
4 changed files with 36 additions and 22 deletions

View File

@ -356,12 +356,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
if (presences != null && presences.Length > 0) if (presences != null && presences.Length > 0)
presence = presences[0]; presence = presences[0];
if (presence != null) im.offline = 0;
im.offline = 0;
im.fromAgentID = fromAgentID.Guid; im.fromAgentID = fromAgentID.Guid;
im.fromAgentName = firstname + " " + lastname; im.fromAgentName = firstname + " " + lastname;
im.offline = (byte)((presence == null) ? 1 : 0);
im.imSessionID = im.fromAgentID; im.imSessionID = im.fromAgentID;
im.message = FriendshipMessage(fid); im.message = FriendshipMessage(fid);

View File

@ -201,26 +201,42 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private void UndeliveredMessage(GridInstantMessage im) private void UndeliveredMessage(GridInstantMessage im)
{ {
if ((im.offline != 0) if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
im.dialog != (byte)InstantMessageDialog.GroupNotice &&
im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
im.dialog != (byte)InstantMessageDialog.InventoryOffered)
{ {
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( return;
"POST", m_RestURL+"/SaveMessage/", im); }
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) if (!m_ForwardOfflineGroupMessages)
{ {
IClientAPI client = FindClient(new UUID(im.fromAgentID)); if (im.dialog == (byte)InstantMessageDialog.GroupNotice ||
if (client == null) im.dialog != (byte)InstantMessageDialog.GroupInvitation)
return; return;
}
client.SendInstantMessage(new GridInstantMessage( Scene scene = FindScene(new UUID(im.fromAgentID));
null, new UUID(im.toAgentID), if (scene == null)
"System", new UUID(im.fromAgentID), scene = m_SceneList[0];
(byte)InstantMessageDialog.MessageFromAgent,
"User is not logged in. "+ bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
(success ? "Message saved." : "Message not saved"), "POST", m_RestURL+"/SaveMessage/", im);
false, new Vector3()));
} 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()));
} }
} }
} }

View File

@ -1494,7 +1494,7 @@ namespace OpenSim.Region.Framework.Scenes
msg.fromAgentName = "Server"; msg.fromAgentName = "Server";
msg.dialog = (byte)19; // Object msg msg.dialog = (byte)19; // Object msg
msg.fromGroup = false; msg.fromGroup = false;
msg.offline = (byte)1; msg.offline = (byte)0;
msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
msg.Position = Vector3.Zero; msg.Position = Vector3.Zero;
msg.RegionID = RegionInfo.RegionID.Guid; msg.RegionID = RegionInfo.RegionID.Guid;

View File

@ -881,7 +881,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
msg.dialog = dialog; msg.dialog = dialog;
// msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice; // msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice;
msg.fromGroup = true; msg.fromGroup = true;
msg.offline = (byte)1; // Allow this message to be stored for offline use msg.offline = (byte)0;
msg.ParentEstateID = 0; msg.ParentEstateID = 0;
msg.Position = Vector3.Zero; msg.Position = Vector3.Zero;
msg.RegionID = UUID.Zero.Guid; msg.RegionID = UUID.Zero.Guid;