aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/Groups/Remote
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs31
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs24
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs45
-rw-r--r--OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs13
4 files changed, 74 insertions, 39 deletions
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
index 04328c9..161ca0c 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
@@ -133,6 +133,36 @@ namespace OpenSim.Groups
133 return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]); 133 return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
134 } 134 }
135 135
136 public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
137 {
138 List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
139 if (string.IsNullOrEmpty(query))
140 return hits;
141
142 Dictionary<string, object> sendData = new Dictionary<string, object>();
143 sendData["Query"] = query;
144 sendData["RequestingAgentID"] = RequestingAgentID;
145
146 Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);
147
148 if (ret == null)
149 return hits;
150
151 if (!ret.ContainsKey("RESULT"))
152 return hits;
153
154 if (ret["RESULT"].ToString() == "NULL")
155 return hits;
156
157 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
158 {
159 DirGroupsReplyData m = GroupsDataUtils.DirGroupsReplyData((Dictionary<string, object>)v);
160 hits.Add(m);
161 }
162
163 return hits;
164 }
165
136 public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) 166 public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
137 { 167 {
138 reason = string.Empty; 168 reason = string.Empty;
@@ -226,6 +256,7 @@ namespace OpenSim.Groups
226 Dictionary<string, object> sendData = new Dictionary<string, object>(); 256 Dictionary<string, object> sendData = new Dictionary<string, object>();
227 sendData["GroupID"] = GroupID.ToString(); 257 sendData["GroupID"] = GroupID.ToString();
228 sendData["RequestingAgentID"] = RequestingAgentID; 258 sendData["RequestingAgentID"] = RequestingAgentID;
259
229 Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData); 260 Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData);
230 261
231 if (ret == null) 262 if (ret == null)
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
index f1cf66c..d3de0e8 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
@@ -199,7 +199,7 @@ namespace OpenSim.Groups
199 public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search) 199 public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
200 { 200 {
201 // TODO! 201 // TODO!
202 return new List<DirGroupsReplyData>(); 202 return m_GroupsService.FindGroups(RequestingAgentID, search);
203 } 203 }
204 204
205 public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) 205 public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
@@ -406,28 +406,6 @@ namespace OpenSim.Groups
406 }); 406 });
407 } 407 }
408 408
409 public void ResetAgentGroupChatSessions(string agentID)
410 {
411 }
412
413 public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
414 {
415 return false;
416 }
417
418 public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
419 {
420 return false;
421 }
422
423 public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
424 {
425 }
426
427 public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
428 {
429 }
430
431 #endregion 409 #endregion
432 } 410 }
433 411
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index f991d01..7e55d3c 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -133,6 +133,8 @@ namespace OpenSim.Groups
133 return HandleAddNotice(request); 133 return HandleAddNotice(request);
134 case "GETNOTICES": 134 case "GETNOTICES":
135 return HandleGetNotices(request); 135 return HandleGetNotices(request);
136 case "FINDGROUPS":
137 return HandleFindGroups(request);
136 } 138 }
137 m_log.DebugFormat("[GROUPS HANDLER]: unknown method request: {0}", method); 139 m_log.DebugFormat("[GROUPS HANDLER]: unknown method request: {0}", method);
138 } 140 }
@@ -170,11 +172,16 @@ namespace OpenSim.Groups
170 172
171 } 173 }
172 174
173 grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID); 175 if (grec.GroupID != UUID.Zero)
174 if (grec == null) 176 {
175 NullResult(result, "Internal Error"); 177 grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID);
178 if (grec == null)
179 NullResult(result, "Internal Error");
180 else
181 result["RESULT"] = GroupsDataUtils.GroupRecord(grec);
182 }
176 else 183 else
177 result["RESULT"] = GroupsDataUtils.GroupRecord(grec); 184 NullResult(result, reason);
178 } 185 }
179 186
180 string xmlString = ServerUtils.BuildXmlResponse(result); 187 string xmlString = ServerUtils.BuildXmlResponse(result);
@@ -264,7 +271,6 @@ namespace OpenSim.Groups
264 UUID groupID = new UUID(request["GroupID"].ToString()); 271 UUID groupID = new UUID(request["GroupID"].ToString());
265 string agentID = request["AgentID"].ToString(); 272 string agentID = request["AgentID"].ToString();
266 string requestingAgentID = request["RequestingAgentID"].ToString(); 273 string requestingAgentID = request["RequestingAgentID"].ToString();
267 string reason = string.Empty;
268 274
269 m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID); 275 m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID);
270 } 276 }
@@ -495,7 +501,6 @@ namespace OpenSim.Groups
495 else 501 else
496 { 502 {
497 string op = request["OP"].ToString(); 503 string op = request["OP"].ToString();
498 string reason = string.Empty;
499 504
500 bool success = false; 505 bool success = false;
501 if (op == "ADD") 506 if (op == "ADD")
@@ -563,7 +568,6 @@ namespace OpenSim.Groups
563 else 568 else
564 { 569 {
565 string op = request["OP"].ToString(); 570 string op = request["OP"].ToString();
566 string reason = string.Empty;
567 571
568 if (op == "GROUP") 572 if (op == "GROUP")
569 { 573 {
@@ -626,7 +630,6 @@ namespace OpenSim.Groups
626 else 630 else
627 { 631 {
628 string op = request["OP"].ToString(); 632 string op = request["OP"].ToString();
629 string reason = string.Empty;
630 633
631 if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID")) 634 if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID"))
632 { 635 {
@@ -739,6 +742,32 @@ namespace OpenSim.Groups
739 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 742 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
740 } 743 }
741 744
745 byte[] HandleFindGroups(Dictionary<string, object> request)
746 {
747 Dictionary<string, object> result = new Dictionary<string, object>();
748
749 if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("Query"))
750 NullResult(result, "Bad network data");
751
752 List<DirGroupsReplyData> hits = m_GroupsService.FindGroups(request["RequestingAgentID"].ToString(), request["Query"].ToString());
753
754 if (hits == null || (hits != null && hits.Count == 0))
755 NullResult(result, "No hits");
756 else
757 {
758 Dictionary<string, object> dict = new Dictionary<string, object>();
759 int i = 0;
760 foreach (DirGroupsReplyData n in hits)
761 dict["n-" + i++] = GroupsDataUtils.DirGroupsReplyData(n);
762
763 result["RESULT"] = dict;
764 }
765
766
767 string xmlString = ServerUtils.BuildXmlResponse(result);
768 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
769 }
770
742 771
743 #region Helpers 772 #region Helpers
744 773
diff --git a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs
index e7d38c2..3ac74fc 100644
--- a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs
+++ b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Groups
53 private ForeignImporter m_ForeignImporter; 53 private ForeignImporter m_ForeignImporter;
54 54
55 private Dictionary<string, bool> m_ActiveRequests = new Dictionary<string, bool>(); 55 private Dictionary<string, bool> m_ActiveRequests = new Dictionary<string, bool>();
56 private const int GROUPS_CACHE_TIMEOUT = 5 * 60; // 5 minutes 56 private const int GROUPS_CACHE_TIMEOUT = 1 * 60; // 1 minutes
57 57
58 // This all important cache cahces objects of different types: 58 // This all important cache cahces objects of different types:
59 // group-<GroupID> or group-<Name> => ExtendedGroupRecord 59 // group-<GroupID> or group-<Name> => ExtendedGroupRecord
@@ -209,13 +209,10 @@ namespace OpenSim.Groups
209 public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d) 209 public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d)
210 { 210 {
211 GroupMembershipData activeGroup = d(); 211 GroupMembershipData activeGroup = d();
212 if (activeGroup != null) 212 string cacheKey = "active-" + AgentID.ToString();
213 { 213 lock (m_Cache)
214 string cacheKey = "active-" + AgentID.ToString(); 214 if (m_Cache.Contains(cacheKey))
215 lock (m_Cache) 215 m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT);
216 if (m_Cache.Contains(cacheKey))
217 m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT);
218 }
219 } 216 }
220 217
221 public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d) 218 public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d)