diff options
author | Oren Hurvitz | 2013-10-29 16:38:03 +0200 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-01-16 00:24:51 +0000 |
commit | 2d9d6fe922c99e79489b19b18ac33338012137ff (patch) | |
tree | 2a3a64542c6b321bcce759c1e954043a0d55e368 | |
parent | In the offline message table, store the sender. (diff) | |
download | opensim-SC_OLD-2d9d6fe922c99e79489b19b18ac33338012137ff.zip opensim-SC_OLD-2d9d6fe922c99e79489b19b18ac33338012137ff.tar.gz opensim-SC_OLD-2d9d6fe922c99e79489b19b18ac33338012137ff.tar.bz2 opensim-SC_OLD-2d9d6fe922c99e79489b19b18ac33338012137ff.tar.xz |
Can delete the Offline Messages sent to/from a user.
This is useful if the user is deleted.
Diffstat (limited to '')
5 files changed, 44 insertions, 0 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 6158abc..13b0e7e 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs | |||
@@ -102,6 +102,8 @@ namespace OpenSim.OfflineIM | |||
102 | return HandleGet(request); | 102 | return HandleGet(request); |
103 | case "STORE": | 103 | case "STORE": |
104 | return HandleStore(request); | 104 | return HandleStore(request); |
105 | case "DELETE": | ||
106 | return HandleDelete(request); | ||
105 | } | 107 | } |
106 | m_log.DebugFormat("[OFFLINE IM HANDLER]: unknown method request: {0}", method); | 108 | m_log.DebugFormat("[OFFLINE IM HANDLER]: unknown method request: {0}", method); |
107 | } | 109 | } |
@@ -158,6 +160,21 @@ namespace OpenSim.OfflineIM | |||
158 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | 160 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
159 | } | 161 | } |
160 | 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 | |||
161 | #region Helpers | 178 | #region Helpers |
162 | 179 | ||
163 | 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 df0c53f..690c955 100644 --- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs +++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | |||
@@ -124,5 +124,12 @@ namespace OpenSim.OfflineIM | |||
124 | return m_Database.Store(data); | 124 | return m_Database.Store(data); |
125 | 125 | ||
126 | } | 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 | |||
127 | } | 134 | } |
128 | } | 135 | } |
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 |