aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorUbitUmarov2016-08-19 03:05:25 +0100
committerUbitUmarov2016-08-19 03:05:25 +0100
commit7ba3fb7b5d9c883b7a99d19f893ff6d43689b629 (patch)
tree1ea4937e30520d440979ab02e92882f6f54a3e73 /OpenSim/Region/OptionalModules
parentfix entity update flags update (diff)
parent catch some NULL refs (diff)
downloadopensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.zip
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.gz
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.bz2
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.xz
merge issue
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs32
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs8
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs5
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs100
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
7 files changed, 42 insertions, 117 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 50be3ac..e21d69f 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1217,6 +1217,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1217 1217
1218 } 1218 }
1219 1219
1220 public void SendAlertMessage(string message, string info)
1221 {
1222
1223 }
1224
1220 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) 1225 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
1221 { 1226 {
1222 IRC_SendChannelPrivmsg(objectname,url); 1227 IRC_SendChannelPrivmsg(objectname,url);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 112a41f..626937c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -862,7 +862,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
862 { 862 {
863 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 863 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
864 864
865 if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null) 865 GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name);
866
867 if (groupRecord != null)
866 { 868 {
867 remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); 869 remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
868 return UUID.Zero; 870 return UUID.Zero;
@@ -877,26 +879,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
877 { 879 {
878 if (avatar.UserLevel < m_levelGroupCreate) 880 if (avatar.UserLevel < m_levelGroupCreate)
879 { 881 {
880 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient permissions to create a group."); 882 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group.");
881 return UUID.Zero; 883 return UUID.Zero;
882 } 884 }
883 } 885 }
884 886
885 // check funds 887 // check funds
886 // is there is a money module present ? 888 // is there a money module present ?
887 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); 889 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
888 if (money != null) 890 if (money != null && money.GroupCreationCharge > 0)
889 { 891 {
890 // do the transaction, that is if the agent has got sufficient funds 892 // do the transaction, that is if the agent has sufficient funds
891 if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { 893 if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) {
892 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); 894 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to create a group.");
893 return UUID.Zero; 895 return UUID.Zero;
894 } 896 }
895 money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate); 897 money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
896 } 898 }
897 UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); 899 UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));
898 900
899 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 901 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
900 902
901 // Update the founder with new group information. 903 // Update the founder with new group information.
902 SendAgentGroupDataUpdate(remoteClient, false); 904 SendAgentGroupDataUpdate(remoteClient, false);
@@ -1092,6 +1094,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1092 // Should check to see if OpenEnrollment, or if there's an outstanding invitation 1094 // Should check to see if OpenEnrollment, or if there's an outstanding invitation
1093 m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); 1095 m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero);
1094 1096
1097 // check funds
1098 // is there a money module present ?
1099 GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null);
1100 IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
1101 if (money != null && groupRecord.MembershipFee > 0)
1102 {
1103 // do the transaction, that is if the agent has sufficient funds
1104 if (!money.AmountCovered(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee)) {
1105 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to join the group.");
1106 return;
1107 }
1108 money.ApplyCharge(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName);
1109 }
1110
1095 remoteClient.SendJoinGroupReply(groupID, true); 1111 remoteClient.SendJoinGroupReply(groupID, true);
1096 1112
1097 SendAgentGroupDataUpdate(remoteClient, true); 1113 SendAgentGroupDataUpdate(remoteClient, true);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 83f08e0..eb64f71 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -1008,11 +1008,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1008 respData.Add("error", e.ToString()); 1008 respData.Add("error", e.ToString());
1009 return respData; 1009 return respData;
1010 } 1010 }
1011 }
1012 1011
1013 if ((m_cacheTimeout > 0) && (CacheKey != null)) 1012 if ((m_cacheTimeout > 0) && (CacheKey != null))
1014 { 1013 {
1015 m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); 1014 m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0);
1015 }
1016 } 1016 }
1017 1017
1018 if (resp.Value is Hashtable) 1018 if (resp.Value is Hashtable)
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
index 7ae4223..770b1f2 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
@@ -108,8 +108,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
108 { 108 {
109 if (m_Enabled) 109 if (m_Enabled)
110 { 110 {
111 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>(); 111 m_Helper = new SimulatorFeaturesHelper(scene);
112 m_Helper = new SimulatorFeaturesHelper(scene, et);
113 112
114 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>(); 113 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
115 if (featuresModule != null) 114 if (featuresModule != null)
@@ -124,7 +123,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
124 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) 123 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
125 { 124 {
126 m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); 125 m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
127 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) 126 if (m_Helper.UserLevel(agentID) <= m_UserLevel)
128 { 127 {
129 OSDMap extrasMap; 128 OSDMap extrasMap;
130 if (features.ContainsKey("OpenSimExtras")) 129 if (features.ContainsKey("OpenSimExtras"))
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
index 2661522..1ae18dd 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
@@ -53,86 +53,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private IEntityTransferModule m_TransferModule;
57 private Scene m_scene; 56 private Scene m_scene;
58 57
59 private struct RegionSend { 58 public SimulatorFeaturesHelper(Scene scene)
60 public UUID region;
61 public bool send;
62 };
63 // Using a static cache so that we don't have to perform the time-consuming tests
64 // in ShouldSend on Extra SimFeatures that go on the same response but come from
65 // different modules.
66 // This cached is indexed on the agentID and maps to a list of regions
67 private static ExpiringCache<UUID, List<RegionSend>> m_Cache = new ExpiringCache<UUID, List<RegionSend>>();
68 private const double TIMEOUT = 1.0; // time in cache
69
70 public SimulatorFeaturesHelper(Scene scene, IEntityTransferModule et)
71 { 59 {
72 m_scene = scene; 60 m_scene = scene;
73 m_TransferModule = et;
74 }
75
76 public bool ShouldSend(UUID agentID)
77 {
78 List<RegionSend> rsendlist;
79 RegionSend rsend;
80 if (m_Cache.TryGetValue(agentID, out rsendlist))
81 {
82 rsend = rsendlist.Find(r => r.region == m_scene.RegionInfo.RegionID);
83 if (rsend.region != UUID.Zero) // Found it
84 {
85 return rsend.send;
86 }
87 }
88
89 // Relatively complex logic for deciding whether to send the extra SimFeature or not.
90 // This is because the viewer calls this cap to all sims that it knows about,
91 // including the departing sims and non-neighbors (those that are cached).
92 rsend.region = m_scene.RegionInfo.RegionID;
93 rsend.send = false;
94 IClientAPI client = null;
95 int counter = 200;
96
97 // Let's wait a little to see if we get a client here
98 while (!m_scene.TryGetClient(agentID, out client) && counter-- > 0)
99 Thread.Sleep(50);
100
101 if (client != null)
102 {
103 ScenePresence sp = WaitGetScenePresence(agentID);
104
105 if (sp != null)
106 {
107 // On the receiving region, the call to this cap may arrive before
108 // the agent is root. Make sure we only proceed from here when the agent
109 // has been made root
110 counter = 200;
111 while ((sp.IsInTransit || sp.IsChildAgent) && counter-- > 0)
112 {
113 Thread.Sleep(50);
114 }
115
116 // The viewer calls this cap on the departing sims too. Make sure
117 // that we only proceed after the agent is not in transit anymore.
118 // The agent must be root and not going anywhere
119 if (!sp.IsChildAgent && !m_TransferModule.IsInTransit(agentID))
120 rsend.send = true;
121
122 }
123 }
124 //else
125 // m_log.DebugFormat("[XXX]: client is null");
126
127
128 if (rsendlist == null)
129 {
130 rsendlist = new List<RegionSend>();
131 m_Cache.AddOrUpdate(agentID, rsendlist, TIMEOUT);
132 }
133 rsendlist.Add(rsend);
134
135 return rsend.send;
136 } 61 }
137 62
138 public int UserLevel(UUID agentID) 63 public int UserLevel(UUID agentID)
@@ -144,28 +69,5 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
144 69
145 return level; 70 return level;
146 } 71 }
147
148 protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
149 {
150 int ntimes = 20;
151 ScenePresence sp = null;
152 while ((sp = m_scene.GetScenePresence(agentID)) == null && (ntimes-- > 0))
153 Thread.Sleep(1000);
154
155 if (sp == null)
156 m_log.WarnFormat(
157 "[XXX]: Did not find presence with id {0} in {1} before timeout",
158 agentID, m_scene.RegionInfo.RegionName);
159 else
160 {
161 ntimes = 10;
162 while (sp.IsInTransit && (ntimes-- > 0))
163 Thread.Sleep(1000);
164 }
165
166 return sp;
167 }
168
169 } 72 }
170
171} 73}
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
index 3fe922d..fa8fc66 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
@@ -102,8 +102,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
102 { 102 {
103 if (m_Enabled) 103 if (m_Enabled)
104 { 104 {
105 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>(); 105 m_Helper = new SimulatorFeaturesHelper(scene);
106 m_Helper = new SimulatorFeaturesHelper(scene, et);
107 106
108 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>(); 107 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
109 if (featuresModule != null) 108 if (featuresModule != null)
@@ -118,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
118 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) 117 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
119 { 118 {
120 m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); 119 m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
121 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) 120 if (m_Helper.UserLevel(agentID) <= m_UserLevel)
122 { 121 {
123 OSDMap extrasMap; 122 OSDMap extrasMap;
124 OSDMap specialUI = new OSDMap(); 123 OSDMap specialUI = new OSDMap();
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 4275192..52e8660 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -885,6 +885,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
885 { 885 {
886 } 886 }
887 887
888 public void SendAlertMessage(string message, string info)
889 {
890 }
891
888 public void SendSystemAlertMessage(string message) 892 public void SendSystemAlertMessage(string message)
889 { 893 {
890 } 894 }