aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs98
1 files changed, 84 insertions, 14 deletions
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>