diff options
Diffstat (limited to 'OpenSim/Addons')
11 files changed, 59 insertions, 23 deletions
diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs index 59fec6f..653dbac 100644 --- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs +++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnector.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Groups | |||
101 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 101 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
102 | if (GroupID != UUID.Zero) | 102 | if (GroupID != UUID.Zero) |
103 | sendData["GroupID"] = GroupID.ToString(); | 103 | sendData["GroupID"] = GroupID.ToString(); |
104 | if (GroupName != null && GroupName != string.Empty) | 104 | if (!string.IsNullOrEmpty(GroupName)) |
105 | sendData["Name"] = GroupsDataUtils.Sanitize(GroupName); | 105 | sendData["Name"] = GroupsDataUtils.Sanitize(GroupName); |
106 | 106 | ||
107 | sendData["RequestingAgentID"] = RequestingAgentID; | 107 | sendData["RequestingAgentID"] = RequestingAgentID; |
@@ -275,7 +275,7 @@ namespace OpenSim.Groups | |||
275 | 275 | ||
276 | //m_log.DebugFormat("[XXX]: reply was {0}", reply); | 276 | //m_log.DebugFormat("[XXX]: reply was {0}", reply); |
277 | 277 | ||
278 | if (reply == string.Empty || reply == null) | 278 | if (string.IsNullOrEmpty(reply)) |
279 | return null; | 279 | return null; |
280 | 280 | ||
281 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 281 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs index 4642b2a..7d48516 100644 --- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs +++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs | |||
@@ -623,10 +623,13 @@ namespace OpenSim.Groups | |||
623 | if (agent != null) | 623 | if (agent != null) |
624 | break; | 624 | break; |
625 | } | 625 | } |
626 | if (agent == null) // oops | 626 | if (agent != null) |
627 | return AgentID.ToString(); | 627 | return Util.ProduceUserUniversalIdentifier(agent); |
628 | |||
629 | // we don't know anything about this foreign user | ||
630 | // try asking the user management module, which may know more | ||
631 | return m_UserManagement.GetUserUUI(AgentID); | ||
628 | 632 | ||
629 | return Util.ProduceUserUniversalIdentifier(agent); | ||
630 | } | 633 | } |
631 | 634 | ||
632 | private string AgentUUIForOutside(string AgentIDStr) | 635 | private string AgentUUIForOutside(string AgentIDStr) |
diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs index 6f58922..d2bcba5 100644 --- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs | |||
@@ -112,7 +112,7 @@ namespace OpenSim.Groups | |||
112 | m_GroupsService = service; | 112 | m_GroupsService = service; |
113 | } | 113 | } |
114 | 114 | ||
115 | public override byte[] Handle(string path, Stream requestData, | 115 | protected override byte[] ProcessRequest(string path, Stream requestData, |
116 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 116 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
117 | { | 117 | { |
118 | StreamReader sr = new StreamReader(requestData); | 118 | StreamReader sr = new StreamReader(requestData); |
diff --git a/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs b/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs index 5ccd7fe..16fe03b 100644 --- a/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs +++ b/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs | |||
@@ -30,7 +30,7 @@ using Mono.Addins; | |||
30 | // Build Number | 30 | // Build Number |
31 | // Revision | 31 | // Revision |
32 | // | 32 | // |
33 | [assembly: AssemblyVersion("0.7.6.*")] | 33 | [assembly: AssemblyVersion("0.8.0.*")] |
34 | 34 | ||
35 | [assembly: Addin("OpenSim.Groups", "0.1")] | 35 | [assembly: Addin("OpenSim.Groups", "0.1")] |
36 | [assembly: AddinDependency("OpenSim", "0.5")] | 36 | [assembly: AddinDependency("OpenSim", "0.5")] |
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs index 161ca0c..ed41978 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs | |||
@@ -120,7 +120,7 @@ namespace OpenSim.Groups | |||
120 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 120 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
121 | if (GroupID != UUID.Zero) | 121 | if (GroupID != UUID.Zero) |
122 | sendData["GroupID"] = GroupID.ToString(); | 122 | sendData["GroupID"] = GroupID.ToString(); |
123 | if (GroupName != null && GroupName != string.Empty) | 123 | if (!string.IsNullOrEmpty(GroupName)) |
124 | sendData["Name"] = GroupsDataUtils.Sanitize(GroupName); | 124 | sendData["Name"] = GroupsDataUtils.Sanitize(GroupName); |
125 | 125 | ||
126 | sendData["RequestingAgentID"] = RequestingAgentID; | 126 | sendData["RequestingAgentID"] = RequestingAgentID; |
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs index 7e55d3c..249d974 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Groups | |||
75 | m_GroupsService = service; | 75 | m_GroupsService = service; |
76 | } | 76 | } |
77 | 77 | ||
78 | public override byte[] Handle(string path, Stream requestData, | 78 | protected override byte[] ProcessRequest(string path, Stream requestData, |
79 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 79 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
80 | { | 80 | { |
81 | StreamReader sr = new StreamReader(requestData); | 81 | StreamReader sr = new StreamReader(requestData); |
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/Properties/AssemblyInfo.cs b/OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs index ffe8a3e..5d71edc 100644 --- a/OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs +++ b/OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs | |||
@@ -30,7 +30,7 @@ using Mono.Addins; | |||
30 | // Build Number | 30 | // Build Number |
31 | // Revision | 31 | // Revision |
32 | // | 32 | // |
33 | [assembly: AssemblyVersion("0.7.6.*")] | 33 | [assembly: AssemblyVersion("0.8.0.*")] |
34 | 34 | ||
35 | [assembly: Addin("OpenSim.OfflineIM", "0.1")] | 35 | [assembly: Addin("OpenSim.OfflineIM", "0.1")] |
36 | [assembly: AddinDependency("OpenSim", "0.5")] | 36 | [assembly: AddinDependency("OpenSim", "0.5")] |
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 2b3a01d..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 | * |
@@ -75,7 +75,7 @@ namespace OpenSim.OfflineIM | |||
75 | m_OfflineIMService = service; | 75 | m_OfflineIMService = service; |
76 | } | 76 | } |
77 | 77 | ||
78 | public override byte[] Handle(string path, Stream requestData, | 78 | protected override byte[] ProcessRequest(string path, Stream requestData, |
79 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 79 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
80 | { | 80 | { |
81 | StreamReader sr = new StreamReader(requestData); | 81 | StreamReader sr = new StreamReader(requestData); |
@@ -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 6ba022c..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 | * |
@@ -46,7 +46,7 @@ namespace OpenSim.OfflineIM | |||
46 | { | 46 | { |
47 | public class OfflineIMService : OfflineIMServiceBase, IOfflineIMService | 47 | public class OfflineIMService : OfflineIMServiceBase, IOfflineIMService |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private const int MAX_IM = 25; | 50 | private const int MAX_IM = 25; |
51 | 51 | ||
52 | private XmlSerializer m_serializer; | 52 | private XmlSerializer m_serializer; |
@@ -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 | } |