Merge branch 'justincc-master'
commit
1a8b56fa87
|
@ -261,6 +261,11 @@ namespace OpenSim.OfflineIM
|
|||
return m_OfflineIMService.StoreMessage(im, out reason);
|
||||
}
|
||||
|
||||
public void DeleteMessages(UUID userID)
|
||||
{
|
||||
m_OfflineIMService.DeleteMessages(userID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,14 @@ namespace OpenSim.OfflineIM
|
|||
return true;
|
||||
}
|
||||
|
||||
public void DeleteMessages(UUID userID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
sendData["UserID"] = userID;
|
||||
|
||||
MakeRequest("DELETE", sendData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -96,13 +96,14 @@ namespace OpenSim.OfflineIM
|
|||
string method = request["METHOD"].ToString();
|
||||
request.Remove("METHOD");
|
||||
|
||||
m_log.DebugFormat("[OfflineIM.V2.Handler]: {0}", method);
|
||||
switch (method)
|
||||
{
|
||||
case "GET":
|
||||
return HandleGet(request);
|
||||
case "STORE":
|
||||
return HandleStore(request);
|
||||
case "DELETE":
|
||||
return HandleDelete(request);
|
||||
}
|
||||
m_log.DebugFormat("[OFFLINE IM HANDLER]: unknown method request: {0}", method);
|
||||
}
|
||||
|
@ -159,6 +160,21 @@ namespace OpenSim.OfflineIM
|
|||
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
|
||||
}
|
||||
|
||||
byte[] HandleDelete(Dictionary<string, object> request)
|
||||
{
|
||||
if (!request.ContainsKey("UserID"))
|
||||
{
|
||||
return FailureResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID userID = new UUID(request["UserID"].ToString());
|
||||
m_OfflineIMService.DeleteMessages(userID);
|
||||
|
||||
return SuccessResult();
|
||||
}
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private void NullResult(Dictionary<string, object> result, string reason)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -91,7 +91,7 @@ namespace OpenSim.OfflineIM
|
|||
{
|
||||
reason = string.Empty;
|
||||
|
||||
// TODO Check limits
|
||||
// Check limits
|
||||
UUID principalID = new UUID(im.toAgentID);
|
||||
long count = m_Database.GetCount("PrincipalID", principalID.ToString());
|
||||
if (count >= MAX_IM)
|
||||
|
@ -100,7 +100,7 @@ namespace OpenSim.OfflineIM
|
|||
return false;
|
||||
}
|
||||
|
||||
string imXml = string.Empty;
|
||||
string imXml;
|
||||
using (MemoryStream mstream = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
|
@ -110,22 +110,26 @@ namespace OpenSim.OfflineIM
|
|||
{
|
||||
m_serializer.Serialize(writer, im);
|
||||
writer.Flush();
|
||||
|
||||
mstream.Position = 0;
|
||||
using (StreamReader sreader = new StreamReader(mstream))
|
||||
{
|
||||
imXml = sreader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
imXml = Util.UTF8.GetString(mstream.ToArray());
|
||||
}
|
||||
|
||||
OfflineIMData data = new OfflineIMData();
|
||||
data.PrincipalID = principalID;
|
||||
data.FromID = new UUID(im.fromAgentID);
|
||||
data.Data = new Dictionary<string, string>();
|
||||
data.Data["Message"] = imXml;
|
||||
|
||||
return m_Database.Store(data);
|
||||
|
||||
}
|
||||
|
||||
public void DeleteMessages(UUID userID)
|
||||
{
|
||||
m_Database.Delete("PrincipalID", userID.ToString());
|
||||
m_Database.Delete("FromID", userID.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -34,6 +34,7 @@ namespace OpenSim.Data
|
|||
public class OfflineIMData
|
||||
{
|
||||
public UUID PrincipalID;
|
||||
public UUID FromID;
|
||||
public Dictionary<string, string> Data;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,4 +21,14 @@ INSERT INTO `im_offline` SELECT * from `diva_im_offline`;
|
|||
DROP TABLE `diva_im_offline`;
|
||||
DELETE FROM `migrations` WHERE name='diva_im_Store';
|
||||
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 3 # --------------------------
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE `im_offline`
|
||||
ADD `FromID` char(36) NOT NULL default '' AFTER `PrincipalID`,
|
||||
ADD KEY `FromID` (`FromID`);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
|
||||
#endregion
|
||||
|
||||
#region ISimulation
|
||||
#region ISimulationService
|
||||
|
||||
public IScene GetScene(UUID regionId)
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return false;
|
||||
}
|
||||
|
||||
#endregion /* IInterregionComms */
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
|
||||
#endregion
|
||||
|
||||
#region IInterregionComms
|
||||
#region ISimulationService
|
||||
|
||||
public IScene GetScene(UUID regionId)
|
||||
{
|
||||
|
@ -279,6 +279,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return false;
|
||||
}
|
||||
|
||||
#endregion /* IInterregionComms */
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public delegate bool ChildAgentUpdateReceived(AgentData data);
|
||||
|
||||
public interface IInterregionCommsOut
|
||||
{
|
||||
#region Agents
|
||||
|
||||
bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason);
|
||||
|
||||
/// <summary>
|
||||
/// Full child agent update.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
|
||||
|
||||
/// <summary>
|
||||
/// Short child agent update, mostly for position.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool SendChildAgentUpdate(ulong regionHandle, AgentPosition data);
|
||||
|
||||
bool SendRetrieveRootAgent(ulong regionHandle, UUID id, out IAgentData agent);
|
||||
|
||||
/// <summary>
|
||||
/// Message from receiving region to departing region, telling it got contacted by the client.
|
||||
/// When sent over REST, it invokes the opaque uri.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="uri"></param>
|
||||
/// <returns></returns>
|
||||
bool SendReleaseAgent(ulong regionHandle, UUID id, string uri);
|
||||
|
||||
/// <summary>
|
||||
/// Close agent.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
bool SendCloseAgent(ulong regionHandle, UUID id);
|
||||
|
||||
#endregion Agents
|
||||
|
||||
#region Objects
|
||||
|
||||
/// <summary>
|
||||
/// Create an object in the destination region. This message is used primarily for prim crossing.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="sog"></param>
|
||||
/// <param name="isLocalCall"></param>
|
||||
/// <returns></returns>
|
||||
bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall);
|
||||
|
||||
/// <summary>
|
||||
/// Create an object from the user's inventory in the destination region.
|
||||
/// This message is used primarily by clients.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="userID"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <returns></returns>
|
||||
bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID);
|
||||
|
||||
#endregion Objects
|
||||
|
||||
}
|
||||
|
||||
// This may not be needed, but having it here for now.
|
||||
public interface IInterregionCommsIn
|
||||
{
|
||||
event ChildAgentUpdateReceived OnChildAgentUpdate;
|
||||
}
|
||||
|
||||
}
|
|
@ -4410,18 +4410,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return sp;
|
||||
}
|
||||
|
||||
public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent)
|
||||
{
|
||||
agent = null;
|
||||
ScenePresence sp = GetScenePresence(id);
|
||||
if ((sp != null) && (!sp.IsChildAgent))
|
||||
{
|
||||
sp.IsChildAgent = true;
|
||||
return sp.CopyAgent(out agent);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Authenticated close (via network)
|
||||
/// </summary>
|
||||
|
|
|
@ -35,7 +35,14 @@ namespace OpenSim.Services.Interfaces
|
|||
public interface IOfflineIMService
|
||||
{
|
||||
List<GridInstantMessage> GetMessages(UUID principalID);
|
||||
|
||||
bool StoreMessage(GridInstantMessage im, out string reason);
|
||||
|
||||
/// <summary>
|
||||
/// Delete messages to or from this user (or group).
|
||||
/// </summary>
|
||||
/// <param name="userID">A user or group ID</param>
|
||||
void DeleteMessages(UUID userID);
|
||||
}
|
||||
|
||||
public class OfflineIMDataUtils
|
||||
|
|
Loading…
Reference in New Issue