diff options
author | Justin Clark-Casey (justincc) | 2014-01-16 00:33:04 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-01-16 00:33:04 +0000 |
commit | 1a8b56fa876558648f68bb58fd170af79d82efd5 (patch) | |
tree | 432f622e65fda158d1b0aa0b3e68653a3bda018c /OpenSim | |
parent | Merge branch 'justincc-master' (diff) | |
parent | Can delete the Offline Messages sent to/from a user. (diff) | |
download | opensim-SC-1a8b56fa876558648f68bb58fd170af79d82efd5.zip opensim-SC-1a8b56fa876558648f68bb58fd170af79d82efd5.tar.gz opensim-SC-1a8b56fa876558648f68bb58fd170af79d82efd5.tar.bz2 opensim-SC-1a8b56fa876558648f68bb58fd170af79d82efd5.tar.xz |
Merge branch 'justincc-master'
Diffstat (limited to 'OpenSim')
11 files changed, 68 insertions, 140 deletions
diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs index 050ebd2..5ef068a 100644 --- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs +++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs | |||
@@ -261,6 +261,11 @@ namespace OpenSim.OfflineIM | |||
261 | return m_OfflineIMService.StoreMessage(im, out reason); | 261 | return m_OfflineIMService.StoreMessage(im, out reason); |
262 | } | 262 | } |
263 | 263 | ||
264 | public void DeleteMessages(UUID userID) | ||
265 | { | ||
266 | m_OfflineIMService.DeleteMessages(userID); | ||
267 | } | ||
268 | |||
264 | #endregion | 269 | #endregion |
265 | } | 270 | } |
266 | } | 271 | } |
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs index 69feb76..f6b17e5 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs | |||
@@ -117,6 +117,14 @@ namespace OpenSim.OfflineIM | |||
117 | return true; | 117 | return true; |
118 | } | 118 | } |
119 | 119 | ||
120 | public void DeleteMessages(UUID userID) | ||
121 | { | ||
122 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
123 | sendData["UserID"] = userID; | ||
124 | |||
125 | MakeRequest("DELETE", sendData); | ||
126 | } | ||
127 | |||
120 | #endregion | 128 | #endregion |
121 | 129 | ||
122 | 130 | ||
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs index 32c24db..13b0e7e 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -96,13 +96,14 @@ namespace OpenSim.OfflineIM | |||
96 | string method = request["METHOD"].ToString(); | 96 | string method = request["METHOD"].ToString(); |
97 | request.Remove("METHOD"); | 97 | request.Remove("METHOD"); |
98 | 98 | ||
99 | m_log.DebugFormat("[OfflineIM.V2.Handler]: {0}", method); | ||
100 | switch (method) | 99 | switch (method) |
101 | { | 100 | { |
102 | case "GET": | 101 | case "GET": |
103 | return HandleGet(request); | 102 | return HandleGet(request); |
104 | case "STORE": | 103 | case "STORE": |
105 | return HandleStore(request); | 104 | return HandleStore(request); |
105 | case "DELETE": | ||
106 | return HandleDelete(request); | ||
106 | } | 107 | } |
107 | m_log.DebugFormat("[OFFLINE IM HANDLER]: unknown method request: {0}", method); | 108 | m_log.DebugFormat("[OFFLINE IM HANDLER]: unknown method request: {0}", method); |
108 | } | 109 | } |
@@ -159,6 +160,21 @@ namespace OpenSim.OfflineIM | |||
159 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | 160 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
160 | } | 161 | } |
161 | 162 | ||
163 | byte[] HandleDelete(Dictionary<string, object> request) | ||
164 | { | ||
165 | if (!request.ContainsKey("UserID")) | ||
166 | { | ||
167 | return FailureResult(); | ||
168 | } | ||
169 | else | ||
170 | { | ||
171 | UUID userID = new UUID(request["UserID"].ToString()); | ||
172 | m_OfflineIMService.DeleteMessages(userID); | ||
173 | |||
174 | return SuccessResult(); | ||
175 | } | ||
176 | } | ||
177 | |||
162 | #region Helpers | 178 | #region Helpers |
163 | 179 | ||
164 | private void NullResult(Dictionary<string, object> result, string reason) | 180 | private void NullResult(Dictionary<string, object> result, string reason) |
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs index 6731923..690c955 100644 --- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs +++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -91,7 +91,7 @@ namespace OpenSim.OfflineIM | |||
91 | { | 91 | { |
92 | reason = string.Empty; | 92 | reason = string.Empty; |
93 | 93 | ||
94 | // TODO Check limits | 94 | // Check limits |
95 | UUID principalID = new UUID(im.toAgentID); | 95 | UUID principalID = new UUID(im.toAgentID); |
96 | long count = m_Database.GetCount("PrincipalID", principalID.ToString()); | 96 | long count = m_Database.GetCount("PrincipalID", principalID.ToString()); |
97 | if (count >= MAX_IM) | 97 | if (count >= MAX_IM) |
@@ -100,7 +100,7 @@ namespace OpenSim.OfflineIM | |||
100 | return false; | 100 | return false; |
101 | } | 101 | } |
102 | 102 | ||
103 | string imXml = string.Empty; | 103 | string imXml; |
104 | using (MemoryStream mstream = new MemoryStream()) | 104 | using (MemoryStream mstream = new MemoryStream()) |
105 | { | 105 | { |
106 | XmlWriterSettings settings = new XmlWriterSettings(); | 106 | XmlWriterSettings settings = new XmlWriterSettings(); |
@@ -110,22 +110,26 @@ namespace OpenSim.OfflineIM | |||
110 | { | 110 | { |
111 | m_serializer.Serialize(writer, im); | 111 | m_serializer.Serialize(writer, im); |
112 | writer.Flush(); | 112 | writer.Flush(); |
113 | |||
114 | mstream.Position = 0; | ||
115 | using (StreamReader sreader = new StreamReader(mstream)) | ||
116 | { | ||
117 | imXml = sreader.ReadToEnd(); | ||
118 | } | ||
119 | } | 113 | } |
114 | |||
115 | imXml = Util.UTF8.GetString(mstream.ToArray()); | ||
120 | } | 116 | } |
121 | 117 | ||
122 | OfflineIMData data = new OfflineIMData(); | 118 | OfflineIMData data = new OfflineIMData(); |
123 | data.PrincipalID = principalID; | 119 | data.PrincipalID = principalID; |
120 | data.FromID = new UUID(im.fromAgentID); | ||
124 | data.Data = new Dictionary<string, string>(); | 121 | data.Data = new Dictionary<string, string>(); |
125 | data.Data["Message"] = imXml; | 122 | data.Data["Message"] = imXml; |
126 | 123 | ||
127 | return m_Database.Store(data); | 124 | return m_Database.Store(data); |
128 | 125 | ||
129 | } | 126 | } |
127 | |||
128 | public void DeleteMessages(UUID userID) | ||
129 | { | ||
130 | m_Database.Delete("PrincipalID", userID.ToString()); | ||
131 | m_Database.Delete("FromID", userID.ToString()); | ||
132 | } | ||
133 | |||
130 | } | 134 | } |
131 | } | 135 | } |
diff --git a/OpenSim/Data/IOfflineIMData.cs b/OpenSim/Data/IOfflineIMData.cs index e780304..58501a3 100644 --- a/OpenSim/Data/IOfflineIMData.cs +++ b/OpenSim/Data/IOfflineIMData.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -34,6 +34,7 @@ namespace OpenSim.Data | |||
34 | public class OfflineIMData | 34 | public class OfflineIMData |
35 | { | 35 | { |
36 | public UUID PrincipalID; | 36 | public UUID PrincipalID; |
37 | public UUID FromID; | ||
37 | public Dictionary<string, string> Data; | 38 | public Dictionary<string, string> Data; |
38 | } | 39 | } |
39 | 40 | ||
diff --git a/OpenSim/Data/MySQL/Resources/IM_Store.migrations b/OpenSim/Data/MySQL/Resources/IM_Store.migrations index 7cfcd43..f73475e 100644 --- a/OpenSim/Data/MySQL/Resources/IM_Store.migrations +++ b/OpenSim/Data/MySQL/Resources/IM_Store.migrations | |||
@@ -21,4 +21,14 @@ INSERT INTO `im_offline` SELECT * from `diva_im_offline`; | |||
21 | DROP TABLE `diva_im_offline`; | 21 | DROP TABLE `diva_im_offline`; |
22 | DELETE FROM `migrations` WHERE name='diva_im_Store'; | 22 | DELETE FROM `migrations` WHERE name='diva_im_Store'; |
23 | 23 | ||
24 | COMMIT; \ No newline at end of file | 24 | COMMIT; |
25 | |||
26 | :VERSION 3 # -------------------------- | ||
27 | |||
28 | BEGIN; | ||
29 | |||
30 | ALTER TABLE `im_offline` | ||
31 | ADD `FromID` char(36) NOT NULL default '' AFTER `PrincipalID`, | ||
32 | ADD KEY `FromID` (`FromID`); | ||
33 | |||
34 | COMMIT; | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 678f3dc..4dcb99f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
174 | 174 | ||
175 | #endregion | 175 | #endregion |
176 | 176 | ||
177 | #region ISimulation | 177 | #region ISimulationService |
178 | 178 | ||
179 | public IScene GetScene(UUID regionId) | 179 | public IScene GetScene(UUID regionId) |
180 | { | 180 | { |
@@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
353 | return false; | 353 | return false; |
354 | } | 354 | } |
355 | 355 | ||
356 | #endregion /* IInterregionComms */ | 356 | #endregion |
357 | 357 | ||
358 | #region Misc | 358 | #region Misc |
359 | 359 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index f45f560..cc01430 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
146 | 146 | ||
147 | #endregion | 147 | #endregion |
148 | 148 | ||
149 | #region IInterregionComms | 149 | #region ISimulationService |
150 | 150 | ||
151 | public IScene GetScene(UUID regionId) | 151 | public IScene GetScene(UUID regionId) |
152 | { | 152 | { |
@@ -279,6 +279,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
279 | return false; | 279 | return false; |
280 | } | 280 | } |
281 | 281 | ||
282 | #endregion /* IInterregionComms */ | 282 | #endregion |
283 | } | 283 | } |
284 | } | 284 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs deleted file mode 100644 index 2d6287f..0000000 --- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | public delegate bool ChildAgentUpdateReceived(AgentData data); | ||
35 | |||
36 | public interface IInterregionCommsOut | ||
37 | { | ||
38 | #region Agents | ||
39 | |||
40 | bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason); | ||
41 | |||
42 | /// <summary> | ||
43 | /// Full child agent update. | ||
44 | /// </summary> | ||
45 | /// <param name="regionHandle"></param> | ||
46 | /// <param name="data"></param> | ||
47 | /// <returns></returns> | ||
48 | bool SendChildAgentUpdate(ulong regionHandle, AgentData data); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Short child agent update, mostly for position. | ||
52 | /// </summary> | ||
53 | /// <param name="regionHandle"></param> | ||
54 | /// <param name="data"></param> | ||
55 | /// <returns></returns> | ||
56 | bool SendChildAgentUpdate(ulong regionHandle, AgentPosition data); | ||
57 | |||
58 | bool SendRetrieveRootAgent(ulong regionHandle, UUID id, out IAgentData agent); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Message from receiving region to departing region, telling it got contacted by the client. | ||
62 | /// When sent over REST, it invokes the opaque uri. | ||
63 | /// </summary> | ||
64 | /// <param name="regionHandle"></param> | ||
65 | /// <param name="id"></param> | ||
66 | /// <param name="uri"></param> | ||
67 | /// <returns></returns> | ||
68 | bool SendReleaseAgent(ulong regionHandle, UUID id, string uri); | ||
69 | |||
70 | /// <summary> | ||
71 | /// Close agent. | ||
72 | /// </summary> | ||
73 | /// <param name="regionHandle"></param> | ||
74 | /// <param name="id"></param> | ||
75 | /// <returns></returns> | ||
76 | bool SendCloseAgent(ulong regionHandle, UUID id); | ||
77 | |||
78 | #endregion Agents | ||
79 | |||
80 | #region Objects | ||
81 | |||
82 | /// <summary> | ||
83 | /// Create an object in the destination region. This message is used primarily for prim crossing. | ||
84 | /// </summary> | ||
85 | /// <param name="regionHandle"></param> | ||
86 | /// <param name="sog"></param> | ||
87 | /// <param name="isLocalCall"></param> | ||
88 | /// <returns></returns> | ||
89 | bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall); | ||
90 | |||
91 | /// <summary> | ||
92 | /// Create an object from the user's inventory in the destination region. | ||
93 | /// This message is used primarily by clients. | ||
94 | /// </summary> | ||
95 | /// <param name="regionHandle"></param> | ||
96 | /// <param name="userID"></param> | ||
97 | /// <param name="itemID"></param> | ||
98 | /// <returns></returns> | ||
99 | bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID); | ||
100 | |||
101 | #endregion Objects | ||
102 | |||
103 | } | ||
104 | |||
105 | // This may not be needed, but having it here for now. | ||
106 | public interface IInterregionCommsIn | ||
107 | { | ||
108 | event ChildAgentUpdateReceived OnChildAgentUpdate; | ||
109 | } | ||
110 | |||
111 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 610bcd6..a9fe556 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4410,18 +4410,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4410 | return sp; | 4410 | return sp; |
4411 | } | 4411 | } |
4412 | 4412 | ||
4413 | public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent) | ||
4414 | { | ||
4415 | agent = null; | ||
4416 | ScenePresence sp = GetScenePresence(id); | ||
4417 | if ((sp != null) && (!sp.IsChildAgent)) | ||
4418 | { | ||
4419 | sp.IsChildAgent = true; | ||
4420 | return sp.CopyAgent(out agent); | ||
4421 | } | ||
4422 | |||
4423 | return false; | ||
4424 | } | ||
4425 | /// <summary> | 4413 | /// <summary> |
4426 | /// Authenticated close (via network) | 4414 | /// Authenticated close (via network) |
4427 | /// </summary> | 4415 | /// </summary> |
diff --git a/OpenSim/Services/Interfaces/IOfflineIMService.cs b/OpenSim/Services/Interfaces/IOfflineIMService.cs index 2848967..588aaaf 100644 --- a/OpenSim/Services/Interfaces/IOfflineIMService.cs +++ b/OpenSim/Services/Interfaces/IOfflineIMService.cs | |||
@@ -35,7 +35,14 @@ namespace OpenSim.Services.Interfaces | |||
35 | public interface IOfflineIMService | 35 | public interface IOfflineIMService |
36 | { | 36 | { |
37 | List<GridInstantMessage> GetMessages(UUID principalID); | 37 | List<GridInstantMessage> GetMessages(UUID principalID); |
38 | |||
38 | bool StoreMessage(GridInstantMessage im, out string reason); | 39 | bool StoreMessage(GridInstantMessage im, out string reason); |
40 | |||
41 | /// <summary> | ||
42 | /// Delete messages to or from this user (or group). | ||
43 | /// </summary> | ||
44 | /// <param name="userID">A user or group ID</param> | ||
45 | void DeleteMessages(UUID userID); | ||
39 | } | 46 | } |
40 | 47 | ||
41 | public class OfflineIMDataUtils | 48 | public class OfflineIMDataUtils |