aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs2
-rw-r--r--OpenSim/Framework/Communications/RestClient/RestClient.cs1
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs9
-rw-r--r--OpenSim/Framework/Data/OpenSimDataReader.cs4
-rw-r--r--OpenSim/Framework/Data/OpenSimDatabaseConnector.cs26
-rw-r--r--OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs4
-rw-r--r--OpenSim/Framework/Data/OpenSimTableMapper.cs3
-rw-r--r--OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs6
-rw-r--r--OpenSim/Region/Application/Application.cs3
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs1
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs2
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs1
-rw-r--r--OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs216
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs64
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs49
-rw-r--r--OpenSim/Region/Environment/Scenes/AvatarAppearance.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs3
17 files changed, 354 insertions, 52 deletions
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index cf54fa4..2f0727f 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -95,11 +95,13 @@ namespace OpenSim.Framework.Communications.Cache
95 // RestClient rc = new RestClient(_assetServerUrl); 95 // RestClient rc = new RestClient(_assetServerUrl);
96 MainLog.Instance.Verbose("ASSET", "Storing asset"); 96 MainLog.Instance.Verbose("ASSET", "Storing asset");
97 //rc.AddResourcePath("assets"); 97 //rc.AddResourcePath("assets");
98
98 // rc.RequestMethod = "POST"; 99 // rc.RequestMethod = "POST";
99 // rc.Request(s); 100 // rc.Request(s);
100 //MainLog.Instance.Verbose("ASSET", "Stored {0}", rc); 101 //MainLog.Instance.Verbose("ASSET", "Stored {0}", rc);
101 MainLog.Instance.Verbose("ASSET", "Sending to " + _assetServerUrl + "/assets/"); 102 MainLog.Instance.Verbose("ASSET", "Sending to " + _assetServerUrl + "/assets/");
102 RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset); 103 RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset);
104
103 } 105 }
104 catch (Exception e) 106 catch (Exception e)
105 { 107 {
diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs
index e4da4dc..76bad64 100644
--- a/OpenSim/Framework/Communications/RestClient/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs
@@ -389,6 +389,7 @@ namespace OpenSim.Framework.Communications
389 dst.Write(buf, 0, length); 389 dst.Write(buf, 0, length);
390 length = src.Read(buf, 0, 1024); 390 length = src.Read(buf, 0, 1024);
391 } 391 }
392
392 _response = (HttpWebResponse) _request.GetResponse(); 393 _response = (HttpWebResponse) _request.GetResponse();
393 394
394// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 395// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs b/OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs
index 275ce47..5d636bd 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLDatabaseMapper.cs
@@ -1,10 +1,11 @@
1using System.Data.Common; 1using System.Data.Common;
2using MySql.Data.MySqlClient; 2using MySql.Data.MySqlClient;
3// using TribalMedia.Framework.Data; 3 //using TribalMedia.Framework.Data;
4
4 5
5/*
6namespace OpenSim.Framework.Data.MySQL 6namespace OpenSim.Framework.Data.MySQL
7{ 7{
8 /*
8 public class MySQLDatabaseMapper : OpenSimDatabaseConnector 9 public class MySQLDatabaseMapper : OpenSimDatabaseConnector
9 { 10 {
10 public MySQLDatabaseMapper(string connectionString) 11 public MySQLDatabaseMapper(string connectionString)
@@ -22,6 +23,6 @@ namespace OpenSim.Framework.Data.MySQL
22 { 23 {
23 return "?" + fieldName; 24 return "?" + fieldName;
24 } 25 }
25 } 26 }*/
26} 27}
27*/ 28
diff --git a/OpenSim/Framework/Data/OpenSimDataReader.cs b/OpenSim/Framework/Data/OpenSimDataReader.cs
index c7b6470..d113f14 100644
--- a/OpenSim/Framework/Data/OpenSimDataReader.cs
+++ b/OpenSim/Framework/Data/OpenSimDataReader.cs
@@ -4,7 +4,7 @@ using System.Data;
4using System.Text; 4using System.Text;
5using libsecondlife; 5using libsecondlife;
6 6
7/* 7
8using TribalMedia.Framework.Data; 8using TribalMedia.Framework.Data;
9 9
10namespace OpenSim.Framework.Data 10namespace OpenSim.Framework.Data
@@ -39,4 +39,4 @@ namespace OpenSim.Framework.Data
39 } 39 }
40 } 40 }
41} 41}
42*/ 42
diff --git a/OpenSim/Framework/Data/OpenSimDatabaseConnector.cs b/OpenSim/Framework/Data/OpenSimDatabaseConnector.cs
index 155bdc1..aba9329 100644
--- a/OpenSim/Framework/Data/OpenSimDatabaseConnector.cs
+++ b/OpenSim/Framework/Data/OpenSimDatabaseConnector.cs
@@ -1,6 +1,8 @@
1using System.Data; 1using System.Data;
2using System.Data.Common;
2using libsecondlife; 3using libsecondlife;
3/* 4using MySql.Data.MySqlClient;
5
4using TribalMedia.Framework.Data; 6using TribalMedia.Framework.Data;
5 7
6namespace OpenSim.Framework.Data 8namespace OpenSim.Framework.Data
@@ -26,5 +28,25 @@ namespace OpenSim.Framework.Data
26 return new OpenSimDataReader(reader); 28 return new OpenSimDataReader(reader);
27 } 29 }
28 } 30 }
31
32
33 public class MySQLDatabaseMapper : OpenSimDatabaseConnector
34 {
35 public MySQLDatabaseMapper(string connectionString)
36 : base(connectionString)
37 {
38 }
39
40 public override DbConnection GetNewConnection()
41 {
42 MySqlConnection connection = new MySqlConnection(m_connectionString);
43 return connection;
44 }
45
46 public override string CreateParamName(string fieldName)
47 {
48 return "?" + fieldName;
49 }
50 }
29} 51}
30*/ 52
diff --git a/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs b/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs
index 8d5b9cf..269f863 100644
--- a/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs
+++ b/OpenSim/Framework/Data/OpenSimObjectFieldMapper.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
3using System.Data.Common; 3using System.Data.Common;
4using System.Text; 4using System.Text;
5using libsecondlife; 5using libsecondlife;
6/* 6
7using TribalMedia.Framework.Data; 7using TribalMedia.Framework.Data;
8 8
9namespace OpenSim.Framework.Data 9namespace OpenSim.Framework.Data
@@ -73,4 +73,4 @@ namespace OpenSim.Framework.Data
73 } 73 }
74 } 74 }
75} 75}
76*/ 76
diff --git a/OpenSim/Framework/Data/OpenSimTableMapper.cs b/OpenSim/Framework/Data/OpenSimTableMapper.cs
index f596b45..e5deae0 100644
--- a/OpenSim/Framework/Data/OpenSimTableMapper.cs
+++ b/OpenSim/Framework/Data/OpenSimTableMapper.cs
@@ -1,5 +1,5 @@
1using System.Data; 1using System.Data;
2/* 2
3using TribalMedia.Framework.Data; 3using TribalMedia.Framework.Data;
4 4
5namespace OpenSim.Framework.Data 5namespace OpenSim.Framework.Data
@@ -11,4 +11,3 @@ namespace OpenSim.Framework.Data
11 } 11 }
12 } 12 }
13} 13}
14*/
diff --git a/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs b/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs
index 227a98e..ec9689a 100644
--- a/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs
+++ b/OpenSim/Framework/Data/PrimitiveBaseShapeTableMapper.cs
@@ -1,9 +1,9 @@
1using System; 1using System;
2using OpenSim.Framework; 2using OpenSim.Framework;
3//using TribalMedia.Framework.Data; 3using TribalMedia.Framework.Data;
4using libsecondlife; 4using libsecondlife;
5 5
6/* 6
7namespace OpenSim.Framework.Data 7namespace OpenSim.Framework.Data
8{ 8{
9 public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape> 9 public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape>
@@ -142,4 +142,4 @@ namespace OpenSim.Framework.Data
142 } 142 }
143 } 143 }
144} 144}
145*/ 145
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 2045b56..4c4d315 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -58,7 +58,7 @@ namespace OpenSim
58 } 58 }
59 59
60 Console.WriteLine("Starting...\n"); 60 Console.WriteLine("Starting...\n");
61 61
62 Culture.SetCurrentCulture(); 62 Culture.SetCurrentCulture();
63 63
64 ArgvConfigSource configSource = new ArgvConfigSource(args); 64 ArgvConfigSource configSource = new ArgvConfigSource(args);
@@ -75,6 +75,7 @@ namespace OpenSim
75 OpenSimMain sim = new OpenSimMain(configSource); 75 OpenSimMain sim = new OpenSimMain(configSource);
76 76
77 sim.StartUp(); 77 sim.StartUp();
78
78 79
79 while (true) 80 while (true)
80 { 81 {
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 7f62d4d..167e4c3 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -351,6 +351,7 @@ namespace OpenSim.Region.ClientStack
351 if (m_debug > 0) 351 if (m_debug > 0)
352 { 352 {
353 string info = String.Empty; 353 string info = String.Empty;
354
354 if (m_debug < 255 && packet.Type == PacketType.AgentUpdate) 355 if (m_debug < 255 && packet.Type == PacketType.AgentUpdate)
355 return; 356 return;
356 if (m_debug < 254 && packet.Type == PacketType.ViewerEffect) 357 if (m_debug < 254 && packet.Type == PacketType.ViewerEffect)
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 4dce9e7..d6cf7c3 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -1,7 +1,7 @@
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
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index 41d8cac..76ba14b 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -135,6 +135,7 @@ namespace OpenSim.Region.Environment
135 m_loadedSharedModules.Add(xmlRpcMod.Name, xmlRpcMod); 135 m_loadedSharedModules.Add(xmlRpcMod.Name, xmlRpcMod);
136 } 136 }
137 //TextureDownloadModule textureModule = new TextureDownloadModule(); 137 //TextureDownloadModule textureModule = new TextureDownloadModule();
138
138 //LoadedSharedModules.Add(textureModule.Name, textureModule); 139 //LoadedSharedModules.Add(textureModule.Name, textureModule);
139 } 140 }
140 141
diff --git a/OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs b/OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs
new file mode 100644
index 0000000..ec82145
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs
@@ -0,0 +1,216 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.Environment.Scenes;
5using OpenSim.Framework;
6using TribalMedia.Framework.Data;
7
8namespace OpenSim.Region.Environment.Modules
9{
10 public class AppearanceRowMapper : BaseRowMapper<AvatarAppearance>
11 {
12
13 public AppearanceRowMapper(BaseSchema schema, AvatarAppearance obj)
14 : base(schema, obj)
15 {
16 }
17 }
18
19 public class AppearanceTableMapper : BaseTableMapper<AppearanceRowMapper, Guid>
20 {
21 public AppearanceTableMapper(BaseDatabaseConnector database, string tableName)
22 : base(database, tableName)
23 {
24 BaseSchema<AppearanceRowMapper> rowMapperSchema = new BaseSchema<AppearanceRowMapper>(this);
25 m_schema = rowMapperSchema;
26
27 m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("UUID",
28 delegate(AppearanceRowMapper mapper) { return mapper.Object.ScenePresenceID.UUID; },
29 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.ScenePresenceID = new libsecondlife.LLUUID(value.ToString()); });
30
31 rowMapperSchema.AddMapping<uint>("Serial",
32 delegate(AppearanceRowMapper mapper) { return (uint)mapper.Object.WearablesSerial; },
33 delegate(AppearanceRowMapper mapper, uint value) { mapper.Object.WearablesSerial = (int)value; });
34
35 rowMapperSchema.AddMapping<Guid>("WearableItem0",
36 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].ItemID.UUID; },
37 delegate(AppearanceRowMapper mapper, Guid value)
38 {
39 if (mapper.Object.Wearables == null)
40 {
41 mapper.Object.Wearables = new OpenSim.Framework.AvatarWearable[13];
42 for (int i = 0; i < 13; i++)
43 {
44 mapper.Object.Wearables[i] = new AvatarWearable();
45 }
46 }
47 mapper.Object.Wearables[0].ItemID = new libsecondlife.LLUUID(value.ToString());
48 });
49
50 rowMapperSchema.AddMapping<Guid>("WearableAsset0",
51 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].AssetID.UUID; },
52 delegate(AppearanceRowMapper mapper, Guid value)
53 { mapper.Object.Wearables[0].AssetID = new libsecondlife.LLUUID(value.ToString()); });
54
55 rowMapperSchema.AddMapping<Guid>("WearableItem1",
56 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[1].ItemID.UUID; },
57 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[1].ItemID = new libsecondlife.LLUUID(value.ToString()); });
58
59 rowMapperSchema.AddMapping<Guid>("WearableAsset1",
60 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[1].AssetID.UUID; },
61 delegate(AppearanceRowMapper mapper, Guid value)
62 { mapper.Object.Wearables[1].AssetID = new libsecondlife.LLUUID(value.ToString()); });
63
64 rowMapperSchema.AddMapping<Guid>("WearableItem2",
65 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[2].ItemID.UUID; },
66 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[2].ItemID = new libsecondlife.LLUUID(value.ToString()); });
67
68 rowMapperSchema.AddMapping<Guid>("WearableAsset2",
69 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[2].AssetID.UUID; },
70 delegate(AppearanceRowMapper mapper, Guid value)
71 { mapper.Object.Wearables[2].AssetID = new libsecondlife.LLUUID(value.ToString()); });
72
73 rowMapperSchema.AddMapping<Guid>("WearableItem3",
74 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[3].ItemID.UUID; },
75 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[3].ItemID = new libsecondlife.LLUUID(value.ToString()); });
76
77 rowMapperSchema.AddMapping<Guid>("WearableAsset3",
78 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[3].AssetID.UUID; },
79 delegate(AppearanceRowMapper mapper, Guid value)
80 { mapper.Object.Wearables[3].AssetID = new libsecondlife.LLUUID(value.ToString()); });
81
82 rowMapperSchema.AddMapping<Guid>("WearableItem4",
83 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[4].ItemID.UUID; },
84 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[4].ItemID = new libsecondlife.LLUUID(value.ToString()); });
85
86 rowMapperSchema.AddMapping<Guid>("WearableAsset4",
87 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[4].AssetID.UUID; },
88 delegate(AppearanceRowMapper mapper, Guid value)
89 { mapper.Object.Wearables[4].AssetID = new libsecondlife.LLUUID(value.ToString()); });
90
91 rowMapperSchema.AddMapping<Guid>("WearableItem5",
92 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[5].ItemID.UUID; },
93 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[5].ItemID = new libsecondlife.LLUUID(value.ToString()); });
94
95 rowMapperSchema.AddMapping<Guid>("WearableAsset5",
96 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[5].AssetID.UUID; },
97 delegate(AppearanceRowMapper mapper, Guid value)
98 { mapper.Object.Wearables[5].AssetID = new libsecondlife.LLUUID(value.ToString()); });
99
100 rowMapperSchema.AddMapping<Guid>("WearableItem6",
101 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[6].ItemID.UUID; },
102 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[6].ItemID = new libsecondlife.LLUUID(value.ToString()); });
103
104 rowMapperSchema.AddMapping<Guid>("WearableAsset6",
105 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[6].AssetID.UUID; },
106 delegate(AppearanceRowMapper mapper, Guid value)
107 { mapper.Object.Wearables[6].AssetID = new libsecondlife.LLUUID(value.ToString()); });
108
109 rowMapperSchema.AddMapping<Guid>("WearableItem7",
110 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[7].ItemID.UUID; },
111 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[7].ItemID = new libsecondlife.LLUUID(value.ToString()); });
112
113 rowMapperSchema.AddMapping<Guid>("WearableAsset7",
114 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[7].AssetID.UUID; },
115 delegate(AppearanceRowMapper mapper, Guid value)
116 { mapper.Object.Wearables[7].AssetID = new libsecondlife.LLUUID(value.ToString()); });
117
118 rowMapperSchema.AddMapping<Guid>("WearableItem8",
119 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[8].ItemID.UUID; },
120 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[8].ItemID = new libsecondlife.LLUUID(value.ToString()); });
121
122 rowMapperSchema.AddMapping<Guid>("WearableAsset8",
123 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[8].AssetID.UUID; },
124 delegate(AppearanceRowMapper mapper, Guid value)
125 { mapper.Object.Wearables[8].AssetID = new libsecondlife.LLUUID(value.ToString()); });
126
127 rowMapperSchema.AddMapping<Guid>("WearableItem9",
128 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[9].ItemID.UUID; },
129 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[9].ItemID = new libsecondlife.LLUUID(value.ToString()); });
130
131 rowMapperSchema.AddMapping<Guid>("WearableAsset9",
132 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[9].AssetID.UUID; },
133 delegate(AppearanceRowMapper mapper, Guid value)
134 { mapper.Object.Wearables[9].AssetID = new libsecondlife.LLUUID(value.ToString()); });
135
136 rowMapperSchema.AddMapping<Guid>("WearableItem10",
137 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[10].ItemID.UUID; },
138 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[10].ItemID = new libsecondlife.LLUUID(value.ToString()); });
139
140 rowMapperSchema.AddMapping<Guid>("WearableAsset10",
141 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[10].AssetID.UUID; },
142 delegate(AppearanceRowMapper mapper, Guid value)
143 { mapper.Object.Wearables[10].AssetID = new libsecondlife.LLUUID(value.ToString()); });
144
145 rowMapperSchema.AddMapping<Guid>("WearableItem11",
146 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[11].ItemID.UUID; },
147 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[11].ItemID = new libsecondlife.LLUUID(value.ToString()); });
148
149 rowMapperSchema.AddMapping<Guid>("WearableAsset11",
150 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[11].AssetID.UUID; },
151 delegate(AppearanceRowMapper mapper, Guid value)
152 { mapper.Object.Wearables[11].AssetID = new libsecondlife.LLUUID(value.ToString()); });
153
154 rowMapperSchema.AddMapping<Guid>("WearableItem12",
155 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[12].ItemID.UUID; },
156 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[12].ItemID = new libsecondlife.LLUUID(value.ToString()); });
157
158 rowMapperSchema.AddMapping<Guid>("WearableAsset12",
159 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[12].AssetID.UUID; },
160 delegate(AppearanceRowMapper mapper, Guid value)
161 { mapper.Object.Wearables[12].AssetID = new libsecondlife.LLUUID(value.ToString()); });
162
163 }
164
165 public bool Add(Guid userID, AvatarAppearance appearance)
166 {
167 AppearanceRowMapper mapper = CreateRowMapper(appearance);
168 return Add(mapper);
169 }
170
171 public bool Update(Guid userID, AvatarAppearance appearance)
172 {
173 AppearanceRowMapper mapper = CreateRowMapper(appearance);
174 return Update(appearance.ScenePresenceID.UUID, mapper);
175 }
176
177 protected AppearanceRowMapper CreateRowMapper(AvatarAppearance appearance)
178 {
179 return new AppearanceRowMapper(m_schema, appearance);
180 }
181
182 protected AppearanceRowMapper CreateRowMapper()
183 {
184 return CreateRowMapper(new AvatarAppearance());
185 }
186
187 protected AppearanceRowMapper FromReader(BaseDataReader reader, AvatarAppearance appearance)
188 {
189 AppearanceRowMapper mapper = CreateRowMapper(appearance);
190 mapper.FillObject(reader);
191 return mapper;
192 }
193
194 public override AppearanceRowMapper FromReader(BaseDataReader reader)
195 {
196 AppearanceRowMapper mapper = CreateRowMapper();
197 mapper.FillObject(reader);
198 return mapper;
199 }
200
201 public bool TryGetValue(Guid presenceID, out AvatarAppearance val)
202 {
203 AppearanceRowMapper mapper;
204 if (TryGetValue(presenceID, out mapper))
205 {
206 val = mapper.Object;
207 return true;
208 }
209 else
210 {
211 val = null;
212 return false;
213 }
214 }
215 }
216}
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 4dd1cb1..19ebdb8 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -35,6 +35,8 @@ using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38using OpenSim.Framework.Data;
39using TribalMedia.Framework.Data;
38 40
39namespace OpenSim.Region.Environment.Modules 41namespace OpenSim.Region.Environment.Modules
40{ 42{
@@ -43,6 +45,12 @@ namespace OpenSim.Region.Environment.Modules
43 private Scene m_scene = null; 45 private Scene m_scene = null;
44 private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>(); 46 private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>();
45 47
48 private bool m_enablePersist = false;
49 private string m_connectionString;
50 private bool m_configured = false;
51 private BaseDatabaseConnector m_databaseMapper;
52 private AppearanceTableMapper m_appearanceMapper;
53
46 public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) 54 public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance)
47 { 55 {
48 if (m_avatarsAppearance.ContainsKey(avatarId)) 56 if (m_avatarsAppearance.ContainsKey(avatarId))
@@ -50,22 +58,31 @@ namespace OpenSim.Region.Environment.Modules
50 appearance = m_avatarsAppearance[avatarId]; 58 appearance = m_avatarsAppearance[avatarId];
51 return true; 59 return true;
52 } 60 }
53 else 61
62 if (m_enablePersist)
54 { 63 {
55 AvatarWearable[] wearables; 64 if (m_appearanceMapper.TryGetValue(avatarId.UUID, out appearance))
56 byte[] visualParams;
57 GetDefaultAvatarAppearance(out wearables, out visualParams);
58 appearance = new AvatarAppearance(avatarId, wearables, visualParams);
59 try
60 { 65 {
66 appearance.VisualParams = GetDefaultVisualParams();
67 appearance.TextureEntry = AvatarAppearance.GetDefaultTextureEntry();
61 m_avatarsAppearance[avatarId] = appearance; 68 m_avatarsAppearance[avatarId] = appearance;
69 return true;
62 } 70 }
63 catch (NullReferenceException)
64 {
65 MainLog.Instance.Error("AVATAR", "Unable to load appearance for uninitialized avatar");
66 }
67 return true;
68 } 71 }
72
73
74 //not found a appearance for user, so create a new one
75 AvatarWearable[] wearables;
76 byte[] visualParams;
77 GetDefaultAvatarAppearance(out wearables, out visualParams);
78 appearance = new AvatarAppearance(avatarId, wearables, visualParams);
79
80 m_avatarsAppearance[avatarId] = appearance;
81 if (m_enablePersist)
82 {
83 m_appearanceMapper.Add(avatarId.UUID, appearance);
84 }
85 return true;
69 } 86 }
70 87
71 public void Initialise(Scene scene, IConfigSource source) 88 public void Initialise(Scene scene, IConfigSource source)
@@ -77,6 +94,24 @@ namespace OpenSim.Region.Environment.Modules
77 { 94 {
78 m_scene = scene; 95 m_scene = scene;
79 } 96 }
97
98 if (!m_configured)
99 {
100 m_configured = true;
101 try
102 {
103 m_enablePersist = source.Configs["Appearance"].GetBoolean("persist", false);
104 m_connectionString = source.Configs["Appearance"].GetString("connection_string", "");
105 }
106 catch (Exception)
107 {
108 }
109 if (m_enablePersist)
110 {
111 m_databaseMapper = new MySQLDatabaseMapper(m_connectionString);
112 m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance");
113 }
114 }
80 } 115 }
81 116
82 public void PostInitialise() 117 public void PostInitialise()
@@ -109,7 +144,7 @@ namespace OpenSim.Region.Environment.Modules
109 144
110 public void AvatarIsWearing(Object sender, AvatarWearingArgs e) 145 public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
111 { 146 {
112 IClientAPI clientView = (IClientAPI) sender; 147 IClientAPI clientView = (IClientAPI)sender;
113 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); 148 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
114 if (profile != null) 149 if (profile != null)
115 { 150 {
@@ -134,6 +169,11 @@ namespace OpenSim.Region.Environment.Modules
134 AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId]; 169 AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId];
135 avatAppearance.Wearables[wear.Type].AssetID = assetId; 170 avatAppearance.Wearables[wear.Type].AssetID = assetId;
136 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; 171 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
172
173 if (m_enablePersist)
174 {
175 m_appearanceMapper.Update(clientView.AgentId.UUID, avatAppearance);
176 }
137 } 177 }
138 } 178 }
139 } 179 }
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 9640ed7..6c49586 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -170,31 +170,9 @@ namespace OpenSim.Region.Environment
170 // the administrator object permissions to take effect. 170 // the administrator object permissions to take effect.
171 LLUUID objectOwner = task.OwnerID; 171 LLUUID objectOwner = task.OwnerID;
172 172
173 //return task.RootPart.ObjectFlags;task.RootPart.ObjectFlags |
174
175 uint objectOwnerMask = task.RootPart.ObjectFlags; 173 uint objectOwnerMask = task.RootPart.ObjectFlags;
174 objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objectOwnerMask);
176 175
177 if((task.RootPart.OwnerMask & (uint)PermissionMask.Copy) != 0)
178 {
179 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
180 }
181
182 if ((task.RootPart.OwnerMask & (uint) PermissionMask.Move) != 0)
183 {
184 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectMove;
185 }
186
187 if ((task.RootPart.OwnerMask & (uint) PermissionMask.Modify) != 0)
188 {
189 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectModify;
190 }
191
192 if ((task.RootPart.OwnerMask & (uint) PermissionMask.Transfer) != 0)
193 {
194 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
195 }
196
197 uint objectGroupMask = task.RootPart.ObjectFlags | task.RootPart.GroupMask;
198 uint objectEveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask; 176 uint objectEveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask;
199 177
200 if (m_bypassPermissions) 178 if (m_bypassPermissions)
@@ -240,6 +218,31 @@ namespace OpenSim.Region.Environment
240 return objectEveryoneMask; 218 return objectEveryoneMask;
241 } 219 }
242 220
221
222 private uint ApplyObjectModifyMasks(uint parentMask, uint objectOwnerMask)
223 {
224 if ((parentMask & (uint)PermissionMask.Copy) != 0)
225 {
226 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
227 }
228
229 if ((parentMask & (uint)PermissionMask.Move) != 0)
230 {
231 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectMove;
232 }
233
234 if ((parentMask & (uint)PermissionMask.Modify) != 0)
235 {
236 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectModify;
237 }
238
239 if ((parentMask & (uint)PermissionMask.Transfer) != 0)
240 {
241 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
242 }
243 return objectOwnerMask;
244 }
245
243 protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId) 246 protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
244 { 247 {
245 // Default: deny 248 // Default: deny
diff --git a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
index 1583124..b54f777 100644
--- a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
+++ b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
@@ -35,8 +35,20 @@ namespace OpenSim.Region.Environment.Scenes
35 public class AvatarAppearance 35 public class AvatarAppearance
36 { 36 {
37 protected LLUUID m_scenePresenceID; 37 protected LLUUID m_scenePresenceID;
38
39 public LLUUID ScenePresenceID
40 {
41 get { return m_scenePresenceID; }
42 set { m_scenePresenceID = value; }
43 }
38 protected int m_wearablesSerial = 1; 44 protected int m_wearablesSerial = 1;
39 45
46 public int WearablesSerial
47 {
48 get { return m_wearablesSerial; }
49 set { m_wearablesSerial = value; }
50 }
51
40 protected byte[] m_visualParams; 52 protected byte[] m_visualParams;
41 53
42 public byte[] VisualParams 54 public byte[] VisualParams
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 043b094..159eaf1 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -72,6 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
72 72
73 public partial class SceneObjectPart : IScriptHost 73 public partial class SceneObjectPart : IScriptHost
74 { 74 {
75
75 [XmlIgnore] public PhysicsActor PhysActor = null; 76 [XmlIgnore] public PhysicsActor PhysActor = null;
76 77
77 public LLUUID LastOwnerID; 78 public LLUUID LastOwnerID;
@@ -764,11 +765,13 @@ namespace OpenSim.Region.Environment.Scenes
764 765
765 public void TrimPermissions() 766 public void TrimPermissions()
766 { 767 {
768
767 BaseMask &= (uint)PermissionMask.All; 769 BaseMask &= (uint)PermissionMask.All;
768 OwnerMask &= (uint)PermissionMask.All; 770 OwnerMask &= (uint)PermissionMask.All;
769 GroupMask &= (uint)PermissionMask.All; 771 GroupMask &= (uint)PermissionMask.All;
770 EveryoneMask &= (uint)PermissionMask.All; 772 EveryoneMask &= (uint)PermissionMask.All;
771 NextOwnerMask &= (uint)PermissionMask.All; 773 NextOwnerMask &= (uint)PermissionMask.All;
774
772 } 775 }
773 776
774 /// <summary> 777 /// <summary>