aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs216
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs9
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs87
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs98
5 files changed, 262 insertions, 156 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 533815f..17a5349 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -49,14 +49,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
49 49
50 private List<Scene> m_sceneList = new List<Scene>(); 50 private List<Scene> m_sceneList = new List<Scene>();
51 51
52 private IMessageTransferModule m_msgTransferModule = null; 52 private IMessageTransferModule m_msgTransferModule = null;
53 53
54 private IGroupsModule m_groupsModule = null; 54 private IGroupsServicesConnector m_groupData = null;
55
56 // TODO: Move this off to the Groups Server
57 public Dictionary<Guid, List<Guid>> m_agentsInGroupSession = new Dictionary<Guid, List<Guid>>();
58 public Dictionary<Guid, List<Guid>> m_agentsDroppedSession = new Dictionary<Guid, List<Guid>>();
59
60 55
61 // Config Options 56 // Config Options
62 private bool m_groupMessagingEnabled = false; 57 private bool m_groupMessagingEnabled = false;
@@ -113,14 +108,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
113 if (!m_groupMessagingEnabled) 108 if (!m_groupMessagingEnabled)
114 return; 109 return;
115 110
116 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 111 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
117 112
118 m_groupsModule = scene.RequestModuleInterface<IGroupsModule>(); 113 m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();
119 114
120 // No groups module, no groups messaging 115 // No groups module, no groups messaging
121 if (m_groupsModule == null) 116 if (m_groupData == null)
122 { 117 {
123 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, GroupsMessagingModule is now disabled."); 118 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
124 Close(); 119 Close();
125 m_groupMessagingEnabled = false; 120 m_groupMessagingEnabled = false;
126 return; 121 return;
@@ -142,7 +137,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
142 137
143 scene.EventManager.OnNewClient += OnNewClient; 138 scene.EventManager.OnNewClient += OnNewClient;
144 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 139 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
145 140 scene.EventManager.OnClientLogin += OnClientLogin;
146 } 141 }
147 142
148 public void RemoveRegion(Scene scene) 143 public void RemoveRegion(Scene scene)
@@ -170,7 +165,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
170 165
171 m_sceneList.Clear(); 166 m_sceneList.Clear();
172 167
173 m_groupsModule = null; 168 m_groupData = null;
174 m_msgTransferModule = null; 169 m_msgTransferModule = null;
175 } 170 }
176 171
@@ -195,16 +190,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
195 190
196 #endregion 191 #endregion
197 192
193 /// <summary>
194 /// Not really needed, but does confirm that the group exists.
195 /// </summary>
198 public bool StartGroupChatSession(UUID agentID, UUID groupID) 196 public bool StartGroupChatSession(UUID agentID, UUID groupID)
199 { 197 {
200 if (m_debugEnabled) 198 if (m_debugEnabled)
201 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 199 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
202 200
203 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); 201 GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null);
204 202
205 if (groupInfo != null) 203 if (groupInfo != null)
206 { 204 {
207 AddAgentToGroupSession(agentID.Guid, groupID.Guid);
208 return true; 205 return true;
209 } 206 }
210 else 207 else
@@ -216,11 +213,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
216 public void SendMessageToGroup(GridInstantMessage im, UUID groupID) 213 public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
217 { 214 {
218 if (m_debugEnabled) 215 if (m_debugEnabled)
219 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 216 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
220 217
221 foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID)) 218
222 { 219 foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID))
223 if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid)) 220 {
221 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
224 { 222 {
225 // Don't deliver messages to people who have dropped this session 223 // Don't deliver messages to people who have dropped this session
226 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); 224 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID);
@@ -228,8 +226,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
228 } 226 }
229 227
230 // Copy Message 228 // Copy Message
231 GridInstantMessage msg = new GridInstantMessage(); 229 GridInstantMessage msg = new GridInstantMessage();
232 msg.imSessionID = im.imSessionID; 230 msg.imSessionID = groupID.Guid;
233 msg.fromAgentName = im.fromAgentName; 231 msg.fromAgentName = im.fromAgentName;
234 msg.message = im.message; 232 msg.message = im.message;
235 msg.dialog = im.dialog; 233 msg.dialog = im.dialog;
@@ -240,8 +238,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
240 msg.binaryBucket = im.binaryBucket; 238 msg.binaryBucket = im.binaryBucket;
241 msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); 239 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
242 240
243 // Updat Pertinate fields to make it a "group message" 241 msg.fromAgentID = im.fromAgentID;
244 msg.fromAgentID = groupID.Guid;
245 msg.fromGroup = true; 242 msg.fromGroup = true;
246 243
247 msg.toAgentID = member.AgentID.Guid; 244 msg.toAgentID = member.AgentID.Guid;
@@ -262,7 +259,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
262 } 259 }
263 } 260 }
264 261
265 #region SimGridEventHandlers 262 #region SimGridEventHandlers
263
264 void OnClientLogin(IClientAPI client)
265 {
266 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name);
267
268
269 }
266 270
267 private void OnNewClient(IClientAPI client) 271 private void OnNewClient(IClientAPI client)
268 { 272 {
@@ -299,44 +303,48 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
299 303
300 private void ProcessMessageFromGroupSession(GridInstantMessage msg) 304 private void ProcessMessageFromGroupSession(GridInstantMessage msg)
301 { 305 {
302 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); 306 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID);
307
308 UUID AgentID = new UUID(msg.fromAgentID);
309 UUID GroupID = new UUID(msg.imSessionID);
303 310
304 switch (msg.dialog) 311 switch (msg.dialog)
305 { 312 {
306 case (byte)InstantMessageDialog.SessionAdd: 313 case (byte)InstantMessageDialog.SessionAdd:
307 AddAgentToGroupSession(msg.fromAgentID, msg.imSessionID); 314 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
308 break; 315 break;
309 316
310 case (byte)InstantMessageDialog.SessionDrop: 317 case (byte)InstantMessageDialog.SessionDrop:
311 RemoveAgentFromGroupSession(msg.fromAgentID, msg.imSessionID); 318 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID);
312 break; 319 break;
313 320
314 case (byte)InstantMessageDialog.SessionSend: 321 case (byte)InstantMessageDialog.SessionSend:
315 if (!m_agentsInGroupSession.ContainsKey(msg.toAgentID) 322 if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)
316 && !m_agentsDroppedSession.ContainsKey(msg.toAgentID)) 323 && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID)
324 )
317 { 325 {
318 // Agent not in session and hasn't dropped from session 326 // Agent not in session and hasn't dropped from session
319 // Add them to the session for now, and Invite them 327 // Add them to the session for now, and Invite them
320 AddAgentToGroupSession(msg.toAgentID, msg.imSessionID); 328 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
321 329
322 UUID toAgentID = new UUID(msg.toAgentID); 330 UUID toAgentID = new UUID(msg.toAgentID);
323 IClientAPI activeClient = GetActiveClient(toAgentID); 331 IClientAPI activeClient = GetActiveClient(toAgentID);
324 if (activeClient != null) 332 if (activeClient != null)
325 { 333 {
326 UUID groupID = new UUID(msg.fromAgentID); 334 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
327
328 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
329 if (groupInfo != null) 335 if (groupInfo != null)
330 { 336 {
331 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); 337 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
332 338
333 // Force? open the group session dialog??? 339 // Force? open the group session dialog???
340 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
334 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>(); 341 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
335 eq.ChatterboxInvitation( 342 eq.ChatterboxInvitation(
336 groupID 343 GroupID
337 , groupInfo.GroupName 344 , groupInfo.GroupName
338 , new UUID(msg.fromAgentID) 345 , new UUID(msg.fromAgentID)
339 , msg.message, new UUID(msg.toAgentID) 346 , msg.message
347 , new UUID(msg.toAgentID)
340 , msg.fromAgentName 348 , msg.fromAgentName
341 , msg.dialog 349 , msg.dialog
342 , msg.timestamp 350 , msg.timestamp
@@ -349,8 +357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
349 , Utils.StringToBytes(groupInfo.GroupName) 357 , Utils.StringToBytes(groupInfo.GroupName)
350 ); 358 );
351 359
352 eq.ChatterBoxSessionAgentListUpdates( 360 eq.ChatterBoxSessionAgentListUpdates(
353 new UUID(groupID) 361 new UUID(GroupID)
354 , new UUID(msg.fromAgentID) 362 , new UUID(msg.fromAgentID)
355 , new UUID(msg.toAgentID) 363 , new UUID(msg.toAgentID)
356 , false //canVoiceChat 364 , false //canVoiceChat
@@ -359,8 +367,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
359 ); 367 );
360 } 368 }
361 } 369 }
362 } 370 }
363 else if (!m_agentsDroppedSession.ContainsKey(msg.toAgentID)) 371 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID))
364 { 372 {
365 // User hasn't dropped, so they're in the session, 373 // User hasn't dropped, so they're in the session,
366 // maybe we should deliver it. 374 // maybe we should deliver it.
@@ -386,56 +394,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
386 394
387 #endregion 395 #endregion
388 396
389 #region ClientEvents 397
390 398 #region ClientEvents
391 private void RemoveAgentFromGroupSession(Guid agentID, Guid sessionID)
392 {
393 if (m_agentsInGroupSession.ContainsKey(sessionID))
394 {
395 // If in session remove
396 if (m_agentsInGroupSession[sessionID].Contains(agentID))
397 {
398 m_agentsInGroupSession[sessionID].Remove(agentID);
399 }
400
401 // If not in dropped list, add
402 if (!m_agentsDroppedSession[sessionID].Contains(agentID))
403 {
404 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Dropped {1} from session {0}", sessionID, agentID);
405 m_agentsDroppedSession[sessionID].Add(agentID);
406 }
407 }
408 }
409
410 private void AddAgentToGroupSession(Guid agentID, Guid sessionID)
411 {
412 // Add Session Status if it doesn't exist for this session
413 CreateGroupSessionTracking(sessionID);
414
415 // If nessesary, remove from dropped list
416 if (m_agentsDroppedSession[sessionID].Contains(agentID))
417 {
418 m_agentsDroppedSession[sessionID].Remove(agentID);
419 }
420
421 // If nessesary, add to in session list
422 if (!m_agentsInGroupSession[sessionID].Contains(agentID))
423 {
424 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Added {1} to session {0}", sessionID, agentID);
425 m_agentsInGroupSession[sessionID].Add(agentID);
426 }
427 }
428
429 private void CreateGroupSessionTracking(Guid sessionID)
430 {
431 if (!m_agentsInGroupSession.ContainsKey(sessionID))
432 {
433 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Creating session tracking for : {0}", sessionID);
434 m_agentsInGroupSession.Add(sessionID, new List<Guid>());
435 m_agentsDroppedSession.Add(sessionID, new List<Guid>());
436 }
437 }
438
439 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 399 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
440 { 400 {
441 if (m_debugEnabled) 401 if (m_debugEnabled)
@@ -447,20 +407,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
447 407
448 // Start group IM session 408 // Start group IM session
449 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) 409 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
450 { 410 {
451 UUID groupID = new UUID(im.toAgentID); 411 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID);
452 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); 412
413 UUID GroupID = new UUID(im.imSessionID);
414 UUID AgentID = new UUID(im.fromAgentID);
415
416 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
453 417
454 if (groupInfo != null) 418 if (groupInfo != null)
455 { 419 {
456 AddAgentToGroupSession(im.fromAgentID, groupInfo.GroupID.Guid); 420 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
457 421
458 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID); 422 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
459 423
460 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); 424 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
461 queue.ChatterBoxSessionAgentListUpdates( 425 queue.ChatterBoxSessionAgentListUpdates(
462 new UUID(groupID) 426 GroupID
463 , new UUID(im.fromAgentID) 427 , AgentID
464 , new UUID(im.toAgentID) 428 , new UUID(im.toAgentID)
465 , false //canVoiceChat 429 , false //canVoiceChat
466 , false //isModerator 430 , false //isModerator
@@ -471,13 +435,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
471 435
472 // Send a message from locally connected client to a group 436 // Send a message from locally connected client to a group
473 if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) 437 if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
474 { 438 {
475 UUID groupID = new UUID(im.toAgentID); 439 UUID GroupID = new UUID(im.imSessionID);
440 UUID AgentID = new UUID(im.fromAgentID);
476 441
477 if (m_debugEnabled) 442 if (m_debugEnabled)
478 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString()); 443 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
479 444
480 SendMessageToGroup(im, groupID); 445 //If this agent is sending a message, then they want to be in the session
446 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
447
448 SendMessageToGroup(im, GroupID);
481 } 449 }
482 } 450 }
483 451
@@ -533,7 +501,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
533 /// Try to find an active IClientAPI reference for agentID giving preference to root connections 501 /// Try to find an active IClientAPI reference for agentID giving preference to root connections
534 /// </summary> 502 /// </summary>
535 private IClientAPI GetActiveClient(UUID agentID) 503 private IClientAPI GetActiveClient(UUID agentID)
536 { 504 {
505 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
506
537 IClientAPI child = null; 507 IClientAPI child = null;
538 508
539 // Try root avatar first 509 // Try root avatar first
@@ -544,17 +514,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
544 { 514 {
545 ScenePresence user = (ScenePresence)scene.Entities[agentID]; 515 ScenePresence user = (ScenePresence)scene.Entities[agentID];
546 if (!user.IsChildAgent) 516 if (!user.IsChildAgent)
547 { 517 {
518 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name);
548 return user.ControllingClient; 519 return user.ControllingClient;
549 } 520 }
550 else 521 else
551 { 522 {
523 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name);
552 child = user.ControllingClient; 524 child = user.ControllingClient;
553 } 525 }
554 } 526 }
555 } 527 }
556 528
557 // If we didn't find a root, then just return whichever child we found, or null if none 529 // If we didn't find a root, then just return whichever child we found, or null if none
530 if (child == null)
531 {
532 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID);
533 }
534 else
535 {
536 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name);
537 }
558 return child; 538 return child;
559 } 539 }
560 540
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index b2b8110..e5dab93 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -175,14 +175,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
175 } 175 }
176 176
177 scene.EventManager.OnNewClient += OnNewClient; 177 scene.EventManager.OnNewClient += OnNewClient;
178 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 178 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
179
180 // The InstantMessageModule itself doesn't do this, 179 // The InstantMessageModule itself doesn't do this,
181 // so lets see if things explode if we don't do it 180 // so lets see if things explode if we don't do it
182 // scene.EventManager.OnClientClosed += OnClientClosed; 181 // scene.EventManager.OnClientClosed += OnClientClosed;
183 182
184 } 183 }
185 184
186 public void RemoveRegion(Scene scene) 185 public void RemoveRegion(Scene scene)
187 { 186 {
188 if (!m_groupsEnabled) 187 if (!m_groupsEnabled)
@@ -510,7 +509,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
510 IClientAPI ejectee = GetActiveClient(ejecteeID); 509 IClientAPI ejectee = GetActiveClient(ejecteeID);
511 if (ejectee != null) 510 if (ejectee != null)
512 { 511 {
513 UUID groupID = new UUID(im.fromAgentID); 512 UUID groupID = new UUID(im.imSessionID);
514 ejectee.SendAgentDropGroup(groupID); 513 ejectee.SendAgentDropGroup(groupID);
515 } 514 }
516 } 515 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index 6487967..54ffc81 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -70,7 +70,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
70 70
71 void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); 71 void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
72 GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID); 72 GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID);
73 List<GroupNoticeData> GetGroupNotices(UUID RequestingAgentID, UUID GroupID); 73 List<GroupNoticeData> GetGroupNotices(UUID RequestingAgentID, UUID GroupID);
74
75 void ResetAgentGroupChatSessions(UUID agentID);
76 bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID);
77 bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID);
78 void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID);
79 void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID);
74 } 80 }
75 81
76 public class GroupInviteInfo 82 public class GroupInviteInfo
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index bc05b0f..4867c01 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -55,6 +55,9 @@ using OpenSim.Services.Interfaces;
55 * UserID -> Group -> ActiveGroup 55 * UserID -> Group -> ActiveGroup
56 * + GroupID 56 * + GroupID
57 * 57 *
58 * UserID -> GroupSessionDropped -> GroupID
59 * UserID -> GroupSessionInvited -> GroupID
60 *
58 * UserID -> GroupMember -> GroupID 61 * UserID -> GroupMember -> GroupID
59 * + SelectedRoleID [UUID] 62 * + SelectedRoleID [UUID]
60 * + AcceptNotices [bool] 63 * + AcceptNotices [bool]
@@ -63,6 +66,7 @@ using OpenSim.Services.Interfaces;
63 * 66 *
64 * UserID -> GroupRole[GroupID] -> RoleID 67 * UserID -> GroupRole[GroupID] -> RoleID
65 * 68 *
69 *
66 * GroupID -> Group -> GroupName 70 * GroupID -> Group -> GroupName
67 * + Charter 71 * + Charter
68 * + ShowInList 72 * + ShowInList
@@ -159,7 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
159 163
160 private bool m_connectorEnabled = false; 164 private bool m_connectorEnabled = false;
161 165
162 private string m_serviceURL = string.Empty; 166 private string m_groupsServerURI = string.Empty;
163 167
164 private bool m_debugEnabled = false; 168 private bool m_debugEnabled = false;
165 169
@@ -199,13 +203,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
199 return; 203 return;
200 } 204 }
201 205
202 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); 206 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
203 207
204 m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); 208 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
205 if ((m_serviceURL == null) || 209 if ((m_groupsServerURI == null) ||
206 (m_serviceURL == string.Empty)) 210 (m_groupsServerURI == string.Empty))
207 { 211 {
208 m_log.ErrorFormat("Please specify a valid Simian Server URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); 212 m_log.ErrorFormat("Please specify a valid Simian Server for GroupsServerURI in OpenSim.ini, [Groups]");
209 m_connectorEnabled = false; 213 m_connectorEnabled = false;
210 return; 214 return;
211 } 215 }
@@ -653,7 +657,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
653 }; 657 };
654 658
655 659
656 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); 660 OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
657 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 661 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
658 { 662 {
659 OSDArray entryArray = (OSDArray)response["Entries"]; 663 OSDArray entryArray = (OSDArray)response["Entries"];
@@ -996,9 +1000,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
996 SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice); 1000 SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice);
997 1001
998 } 1002 }
1003 #endregion
1004
1005 #region GroupSessionTracking
1006
1007 public void ResetAgentGroupChatSessions(UUID agentID)
1008 {
1009 Dictionary<string, OSDMap> agentSessions;
1010
1011 if (SimianGetGenericEntries(agentID, "GroupSessionDropped", out agentSessions))
1012 {
1013 foreach (string GroupID in agentSessions.Keys)
1014 {
1015 SimianRemoveGenericEntry(agentID, "GroupSessionDropped", GroupID);
1016 }
1017 }
1018
1019 if (SimianGetGenericEntries(agentID, "GroupSessionInvited", out agentSessions))
1020 {
1021 foreach (string GroupID in agentSessions.Keys)
1022 {
1023 SimianRemoveGenericEntry(agentID, "GroupSessionInvited", GroupID);
1024 }
1025 }
1026 }
1027
1028 public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
1029 {
1030 OSDMap session;
1031 return SimianGetGenericEntry(agentID, "GroupSessionDropped", groupID.ToString(), out session);
1032 }
1033
1034 public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
1035 {
1036 SimianAddGeneric(agentID, "GroupSessionDropped", groupID.ToString(), new OSDMap());
1037 }
1038
1039 public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
1040 {
1041 SimianAddGeneric(agentID, "GroupSessionInvited", groupID.ToString(), new OSDMap());
1042 }
1043
1044 public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
1045 {
1046 OSDMap session;
1047 return SimianGetGenericEntry(agentID, "GroupSessionDropped", groupID.ToString(), out session);
1048 }
1049
999 #endregion 1050 #endregion
1000 1051
1001
1002 private void EnsureRoleNotSelectedByMember(UUID groupID, UUID roleID, UUID userID) 1052 private void EnsureRoleNotSelectedByMember(UUID groupID, UUID roleID, UUID userID)
1003 { 1053 {
1004 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1054 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -1036,7 +1086,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1036 }; 1086 };
1037 1087
1038 1088
1039 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); 1089 OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
1040 if (Response["Success"].AsBoolean()) 1090 if (Response["Success"].AsBoolean())
1041 { 1091 {
1042 return true; 1092 return true;
@@ -1063,7 +1113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1063 }; 1113 };
1064 1114
1065 1115
1066 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); 1116 OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
1067 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) 1117 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
1068 { 1118 {
1069 OSDArray entryArray = (OSDArray)Response["Entries"]; 1119 OSDArray entryArray = (OSDArray)Response["Entries"];
@@ -1103,7 +1153,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1103 }; 1153 };
1104 1154
1105 1155
1106 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); 1156 OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
1107 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) 1157 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
1108 { 1158 {
1109 OSDArray entryArray = (OSDArray)Response["Entries"]; 1159 OSDArray entryArray = (OSDArray)Response["Entries"];
@@ -1144,7 +1194,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1144 }; 1194 };
1145 1195
1146 1196
1147 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); 1197 OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
1148 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) 1198 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
1149 { 1199 {
1150 OSDArray entryArray = (OSDArray)Response["Entries"]; 1200 OSDArray entryArray = (OSDArray)Response["Entries"];
@@ -1184,7 +1234,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1184 1234
1185 1235
1186 1236
1187 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); 1237 OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1188 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 1238 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
1189 { 1239 {
1190 maps = new Dictionary<string, OSDMap>(); 1240 maps = new Dictionary<string, OSDMap>();
@@ -1222,7 +1272,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1222 1272
1223 1273
1224 1274
1225 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); 1275 OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1226 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 1276 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
1227 { 1277 {
1228 maps = new Dictionary<UUID, OSDMap>(); 1278 maps = new Dictionary<UUID, OSDMap>();
@@ -1260,7 +1310,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1260 }; 1310 };
1261 1311
1262 1312
1263 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); 1313 OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1264 if (response["Success"].AsBoolean()) 1314 if (response["Success"].AsBoolean())
1265 { 1315 {
1266 return true; 1316 return true;
@@ -1271,7 +1321,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1271 return false; 1321 return false;
1272 } 1322 }
1273 } 1323 }
1274 #endregion 1324 #endregion
1325
1275 } 1326 }
1276 1327
1277} 1328}
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index ab343c8..8e7aa68 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -61,15 +61,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
61 61
62 private bool m_connectorEnabled = false; 62 private bool m_connectorEnabled = false;
63 63
64 private string m_serviceURL = string.Empty; 64 private string m_groupsServerURI = string.Empty;
65 65
66 private bool m_disableKeepAlive = false; 66 private bool m_disableKeepAlive = false;
67 67
68 private string m_groupReadKey = string.Empty; 68 private string m_groupReadKey = string.Empty;
69 private string m_groupWriteKey = string.Empty; 69 private string m_groupWriteKey = string.Empty;
70 70
71 private IUserAccountService m_accountService = null; 71 private IUserAccountService m_accountService = null;
72 72
73 // Used to track which agents are have dropped from a group chat session
74 // Should be reset per agent, on logon
75 // TODO: move this to Flotsam XmlRpc Service
76 // SessionID, List<AgentID>
77 private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>();
78 private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>();
79
73 80
74 #region IRegionModuleBase Members 81 #region IRegionModuleBase Members
75 82
@@ -104,13 +111,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
104 return; 111 return;
105 } 112 }
106 113
107 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); 114 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
108 115
109 m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); 116 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
110 if ((m_serviceURL == null) || 117 if ((m_groupsServerURI == null) ||
111 (m_serviceURL == string.Empty)) 118 (m_groupsServerURI == string.Empty))
112 { 119 {
113 m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); 120 m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]");
114 m_connectorEnabled = false; 121 m_connectorEnabled = false;
115 return; 122 return;
116 } 123 }
@@ -756,7 +763,70 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
756 763
757 XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); 764 XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
758 } 765 }
759 #endregion 766
767
768
769 #endregion
770
771 #region GroupSessionTracking
772
773 public void ResetAgentGroupChatSessions(UUID agentID)
774 {
775 foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values)
776 {
777 agentList.Remove(agentID);
778 }
779 }
780
781 public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
782 {
783 // If we're tracking this group, and we can find them in the tracking, then they've been invited
784 return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID)
785 && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID);
786 }
787
788 public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
789 {
790 // If we're tracking drops for this group,
791 // and we find them, well... then they've dropped
792 return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)
793 && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID);
794 }
795
796 public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
797 {
798 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
799 {
800 // If not in dropped list, add
801 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
802 {
803 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
804 }
805 }
806 }
807
808 public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
809 {
810 // Add Session Status if it doesn't exist for this session
811 CreateGroupChatSessionTracking(groupID);
812
813 // If nessesary, remove from dropped list
814 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
815 {
816 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
817 }
818 }
819
820 private void CreateGroupChatSessionTracking(UUID groupID)
821 {
822 if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
823 {
824 m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>());
825 m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>());
826 }
827
828 }
829 #endregion
760 830
761 #region XmlRpcHashtableMarshalling 831 #region XmlRpcHashtableMarshalling
762 private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) 832 private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
@@ -871,7 +941,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
871 941
872 try 942 try
873 { 943 {
874 resp = req.Send(m_serviceURL, 10000); 944 resp = req.Send(m_groupsServerURI, 10000);
875 } 945 }
876 catch (Exception e) 946 catch (Exception e)
877 { 947 {
@@ -948,8 +1018,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
948 1018
949 /// <summary> 1019 /// <summary>
950 /// Group Request Tokens are an attempt to allow the groups service to authenticate 1020 /// Group Request Tokens are an attempt to allow the groups service to authenticate
951 /// requests. Currently uses UserService, AgentID, and SessionID 1021 /// requests.
952 /// TODO: Find a better way to do this. 1022 /// TODO: This broke after the big grid refactor, either find a better way, or discard this
953 /// </summary> 1023 /// </summary>
954 /// <param name="client"></param> 1024 /// <param name="client"></param>
955 /// <returns></returns> 1025 /// <returns></returns>