diff options
author | Dr Scofield | 2008-11-06 09:12:14 +0000 |
---|---|---|
committer | Dr Scofield | 2008-11-06 09:12:14 +0000 |
commit | 44b0c59ba9a1654ea0f7fadd4601b08d5cd9930b (patch) | |
tree | f66bb41f99a5c6a55af2661b1823f1cb577ed4f4 /OpenSim | |
parent | - create entries in avatarattachments table when first attaching an object; f... (diff) | |
download | opensim-SC_OLD-44b0c59ba9a1654ea0f7fadd4601b08d5cd9930b.zip opensim-SC_OLD-44b0c59ba9a1654ea0f7fadd4601b08d5cd9930b.tar.gz opensim-SC_OLD-44b0c59ba9a1654ea0f7fadd4601b08d5cd9930b.tar.bz2 opensim-SC_OLD-44b0c59ba9a1654ea0f7fadd4601b08d5cd9930b.tar.xz |
From: Christopher Yeoh <cyeoh@au1.ibm.com>
The following patch implements osMakeNotecard as specified on the OpenSim website
Diffstat (limited to 'OpenSim')
3 files changed, 60 insertions, 1 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; | |||
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Runtime.Remoting.Lifetime; | 30 | using System.Runtime.Remoting.Lifetime; |
31 | using System.Text; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim; | 34 | using 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 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index b1749f9..2e02bd1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
95 | Hashtable osParseJSON(string JSON); | 95 | Hashtable osParseJSON(string JSON); |
96 | 96 | ||
97 | void osMessageObject(key objectUUID,string message); | 97 | void osMessageObject(key objectUUID,string message); |
98 | 98 | ||
99 | void osMakeNotecard(string notecardName, LSL_Types.list contents); | ||
99 | } | 100 | } |
100 | } | 101 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 35a8830..01b2d86 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -237,6 +237,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
237 | m_OSSL_Functions.osMessageObject(objectUUID,message); | 237 | m_OSSL_Functions.osMessageObject(objectUUID,message); |
238 | } | 238 | } |
239 | 239 | ||
240 | public void osMakeNotecard(string notecardName, LSL_Types.list contents) | ||
241 | { | ||
242 | m_OSSL_Functions.osMakeNotecard(notecardName, contents); | ||
243 | } | ||
244 | |||
240 | public OSSLPrim Prim; | 245 | public OSSLPrim Prim; |
241 | 246 | ||
242 | [Serializable] | 247 | [Serializable] |