aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8a967ac..bd14a13 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -28,6 +28,7 @@ using System;
28using System.Collections; 28using System.Collections;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Runtime.Remoting.Lifetime; 30using System.Runtime.Remoting.Lifetime;
31using System.Text;
31using OpenMetaverse; 32using OpenMetaverse;
32using Nini.Config; 33using Nini.Config;
33using OpenSim; 34using OpenSim;
@@ -959,5 +960,57 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
959 sceneOP.LocalId, new EventParams( 960 sceneOP.LocalId, new EventParams(
960 "dataserver", resobj, new DetectParams[0])); 961 "dataserver", resobj, new DetectParams[0]));
961 } 962 }
963
964
965 public void osMakeNotecard(string notecardName, LSL_Types.list contents)
966 {
967 CheckThreatLevel(ThreatLevel.None, "osMakeNotecard");
968 m_host.AddScriptLPS(1);
969
970 // Create new asset
971 AssetBase asset = new AssetBase();
972 asset.Name = notecardName;
973 asset.Description = "Script Generated Notecard";
974 asset.Type = 7;
975 asset.FullID = UUID.Random();
976 string notecardData = "";
977
978 for (int i = 0; i < contents.Length; i++) {
979 notecardData += contents.GetLSLStringItem(i) + "\n";
980 }
981
982 int textLength = notecardData.Length;
983 notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
984 + textLength.ToString() + "\n" + notecardData + "}\n";
985
986 asset.Data = Encoding.ASCII.GetBytes(notecardData);
987 World.AssetCache.AddAsset(asset);
988
989 // Create Task Entry
990 TaskInventoryItem taskItem=new TaskInventoryItem();
991
992 taskItem.ResetIDs(m_host.UUID);
993 taskItem.ParentID = m_host.UUID;
994 taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch();
995 taskItem.Name = asset.Name;
996 taskItem.Description = asset.Description;
997 taskItem.Type = 7;
998 taskItem.InvType = 7;
999 taskItem.OwnerID = m_host.OwnerID;
1000 taskItem.CreatorID = m_host.OwnerID;
1001 taskItem.BasePermissions = (uint)PermissionMask.All;
1002 taskItem.CurrentPermissions = (uint)PermissionMask.All;
1003 taskItem.EveryonePermissions = (uint)PermissionMask.All;
1004 taskItem.NextPermissions = (uint)PermissionMask.All;
1005 taskItem.GroupID = m_host.GroupID;
1006 taskItem.GroupPermissions = 0;
1007 taskItem.Flags = 0;
1008 taskItem.PermsGranter = UUID.Zero;
1009 taskItem.PermsMask = 0;
1010 taskItem.AssetID = asset.FullID;
1011
1012 m_host.AddInventoryItem(taskItem);
1013
1014 }
962 } 1015 }
963} 1016}