aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2017-01-05 16:33:01 +0000
committerUbitUmarov2017-01-05 16:33:01 +0000
commit9d28fd41c67bd14dd684c6982ff49db8476ef887 (patch)
treebe886a33e381da4e07796d9eb5b19f40ba665ac4
parentMerge branch 'master' into httptests (diff)
parent a few changes to estates and estate teleportHome (used kick) (diff)
downloadopensim-SC-9d28fd41c67bd14dd684c6982ff49db8476ef887.zip
opensim-SC-9d28fd41c67bd14dd684c6982ff49db8476ef887.tar.gz
opensim-SC-9d28fd41c67bd14dd684c6982ff49db8476ef887.tar.bz2
opensim-SC-9d28fd41c67bd14dd684c6982ff49db8476ef887.tar.xz
Merge branch 'master' into httptests
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs19
-rw-r--r--OpenSim/Data/MySQL/Resources/IM_Store.migrations2
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations16
-rw-r--r--OpenSim/Data/MySQL/Resources/UserProfiles.migrations10
-rw-r--r--OpenSim/Data/MySQL/Resources/os_groups_Store.migrations16
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs56
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs36
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs13
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs2
10 files changed, 116 insertions, 72 deletions
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index ae0518c..710b00a 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -496,7 +496,7 @@ namespace OpenSim.Groups
496 if (!unlimited && limited) 496 if (!unlimited && limited)
497 { 497 {
498 // check whether person's has this role 498 // check whether person's has this role
499 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 499 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
500 if (rolemembership == null) 500 if (rolemembership == null)
501 { 501 {
502 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID); 502 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
@@ -516,13 +516,26 @@ namespace OpenSim.Groups
516 return false; 516 return false;
517 517
518 // check permissions 518 // check permissions
519 bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
519 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID); 520 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
520 if (!unlimited) 521 if (!limited && !unlimited)
521 { 522 {
522 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID); 523 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
523 return false; 524 return false;
524 } 525 }
525 526
527 // AssignMemberLimited means that the person can assign another person to the same roles that she has in the group
528 if (!unlimited && limited)
529 {
530 // check whether person's has this role
531 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
532 if (rolemembership == null)
533 {
534 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
535 return false;
536 }
537 }
538
526 RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 539 RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
527 540
528 if (rolemember == null) 541 if (rolemember == null)
@@ -812,7 +825,7 @@ namespace OpenSim.Groups
812 if (RoleID != UUID.Zero) 825 if (RoleID != UUID.Zero)
813 _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); 826 _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
814 827
815 // Make thit this active group 828 // Make this the active group
816 PrincipalData pdata = new PrincipalData(); 829 PrincipalData pdata = new PrincipalData();
817 pdata.PrincipalID = AgentID; 830 pdata.PrincipalID = AgentID;
818 pdata.ActiveGroupID = GroupID; 831 pdata.ActiveGroupID = GroupID;
diff --git a/OpenSim/Data/MySQL/Resources/IM_Store.migrations b/OpenSim/Data/MySQL/Resources/IM_Store.migrations
index e271fcc..4f14826 100644
--- a/OpenSim/Data/MySQL/Resources/IM_Store.migrations
+++ b/OpenSim/Data/MySQL/Resources/IM_Store.migrations
@@ -11,6 +11,6 @@ CREATE TABLE IF NOT EXISTS `im_offline` (
11 PRIMARY KEY (`ID`), 11 PRIMARY KEY (`ID`),
12 KEY `PrincipalID` (`PrincipalID`), 12 KEY `PrincipalID` (`PrincipalID`),
13 KEY `FromID` (`FromID`) 13 KEY `FromID` (`FromID`)
14) ENGINE=MyISAM DEFAULT CHARSET=utf8; 14) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15 15
16COMMIT; 16COMMIT;
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index 2108c76..c63cc95 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `prims` (
97 PRIMARY KEY (`UUID`), 97 PRIMARY KEY (`UUID`),
98 KEY `prims_regionuuid` (`RegionUUID`), 98 KEY `prims_regionuuid` (`RegionUUID`),
99 KEY `prims_scenegroupid` (`SceneGroupID`) 99 KEY `prims_scenegroupid` (`SceneGroupID`)
100) ENGINE=MyISAM DEFAULT CHARSET=latin1; 100) ENGINE=InnoDB DEFAULT CHARSET=latin1;
101 101
102CREATE TABLE IF NOT EXISTS `primshapes` ( 102CREATE TABLE IF NOT EXISTS `primshapes` (
103 `Shape` int(11) DEFAULT NULL, 103 `Shape` int(11) DEFAULT NULL,
@@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `primshapes` (
130 `Media` text, 130 `Media` text,
131 `LastAttachPoint` int(4) NOT NULL DEFAULT '0', 131 `LastAttachPoint` int(4) NOT NULL DEFAULT '0',
132 PRIMARY KEY (`UUID`) 132 PRIMARY KEY (`UUID`)
133) ENGINE=MyISAM DEFAULT CHARSET=latin1; 133) ENGINE=InnoDB DEFAULT CHARSET=latin1;
134 134
135CREATE TABLE IF NOT EXISTS `primitems` ( 135CREATE TABLE IF NOT EXISTS `primitems` (
136 `invType` int(11) DEFAULT NULL, 136 `invType` int(11) DEFAULT NULL,
@@ -154,13 +154,13 @@ CREATE TABLE IF NOT EXISTS `primitems` (
154 `lastOwnerID` char(36) DEFAULT NULL, 154 `lastOwnerID` char(36) DEFAULT NULL,
155 PRIMARY KEY (`itemID`), 155 PRIMARY KEY (`itemID`),
156 KEY `primitems_primid` (`primID`) 156 KEY `primitems_primid` (`primID`)
157) ENGINE=MyISAM DEFAULT CHARSET=latin1; 157) ENGINE=InnoDB DEFAULT CHARSET=latin1;
158 158
159CREATE TABLE IF NOT EXISTS `terrain` ( 159CREATE TABLE IF NOT EXISTS `terrain` (
160 `RegionUUID` varchar(255) DEFAULT NULL, 160 `RegionUUID` varchar(255) DEFAULT NULL,
161 `Revision` int(11) DEFAULT NULL, 161 `Revision` int(11) DEFAULT NULL,
162 `Heightfield` longblob 162 `Heightfield` longblob
163) ENGINE=MyISAM DEFAULT CHARSET=latin1; 163) ENGINE=InnoDB DEFAULT CHARSET=latin1;
164 164
165CREATE TABLE IF NOT EXISTS `land` ( 165CREATE TABLE IF NOT EXISTS `land` (
166 `UUID` varchar(255) NOT NULL, 166 `UUID` varchar(255) NOT NULL,
@@ -204,21 +204,21 @@ CREATE TABLE IF NOT EXISTS `land` (
204 `ObscureMusic` tinyint(1) NOT NULL DEFAULT '0', 204 `ObscureMusic` tinyint(1) NOT NULL DEFAULT '0',
205 `ObscureMedia` tinyint(1) NOT NULL DEFAULT '0', 205 `ObscureMedia` tinyint(1) NOT NULL DEFAULT '0',
206 PRIMARY KEY (`UUID`) 206 PRIMARY KEY (`UUID`)
207) ENGINE=MyISAM DEFAULT CHARSET=utf8; 207) ENGINE=InnoDB DEFAULT CHARSET=utf8;
208 208
209CREATE TABLE IF NOT EXISTS `landaccesslist` ( 209CREATE TABLE IF NOT EXISTS `landaccesslist` (
210 `LandUUID` varchar(255) DEFAULT NULL, 210 `LandUUID` varchar(255) DEFAULT NULL,
211 `AccessUUID` varchar(255) DEFAULT NULL, 211 `AccessUUID` varchar(255) DEFAULT NULL,
212 `Flags` int(11) DEFAULT NULL, 212 `Flags` int(11) DEFAULT NULL,
213 `Expires` int(11) NOT NULL DEFAULT '0' 213 `Expires` int(11) NOT NULL DEFAULT '0'
214) ENGINE=MyISAM DEFAULT CHARSET=latin1; 214) ENGINE=InnoDB DEFAULT CHARSET=latin1;
215 215
216CREATE TABLE IF NOT EXISTS `regionban` ( 216CREATE TABLE IF NOT EXISTS `regionban` (
217 `regionUUID` varchar(36) NOT NULL, 217 `regionUUID` varchar(36) NOT NULL,
218 `bannedUUID` varchar(36) NOT NULL, 218 `bannedUUID` varchar(36) NOT NULL,
219 `bannedIp` varchar(16) NOT NULL, 219 `bannedIp` varchar(16) NOT NULL,
220 `bannedIpHostMask` varchar(16) NOT NULL 220 `bannedIpHostMask` varchar(16) NOT NULL
221) ENGINE=MyISAM DEFAULT CHARSET=utf8; 221) ENGINE=InnoDB DEFAULT CHARSET=utf8;
222 222
223CREATE TABLE IF NOT EXISTS `regionsettings` ( 223CREATE TABLE IF NOT EXISTS `regionsettings` (
224 `regionUUID` char(36) NOT NULL, 224 `regionUUID` char(36) NOT NULL,
@@ -265,7 +265,7 @@ CREATE TABLE IF NOT EXISTS `regionsettings` (
265 `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', 265 `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
266 `covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0', 266 `covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0',
267 PRIMARY KEY (`regionUUID`) 267 PRIMARY KEY (`regionUUID`)
268) ENGINE=MyISAM DEFAULT CHARSET=utf8; 268) ENGINE=InnoDB DEFAULT CHARSET=utf8;
269 269
270CREATE TABLE IF NOT EXISTS `regionwindlight` ( 270CREATE TABLE IF NOT EXISTS `regionwindlight` (
271 `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', 271 `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
diff --git a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
index 008e455..cfcc18b 100644
--- a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
@@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS `usernotes` (
27 `targetuuid` varchar(36) NOT NULL, 27 `targetuuid` varchar(36) NOT NULL,
28 `notes` text NOT NULL, 28 `notes` text NOT NULL,
29 UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`) 29 UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`)
30) ENGINE=MyISAM DEFAULT CHARSET=latin1; 30) ENGINE=InnoDB DEFAULT CHARSET=latin1;
31 31
32 32
33CREATE TABLE IF NOT EXISTS `userpicks` ( 33CREATE TABLE IF NOT EXISTS `userpicks` (
@@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `userpicks` (
46 `enabled` enum('true','false') NOT NULL, 46 `enabled` enum('true','false') NOT NULL,
47 `gatekeeper` varchar(255), 47 `gatekeeper` varchar(255),
48 PRIMARY KEY (`pickuuid`) 48 PRIMARY KEY (`pickuuid`)
49) ENGINE=MyISAM DEFAULT CHARSET=latin1; 49) ENGINE=InnoDB DEFAULT CHARSET=latin1;
50 50
51 51
52CREATE TABLE IF NOT EXISTS `userprofile` ( 52CREATE TABLE IF NOT EXISTS `userprofile` (
@@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `userprofile` (
65 `profileFirstImage` varchar(36) NOT NULL, 65 `profileFirstImage` varchar(36) NOT NULL,
66 `profileFirstText` text NOT NULL, 66 `profileFirstText` text NOT NULL,
67 PRIMARY KEY (`useruuid`) 67 PRIMARY KEY (`useruuid`)
68) ENGINE=MyISAM DEFAULT CHARSET=latin1; 68) ENGINE=InnoDB DEFAULT CHARSET=latin1;
69 69
70CREATE TABLE IF NOT EXISTS `userdata` ( 70CREATE TABLE IF NOT EXISTS `userdata` (
71 `UserId` char(36) NOT NULL, 71 `UserId` char(36) NOT NULL,
@@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `userdata` (
73 `DataKey` varchar(255), 73 `DataKey` varchar(255),
74 `DataVal` varchar(255), 74 `DataVal` varchar(255),
75 PRIMARY KEY (`UserId`,`TagId`) 75 PRIMARY KEY (`UserId`,`TagId`)
76) ENGINE=MyISAM DEFAULT CHARSET=latin1; 76) ENGINE=InnoDB DEFAULT CHARSET=latin1;
77 77
78CREATE TABLE IF NOT EXISTS `usersettings` ( 78CREATE TABLE IF NOT EXISTS `usersettings` (
79 `useruuid` varchar(36) NOT NULL, 79 `useruuid` varchar(36) NOT NULL,
@@ -81,6 +81,6 @@ CREATE TABLE IF NOT EXISTS `usersettings` (
81 `visible` enum('true','false') NOT NULL, 81 `visible` enum('true','false') NOT NULL,
82 `email` varchar(254) NOT NULL, 82 `email` varchar(254) NOT NULL,
83 PRIMARY KEY (`useruuid`) 83 PRIMARY KEY (`useruuid`)
84) ENGINE=MyISAM DEFAULT CHARSET=latin1; 84) ENGINE=InnoDB DEFAULT CHARSET=latin1;
85 85
86commit; 86commit;
diff --git a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations
index 9e6f1c1..1a49900 100644
--- a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations
+++ b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations
@@ -18,7 +18,7 @@ CREATE TABLE `os_groups_groups` (
18 PRIMARY KEY (`GroupID`), 18 PRIMARY KEY (`GroupID`),
19 UNIQUE KEY `Name` (`Name`), 19 UNIQUE KEY `Name` (`Name`),
20 FULLTEXT KEY `Name_2` (`Name`) 20 FULLTEXT KEY `Name_2` (`Name`)
21) ENGINE=MyISAM; 21) ENGINE=InnoDB;
22 22
23 23
24CREATE TABLE `os_groups_membership` ( 24CREATE TABLE `os_groups_membership` (
@@ -31,7 +31,7 @@ CREATE TABLE `os_groups_membership` (
31 `AccessToken` char(36) NOT NULL default '', 31 `AccessToken` char(36) NOT NULL default '',
32 PRIMARY KEY (`GroupID`,`PrincipalID`), 32 PRIMARY KEY (`GroupID`,`PrincipalID`),
33 KEY `PrincipalID` (`PrincipalID`) 33 KEY `PrincipalID` (`PrincipalID`)
34) ENGINE=MyISAM; 34) ENGINE=InnoDB;
35 35
36 36
37CREATE TABLE `os_groups_roles` ( 37CREATE TABLE `os_groups_roles` (
@@ -43,7 +43,7 @@ CREATE TABLE `os_groups_roles` (
43 `Powers` bigint(20) unsigned NOT NULL default '0', 43 `Powers` bigint(20) unsigned NOT NULL default '0',
44 PRIMARY KEY (`GroupID`,`RoleID`), 44 PRIMARY KEY (`GroupID`,`RoleID`),
45 KEY `GroupID` (`GroupID`) 45 KEY `GroupID` (`GroupID`)
46) ENGINE=MyISAM; 46) ENGINE=InnoDB;
47 47
48 48
49CREATE TABLE `os_groups_rolemembership` ( 49CREATE TABLE `os_groups_rolemembership` (
@@ -52,7 +52,7 @@ CREATE TABLE `os_groups_rolemembership` (
52 `PrincipalID` VARCHAR(255) NOT NULL default '', 52 `PrincipalID` VARCHAR(255) NOT NULL default '',
53 PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`), 53 PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`),
54 KEY `PrincipalID` (`PrincipalID`) 54 KEY `PrincipalID` (`PrincipalID`)
55) ENGINE=MyISAM; 55) ENGINE=InnoDB;
56 56
57 57
58CREATE TABLE `os_groups_invites` ( 58CREATE TABLE `os_groups_invites` (
@@ -63,7 +63,7 @@ CREATE TABLE `os_groups_invites` (
63 `TMStamp` timestamp NOT NULL, 63 `TMStamp` timestamp NOT NULL,
64 PRIMARY KEY (`InviteID`), 64 PRIMARY KEY (`InviteID`),
65 UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`) 65 UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`)
66) ENGINE=MyISAM; 66) ENGINE=InnoDB;
67 67
68 68
69CREATE TABLE `os_groups_notices` ( 69CREATE TABLE `os_groups_notices` (
@@ -81,13 +81,13 @@ CREATE TABLE `os_groups_notices` (
81 PRIMARY KEY (`NoticeID`), 81 PRIMARY KEY (`NoticeID`),
82 KEY `GroupID` (`GroupID`), 82 KEY `GroupID` (`GroupID`),
83 KEY `TMStamp` (`TMStamp`) 83 KEY `TMStamp` (`TMStamp`)
84) ENGINE=MyISAM; 84) ENGINE=InnoDB;
85 85
86CREATE TABLE `os_groups_principals` ( 86CREATE TABLE `os_groups_principals` (
87 `PrincipalID` VARCHAR(255) NOT NULL default '', 87 `PrincipalID` VARCHAR(255) NOT NULL default '',
88 `ActiveGroupID` char(36) NOT NULL default '', 88 `ActiveGroupID` char(36) NOT NULL default '',
89 PRIMARY KEY (`PrincipalID`) 89 PRIMARY KEY (`PrincipalID`)
90) ENGINE=MyISAM; 90) ENGINE=InnoDB;
91 91
92COMMIT; 92COMMIT;
93 93
@@ -112,4 +112,4 @@ DROP TABLE `diva_groups_principals`;
112 112
113DELETE FROM `migrations` WHERE name='diva_im_Store'; 113DELETE FROM `migrations` WHERE name='diva_im_Store';
114 114
115COMMIT; \ No newline at end of file 115COMMIT;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 8eb2b1e..efd4ca6 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -71,6 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
71 public event ChangeDelegate OnRegionInfoChange; 71 public event ChangeDelegate OnRegionInfoChange;
72 public event ChangeDelegate OnEstateInfoChange; 72 public event ChangeDelegate OnEstateInfoChange;
73 public event MessageDelegate OnEstateMessage; 73 public event MessageDelegate OnEstateMessage;
74 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
75 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
74 76
75 private int m_delayCount = 0; 77 private int m_delayCount = 0;
76 78
@@ -1193,13 +1195,20 @@ namespace OpenSim.Region.CoreModules.World.Estate
1193 1195
1194 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) 1196 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)
1195 { 1197 {
1198 EstateTeleportOneUserHomeRequest evOverride = OnEstateTeleportOneUserHomeRequest;
1199 if(evOverride != null)
1200 {
1201 evOverride(remover_client, invoice, senderID, prey);
1202 return;
1203 }
1204
1196 if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) 1205 if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
1197 return; 1206 return;
1198 1207
1199 if (prey != UUID.Zero) 1208 if (prey != UUID.Zero)
1200 { 1209 {
1201 ScenePresence s = Scene.GetScenePresence(prey); 1210 ScenePresence s = Scene.GetScenePresence(prey);
1202 if (s != null) 1211 if (s != null && !s.IsDeleted && !s.IsInTransit)
1203 { 1212 {
1204 if (!Scene.TeleportClientHome(prey, s.ControllingClient)) 1213 if (!Scene.TeleportClientHome(prey, s.ControllingClient))
1205 { 1214 {
@@ -1212,6 +1221,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
1212 1221
1213 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) 1222 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
1214 { 1223 {
1224 EstateTeleportAllUsersHomeRequest evOverride = OnEstateTeleportAllUsersHomeRequest;
1225 if(evOverride != null)
1226 {
1227 evOverride(remover_client, invoice, senderID);
1228 return;
1229 }
1230
1215 if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) 1231 if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
1216 return; 1232 return;
1217 1233
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs
index 73e706c..2c0c882 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs
@@ -46,16 +46,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 protected XEstateModule m_EstateModule; 48 protected XEstateModule m_EstateModule;
49 private string token;
49 50
50 public EstateConnector(XEstateModule module) 51 public EstateConnector(XEstateModule module, string _token)
51 { 52 {
52 m_EstateModule = module; 53 m_EstateModule = module;
54 token = _token;
53 } 55 }
54 56
55 public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID) 57 public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID)
56 { 58 {
57 Dictionary<string, object> sendData = new Dictionary<string, object>(); 59 Dictionary<string, object> sendData = new Dictionary<string, object>();
58 sendData["METHOD"] = "teleport_home_one_user"; 60 sendData["METHOD"] = "teleport_home_one_user";
61 sendData["TOKEN"] = token;
59 62
60 sendData["EstateID"] = EstateID.ToString(); 63 sendData["EstateID"] = EstateID.ToString();
61 sendData["PreyID"] = PreyID.ToString(); 64 sendData["PreyID"] = PreyID.ToString();
@@ -67,6 +70,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
67 { 70 {
68 Dictionary<string, object> sendData = new Dictionary<string, object>(); 71 Dictionary<string, object> sendData = new Dictionary<string, object>();
69 sendData["METHOD"] = "teleport_home_all_users"; 72 sendData["METHOD"] = "teleport_home_all_users";
73 sendData["TOKEN"] = token;
70 74
71 sendData["EstateID"] = EstateID.ToString(); 75 sendData["EstateID"] = EstateID.ToString();
72 76
@@ -77,6 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
77 { 81 {
78 Dictionary<string, object> sendData = new Dictionary<string, object>(); 82 Dictionary<string, object> sendData = new Dictionary<string, object>();
79 sendData["METHOD"] = "update_covenant"; 83 sendData["METHOD"] = "update_covenant";
84 sendData["TOKEN"] = token;
80 85
81 sendData["CovenantID"] = CovenantID.ToString(); 86 sendData["CovenantID"] = CovenantID.ToString();
82 sendData["EstateID"] = EstateID.ToString(); 87 sendData["EstateID"] = EstateID.ToString();
@@ -99,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
99 { 104 {
100 Dictionary<string, object> sendData = new Dictionary<string, object>(); 105 Dictionary<string, object> sendData = new Dictionary<string, object>();
101 sendData["METHOD"] = "update_estate"; 106 sendData["METHOD"] = "update_estate";
107 sendData["TOKEN"] = token;
102 108
103 sendData["EstateID"] = EstateID.ToString(); 109 sendData["EstateID"] = EstateID.ToString();
104 110
@@ -119,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
119 { 125 {
120 Dictionary<string, object> sendData = new Dictionary<string, object>(); 126 Dictionary<string, object> sendData = new Dictionary<string, object>();
121 sendData["METHOD"] = "estate_message"; 127 sendData["METHOD"] = "estate_message";
128 sendData["TOKEN"] = token;
122 129
123 sendData["EstateID"] = EstateID.ToString(); 130 sendData["EstateID"] = EstateID.ToString();
124 sendData["FromID"] = FromID.ToString(); 131 sendData["FromID"] = FromID.ToString();
@@ -132,47 +139,43 @@ namespace OpenSim.Region.CoreModules.World.Estate
132 { 139 {
133 List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID); 140 List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID);
134 141
135 UUID ScopeID = UUID.Zero; 142 // Don't send to the same instance twice
143 List<string> done = new List<string>();
136 144
137 // Handle local regions locally 145 // Handle local regions locally
138 //
139 lock (m_EstateModule.Scenes) 146 lock (m_EstateModule.Scenes)
140 { 147 {
141 foreach (Scene s in m_EstateModule.Scenes) 148 foreach (Scene s in m_EstateModule.Scenes)
142 { 149 {
143 if (regions.Contains(s.RegionInfo.RegionID)) 150 RegionInfo sreg = s.RegionInfo;
151 if (regions.Contains(sreg.RegionID))
144 { 152 {
145 // All regions in one estate are in the same scope. 153 string url = sreg.ExternalHostName + ":" + sreg.HttpPort;
146 // Use that scope. 154 regions.Remove(sreg.RegionID);
147 // 155 if(!done.Contains(url)) // we may have older regs with same url lost in dbs
148 ScopeID = s.RegionInfo.ScopeID; 156 done.Add(url);
149 regions.Remove(s.RegionInfo.RegionID);
150 } 157 }
151 } 158 }
152 } 159 }
153 160
154 // Our own region should always be in the above list. 161 if(regions.Count == 0)
155 // In a standalone this would not be true. But then, 162 return;
156 // Scope ID is not relevat there. Use first scope.
157 //
158 if (ScopeID == UUID.Zero)
159 ScopeID = m_EstateModule.Scenes[0].RegionInfo.ScopeID;
160 163
161 // Don't send to the same instance twice 164 Scene baseScene = m_EstateModule.Scenes[0];
162 // 165 UUID ScopeID = baseScene.RegionInfo.ScopeID;
163 List<string> done = new List<string>(); 166 IGridService gridService = baseScene.GridService;
167 if(gridService == null)
168 return;
164 169
165 // Send to remote regions 170 // Send to remote regions
166 //
167 foreach (UUID regionID in regions) 171 foreach (UUID regionID in regions)
168 { 172 {
169 GridRegion region = m_EstateModule.Scenes[0].GridService.GetRegionByUUID(ScopeID, regionID); 173 GridRegion region = gridService.GetRegionByUUID(ScopeID, regionID);
170 if (region != null) 174 if (region != null)
171 { 175 {
172 string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; 176 string url = region.ExternalHostName + ":" + region.HttpPort;
173 if (done.Contains(url)) 177 if(done.Contains(url))
174 continue; 178 continue;
175
176 Call(region, sendData); 179 Call(region, sendData);
177 done.Add(url); 180 done.Add(url);
178 } 181 }
@@ -185,7 +188,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
185 // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString); 188 // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString);
186 try 189 try
187 { 190 {
188 string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; 191 string url = "";
192 if(string.IsNullOrEmpty(region.ServerURI))
193 url = "http://" + region.ExternalHostName + ":" + region.HttpPort;
194 else
195 url = region.ServerURI;
196
189 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 197 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
190 url + "/estate", 198 url + "/estate",
191 reqString); 199 reqString);
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs
index 4bb3799..a7195af 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs
@@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
51 51
52 protected List<Scene> m_Scenes = new List<Scene>(); 52 protected List<Scene> m_Scenes = new List<Scene>();
53 protected bool m_InInfoUpdate = false; 53 protected bool m_InInfoUpdate = false;
54 private string token = "7db8eh2gvgg45jj";
54 55
55 public bool InInfoUpdate 56 public bool InInfoUpdate
56 { 57 {
@@ -69,17 +70,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
69 { 70 {
70 int port = 0; 71 int port = 0;
71 72
72 IConfig estateConfig = config.Configs["Estate"]; 73 IConfig estateConfig = config.Configs["Estates"];
73 if (estateConfig != null) 74 if (estateConfig != null)
74 { 75 {
75 port = estateConfig.GetInt("Port", 0); 76 port = estateConfig.GetInt("Port", 0);
77 // this will need to came from somewhere else
78 token = estateConfig.GetString("Token", token);
76 } 79 }
77 80
78 m_EstateConnector = new EstateConnector(this); 81 m_EstateConnector = new EstateConnector(this, token);
79 82
80 // Instantiate the request handler 83 // Instantiate the request handler
81 IHttpServer server = MainServer.GetHttpServer((uint)port); 84 IHttpServer server = MainServer.GetHttpServer((uint)port);
82 server.AddStreamHandler(new EstateRequestHandler(this)); 85 server.AddStreamHandler(new EstateRequestHandler(this, token));
83 } 86 }
84 87
85 public void PostInitialise() 88 public void PostInitialise()
@@ -94,8 +97,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
94 { 97 {
95 lock (m_Scenes) 98 lock (m_Scenes)
96 m_Scenes.Add(scene); 99 m_Scenes.Add(scene);
97
98 scene.EventManager.OnNewClient += OnNewClient;
99 } 100 }
100 101
101 public void RegionLoaded(Scene scene) 102 public void RegionLoaded(Scene scene)
@@ -105,12 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
105 em.OnRegionInfoChange += OnRegionInfoChange; 106 em.OnRegionInfoChange += OnRegionInfoChange;
106 em.OnEstateInfoChange += OnEstateInfoChange; 107 em.OnEstateInfoChange += OnEstateInfoChange;
107 em.OnEstateMessage += OnEstateMessage; 108 em.OnEstateMessage += OnEstateMessage;
109 em.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest;
110 em.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest;
108 } 111 }
109 112
110 public void RemoveRegion(Scene scene) 113 public void RemoveRegion(Scene scene)
111 { 114 {
112 scene.EventManager.OnNewClient -= OnNewClient;
113
114 lock (m_Scenes) 115 lock (m_Scenes)
115 m_Scenes.Remove(scene); 116 m_Scenes.Remove(scene);
116 } 117 }
@@ -181,13 +182,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
181 m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message); 182 m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message);
182 } 183 }
183 184
184 private void OnNewClient(IClientAPI client)
185 {
186 client.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest;
187 client.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest;
188
189 }
190
191 private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey) 185 private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey)
192 { 186 {
193 if (prey == UUID.Zero) 187 if (prey == UUID.Zero)
@@ -205,16 +199,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
205 199
206 foreach (Scene s in Scenes) 200 foreach (Scene s in Scenes)
207 { 201 {
208 if (s == scene)
209 continue; // Already handles by estate module
210 if (s.RegionInfo.EstateSettings.EstateID != estateID) 202 if (s.RegionInfo.EstateSettings.EstateID != estateID)
211 continue; 203 continue;
212 204
213 ScenePresence p = scene.GetScenePresence(prey); 205 ScenePresence p = scene.GetScenePresence(prey);
214 if (p != null && !p.IsChildAgent) 206 if (p != null && !p.IsChildAgent )
215 { 207 {
216 p.ControllingClient.SendTeleportStart(16); 208 if(!p.IsDeleted && !p.IsInTransit)
217 scene.TeleportClientHome(prey, p.ControllingClient); 209 {
210 p.ControllingClient.SendTeleportStart(16);
211 scene.TeleportClientHome(prey, p.ControllingClient);
212 }
213 return;
218 } 214 }
219 } 215 }
220 216
@@ -235,8 +231,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
235 231
236 foreach (Scene s in Scenes) 232 foreach (Scene s in Scenes)
237 { 233 {
238 if (s == scene)
239 continue; // Already handles by estate module
240 if (s.RegionInfo.EstateSettings.EstateID != estateID) 234 if (s.RegionInfo.EstateSettings.EstateID != estateID)
241 continue; 235 continue;
242 236
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
index 1dcaed3..756b54d 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
@@ -48,11 +48,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
48 48
49 protected XEstateModule m_EstateModule; 49 protected XEstateModule m_EstateModule;
50 protected Object m_RequestLock = new Object(); 50 protected Object m_RequestLock = new Object();
51 private string token;
51 52
52 public EstateRequestHandler(XEstateModule fmodule) 53 public EstateRequestHandler(XEstateModule fmodule, string _token)
53 : base("POST", "/estate") 54 : base("POST", "/estate")
54 { 55 {
55 m_EstateModule = fmodule; 56 m_EstateModule = fmodule;
57 token = _token;
56 } 58 }
57 59
58 protected override byte[] ProcessRequest(string path, Stream requestData, 60 protected override byte[] ProcessRequest(string path, Stream requestData,
@@ -75,6 +77,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
75 if (!request.ContainsKey("METHOD")) 77 if (!request.ContainsKey("METHOD"))
76 return FailureResult(); 78 return FailureResult();
77 79
80 if (!request.ContainsKey("TOKEN"))
81 return FailureResult();
82
83 string reqToken = request["TOKEN"].ToString();
84 request.Remove("TOKEN");
85
86 if(token != reqToken)
87 return FailureResult();
88
78 string method = request["METHOD"].ToString(); 89 string method = request["METHOD"].ToString();
79 request.Remove("METHOD"); 90 request.Remove("METHOD");
80 91
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index 461c880..6b8b999 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces
39 event ChangeDelegate OnRegionInfoChange; 39 event ChangeDelegate OnRegionInfoChange;
40 event ChangeDelegate OnEstateInfoChange; 40 event ChangeDelegate OnEstateInfoChange;
41 event MessageDelegate OnEstateMessage; 41 event MessageDelegate OnEstateMessage;
42 event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
43 event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
42 44
43 uint GetRegionFlags(); 45 uint GetRegionFlags();
44 bool IsManager(UUID avatarID); 46 bool IsManager(UUID avatarID);