fixed the key issue that caused appearance to go wonky

0.6.0-stable
Sean Dague 2008-05-15 21:14:42 +00:00
parent 30202542c0
commit 129e7e19c5
1 changed files with 13 additions and 2 deletions

View File

@ -25,14 +25,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using log4net;
using OpenSim.Framework; using OpenSim.Framework;
namespace OpenSim.Data namespace OpenSim.Data
{ {
public abstract class UserDataBase : IUserData public abstract class UserDataBase : IUserData
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<LLUUID, AvatarAppearance> aplist = new Dictionary<LLUUID, AvatarAppearance>(); private Dictionary<LLUUID, AvatarAppearance> aplist = new Dictionary<LLUUID, AvatarAppearance>();
public abstract UserProfileData GetUserByUUID(LLUUID user); public abstract UserProfileData GetUserByUUID(LLUUID user);
@ -56,14 +60,21 @@ namespace OpenSim.Data
public abstract void Initialise(string connect); public abstract void Initialise(string connect);
public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
public AvatarAppearance GetUserAppearance(LLUUID user) { public AvatarAppearance GetUserAppearance(LLUUID user) {
if (aplist[user] != null) { AvatarAppearance aa;
try {
m_log.Info("[APPEARANCE] Found appearance for " + user.ToString());
aa = aplist[user];
} catch (System.Collections.Generic.KeyNotFoundException e) {
m_log.Info("[APPEARANCE] Setting up default appearance for " + user.ToString());
aplist[user] = new AvatarAppearance(); aplist[user] = new AvatarAppearance();
aplist[user].Owner = user; aplist[user].Owner = user;
aa = aplist[user];
} }
return aplist[user]; return aa;
} }
public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) { public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) {
aplist[user] = appearance; aplist[user] = appearance;
m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString());
} }
public abstract void AddAttachment(LLUUID user, LLUUID item); public abstract void AddAttachment(LLUUID user, LLUUID item);
public abstract void RemoveAttachment(LLUUID user, LLUUID item); public abstract void RemoveAttachment(LLUUID user, LLUUID item);