diff options
author | Melanie | 2010-06-14 02:49:15 +0100 |
---|---|---|
committer | Melanie | 2010-06-14 02:49:15 +0100 |
commit | fdf648bcf3cecc2236cc6761d33f3df5e0af136d (patch) | |
tree | db65a301f98b6b998a901cdd887fec755e6d73dd /OpenSim | |
parent | D.U.H. #2. Inverted test. Again. Argh! (diff) | |
parent | Fixes attachments coming back upon being detached in neighbouring regions and... (diff) | |
download | opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.zip opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.tar.gz opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.tar.bz2 opensim-SC-fdf648bcf3cecc2236cc6761d33f3df5e0af136d.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
17 files changed, 709 insertions, 445 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index ed43363..03b8e9f 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -1116,6 +1116,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1116 | string firstname = (string) requestData["user_firstname"]; | 1116 | string firstname = (string) requestData["user_firstname"]; |
1117 | string lastname = (string) requestData["user_lastname"]; | 1117 | string lastname = (string) requestData["user_lastname"]; |
1118 | string passwd = (string) requestData["user_password"]; | 1118 | string passwd = (string) requestData["user_password"]; |
1119 | |||
1119 | uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1120 | uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1120 | uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1121 | uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1121 | 1122 | ||
@@ -1123,28 +1124,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1123 | if (requestData.Contains("user_email")) | 1124 | if (requestData.Contains("user_email")) |
1124 | email = (string)requestData["user_email"]; | 1125 | email = (string)requestData["user_email"]; |
1125 | 1126 | ||
1126 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 1127 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; |
1127 | 1128 | UUID scopeID = scene.RegionInfo.ScopeID; | |
1128 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | ||
1129 | |||
1130 | if (null != account) | ||
1131 | throw new Exception(String.Format("Account {0} {1} already exists", firstname, lastname)); | ||
1132 | 1129 | ||
1133 | account = new UserAccount(scopeID, firstname, lastname, email); | 1130 | UserAccount account = CreateUser(scopeID, firstname, lastname, passwd, email); |
1134 | 1131 | ||
1135 | bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account); | 1132 | if (null == account) |
1136 | |||
1137 | if (!success) | ||
1138 | throw new Exception(String.Format("failed to create new user {0} {1}", | 1133 | throw new Exception(String.Format("failed to create new user {0} {1}", |
1139 | firstname, lastname)); | 1134 | firstname, lastname)); |
1140 | 1135 | ||
1141 | // Store the password | 1136 | // Set home position |
1142 | m_app.SceneManager.CurrentOrFirstScene.AuthenticationService.SetPassword(account.PrincipalID, passwd); | ||
1143 | 1137 | ||
1144 | GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID, | 1138 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1145 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | 1139 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); |
1146 | if (home == null) | 1140 | if (null == home) { |
1147 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname); | 1141 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname); |
1142 | } else { | ||
1143 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1144 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); | ||
1145 | } | ||
1148 | 1146 | ||
1149 | // Establish the avatar's initial appearance | 1147 | // Establish the avatar's initial appearance |
1150 | 1148 | ||
@@ -1287,9 +1285,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1287 | /// <item><term>start_region_y</term> | 1285 | /// <item><term>start_region_y</term> |
1288 | /// <description>avatar's start region coordinates, Y | 1286 | /// <description>avatar's start region coordinates, Y |
1289 | /// value (changeable)</description></item> | 1287 | /// value (changeable)</description></item> |
1290 | /// <item><term>about_real_world</term> | 1288 | /// <item><term>about_real_world (not implemented yet)</term> |
1291 | /// <description>"about" text of avatar owner (changeable)</description></item> | 1289 | /// <description>"about" text of avatar owner (changeable)</description></item> |
1292 | /// <item><term>about_virtual_world</term> | 1290 | /// <item><term>about_virtual_world (not implemented yet)</term> |
1293 | /// <description>"about" text of avatar (changeable)</description></item> | 1291 | /// <description>"about" text of avatar (changeable)</description></item> |
1294 | /// </list> | 1292 | /// </list> |
1295 | /// | 1293 | /// |
@@ -1300,6 +1298,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1300 | /// <description>true or false</description></item> | 1298 | /// <description>true or false</description></item> |
1301 | /// <item><term>error</term> | 1299 | /// <item><term>error</term> |
1302 | /// <description>error message if success is false</description></item> | 1300 | /// <description>error message if success is false</description></item> |
1301 | /// <item><term>avatar_uuid</term> | ||
1302 | /// <description>UUID of the updated avatar | ||
1303 | /// account; UUID.Zero if failed. | ||
1304 | /// </description></item> | ||
1303 | /// </list> | 1305 | /// </list> |
1304 | /// </remarks> | 1306 | /// </remarks> |
1305 | 1307 | ||
@@ -1307,31 +1309,34 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1307 | { | 1309 | { |
1308 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); | 1310 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); |
1309 | m_log.Warn("[RADMIN]: This method needs update for 0.7"); | 1311 | m_log.Warn("[RADMIN]: This method needs update for 0.7"); |
1312 | |||
1313 | FailIfRemoteAdminDisabled("UpdateUserAccount"); | ||
1314 | |||
1310 | XmlRpcResponse response = new XmlRpcResponse(); | 1315 | XmlRpcResponse response = new XmlRpcResponse(); |
1311 | Hashtable responseData = new Hashtable(); | 1316 | Hashtable responseData = new Hashtable(); |
1312 | 1317 | ||
1313 | //lock (rslock) | 1318 | lock (rslock) |
1314 | //{ | 1319 | { |
1315 | // try | 1320 | try |
1316 | // { | 1321 | { |
1317 | // Hashtable requestData = (Hashtable) request.Params[0]; | 1322 | Hashtable requestData = (Hashtable) request.Params[0]; |
1318 | 1323 | ||
1319 | // // check completeness | 1324 | // check completeness |
1320 | // checkStringParameters(request, new string[] { | 1325 | checkStringParameters(request, new string[] { |
1321 | // "password", "user_firstname", | 1326 | "password", "user_firstname", |
1322 | // "user_lastname"}); | 1327 | "user_lastname"}); |
1323 | 1328 | ||
1324 | // // check password | 1329 | // check password |
1325 | // if (!String.IsNullOrEmpty(m_requiredPassword) && | 1330 | if (!String.IsNullOrEmpty(m_requiredPassword) && |
1326 | // (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 1331 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
1327 | 1332 | ||
1328 | // // do the job | 1333 | // do the job |
1329 | // string firstname = (string) requestData["user_firstname"]; | 1334 | string firstname = (string) requestData["user_firstname"]; |
1330 | // string lastname = (string) requestData["user_lastname"]; | 1335 | string lastname = (string) requestData["user_lastname"]; |
1331 | 1336 | ||
1332 | // string passwd = String.Empty; | 1337 | string passwd = String.Empty; |
1333 | // uint? regX = null; | 1338 | uint? regX = null; |
1334 | // uint? regY = null; | 1339 | uint? regY = null; |
1335 | // uint? ulaX = null; | 1340 | // uint? ulaX = null; |
1336 | // uint? ulaY = null; | 1341 | // uint? ulaY = null; |
1337 | // uint? ulaZ = null; | 1342 | // uint? ulaZ = null; |
@@ -1341,11 +1346,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1341 | // string aboutFirstLive = String.Empty; | 1346 | // string aboutFirstLive = String.Empty; |
1342 | // string aboutAvatar = String.Empty; | 1347 | // string aboutAvatar = String.Empty; |
1343 | 1348 | ||
1344 | // if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; | 1349 | if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; |
1345 | // if (requestData.ContainsKey("start_region_x")) | 1350 | if (requestData.ContainsKey("start_region_x")) |
1346 | // regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1351 | regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1347 | // if (requestData.ContainsKey("start_region_y")) | 1352 | if (requestData.ContainsKey("start_region_y")) |
1348 | // regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1353 | regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1349 | 1354 | ||
1350 | // if (requestData.ContainsKey("start_lookat_x")) | 1355 | // if (requestData.ContainsKey("start_lookat_x")) |
1351 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); | 1356 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); |
@@ -1365,21 +1370,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1365 | // if (requestData.ContainsKey("about_virtual_world")) | 1370 | // if (requestData.ContainsKey("about_virtual_world")) |
1366 | // aboutAvatar = (string)requestData["about_virtual_world"]; | 1371 | // aboutAvatar = (string)requestData["about_virtual_world"]; |
1367 | 1372 | ||
1368 | // UserProfileData userProfile | 1373 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; |
1369 | // = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); | 1374 | UUID scopeID = scene.RegionInfo.ScopeID; |
1370 | 1375 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | |
1371 | // if (null == userProfile) | ||
1372 | // throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); | ||
1373 | 1376 | ||
1374 | // if (!String.IsNullOrEmpty(passwd)) | 1377 | if (null == account) |
1375 | // { | 1378 | throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); |
1376 | // m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); | ||
1377 | // string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); | ||
1378 | // userProfile.PasswordHash = md5PasswdHash; | ||
1379 | // } | ||
1380 | 1379 | ||
1381 | // if (null != regX) userProfile.HomeRegionX = (uint) regX; | 1380 | if (!String.IsNullOrEmpty(passwd)) |
1382 | // if (null != regY) userProfile.HomeRegionY = (uint) regY; | 1381 | { |
1382 | m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); | ||
1383 | ChangeUserPassword(firstname, lastname, passwd); | ||
1384 | } | ||
1383 | 1385 | ||
1384 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; | 1386 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; |
1385 | // if (null != usaY) userProfile.HomeLocationY = (uint) usaY; | 1387 | // if (null != usaY) userProfile.HomeLocationY = (uint) usaY; |
@@ -1392,35 +1394,48 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1392 | // if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; | 1394 | // if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; |
1393 | // if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; | 1395 | // if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; |
1394 | 1396 | ||
1395 | // // User has been created. Now establish gender and appearance. | 1397 | // Set home position |
1396 | 1398 | ||
1397 | // updateUserAppearance(responseData, requestData, userProfile.ID); | 1399 | if ((null != regX) && (null != regY)) |
1400 | { | ||
1401 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | ||
1402 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | ||
1403 | if (null == home) { | ||
1404 | m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstname, lastname); | ||
1405 | } else { | ||
1406 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1407 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); | ||
1408 | } | ||
1409 | } | ||
1398 | 1410 | ||
1399 | // if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) | 1411 | // User has been created. Now establish gender and appearance. |
1400 | // throw new Exception("did not manage to update user profile"); | ||
1401 | 1412 | ||
1402 | // responseData["success"] = true; | 1413 | updateUserAppearance(responseData, requestData, account.PrincipalID); |
1403 | 1414 | ||
1404 | // response.Value = responseData; | 1415 | responseData["success"] = true; |
1416 | responseData["avatar_uuid"] = account.PrincipalID.ToString(); | ||
1405 | 1417 | ||
1406 | // m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", | 1418 | response.Value = responseData; |
1407 | // firstname, lastname, | ||
1408 | // userProfile.ID); | ||
1409 | // } | ||
1410 | // catch (Exception e) | ||
1411 | // { | ||
1412 | // m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); | ||
1413 | // m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); | ||
1414 | 1419 | ||
1415 | // responseData["success"] = false; | 1420 | m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", |
1416 | // responseData["error"] = e.Message; | 1421 | firstname, lastname, |
1422 | account.PrincipalID); | ||
1423 | } | ||
1424 | catch (Exception e) | ||
1425 | { | ||
1417 | 1426 | ||
1418 | // response.Value = responseData; | 1427 | m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); |
1419 | // } | 1428 | m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); |
1420 | //} | ||
1421 | 1429 | ||
1422 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); | 1430 | responseData["success"] = false; |
1423 | return response; | 1431 | responseData["avatar_uuid"] = UUID.Zero.ToString(); |
1432 | responseData["error"] = e.Message; | ||
1433 | |||
1434 | response.Value = responseData; | ||
1435 | } | ||
1436 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); | ||
1437 | return response; | ||
1438 | } | ||
1424 | } | 1439 | } |
1425 | 1440 | ||
1426 | /// <summary> | 1441 | /// <summary> |
@@ -1434,73 +1449,74 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1434 | private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) | 1449 | private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) |
1435 | { | 1450 | { |
1436 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); | 1451 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); |
1437 | m_log.Warn("[RADMIN]: This method needs update for 0.7"); | ||
1438 | 1452 | ||
1439 | //string dmale = m_config.GetString("default_male", "Default Male"); | 1453 | string dmale = m_config.GetString("default_male", "Default Male"); |
1440 | //string dfemale = m_config.GetString("default_female", "Default Female"); | 1454 | string dfemale = m_config.GetString("default_female", "Default Female"); |
1441 | //string dneut = m_config.GetString("default_female", "Default Default"); | 1455 | string dneut = m_config.GetString("default_female", "Default Default"); |
1442 | string model = String.Empty; | 1456 | string model = String.Empty; |
1443 | 1457 | ||
1444 | //// Has a gender preference been supplied? | 1458 | // Has a gender preference been supplied? |
1445 | 1459 | ||
1446 | //if (requestData.Contains("gender")) | 1460 | if (requestData.Contains("gender")) |
1447 | //{ | 1461 | { |
1448 | // switch ((string)requestData["gender"]) | 1462 | switch ((string)requestData["gender"]) |
1449 | // { | 1463 | { |
1450 | // case "m" : | 1464 | case "m" : |
1451 | // model = dmale; | 1465 | case "male" : |
1452 | // break; | 1466 | model = dmale; |
1453 | // case "f" : | 1467 | break; |
1454 | // model = dfemale; | 1468 | case "f" : |
1455 | // break; | 1469 | case "female" : |
1456 | // case "n" : | 1470 | model = dfemale; |
1457 | // default : | 1471 | break; |
1458 | // model = dneut; | 1472 | case "n" : |
1459 | // break; | 1473 | case "neutral" : |
1460 | // } | 1474 | default : |
1461 | //} | 1475 | model = dneut; |
1462 | 1476 | break; | |
1463 | //// Has an explicit model been specified? | 1477 | } |
1464 | 1478 | } | |
1465 | //if (requestData.Contains("model")) | 1479 | |
1466 | //{ | 1480 | // Has an explicit model been specified? |
1467 | // model = (string)requestData["model"]; | 1481 | |
1468 | //} | 1482 | if (requestData.Contains("model") && (String.IsNullOrEmpty((string)requestData["gender"]))) |
1469 | 1483 | { | |
1470 | //// No appearance attributes were set | 1484 | model = (string)requestData["model"]; |
1471 | 1485 | } | |
1472 | //if (model == String.Empty) | 1486 | |
1473 | //{ | 1487 | // No appearance attributes were set |
1474 | // m_log.DebugFormat("[RADMIN] Appearance update not requested"); | 1488 | |
1475 | // return; | 1489 | if (String.IsNullOrEmpty(model)) |
1476 | //} | 1490 | { |
1477 | 1491 | m_log.DebugFormat("[RADMIN] Appearance update not requested"); | |
1478 | //m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); | 1492 | return; |
1479 | 1493 | } | |
1480 | //string[] nomens = model.Split(); | 1494 | |
1481 | //if (nomens.Length != 2) | 1495 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); |
1482 | //{ | 1496 | |
1483 | // m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); | 1497 | string[] nomens = model.Split(); |
1484 | // // nomens = dmodel.Split(); | 1498 | if (nomens.Length != 2) |
1485 | // return; | 1499 | { |
1486 | //} | 1500 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); |
1487 | 1501 | // nomens = dmodel.Split(); | |
1488 | //UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); | 1502 | return; |
1489 | 1503 | } | |
1490 | //// Is this the first time one of the default models has been used? Create it if that is the case | 1504 | |
1491 | //// otherwise default to male. | 1505 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; |
1492 | 1506 | UUID scopeID = scene.RegionInfo.ScopeID; | |
1493 | //if (mprof == null) | 1507 | UserAccount mprof = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); |
1494 | //{ | 1508 | |
1495 | // m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); | 1509 | if (mprof == null) |
1496 | // return; | 1510 | { |
1497 | //} | 1511 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); |
1498 | 1512 | return; | |
1499 | //// Set current user's appearance. This bit is easy. The appearance structure is populated with | 1513 | } |
1500 | //// actual asset ids, however to complete the magic we need to populate the inventory with the | 1514 | |
1501 | //// assets in question. | 1515 | // Set current user's appearance. This bit is easy. The appearance structure is populated with |
1502 | 1516 | // actual asset ids, however to complete the magic we need to populate the inventory with the | |
1503 | //establishAppearance(userid, mprof.ID); | 1517 | // assets in question. |
1518 | |||
1519 | establishAppearance(userid, mprof.PrincipalID); | ||
1504 | 1520 | ||
1505 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", | 1521 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", |
1506 | userid, model); | 1522 | userid, model); |
@@ -1515,116 +1531,312 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1515 | private void establishAppearance(UUID dest, UUID srca) | 1531 | private void establishAppearance(UUID dest, UUID srca) |
1516 | { | 1532 | { |
1517 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); | 1533 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); |
1534 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | ||
1518 | AvatarAppearance ava = null; | 1535 | AvatarAppearance ava = null; |
1519 | AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca); | 1536 | AvatarData avatar = scene.AvatarService.GetAvatar(srca); |
1520 | if (avatar != null) | 1537 | if (avatar != null) |
1521 | ava = avatar.ToAvatarAppearance(srca); | 1538 | ava = avatar.ToAvatarAppearance(srca); |
1522 | 1539 | ||
1523 | // If the model has no associated appearance we're done. | 1540 | // If the model has no associated appearance we're done. |
1524 | |||
1525 | // if (ava == null) | ||
1526 | // { | ||
1527 | // return new AvatarAppearance(); | ||
1528 | // } | ||
1529 | |||
1530 | if (ava == null) | 1541 | if (ava == null) |
1531 | return; | 1542 | return; |
1532 | 1543 | ||
1533 | UICallback sic = new UICallback(); | 1544 | // Simple appearance copy or copy Clothing and Bodyparts folders? |
1534 | UICallback dic = new UICallback(); | 1545 | bool copyFolders = m_config.GetBoolean("copy_folders", false); |
1535 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | 1546 | |
1547 | if (!copyFolders) | ||
1548 | { | ||
1549 | // Simple copy of wearables and appearance update | ||
1550 | try | ||
1551 | { | ||
1552 | copyWearablesAndAttachments(dest, srca, ava); | ||
1536 | 1553 | ||
1554 | AvatarData adata = new AvatarData(ava); | ||
1555 | scene.AvatarService.SetAvatar(dest, adata); | ||
1556 | } | ||
1557 | catch (Exception e) | ||
1558 | { | ||
1559 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", | ||
1560 | dest, e.Message); | ||
1561 | } | ||
1562 | |||
1563 | return; | ||
1564 | } | ||
1565 | |||
1566 | // Copy Clothing and Bodypart folders and appearance update | ||
1537 | try | 1567 | try |
1538 | { | 1568 | { |
1539 | Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>(); | 1569 | Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>(); |
1570 | copyInventoryFolders(dest, srca, AssetType.Clothing, imap, ava); | ||
1571 | copyInventoryFolders(dest, srca, AssetType.Bodypart, imap, ava); | ||
1540 | 1572 | ||
1541 | iserv.GetUserInventory(dest, dic.callback); | 1573 | AvatarWearable[] wearables = ava.Wearables; |
1542 | iserv.GetUserInventory(srca, sic.callback); | ||
1543 | |||
1544 | dic.GetInventory(); | ||
1545 | sic.GetInventory(); | ||
1546 | 1574 | ||
1547 | if (sic.OK && dic.OK) | 1575 | for (int i=0; i<wearables.Length; i++) |
1548 | { | 1576 | { |
1549 | InventoryFolderImpl efolder; | 1577 | if (imap.ContainsKey(wearables[i].ItemID)) |
1550 | InventoryFolderImpl srcf = sic.root.FindFolderForType(5); | 1578 | { |
1551 | InventoryFolderImpl dstf = dic.root.FindFolderForType(5); | 1579 | AvatarWearable dw = new AvatarWearable(); |
1580 | dw.AssetID = wearables[i].AssetID; | ||
1581 | dw.ItemID = imap[wearables[i].ItemID]; | ||
1582 | ava.SetWearable(i, dw); | ||
1583 | } | ||
1584 | } | ||
1585 | |||
1586 | AvatarData adata = new AvatarData(ava); | ||
1587 | scene.AvatarService.SetAvatar(dest, adata); | ||
1588 | } | ||
1589 | catch (Exception e) | ||
1590 | { | ||
1591 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", | ||
1592 | dest, e.Message); | ||
1593 | } | ||
1552 | 1594 | ||
1553 | if (srcf == null || dstf == null) | 1595 | return; |
1554 | throw new Exception("Cannot locate clothing folder(s)"); | 1596 | } |
1597 | |||
1598 | /// <summary> | ||
1599 | /// This method is called by establishAppearance to do a copy all inventory items | ||
1600 | /// worn or attached to the Clothing inventory folder of the receiving avatar. | ||
1601 | /// In parallel the avatar wearables and attachments are updated. | ||
1602 | /// </summary> | ||
1603 | |||
1604 | private void copyWearablesAndAttachments(UUID dest, UUID srca, AvatarAppearance ava) | ||
1605 | { | ||
1606 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | ||
1555 | 1607 | ||
1556 | foreach (InventoryFolderImpl folder in sic.folders) | 1608 | // Get Clothing folder of receiver |
1609 | InventoryFolderBase dstf = iserv.GetFolderForType(dest, AssetType.Clothing); | ||
1610 | |||
1611 | if (dstf == null) | ||
1612 | throw new Exception("Cannot locate folder(s)"); | ||
1613 | |||
1614 | // Missing destination folder? This should *never* be the case | ||
1615 | if (dstf.Type != (short)AssetType.Clothing) | ||
1616 | { | ||
1617 | dstf = new InventoryFolderBase(); | ||
1618 | dstf.ID = UUID.Random(); | ||
1619 | dstf.Name = "Clothing"; | ||
1620 | dstf.Owner = dest; | ||
1621 | dstf.Type = (short)AssetType.Clothing; | ||
1622 | dstf.ParentID = iserv.GetRootFolder(dest).ID; | ||
1623 | dstf.Version = 1; | ||
1624 | iserv.AddFolder(dstf); // store base record | ||
1625 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); | ||
1626 | } | ||
1627 | |||
1628 | // Wearables | ||
1629 | AvatarWearable[] wearables = ava.Wearables; | ||
1630 | AvatarWearable wearable; | ||
1631 | |||
1632 | for (int i=0; i<wearables.Length; i++) | ||
1633 | { | ||
1634 | wearable = wearables[i]; | ||
1635 | if (wearable.ItemID != UUID.Zero) | ||
1636 | { | ||
1637 | // Get inventory item and copy it | ||
1638 | InventoryItemBase item = new InventoryItemBase(wearable.ItemID, srca); | ||
1639 | item = iserv.GetItem(item); | ||
1640 | |||
1641 | if (item != null) | ||
1557 | { | 1642 | { |
1558 | if (folder.ParentID == srcf.ID) | 1643 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); |
1559 | { | 1644 | dsti.Name = item.Name; |
1560 | efolder = new InventoryFolderImpl(); | 1645 | dsti.Description = item.Description; |
1561 | efolder.ID = UUID.Random(); | 1646 | dsti.InvType = item.InvType; |
1562 | efolder.Name = folder.Name; | 1647 | dsti.CreatorId = item.CreatorId; |
1563 | efolder.Type = folder.Type; | 1648 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; |
1564 | efolder.Version = folder.Version; | 1649 | dsti.NextPermissions = item.NextPermissions; |
1565 | efolder.Owner = dest; | 1650 | dsti.CurrentPermissions = item.CurrentPermissions; |
1566 | dstf.AddChildFolder(efolder); | 1651 | dsti.BasePermissions = item.BasePermissions; |
1567 | iserv.AddFolder(efolder); | 1652 | dsti.EveryOnePermissions = item.EveryOnePermissions; |
1568 | m_log.DebugFormat("[RADMIN] Added outfile folder {0} to folder {1}", efolder.ID, srcf.ID); | 1653 | dsti.GroupPermissions = item.GroupPermissions; |
1569 | foreach (InventoryItemBase item in sic.items) | 1654 | dsti.AssetType = item.AssetType; |
1570 | { | 1655 | dsti.AssetID = item.AssetID; |
1571 | if (item.Folder == folder.ID) | 1656 | dsti.GroupID = item.GroupID; |
1572 | { | 1657 | dsti.GroupOwned = item.GroupOwned; |
1573 | InventoryItemBase dsti = new InventoryItemBase(); | 1658 | dsti.SalePrice = item.SalePrice; |
1574 | dsti.ID = UUID.Random(); | 1659 | dsti.SaleType = item.SaleType; |
1575 | dsti.Name = item.Name; | 1660 | dsti.Flags = item.Flags; |
1576 | dsti.Description = item.Description; | 1661 | dsti.CreationDate = item.CreationDate; |
1577 | dsti.InvType = item.InvType; | 1662 | dsti.Folder = dstf.ID; |
1578 | dsti.AssetType = item.AssetType; | 1663 | |
1579 | dsti.Flags = item.Flags; | 1664 | iserv.AddItem(dsti); |
1580 | dsti.AssetID = item.AssetID; | 1665 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); |
1581 | dsti.Folder = efolder.ID; | 1666 | |
1582 | dsti.Owner = dest; | 1667 | // Wear item |
1583 | dsti.BasePermissions = item.BasePermissions; | 1668 | AvatarWearable dw = new AvatarWearable(); |
1584 | dsti.NextPermissions = item.NextPermissions; | 1669 | dw.AssetID = wearable.AssetID; |
1585 | dsti.CurrentPermissions = item.CurrentPermissions; | 1670 | dw.ItemID = dsti.ID; |
1586 | dsti.GroupPermissions = item.GroupPermissions; | 1671 | ava.SetWearable(i, dw); |
1587 | dsti.EveryOnePermissions = item.EveryOnePermissions; | ||
1588 | iserv.AddItem(dsti); | ||
1589 | imap.Add(item.ID, dsti.ID); | ||
1590 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, efolder.ID); | ||
1591 | } | ||
1592 | } | ||
1593 | } | ||
1594 | } | 1672 | } |
1595 | 1673 | else | |
1596 | // Update appearance tables | ||
1597 | AvatarWearable[] wearables = ava.Wearables; | ||
1598 | for (int i=0; i<wearables.Length; i++) | ||
1599 | { | 1674 | { |
1600 | if (imap.ContainsKey(wearables[i].ItemID)) | 1675 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, dstf.ID); |
1601 | { | ||
1602 | AvatarWearable dw = new AvatarWearable(); | ||
1603 | dw.AssetID = wearables[i].AssetID; | ||
1604 | dw.ItemID = imap[wearables[i].ItemID]; | ||
1605 | ava.SetWearable(i, dw); | ||
1606 | } | ||
1607 | } | 1676 | } |
1608 | } | 1677 | } |
1609 | else | 1678 | } |
1679 | |||
1680 | // Attachments | ||
1681 | Dictionary<int, UUID[]> attachments = ava.GetAttachmentDictionary(); | ||
1682 | |||
1683 | foreach (KeyValuePair<int, UUID[]> kvp in attachments) | ||
1684 | { | ||
1685 | int attachpoint = kvp.Key; | ||
1686 | UUID itemID = kvp.Value[0]; | ||
1687 | |||
1688 | if (itemID != UUID.Zero) | ||
1610 | { | 1689 | { |
1611 | throw new Exception("Unable to load both inventories"); | 1690 | // Get inventory item and copy it |
1691 | InventoryItemBase item = new InventoryItemBase(itemID, srca); | ||
1692 | item = iserv.GetItem(item); | ||
1693 | |||
1694 | if (item != null) | ||
1695 | { | ||
1696 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | ||
1697 | dsti.Name = item.Name; | ||
1698 | dsti.Description = item.Description; | ||
1699 | dsti.InvType = item.InvType; | ||
1700 | dsti.CreatorId = item.CreatorId; | ||
1701 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | ||
1702 | dsti.NextPermissions = item.NextPermissions; | ||
1703 | dsti.CurrentPermissions = item.CurrentPermissions; | ||
1704 | dsti.BasePermissions = item.BasePermissions; | ||
1705 | dsti.EveryOnePermissions = item.EveryOnePermissions; | ||
1706 | dsti.GroupPermissions = item.GroupPermissions; | ||
1707 | dsti.AssetType = item.AssetType; | ||
1708 | dsti.AssetID = item.AssetID; | ||
1709 | dsti.GroupID = item.GroupID; | ||
1710 | dsti.GroupOwned = item.GroupOwned; | ||
1711 | dsti.SalePrice = item.SalePrice; | ||
1712 | dsti.SaleType = item.SaleType; | ||
1713 | dsti.Flags = item.Flags; | ||
1714 | dsti.CreationDate = item.CreationDate; | ||
1715 | dsti.Folder = dstf.ID; | ||
1716 | |||
1717 | iserv.AddItem(dsti); | ||
1718 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); | ||
1719 | |||
1720 | // Attach item | ||
1721 | ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); | ||
1722 | m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); | ||
1723 | } | ||
1724 | else | ||
1725 | { | ||
1726 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, dstf.ID); | ||
1727 | } | ||
1612 | } | 1728 | } |
1729 | } | ||
1613 | 1730 | ||
1614 | AvatarData adata = new AvatarData(ava); | 1731 | |
1615 | m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(dest, adata); | 1732 | } |
1733 | |||
1734 | /// <summary> | ||
1735 | /// This method is called by establishAppearance to copy inventory folders to make | ||
1736 | /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments | ||
1737 | /// </summary> | ||
1738 | |||
1739 | private void copyInventoryFolders(UUID dest, UUID srca, AssetType assettype, Dictionary<UUID,UUID> imap, | ||
1740 | AvatarAppearance ava) | ||
1741 | { | ||
1742 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | ||
1743 | |||
1744 | InventoryFolderBase srcf = iserv.GetFolderForType(srca, assettype); | ||
1745 | InventoryFolderBase dstf = iserv.GetFolderForType(dest, assettype); | ||
1746 | |||
1747 | if (srcf == null || dstf == null) | ||
1748 | throw new Exception("Cannot locate folder(s)"); | ||
1749 | |||
1750 | // Missing source folder? This should *never* be the case | ||
1751 | if (srcf.Type != (short)assettype) | ||
1752 | { | ||
1753 | srcf = new InventoryFolderBase(); | ||
1754 | srcf.ID = UUID.Random(); | ||
1755 | if (assettype == AssetType.Clothing) { | ||
1756 | srcf.Name = "Clothing"; | ||
1757 | } else { | ||
1758 | srcf.Name = "Body Parts"; | ||
1759 | } | ||
1760 | srcf.Owner = srca; | ||
1761 | srcf.Type = (short)assettype; | ||
1762 | srcf.ParentID = iserv.GetRootFolder(srca).ID; | ||
1763 | srcf.Version = 1; | ||
1764 | iserv.AddFolder(srcf); // store base record | ||
1765 | m_log.ErrorFormat("[RADMIN] Created folder for source {0}", srca); | ||
1616 | } | 1766 | } |
1617 | catch (Exception e) | 1767 | |
1768 | // Missing destination folder? This should *never* be the case | ||
1769 | if (dstf.Type != (short)assettype) | ||
1618 | { | 1770 | { |
1619 | m_log.WarnFormat("[RADMIN] Error transferring inventory for {0} : {1}", | 1771 | dstf = new InventoryFolderBase(); |
1620 | dest, e.Message); | 1772 | dstf.ID = UUID.Random(); |
1621 | return; | 1773 | dstf.Name = assettype.ToString(); |
1774 | dstf.Owner = dest; | ||
1775 | dstf.Type = (short)assettype; | ||
1776 | dstf.ParentID = iserv.GetRootFolder(dest).ID; | ||
1777 | dstf.Version = 1; | ||
1778 | iserv.AddFolder(dstf); // store base record | ||
1779 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); | ||
1622 | } | 1780 | } |
1623 | 1781 | ||
1624 | return; | 1782 | InventoryFolderBase efolder; |
1783 | List<InventoryFolderBase> folders = iserv.GetFolderContent(srca, srcf.ID).Folders; | ||
1784 | |||
1785 | foreach (InventoryFolderBase folder in folders) | ||
1786 | { | ||
1787 | |||
1788 | efolder = new InventoryFolderBase(); | ||
1789 | efolder.ID = UUID.Random(); | ||
1790 | efolder.Name = folder.Name; | ||
1791 | efolder.Owner = dest; | ||
1792 | efolder.Type = folder.Type; | ||
1793 | efolder.Version = folder.Version; | ||
1794 | efolder.ParentID = dstf.ID; | ||
1795 | iserv.AddFolder(efolder); | ||
1796 | |||
1797 | m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", efolder.ID, srcf.ID); | ||
1798 | |||
1799 | List<InventoryItemBase> items = iserv.GetFolderContent(srca, folder.ID).Items; | ||
1800 | |||
1801 | foreach (InventoryItemBase item in items) | ||
1802 | { | ||
1803 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | ||
1804 | dsti.Name = item.Name; | ||
1805 | dsti.Description = item.Description; | ||
1806 | dsti.InvType = item.InvType; | ||
1807 | dsti.CreatorId = item.CreatorId; | ||
1808 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | ||
1809 | dsti.NextPermissions = item.NextPermissions; | ||
1810 | dsti.CurrentPermissions = item.CurrentPermissions; | ||
1811 | dsti.BasePermissions = item.BasePermissions; | ||
1812 | dsti.EveryOnePermissions = item.EveryOnePermissions; | ||
1813 | dsti.GroupPermissions = item.GroupPermissions; | ||
1814 | dsti.AssetType = item.AssetType; | ||
1815 | dsti.AssetID = item.AssetID; | ||
1816 | dsti.GroupID = item.GroupID; | ||
1817 | dsti.GroupOwned = item.GroupOwned; | ||
1818 | dsti.SalePrice = item.SalePrice; | ||
1819 | dsti.SaleType = item.SaleType; | ||
1820 | dsti.Flags = item.Flags; | ||
1821 | dsti.CreationDate = item.CreationDate; | ||
1822 | dsti.Folder = efolder.ID; | ||
1823 | |||
1824 | iserv.AddItem(dsti); | ||
1825 | imap.Add(item.ID, dsti.ID); | ||
1826 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, efolder.ID); | ||
1827 | |||
1828 | // Attach item, if original is attached | ||
1829 | int attachpoint = ava.GetAttachpoint(item.ID); | ||
1830 | if (attachpoint != 0) | ||
1831 | { | ||
1832 | ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); | ||
1833 | m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); | ||
1834 | } | ||
1835 | } | ||
1836 | } | ||
1625 | } | 1837 | } |
1626 | 1838 | ||
1627 | ///<summary> | 1839 | /// <summary> |
1628 | /// This method is called if a given model avatar name can not be found. If the external | 1840 | /// This method is called if a given model avatar name can not be found. If the external |
1629 | /// file has already been loaded once, then control returns immediately. If not, then it | 1841 | /// file has already been loaded once, then control returns immediately. If not, then it |
1630 | /// looks for a default appearance file. This file contains XML definitions of zero or more named | 1842 | /// looks for a default appearance file. This file contains XML definitions of zero or more named |
@@ -1675,9 +1887,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1675 | bool include = false; | 1887 | bool include = false; |
1676 | bool select = false; | 1888 | bool select = false; |
1677 | 1889 | ||
1678 | UICallback uic; | 1890 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; |
1679 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | 1891 | IInventoryService iserv = scene.InventoryService; |
1680 | IAssetService aserv = m_app.SceneManager.CurrentOrFirstScene.AssetService; | 1892 | IAssetService aserv = scene.AssetService; |
1681 | 1893 | ||
1682 | doc.LoadXml(File.ReadAllText(dafn)); | 1894 | doc.LoadXml(File.ReadAllText(dafn)); |
1683 | 1895 | ||
@@ -1714,29 +1926,31 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1714 | passwd = GetStringAttribute(avatar,"password",passwd); | 1926 | passwd = GetStringAttribute(avatar,"password",passwd); |
1715 | 1927 | ||
1716 | string[] nomens = name.Split(); | 1928 | string[] nomens = name.Split(); |
1717 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 1929 | UUID scopeID = scene.RegionInfo.ScopeID; |
1718 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); | 1930 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); |
1719 | if (null == account) | 1931 | if (null == account) |
1720 | { | 1932 | { |
1721 | account = new UserAccount(scopeID, nomens[0], nomens[1], email); | 1933 | account = CreateUser(scopeID, nomens[0], nomens[1], passwd, email); |
1722 | bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account); | 1934 | if (null == account) |
1723 | if (!success) | ||
1724 | { | 1935 | { |
1725 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); | 1936 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); |
1726 | return false; | 1937 | return false; |
1727 | } | 1938 | } |
1728 | // !!! REFACTORING PROBLEM: need to set the password | ||
1729 | |||
1730 | GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID, | ||
1731 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | ||
1732 | if (home != null) | ||
1733 | m_app.SceneManager.CurrentOrFirstScene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1734 | } | 1939 | } |
1735 | else | 1940 | |
1736 | { | 1941 | // Set home position |
1737 | ID = account.PrincipalID; | 1942 | |
1943 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | ||
1944 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | ||
1945 | if (null == home) { | ||
1946 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", nomens[0], nomens[1]); | ||
1947 | } else { | ||
1948 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1949 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, nomens[0], nomens[1]); | ||
1738 | } | 1950 | } |
1739 | 1951 | ||
1952 | ID = account.PrincipalID; | ||
1953 | |||
1740 | m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); | 1954 | m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); |
1741 | include = true; | 1955 | include = true; |
1742 | } | 1956 | } |
@@ -1753,46 +1967,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1753 | 1967 | ||
1754 | if (include) | 1968 | if (include) |
1755 | { | 1969 | { |
1756 | uic = new UICallback(); | 1970 | // Setup for appearance processing |
1757 | // Request the inventory | 1971 | AvatarData adata = scene.AvatarService.GetAvatar(ID); |
1758 | iserv.GetUserInventory(ID, uic.callback); | ||
1759 | |||
1760 | // While the inventory is being fetched, setup for appearance processing | ||
1761 | AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID); | ||
1762 | if (adata != null) | 1972 | if (adata != null) |
1763 | mava = adata.ToAvatarAppearance(ID); | 1973 | mava = adata.ToAvatarAppearance(ID); |
1764 | else | 1974 | else |
1765 | mava = new AvatarAppearance(); | 1975 | mava = new AvatarAppearance(); |
1766 | 1976 | ||
1977 | AvatarWearable[] wearables = mava.Wearables; | ||
1978 | for (int i=0; i<wearables.Length; i++) | ||
1767 | { | 1979 | { |
1768 | AvatarWearable[] wearables = mava.Wearables; | 1980 | wearables[i] = new AvatarWearable(); |
1769 | for (int i=0; i<wearables.Length; i++) | ||
1770 | { | ||
1771 | wearables[i] = new AvatarWearable(); | ||
1772 | } | ||
1773 | } | 1981 | } |
1774 | 1982 | ||
1775 | // Wait for the inventory to arrive | ||
1776 | uic.GetInventory(); | ||
1777 | |||
1778 | // We can only get dresssed if an inventory is forthcoming | ||
1779 | if (uic.OK) | ||
1780 | try | 1983 | try |
1781 | { | 1984 | { |
1782 | m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", | 1985 | // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", |
1783 | uic.folders.Count, uic.items.Count); | 1986 | // uic.folders.Count, uic.items.Count); |
1784 | 1987 | ||
1785 | InventoryFolderImpl cfolder = uic.root.FindFolderForType(5); | 1988 | InventoryFolderBase cfolder = iserv.GetFolderForType(ID, AssetType.Clothing); |
1786 | 1989 | ||
1787 | // This should *never* be the case | 1990 | // This should *never* be the case |
1788 | if (cfolder == null) | 1991 | if (cfolder == null || cfolder.Type != (short)AssetType.Clothing) |
1789 | { | 1992 | { |
1790 | cfolder = new InventoryFolderImpl(); | 1993 | cfolder = new InventoryFolderBase(); |
1994 | cfolder.ID = UUID.Random(); | ||
1791 | cfolder.Name = "Clothing"; | 1995 | cfolder.Name = "Clothing"; |
1792 | cfolder.Type = 5; | ||
1793 | cfolder.Version = 1; | ||
1794 | cfolder.Owner = ID; | 1996 | cfolder.Owner = ID; |
1795 | uic.root.AddChildFolder(cfolder); // make connection | 1997 | cfolder.Type = (short)AssetType.Clothing; |
1998 | cfolder.ParentID = iserv.GetRootFolder(ID).ID; | ||
1999 | cfolder.Version = 1; | ||
1796 | iserv.AddFolder(cfolder); // store base record | 2000 | iserv.AddFolder(cfolder); // store base record |
1797 | m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); | 2001 | m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); |
1798 | } | 2002 | } |
@@ -1801,7 +2005,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1801 | // default appearance XMl file. | 2005 | // default appearance XMl file. |
1802 | 2006 | ||
1803 | XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble"); | 2007 | XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble"); |
1804 | InventoryFolderImpl efolder; | 2008 | InventoryFolderBase efolder; |
1805 | string oname; | 2009 | string oname; |
1806 | UUID assetid; | 2010 | UUID assetid; |
1807 | 2011 | ||
@@ -1812,13 +2016,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1812 | 2016 | ||
1813 | oname = GetStringAttribute(outfit,"name",""); | 2017 | oname = GetStringAttribute(outfit,"name",""); |
1814 | select = (GetStringAttribute(outfit,"default","no") == "yes"); | 2018 | select = (GetStringAttribute(outfit,"default","no") == "yes"); |
1815 | efolder = null; | ||
1816 | 2019 | ||
1817 | // If the folder already exists, re-use it. The defaults may | 2020 | // If the folder already exists, re-use it. The defaults may |
1818 | // change over time. Augment only. | 2021 | // change over time. Augment only. |
1819 | foreach (InventoryFolderImpl folder in uic.folders) | 2022 | |
2023 | List<InventoryFolderBase> folders = iserv.GetFolderContent(ID, cfolder.ID).Folders; | ||
2024 | efolder = null; | ||
2025 | |||
2026 | foreach (InventoryFolderBase folder in folders) | ||
1820 | { | 2027 | { |
1821 | if (folder.Name == oname && folder.ParentID == cfolder.ID) | 2028 | if (folder.Name == oname) |
1822 | { | 2029 | { |
1823 | efolder = folder; | 2030 | efolder = folder; |
1824 | break; | 2031 | break; |
@@ -1829,14 +2036,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1829 | if (efolder == null) | 2036 | if (efolder == null) |
1830 | { | 2037 | { |
1831 | m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", oname, name); | 2038 | m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", oname, name); |
1832 | efolder = new InventoryFolderImpl(); | 2039 | efolder = new InventoryFolderBase(); |
1833 | efolder.ID = UUID.Random(); | 2040 | efolder.ID = UUID.Random(); |
1834 | efolder.Name = oname; | 2041 | efolder.Name = oname; |
1835 | efolder.Type = 5; | ||
1836 | efolder.Version = 1; | ||
1837 | efolder.Owner = ID; | 2042 | efolder.Owner = ID; |
1838 | cfolder.AddChildFolder(efolder); // make connection | 2043 | efolder.Type = (short)AssetType.Clothing; |
1839 | iserv.AddFolder(efolder); // store base record | 2044 | efolder.Version = 1; |
2045 | efolder.ParentID = cfolder.ID; | ||
2046 | iserv.AddFolder(efolder); | ||
1840 | m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", efolder.ID, cfolder.ID); | 2047 | m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", efolder.ID, cfolder.ID); |
1841 | } | 2048 | } |
1842 | 2049 | ||
@@ -1863,26 +2070,55 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1863 | 2070 | ||
1864 | InventoryItemBase iitem = null; | 2071 | InventoryItemBase iitem = null; |
1865 | 2072 | ||
1866 | if ((iitem = efolder.FindAsset(assetid)) == null) | 2073 | // Check if asset is in inventory already |
2074 | iitem = null; | ||
2075 | List<InventoryItemBase> iitems = iserv.GetFolderContent(ID, efolder.ID).Items; | ||
2076 | |||
2077 | foreach (InventoryItemBase litem in iitems) | ||
2078 | { | ||
2079 | if (litem.AssetID == assetid) | ||
2080 | { | ||
2081 | iitem = litem; | ||
2082 | break; | ||
2083 | } | ||
2084 | } | ||
2085 | |||
2086 | // Create inventory item | ||
2087 | if (iitem == null) | ||
1867 | { | 2088 | { |
1868 | iitem = new InventoryItemBase(); | 2089 | iitem = new InventoryItemBase(UUID.Random(), ID); |
1869 | iitem.ID = UUID.Random(); | ||
1870 | iitem.Name = GetStringAttribute(item,"name",""); | 2090 | iitem.Name = GetStringAttribute(item,"name",""); |
1871 | iitem.Description = GetStringAttribute(item,"desc",""); | 2091 | iitem.Description = GetStringAttribute(item,"desc",""); |
1872 | iitem.InvType = GetIntegerAttribute(item,"invtype",-1); | 2092 | iitem.InvType = GetIntegerAttribute(item,"invtype",-1); |
1873 | iitem.AssetType = GetIntegerAttribute(item,"assettype",-1); | 2093 | iitem.CreatorId = GetStringAttribute(item,"creatorid",""); |
1874 | iitem.Flags = GetUnsignedAttribute(item,"flags",0); | 2094 | iitem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid",""); |
1875 | iitem.AssetID = assetid; // associated asset | ||
1876 | iitem.Folder = efolder.ID; // Parent folder | ||
1877 | iitem.Owner = ID; // Agent ID | ||
1878 | iitem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); | ||
1879 | iitem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); | 2095 | iitem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); |
1880 | iitem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); | 2096 | iitem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); |
1881 | iitem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff); | 2097 | iitem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); |
1882 | iitem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); | 2098 | iitem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); |
1883 | m_log.DebugFormat("[RADMIN] Adding item {0} to folder {1}", iitem.ID, efolder.ID); | 2099 | iitem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff); |
2100 | iitem.AssetType = GetIntegerAttribute(item,"assettype",-1); | ||
2101 | iitem.AssetID = assetid; // associated asset | ||
2102 | iitem.GroupID = (UUID)GetStringAttribute(item,"groupid",""); | ||
2103 | iitem.GroupOwned = (GetStringAttribute(item,"groupowned","false") == "true"); | ||
2104 | iitem.SalePrice = GetIntegerAttribute(item,"saleprice",0); | ||
2105 | iitem.SaleType = (byte)GetIntegerAttribute(item,"saletype",0); | ||
2106 | iitem.Flags = GetUnsignedAttribute(item,"flags",0); | ||
2107 | iitem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); | ||
2108 | iitem.Folder = efolder.ID; // Parent folder | ||
2109 | |||
1884 | iserv.AddItem(iitem); | 2110 | iserv.AddItem(iitem); |
2111 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", iitem.ID, efolder.ID); | ||
2112 | } | ||
2113 | |||
2114 | // Attach item, if attachpoint is specified | ||
2115 | int attachpoint = GetIntegerAttribute(item,"attachpoint",0); | ||
2116 | if (attachpoint != 0) | ||
2117 | { | ||
2118 | mava.SetAttachment(attachpoint, iitem.ID, iitem.AssetID); | ||
2119 | m_log.DebugFormat("[RADMIN] Attached {0}", iitem.ID); | ||
1885 | } | 2120 | } |
2121 | |||
1886 | // Record whether or not the item is to be initially worn | 2122 | // Record whether or not the item is to be initially worn |
1887 | try | 2123 | try |
1888 | { | 2124 | { |
@@ -1892,25 +2128,22 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1892 | mava.Wearables[iitem.Flags].AssetID = iitem.AssetID; | 2128 | mava.Wearables[iitem.Flags].AssetID = iitem.AssetID; |
1893 | } | 2129 | } |
1894 | } | 2130 | } |
1895 | catch {} | 2131 | catch (Exception e) |
2132 | { | ||
2133 | m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", iitem.ID, e.Message); | ||
2134 | } | ||
1896 | } // foreach item in outfit | 2135 | } // foreach item in outfit |
1897 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); | 2136 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); |
1898 | } // foreach outfit | 2137 | } // foreach outfit |
1899 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); | 2138 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); |
1900 | AvatarData adata2 = new AvatarData(mava); | 2139 | AvatarData adata2 = new AvatarData(mava); |
1901 | m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(ID, adata2); | 2140 | scene.AvatarService.SetAvatar(ID, adata2); |
1902 | } | 2141 | } |
1903 | catch (Exception e) | 2142 | catch (Exception e) |
1904 | { | 2143 | { |
1905 | m_log.WarnFormat("[RADMIN] Inventory processing incomplete for user {0} : {1}", | 2144 | m_log.WarnFormat("[RADMIN] Inventory processing incomplete for user {0} : {1}", |
1906 | name, e.Message); | 2145 | name, e.Message); |
1907 | } | 2146 | } |
1908 | else | ||
1909 | { | ||
1910 | m_log.WarnFormat("[RADMIN] Unable to retrieve inventory for {0}[{1}]", | ||
1911 | name, ID); | ||
1912 | // continue to next avatar | ||
1913 | } | ||
1914 | } // End of include | 2147 | } // End of include |
1915 | } | 2148 | } |
1916 | m_log.DebugFormat("[RADMIN] Default avatar loading complete"); | 2149 | m_log.DebugFormat("[RADMIN] Default avatar loading complete"); |
@@ -2778,81 +3011,115 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2778 | public void Dispose() | 3011 | public void Dispose() |
2779 | { | 3012 | { |
2780 | } | 3013 | } |
2781 | } | ||
2782 | |||
2783 | class UICallback | ||
2784 | { | ||
2785 | private Object uilock = new Object(); | ||
2786 | internal InventoryFolderImpl root = null; | ||
2787 | internal List<InventoryFolderImpl> folders; | ||
2788 | internal List<InventoryItemBase> items; | ||
2789 | internal bool OK = false; | ||
2790 | |||
2791 | public void callback(ICollection<InventoryFolderImpl> p_folders, ICollection<InventoryItemBase> p_items) | ||
2792 | { | ||
2793 | lock (uilock) | ||
2794 | { | ||
2795 | folders = (List<InventoryFolderImpl>) p_folders; | ||
2796 | items = (List<InventoryItemBase>) p_items; | ||
2797 | OK = true; | ||
2798 | System.Threading.Monitor.Pulse(uilock); | ||
2799 | } | ||
2800 | } | ||
2801 | 3014 | ||
2802 | public void GetInventory() | 3015 | /// <summary> |
3016 | /// Create a user | ||
3017 | /// </summary> | ||
3018 | /// <param name="scopeID"></param> | ||
3019 | /// <param name="firstName"></param> | ||
3020 | /// <param name="lastName"></param> | ||
3021 | /// <param name="password"></param> | ||
3022 | /// <param name="email"></param> | ||
3023 | private UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email) | ||
2803 | { | 3024 | { |
2804 | Dictionary<UUID, InventoryFolderImpl> fmap = new Dictionary<UUID, InventoryFolderImpl>(); | 3025 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; |
2805 | 3026 | IUserAccountService m_UserAccountService = scene.UserAccountService; | |
2806 | if (OK == false) | 3027 | IGridService m_GridService = scene.GridService; |
3028 | IAuthenticationService m_AuthenticationService = scene.AuthenticationService; | ||
3029 | IGridUserService m_GridUserService = scene.GridUserService; | ||
3030 | IInventoryService m_InventoryService = scene.InventoryService; | ||
3031 | |||
3032 | UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); | ||
3033 | if (null == account) | ||
2807 | { | 3034 | { |
2808 | lock (uilock) | 3035 | account = new UserAccount(scopeID, firstName, lastName, email); |
3036 | if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) | ||
2809 | { | 3037 | { |
2810 | if (OK == false) | 3038 | account.ServiceURLs = new Dictionary<string, object>(); |
2811 | System.Threading.Monitor.Wait(uilock); | 3039 | account.ServiceURLs["HomeURI"] = string.Empty; |
3040 | account.ServiceURLs["GatekeeperURI"] = string.Empty; | ||
3041 | account.ServiceURLs["InventoryServerURI"] = string.Empty; | ||
3042 | account.ServiceURLs["AssetServerURI"] = string.Empty; | ||
2812 | } | 3043 | } |
2813 | } | ||
2814 | |||
2815 | // Got the inventory OK. So now merge the content of the default appearance | ||
2816 | // file with whatever we already have in-world. For convenience we initialize | ||
2817 | // the inventory hierarchy. | ||
2818 | 3044 | ||
2819 | // Find root and build an index | 3045 | if (m_UserAccountService.StoreUserAccount(account)) |
2820 | |||
2821 | foreach (InventoryFolderImpl folder in folders) | ||
2822 | { | ||
2823 | if (folder.ParentID == UUID.Zero) | ||
2824 | { | 3046 | { |
2825 | if (root == null) | 3047 | bool success; |
3048 | if (m_AuthenticationService != null) | ||
2826 | { | 3049 | { |
2827 | root = folder; | 3050 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); |
3051 | if (!success) | ||
3052 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", | ||
3053 | firstName, lastName); | ||
3054 | } | ||
3055 | |||
3056 | GridRegion home = null; | ||
3057 | if (m_GridService != null) | ||
3058 | { | ||
3059 | List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); | ||
3060 | if (defaultRegions != null && defaultRegions.Count >= 1) | ||
3061 | home = defaultRegions[0]; | ||
3062 | |||
3063 | if (m_GridUserService != null && home != null) | ||
3064 | m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
3065 | else | ||
3066 | m_log.WarnFormat("[RADMIN]: Unable to set home for account {0} {1}.", | ||
3067 | firstName, lastName); | ||
2828 | } | 3068 | } |
2829 | else | 3069 | else |
3070 | m_log.WarnFormat("[RADMIN]: Unable to retrieve home region for account {0} {1}.", | ||
3071 | firstName, lastName); | ||
3072 | |||
3073 | if (m_InventoryService != null) | ||
2830 | { | 3074 | { |
2831 | throw new Exception("Multiple root folders found"); | 3075 | success = m_InventoryService.CreateUserInventory(account.PrincipalID); |
3076 | if (!success) | ||
3077 | m_log.WarnFormat("[RADMIN]: Unable to create inventory for account {0} {1}.", | ||
3078 | firstName, lastName); | ||
2832 | } | 3079 | } |
3080 | |||
3081 | m_log.InfoFormat("[RADMIN]: Account {0} {1} created successfully", firstName, lastName); | ||
3082 | return account; | ||
3083 | } else { | ||
3084 | m_log.ErrorFormat("[RADMIN]: Account creation failed for account {0} {1}", firstName, lastName); | ||
2833 | } | 3085 | } |
2834 | fmap.Add(folder.ID, folder); | ||
2835 | } | 3086 | } |
2836 | 3087 | else | |
2837 | // Hard to continue if the root folder is not there | ||
2838 | if (root == null) | ||
2839 | { | 3088 | { |
2840 | throw new Exception("Root folder not found"); | 3089 | m_log.ErrorFormat("[RADMIN]: A user with the name {0} {1} already exists!", firstName, lastName); |
2841 | } | 3090 | } |
3091 | return null; | ||
3092 | } | ||
2842 | 3093 | ||
2843 | // Construct the folder hierarchy | 3094 | /// <summary> |
2844 | foreach (InventoryFolderImpl folder in folders) | 3095 | /// Change password |
3096 | /// </summary> | ||
3097 | /// <param name="firstName"></param> | ||
3098 | /// <param name="lastName"></param> | ||
3099 | /// <param name="password"></param> | ||
3100 | private bool ChangeUserPassword(string firstName, string lastName, string password) | ||
3101 | { | ||
3102 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | ||
3103 | IUserAccountService m_UserAccountService = scene.UserAccountService; | ||
3104 | IAuthenticationService m_AuthenticationService = scene.AuthenticationService; | ||
3105 | |||
3106 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); | ||
3107 | if (null != account) | ||
2845 | { | 3108 | { |
2846 | if (folder.ID != root.ID) | 3109 | bool success = false; |
2847 | { | 3110 | if (m_AuthenticationService != null) |
2848 | fmap[folder.ParentID].AddChildFolder(folder); | 3111 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); |
3112 | if (!success) { | ||
3113 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", | ||
3114 | firstName, lastName); | ||
3115 | return false; | ||
2849 | } | 3116 | } |
3117 | return true; | ||
2850 | } | 3118 | } |
2851 | 3119 | else | |
2852 | // Find a home for every pre-existing item | ||
2853 | foreach (InventoryItemBase item in items) | ||
2854 | { | 3120 | { |
2855 | fmap[item.Folder].Items.Add(item.ID, item); | 3121 | m_log.ErrorFormat("[RADMIN]: No such user"); |
3122 | return false; | ||
2856 | } | 3123 | } |
2857 | } | 3124 | } |
2858 | } | 3125 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f63089d..d3d6f25 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -373,7 +373,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
373 | // Save avatar attachment information | 373 | // Save avatar attachment information |
374 | if (m_scene.AvatarFactory != null) | 374 | if (m_scene.AvatarFactory != null) |
375 | { | 375 | { |
376 | m_log.Debug("[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID); | 376 | m_log.Debug("[ATTACHMENTS MODULE]: Dettaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); |
377 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 377 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); |
378 | } | 378 | } |
379 | } | 379 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 22c8937..7e5a8ec 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
198 | 198 | ||
199 | public void UpdateDatabase(UUID user, AvatarAppearance appearance) | 199 | public void UpdateDatabase(UUID user, AvatarAppearance appearance) |
200 | { | 200 | { |
201 | //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); | 201 | m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); |
202 | AvatarData adata = new AvatarData(appearance); | 202 | AvatarData adata = new AvatarData(appearance); |
203 | m_scene.AvatarService.SetAvatar(user, adata); | 203 | m_scene.AvatarService.SetAvatar(user, adata); |
204 | } | 204 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3fcc0e8..927eeab 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -396,7 +396,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
396 | agent.Position = position; | 396 | agent.Position = position; |
397 | SetCallbackURL(agent, sp.Scene.RegionInfo); | 397 | SetCallbackURL(agent, sp.Scene.RegionInfo); |
398 | 398 | ||
399 | UpdateAgent(reg, finalDestination, agent); | 399 | if (!UpdateAgent(reg, finalDestination, agent)) |
400 | { | ||
401 | // Region doesn't take it | ||
402 | Fail(sp, finalDestination); | ||
403 | return; | ||
404 | } | ||
400 | 405 | ||
401 | m_log.DebugFormat( | 406 | m_log.DebugFormat( |
402 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); | 407 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); |
@@ -421,21 +426,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
421 | // that the client contacted the destination before we send the attachments and close things here. | 426 | // that the client contacted the destination before we send the attachments and close things here. |
422 | if (!WaitForCallback(sp.UUID)) | 427 | if (!WaitForCallback(sp.UUID)) |
423 | { | 428 | { |
424 | // Client never contacted destination. Let's restore everything back | 429 | Fail(sp, finalDestination); |
425 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
426 | |||
427 | // Fail. Reset it back | ||
428 | sp.IsChildAgent = false; | ||
429 | |||
430 | ResetFromTransit(sp.UUID); | ||
431 | |||
432 | // Yikes! We should just have a ref to scene here. | ||
433 | //sp.Scene.InformClientOfNeighbours(sp); | ||
434 | EnableChildAgents(sp); | ||
435 | |||
436 | // Finally, kill the agent we just created at the destination. | ||
437 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | ||
438 | |||
439 | return; | 430 | return; |
440 | } | 431 | } |
441 | 432 | ||
@@ -475,6 +466,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
475 | } | 466 | } |
476 | } | 467 | } |
477 | 468 | ||
469 | private void Fail(ScenePresence sp, GridRegion finalDestination) | ||
470 | { | ||
471 | // Client never contacted destination. Let's restore everything back | ||
472 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
473 | |||
474 | // Fail. Reset it back | ||
475 | sp.IsChildAgent = false; | ||
476 | |||
477 | ResetFromTransit(sp.UUID); | ||
478 | |||
479 | EnableChildAgents(sp); | ||
480 | |||
481 | // Finally, kill the agent we just created at the destination. | ||
482 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | ||
483 | |||
484 | } | ||
478 | 485 | ||
479 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | 486 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) |
480 | { | 487 | { |
@@ -813,7 +820,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
813 | cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + | 820 | cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + |
814 | "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | 821 | "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; |
815 | 822 | ||
816 | m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent); | 823 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) |
824 | { | ||
825 | // region doesn't take it | ||
826 | ResetFromTransit(agent.UUID); | ||
827 | return agent; | ||
828 | } | ||
817 | 829 | ||
818 | // Next, let's close the child agent connections that are too far away. | 830 | // Next, let's close the child agent connections that are too far away. |
819 | agent.CloseChildAgents(neighbourx, neighboury); | 831 | agent.CloseChildAgents(neighbourx, neighboury); |
@@ -914,12 +926,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
914 | /// </summary> | 926 | /// </summary> |
915 | public void EnableChildAgent(ScenePresence sp, GridRegion region) | 927 | public void EnableChildAgent(ScenePresence sp, GridRegion region) |
916 | { | 928 | { |
929 | m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); | ||
930 | |||
931 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
917 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); | 932 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); |
918 | agent.BaseFolder = UUID.Zero; | 933 | agent.BaseFolder = UUID.Zero; |
919 | agent.InventoryFolder = UUID.Zero; | 934 | agent.InventoryFolder = UUID.Zero; |
920 | agent.startpos = new Vector3(128, 128, 70); | 935 | agent.startpos = new Vector3(128, 128, 70); |
921 | agent.child = true; | 936 | agent.child = true; |
922 | agent.Appearance = sp.Appearance; | 937 | agent.Appearance = sp.Appearance; |
938 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
939 | |||
940 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); | ||
941 | m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count); | ||
942 | |||
943 | if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) | ||
944 | agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); | ||
945 | m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count); | ||
946 | |||
947 | sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); | ||
948 | foreach (ulong h in agent.ChildrenCapSeeds.Keys) | ||
949 | m_log.DebugFormat("[XXX] --> {0}", h); | ||
950 | m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); | ||
951 | agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath); | ||
952 | |||
953 | if (sp.Scene.CapsModule != null) | ||
954 | { | ||
955 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, agent.ChildrenCapSeeds); | ||
956 | } | ||
957 | |||
958 | if (currentAgentCircuit != null) | ||
959 | { | ||
960 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
961 | agent.Viewer = currentAgentCircuit.Viewer; | ||
962 | } | ||
923 | 963 | ||
924 | IPEndPoint external = region.ExternalEndPoint; | 964 | IPEndPoint external = region.ExternalEndPoint; |
925 | if (external != null) | 965 | if (external != null) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs index 8a90370..35518d5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs | |||
@@ -123,17 +123,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour | |||
123 | 123 | ||
124 | public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 124 | public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
125 | { | 125 | { |
126 | m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", | ||
127 | thisRegion.RegionName, regionHandle, m_Scenes.Count); | ||
128 | foreach (Scene s in m_Scenes) | 126 | foreach (Scene s in m_Scenes) |
129 | { | 127 | { |
130 | if (s.RegionInfo.RegionHandle == regionHandle) | 128 | if (s.RegionInfo.RegionHandle == regionHandle) |
131 | { | 129 | { |
132 | m_log.Debug("[NEIGHBOUR IN CONNECTOR]: Found region to SendHelloNeighbour"); | 130 | //m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0} to {1}", thisRegion.RegionName, s.RegionInfo.RegionName); |
133 | return s.IncomingHelloNeighbour(thisRegion); | 131 | return s.IncomingHelloNeighbour(thisRegion); |
134 | } | 132 | } |
135 | } | 133 | } |
136 | m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle); | ||
137 | return null; | 134 | return null; |
138 | } | 135 | } |
139 | 136 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 1b00c8a..b2e3f4f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | |||
@@ -181,22 +181,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
181 | 181 | ||
182 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) | 182 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) |
183 | { | 183 | { |
184 | if (m_LocalCache.ContainsKey(regionID)) | 184 | return m_GridService.GetNeighbours(scopeID, regionID); |
185 | { | ||
186 | List<GridRegion> neighbours = m_LocalCache[regionID].GetNeighbours(); | ||
187 | if (neighbours.Count == 0) | ||
188 | // try the DB | ||
189 | neighbours = m_GridService.GetNeighbours(scopeID, regionID); | ||
190 | return neighbours; | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | m_log.WarnFormat("[LOCAL GRID CONNECTOR]: GetNeighbours: Requested region {0} is not on this sim", regionID); | ||
195 | return new List<GridRegion>(); | ||
196 | } | ||
197 | |||
198 | // Don't go to the DB | ||
199 | //return m_GridService.GetNeighbours(scopeID, regionID); | ||
200 | } | 185 | } |
201 | 186 | ||
202 | public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) | 187 | public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 46741a5..16e25e6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | |||
@@ -153,12 +153,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
153 | return false; | 153 | return false; |
154 | } | 154 | } |
155 | 155 | ||
156 | // Let's override GetNeighbours completely -- never go to the grid server | ||
157 | // Neighbours are/should be cached locally | ||
158 | // For retrieval from the DB, caller should call GetRegionByPosition | ||
159 | public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) | 156 | public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) |
160 | { | 157 | { |
161 | return m_LocalGridService.GetNeighbours(scopeID, regionID); | 158 | return base.GetNeighbours(scopeID, regionID); |
162 | } | 159 | } |
163 | 160 | ||
164 | public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) | 161 | public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index daba0b3..f71bf46 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs | |||
@@ -121,17 +121,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | |||
121 | 121 | ||
122 | public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 122 | public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
123 | { | 123 | { |
124 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", | 124 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}.", |
125 | thisRegion.RegionName, regionHandle, m_Scenes.Count); | 125 | thisRegion.RegionName, regionHandle); |
126 | foreach (Scene s in m_Scenes) | 126 | foreach (Scene s in m_Scenes) |
127 | { | 127 | { |
128 | if (s.RegionInfo.RegionHandle == regionHandle) | 128 | if (s.RegionInfo.RegionHandle == regionHandle) |
129 | { | 129 | { |
130 | m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); | 130 | //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); |
131 | return s.IncomingHelloNeighbour(thisRegion); | 131 | return s.IncomingHelloNeighbour(thisRegion); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); | 134 | //m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); |
135 | return null; | 135 | return null; |
136 | } | 136 | } |
137 | 137 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 377c868..e16e273 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -181,7 +181,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
181 | // else do the remote thing | 181 | // else do the remote thing |
182 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | 182 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) |
183 | { | 183 | { |
184 | //m_regionClient.SendUserInformation(regInfo, aCircuit); | ||
185 | return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 184 | return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
186 | } | 185 | } |
187 | return false; | 186 | return false; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b58bfb8..82d4759 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -964,12 +964,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
964 | // Let the grid service module know, so this can be cached | 964 | // Let the grid service module know, so this can be cached |
965 | m_eventManager.TriggerOnRegionUp(otherRegion); | 965 | m_eventManager.TriggerOnRegionUp(otherRegion); |
966 | 966 | ||
967 | RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName); | ||
968 | regInfo.RegionID = otherRegion.RegionID; | ||
969 | regInfo.RegionName = otherRegion.RegionName; | ||
970 | regInfo.ScopeID = otherRegion.ScopeID; | ||
971 | regInfo.ExternalHostName = otherRegion.ExternalHostName; | ||
972 | GridRegion r = new GridRegion(regInfo); | ||
973 | try | 967 | try |
974 | { | 968 | { |
975 | ForEachScenePresence(delegate(ScenePresence agent) | 969 | ForEachScenePresence(delegate(ScenePresence agent) |
@@ -984,7 +978,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
984 | old.Add(otherRegion.RegionHandle); | 978 | old.Add(otherRegion.RegionHandle); |
985 | agent.DropOldNeighbours(old); | 979 | agent.DropOldNeighbours(old); |
986 | if (m_teleportModule != null) | 980 | if (m_teleportModule != null) |
987 | m_teleportModule.EnableChildAgent(agent, r); | 981 | m_teleportModule.EnableChildAgent(agent, otherRegion); |
988 | } | 982 | } |
989 | } | 983 | } |
990 | ); | 984 | ); |
@@ -1546,6 +1540,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1546 | { | 1540 | { |
1547 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); | 1541 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); |
1548 | LoginsDisabled = false; | 1542 | LoginsDisabled = false; |
1543 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | ||
1549 | } | 1544 | } |
1550 | } | 1545 | } |
1551 | } | 1546 | } |
@@ -1830,6 +1825,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1830 | { | 1825 | { |
1831 | RegisterCommsEvents(); | 1826 | RegisterCommsEvents(); |
1832 | 1827 | ||
1828 | m_sceneGridService.SetScene(this); | ||
1829 | |||
1833 | // These two 'commands' *must be* next to each other or sim rebooting fails. | 1830 | // These two 'commands' *must be* next to each other or sim rebooting fails. |
1834 | //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); | 1831 | //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); |
1835 | 1832 | ||
@@ -1840,24 +1837,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1840 | throw new Exception(error); | 1837 | throw new Exception(error); |
1841 | } | 1838 | } |
1842 | 1839 | ||
1843 | m_sceneGridService.SetScene(this); | ||
1844 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | ||
1845 | |||
1846 | //Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings(); | ||
1847 | |||
1848 | //if (dGridSettings.ContainsKey("allow_forceful_banlines")) | ||
1849 | //{ | ||
1850 | // if (dGridSettings["allow_forceful_banlines"] != "TRUE") | ||
1851 | // { | ||
1852 | // m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); | ||
1853 | // EventManager.TriggerSetAllowForcefulBan(false); | ||
1854 | // } | ||
1855 | // else | ||
1856 | // { | ||
1857 | // m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); | ||
1858 | // EventManager.TriggerSetAllowForcefulBan(true); | ||
1859 | // } | ||
1860 | //} | ||
1861 | } | 1840 | } |
1862 | 1841 | ||
1863 | /// <summary> | 1842 | /// <summary> |
@@ -3934,6 +3913,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3934 | m_log.DebugFormat( | 3913 | m_log.DebugFormat( |
3935 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 3914 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
3936 | 3915 | ||
3916 | // XPTO: if this agent is not allowed here as root, always return false | ||
3917 | |||
3937 | // We have to wait until the viewer contacts this region after receiving EAC. | 3918 | // We have to wait until the viewer contacts this region after receiving EAC. |
3938 | // That calls AddNewClient, which finally creates the ScenePresence | 3919 | // That calls AddNewClient, which finally creates the ScenePresence |
3939 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 3920 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 6309cd9..a9ecde8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -182,24 +182,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
182 | { | 182 | { |
183 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); | 183 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); |
184 | 184 | ||
185 | for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++) | 185 | List<GridRegion> neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); |
186 | m_log.DebugFormat("[INTERGRID]: Informing {0} neighbours that this region is up", neighbours.Count); | ||
187 | foreach (GridRegion n in neighbours) | ||
186 | { | 188 | { |
187 | for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++) | 189 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; |
188 | { | 190 | d.BeginInvoke(neighbourService, region, n.RegionHandle, |
189 | if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region | 191 | InformNeighborsThatRegionisUpCompleted, |
190 | { | 192 | d); |
191 | ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize); | ||
192 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | ||
193 | |||
194 | d.BeginInvoke(neighbourService, region, handle, | ||
195 | InformNeighborsThatRegionisUpCompleted, | ||
196 | d); | ||
197 | } | ||
198 | } | ||
199 | } | 193 | } |
200 | } | 194 | } |
201 | 195 | ||
202 | |||
203 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle); | 196 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle); |
204 | 197 | ||
205 | /// <summary> | 198 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6d2cd88..d4fc6cd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3390,6 +3390,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); | |||
3390 | { | 3390 | { |
3391 | if (cAgent.Attachments != null) | 3391 | if (cAgent.Attachments != null) |
3392 | { | 3392 | { |
3393 | m_appearance.ClearAttachments(); | ||
3393 | foreach (AttachmentData att in cAgent.Attachments) | 3394 | foreach (AttachmentData att in cAgent.Attachments) |
3394 | { | 3395 | { |
3395 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); | 3396 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); |
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 0ec8912..1831533 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -210,9 +210,6 @@ namespace OpenSim.Services.Connectors | |||
210 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | 210 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); |
211 | rinfos.Add(rinfo); | 211 | rinfos.Add(rinfo); |
212 | } | 212 | } |
213 | else | ||
214 | m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response type {2}", | ||
215 | scopeID, regionID, r.GetType()); | ||
216 | } | 213 | } |
217 | } | 214 | } |
218 | else | 215 | else |
@@ -299,9 +296,9 @@ namespace OpenSim.Services.Connectors | |||
299 | { | 296 | { |
300 | if (replyData["result"] is Dictionary<string, object>) | 297 | if (replyData["result"] is Dictionary<string, object>) |
301 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | 298 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); |
302 | else | 299 | //else |
303 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region", | 300 | // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region", |
304 | scopeID, x, y); | 301 | // scopeID, x, y); |
305 | } | 302 | } |
306 | else | 303 | else |
307 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", | 304 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 874f1a2..56c73ec 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 748faef..0947b5f 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -483,7 +483,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
483 | } | 483 | } |
484 | catch (WebException ex) | 484 | catch (WebException ex) |
485 | { | 485 | { |
486 | m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete {0}", ex.Message); | 486 | m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete from {0}: {1}", destination.RegionName, ex.Message); |
487 | return false; | 487 | return false; |
488 | } | 488 | } |
489 | finally | 489 | finally |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7c98642..225530f 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -273,14 +273,15 @@ namespace OpenSim.Services.GridService | |||
273 | if (region != null) | 273 | if (region != null) |
274 | { | 274 | { |
275 | // Not really? Maybe? | 275 | // Not really? Maybe? |
276 | List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize, region.posY - (int)Constants.RegionSize, | 276 | List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, |
277 | region.posX + (int)Constants.RegionSize, region.posY + (int)Constants.RegionSize, scopeID); | 277 | region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); |
278 | 278 | ||
279 | foreach (RegionData rdata in rdatas) | 279 | foreach (RegionData rdata in rdatas) |
280 | if (rdata.RegionID != regionID) | 280 | if (rdata.RegionID != regionID) |
281 | rinfos.Add(RegionData2RegionInfo(rdata)); | 281 | rinfos.Add(RegionData2RegionInfo(rdata)); |
282 | 282 | ||
283 | } | 283 | } |
284 | m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); | ||
284 | return rinfos; | 285 | return rinfos; |
285 | } | 286 | } |
286 | 287 | ||
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 063251a..326e502 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -357,7 +357,7 @@ namespace OpenSim.Services.UserAccountService | |||
357 | /// <param name="lastName"></param> | 357 | /// <param name="lastName"></param> |
358 | /// <param name="password"></param> | 358 | /// <param name="password"></param> |
359 | /// <param name="email"></param> | 359 | /// <param name="email"></param> |
360 | public void CreateUser(string firstName, string lastName, string password, string email) | 360 | private void CreateUser(string firstName, string lastName, string password, string email) |
361 | { | 361 | { |
362 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | 362 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); |
363 | if (null == account) | 363 | if (null == account) |
@@ -374,12 +374,14 @@ namespace OpenSim.Services.UserAccountService | |||
374 | 374 | ||
375 | if (StoreUserAccount(account)) | 375 | if (StoreUserAccount(account)) |
376 | { | 376 | { |
377 | bool success = false; | 377 | bool success; |
378 | if (m_AuthenticationService != null) | 378 | if (m_AuthenticationService != null) |
379 | { | ||
379 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); | 380 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); |
380 | if (!success) | 381 | if (!success) |
381 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.", | 382 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.", |
382 | firstName, lastName); | 383 | firstName, lastName); |
384 | } | ||
383 | 385 | ||
384 | GridRegion home = null; | 386 | GridRegion home = null; |
385 | if (m_GridService != null) | 387 | if (m_GridService != null) |
@@ -399,18 +401,22 @@ namespace OpenSim.Services.UserAccountService | |||
399 | firstName, lastName); | 401 | firstName, lastName); |
400 | 402 | ||
401 | if (m_InventoryService != null) | 403 | if (m_InventoryService != null) |
404 | { | ||
402 | success = m_InventoryService.CreateUserInventory(account.PrincipalID); | 405 | success = m_InventoryService.CreateUserInventory(account.PrincipalID); |
403 | if (!success) | 406 | if (!success) |
404 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", | 407 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", |
405 | firstName, lastName); | 408 | firstName, lastName); |
409 | } | ||
406 | 410 | ||
407 | m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); | 411 | m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); |
412 | } else { | ||
413 | m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName); | ||
408 | } | 414 | } |
409 | } | 415 | } |
410 | else | 416 | else |
411 | { | 417 | { |
412 | m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); | 418 | m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); |
413 | } | 419 | } |
414 | } | 420 | } |
415 | } | 421 | } |
416 | } | 422 | } |