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.cs86
1 files changed, 49 insertions, 37 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 20555e4..fab7e8c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -53,17 +53,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
53 53
54 private bool m_debugEnabled = false; 54 private bool m_debugEnabled = false;
55 55
56 public const GroupPowers DefaultEveryonePowers 56 public const GroupPowers DefaultEveryonePowers
57 = GroupPowers.AllowSetHome 57 = GroupPowers.AllowSetHome
58 | GroupPowers.Accountable 58 | GroupPowers.Accountable
59 | GroupPowers.JoinChat 59 | GroupPowers.JoinChat
60 | GroupPowers.AllowVoiceChat 60 | GroupPowers.AllowVoiceChat
61 | GroupPowers.ReceiveNotices 61 | GroupPowers.ReceiveNotices
62 | GroupPowers.StartProposal 62 | GroupPowers.StartProposal
63 | GroupPowers.VoteOnProposal; 63 | GroupPowers.VoteOnProposal;
64 64
65 // Would this be cleaner as (GroupPowers)ulong.MaxValue? 65 // Would this be cleaner as (GroupPowers)ulong.MaxValue?
66 public const GroupPowers DefaultOwnerPowers 66 public const GroupPowers DefaultOwnerPowers
67 = GroupPowers.Accountable 67 = GroupPowers.Accountable
68 | GroupPowers.AllowEditLand 68 | GroupPowers.AllowEditLand
69 | GroupPowers.AllowFly 69 | GroupPowers.AllowFly
@@ -114,7 +114,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
114 114
115 private string m_groupsServerURI = string.Empty; 115 private string m_groupsServerURI = string.Empty;
116 116
117 private bool m_disableKeepAlive = false; 117 private bool m_disableKeepAlive = true;
118 118
119 private string m_groupReadKey = string.Empty; 119 private string m_groupReadKey = string.Empty;
120 private string m_groupWriteKey = string.Empty; 120 private string m_groupWriteKey = string.Empty;
@@ -174,13 +174,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
174 return; 174 return;
175 } 175 }
176 176
177 m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); 177 m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", true);
178 178
179 m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); 179 m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
180 m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); 180 m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
181 181
182
183 m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30); 182 m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
183
184 if (m_cacheTimeout == 0) 184 if (m_cacheTimeout == 0)
185 { 185 {
186 m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled."); 186 m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
@@ -200,7 +200,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
200 200
201 public void Close() 201 public void Close()
202 { 202 {
203 m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name);
204 } 203 }
205 204
206 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) 205 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
@@ -383,10 +382,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
383 382
384 GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); 383 GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID);
385 GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); 384 GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
386 385 if(MemberInfo != null)
387 MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; 386 {
388 MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; 387 MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
389 388 MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
389 }
390 return MemberGroupProfile; 390 return MemberGroupProfile;
391 } 391 }
392 392
@@ -666,6 +666,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
666 data.ListInProfile = ((string)membership["ListInProfile"]) == "1"; 666 data.ListInProfile = ((string)membership["ListInProfile"]) == "1";
667 data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]); 667 data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]);
668 data.Title = (string)membership["Title"]; 668 data.Title = (string)membership["Title"];
669 if(membership.ContainsKey("OnlineStatus"))
670 data.OnlineStatus = (string)membership["OnlineStatus"];
669 671
670 members.Add(data); 672 members.Add(data);
671 } 673 }
@@ -803,11 +805,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
803 { 805 {
804 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) 806 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
805 { 807 {
808 if (m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
809 m_groupsAgentsInvitedToChatSession[groupID].Remove(agentID);
810
806 // If not in dropped list, add 811 // If not in dropped list, add
807 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) 812 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
808 {
809 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); 813 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
810 }
811 } 814 }
812 } 815 }
813 816
@@ -818,9 +821,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
818 821
819 // If nessesary, remove from dropped list 822 // If nessesary, remove from dropped list
820 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) 823 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
821 {
822 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); 824 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
823 } 825
826 if (!m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
827 m_groupsAgentsInvitedToChatSession[groupID].Add(agentID);
824 } 828 }
825 829
826 private void CreateGroupChatSessionTracking(UUID groupID) 830 private void CreateGroupChatSessionTracking(UUID groupID)
@@ -975,35 +979,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
975 979
976 try 980 try
977 { 981 {
978 resp = req.Send(m_groupsServerURI, 10000); 982 resp = req.Send(m_groupsServerURI);
979
980 if ((m_cacheTimeout > 0) && (CacheKey != null))
981 {
982 m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
983 }
984 } 983 }
985 catch (Exception e) 984 catch (Exception e)
986 { 985 {
987 m_log.ErrorFormat( 986 m_log.ErrorFormat(
988 "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}", 987 "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}: {2}",
989 function, m_groupsServerURI); 988 function, m_groupsServerURI, e.Message);
990
991 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace);
992 989
993 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) 990 if(m_debugEnabled)
994 { 991 {
995 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine); 992 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", e.StackTrace);
993
994 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
995 {
996 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine);
997 }
998
999 foreach (string key in param.Keys)
1000 {
1001 m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString());
1002 }
996 } 1003 }
997 1004
998 foreach (string key in param.Keys) 1005 if ((m_cacheTimeout > 0) && (CacheKey != null))
999 { 1006 {
1000 m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString()); 1007 m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0);
1001 } 1008 }
1002
1003 Hashtable respData = new Hashtable(); 1009 Hashtable respData = new Hashtable();
1004 respData.Add("error", e.ToString()); 1010 respData.Add("error", e.ToString());
1005 return respData; 1011 return respData;
1006 } 1012 }
1013
1014 if ((m_cacheTimeout > 0) && (CacheKey != null))
1015 {
1016 m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0);
1017 }
1007 } 1018 }
1008 1019
1009 if (resp.Value is Hashtable) 1020 if (resp.Value is Hashtable)
@@ -1042,7 +1053,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1042 private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData) 1053 private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData)
1043 { 1054 {
1044 m_log.ErrorFormat( 1055 m_log.ErrorFormat(
1045 "[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}", 1056 "[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}",
1046 function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData)); 1057 function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData));
1047 } 1058 }
1048 1059
@@ -1134,6 +1145,7 @@ namespace Nwc.XmlRpc
1134 request.ContentType = "text/xml"; 1145 request.ContentType = "text/xml";
1135 request.AllowWriteStreamBuffering = true; 1146 request.AllowWriteStreamBuffering = true;
1136 request.KeepAlive = !_disableKeepAlive; 1147 request.KeepAlive = !_disableKeepAlive;
1148 request.Timeout = 30000;
1137 1149
1138 using (Stream stream = request.GetRequestStream()) 1150 using (Stream stream = request.GetRequestStream())
1139 { 1151 {
@@ -1141,7 +1153,7 @@ namespace Nwc.XmlRpc
1141 { 1153 {
1142 _serializer.Serialize(xml, this); 1154 _serializer.Serialize(xml, this);
1143 xml.Flush(); 1155 xml.Flush();
1144 } 1156 }
1145 } 1157 }
1146 1158
1147 XmlRpcResponse resp; 1159 XmlRpcResponse resp;