aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs145
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs12
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs4
6 files changed, 171 insertions, 3 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 848d574..c046010 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1256,9 +1256,11 @@ namespace OpenSim.Framework
1256 void SendAttachedSoundGainChange(UUID objectID, float gain); 1256 void SendAttachedSoundGainChange(UUID objectID, float gain);
1257 1257
1258 void SendNameReply(UUID profileId, string firstname, string lastname); 1258 void SendNameReply(UUID profileId, string firstname, string lastname);
1259 void SendAlertMessage(string message);
1260 1259
1260 void SendAlertMessage(string message);
1261 void SendAlertMessage(string message, string into);
1261 void SendAgentAlertMessage(string message, bool modal); 1262 void SendAgentAlertMessage(string message, bool modal);
1263
1262 void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url); 1264 void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url);
1263 1265
1264 /// <summary> 1266 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index c5164ca..bedd3d0 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -193,8 +193,7 @@ namespace OpenSim.Region.ClientStack.Linden
193 193
194 public string GetNewCapPath() 194 public string GetNewCapPath()
195 { 195 {
196 UUID tmpid = UUID.Random(); 196 return "/CAPS/" + UUID.Random();
197 return "/CAPS/" + tmpid.ToString();
198 } 197 }
199 198
200 /// <summary> 199 /// <summary>
@@ -242,6 +241,10 @@ namespace OpenSim.Region.ClientStack.Linden
242 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); 241 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
243 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); 242 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
244 243
244 IRequestHandler HomeLocationHandler = new RestStreamHandler(
245 "POST", GetNewCapPath(), HomeLocation, "HomeLocation", null);
246 m_HostCapsObj.RegisterHandler("HomeLocation", HomeLocationHandler);
247
245// IRequestHandler animSetRequestHandler 248// IRequestHandler animSetRequestHandler
246// = new RestStreamHandler( 249// = new RestStreamHandler(
247// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null); 250// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null);
@@ -1504,6 +1507,144 @@ namespace OpenSim.Region.ClientStack.Linden
1504 string response = OSDParser.SerializeLLSDXmlString(resp); 1507 string response = OSDParser.SerializeLLSDXmlString(resp);
1505 return response; 1508 return response;
1506 } 1509 }
1510
1511 public bool OSDMapTOVector3(OSDMap map, out Vector3 v)
1512 {
1513 v = Vector3.Zero;
1514 if(!map.ContainsKey("X"))
1515 return false;
1516 if(!map.ContainsKey("Y"))
1517 return false;
1518 if(!map.ContainsKey("Z"))
1519 return false;
1520 v.X = (float)map["X"].AsReal();
1521 v.Y = (float)map["Y"].AsReal();
1522 v.Z = (float)map["Z"].AsReal();
1523 return true;
1524 }
1525
1526 public string HomeLocation(string request, string path, string param, IOSHttpRequest httpRequest,
1527 IOSHttpResponse httpResponse)
1528 {
1529 OSDMap resp = new OSDMap();
1530
1531 resp["success"] = "false";
1532
1533
1534 bool fail = true;
1535 string message = "Set Home request failed";
1536 int locationID = 1;
1537 Vector3 pos = Vector3.Zero;
1538 Vector3 lookAt = Vector3.Zero;
1539
1540 IClientAPI client = null;
1541 ScenePresence sp;
1542
1543 while(true)
1544 {
1545 if(m_Scene.GridUserService == null)
1546 break;
1547
1548 if(m_Scene.UserManagementModule == null)
1549 break;
1550
1551 m_Scene.TryGetScenePresence(m_AgentID, out sp);
1552 if(sp == null || sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit)
1553 break;
1554
1555 client = sp.ControllingClient;
1556
1557 if(!m_Scene.UserManagementModule.IsLocalGridUser(m_AgentID))
1558 break;
1559
1560 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1561 if(!req.ContainsKey("HomeLocation"))
1562 break;
1563
1564 OSDMap HLocation = (OSDMap)req["HomeLocation"];
1565 if(!HLocation.ContainsKey("LocationPos"))
1566 break;
1567 if(!HLocation.ContainsKey("LocationLookAt"))
1568 break;
1569
1570 locationID = HLocation["LocationId"].AsInteger();
1571
1572 if(!OSDMapTOVector3((OSDMap)HLocation["LocationPos"], out pos))
1573 break;
1574
1575 if(!OSDMapTOVector3((OSDMap)HLocation["LocationLookAt"], out lookAt))
1576 break;
1577
1578 ILandObject land = m_Scene.LandChannel.GetLandObject(pos);
1579 if(land == null)
1580 break;
1581
1582 ulong gpowers = client.GetGroupPowers(land.LandData.GroupID);
1583 SceneObjectGroup telehub = null;
1584 if (m_Scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
1585 // Does the telehub exist in the scene?
1586 telehub = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
1587
1588 if (!m_Scene.Permissions.IsAdministrator(m_AgentID) && // (a) gods and land managers can set home
1589 !m_Scene.Permissions.IsGod(m_AgentID) &&
1590 m_AgentID != land.LandData.OwnerID && // (b) land owners can set home
1591 // (c) members of the land-associated group in roles that can set home
1592 ((gpowers & (ulong)GroupPowers.AllowSetHome) != (ulong)GroupPowers.AllowSetHome) &&
1593 // (d) parcels with telehubs can be the home of anyone
1594 (telehub == null || !land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
1595 {
1596 message = "You are not allowed to set your home location in this parcel.";
1597 break;
1598 }
1599
1600 string userId;
1601 UUID test;
1602 if (!m_Scene.UserManagementModule.GetUserUUI(m_AgentID, out userId))
1603 {
1604 message = "Set Home request failed. (User Lookup)";
1605 break;
1606 }
1607
1608 if (!UUID.TryParse(userId, out test))
1609 {
1610 message = "Set Home request failed. (HG visitor)";
1611 break;
1612 }
1613
1614 if (m_Scene.GridUserService.SetHome(userId, land.RegionUUID, pos, lookAt))
1615 fail = false;
1616
1617 break;
1618 }
1619
1620 string response;
1621
1622 if(fail)
1623 {
1624 if(client != null)
1625 client.SendAlertMessage(message, "HomePositionSet");
1626 response = OSDParser.SerializeLLSDXmlString(resp);
1627 return response;
1628 }
1629
1630 // so its http but still needs a udp reply to inform user? crap :p
1631 if(client != null)
1632 client.SendAlertMessage("Home position set.","HomePositionSet");
1633
1634 resp["success"] = "true";
1635 OSDMap homeloc = new OSDMap();
1636 OSDMap homelocpos = new OSDMap();
1637 // for some odd reason viewers send pos as reals but read as integer
1638 homelocpos["X"] = new OSDReal(pos.X);
1639 homelocpos["Y"] = new OSDReal(pos.Y);
1640 homelocpos["Z"] = new OSDReal(pos.Z);
1641 homeloc["LocationPos"] = homelocpos;
1642
1643 resp["HomeLocation"] = homeloc;
1644
1645 response = OSDParser.SerializeLLSDXmlString(resp);
1646 return response;
1647 }
1507 } 1648 }
1508 1649
1509 public class AssetUploader 1650 public class AssetUploader
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 6275f19..f580e5a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2411,6 +2411,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2411 OutPacket(alertPack, ThrottleOutPacketType.Task); 2411 OutPacket(alertPack, ThrottleOutPacketType.Task);
2412 } 2412 }
2413 2413
2414 public void SendAlertMessage(string message, string info)
2415 {
2416 AlertMessagePacket alertPack = (AlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AlertMessage);
2417 alertPack.AlertData = new AlertMessagePacket.AlertDataBlock();
2418 alertPack.AlertData.Message = Util.StringToBytes256(message);
2419 alertPack.AlertInfo = new AlertMessagePacket.AlertInfoBlock[1];
2420 alertPack.AlertInfo[0] = new AlertMessagePacket.AlertInfoBlock();
2421 alertPack.AlertInfo[0].Message = Util.StringToBytes256(info);
2422 alertPack.AlertInfo[0].ExtraParams = new Byte[0];
2423 OutPacket(alertPack, ThrottleOutPacketType.Task);
2424 }
2425
2414 /// <summary> 2426 /// <summary>
2415 /// Send an agent alert message to the client. 2427 /// Send an agent alert message to the client.
2416 /// </summary> 2428 /// </summary>
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 50be3ac..e21d69f 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1217,6 +1217,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1217 1217
1218 } 1218 }
1219 1219
1220 public void SendAlertMessage(string message, string info)
1221 {
1222
1223 }
1224
1220 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) 1225 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
1221 { 1226 {
1222 IRC_SendChannelPrivmsg(objectname,url); 1227 IRC_SendChannelPrivmsg(objectname,url);
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 4275192..52e8660 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -885,6 +885,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
885 { 885 {
886 } 886 }
887 887
888 public void SendAlertMessage(string message, string info)
889 {
890 }
891
888 public void SendSystemAlertMessage(string message) 892 public void SendSystemAlertMessage(string message)
889 { 893 {
890 } 894 }
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 4f8e986..9b087c9 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -861,6 +861,10 @@ namespace OpenSim.Tests.Common
861 { 861 {
862 } 862 }
863 863
864 public void SendAlertMessage(string message, string info)
865 {
866 }
867
864 public void SendSystemAlertMessage(string message) 868 public void SendSystemAlertMessage(string message)
865 { 869 {
866 } 870 }