Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2010-12-07 15:27:50 +00:00
commit dd416f4b63
6 changed files with 112 additions and 38 deletions

View File

@ -414,27 +414,36 @@ namespace OpenSim.Framework
/// </summary>
public List<AvatarAttachment> GetAttachments()
{
List<AvatarAttachment> alist = new List<AvatarAttachment>();
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
lock (m_attachments)
{
foreach (AvatarAttachment attach in kvp.Value)
alist.Add(new AvatarAttachment(attach));
}
List<AvatarAttachment> alist = new List<AvatarAttachment>();
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
{
foreach (AvatarAttachment attach in kvp.Value)
alist.Add(new AvatarAttachment(attach));
}
return alist;
return alist;
}
}
internal void AppendAttachment(AvatarAttachment attach)
{
if (! m_attachments.ContainsKey(attach.AttachPoint))
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
m_attachments[attach.AttachPoint].Add(attach);
lock (m_attachments)
{
if (!m_attachments.ContainsKey(attach.AttachPoint))
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
m_attachments[attach.AttachPoint].Add(attach);
}
}
internal void ReplaceAttachment(AvatarAttachment attach)
{
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
m_attachments[attach.AttachPoint].Add(attach);
lock (m_attachments)
{
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
m_attachments[attach.AttachPoint].Add(attach);
}
}
/// <summary>
@ -450,9 +459,12 @@ namespace OpenSim.Framework
if (item == UUID.Zero)
{
if (m_attachments.ContainsKey(attachpoint))
m_attachments.Remove(attachpoint);
return;
lock (m_attachments)
{
if (m_attachments.ContainsKey(attachpoint))
m_attachments.Remove(attachpoint);
return;
}
}
// check if this is an append or a replace, 0x80 marks it as an append
@ -470,37 +482,46 @@ namespace OpenSim.Framework
public int GetAttachpoint(UUID itemID)
{
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
lock (m_attachments)
{
int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
if (index >= 0)
return kvp.Key;
}
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
{
int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
if (index >= 0)
return kvp.Key;
}
return 0;
return 0;
}
}
public void DetachAttachment(UUID itemID)
{
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
lock (m_attachments)
{
int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
if (index >= 0)
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
{
// Remove it from the list of attachments at that attach point
m_attachments[kvp.Key].RemoveAt(index);
int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
if (index >= 0)
{
// Remove it from the list of attachments at that attach point
m_attachments[kvp.Key].RemoveAt(index);
// And remove the list if there are no more attachments here
if (m_attachments[kvp.Key].Count == 0)
m_attachments.Remove(kvp.Key);
return;
// And remove the list if there are no more attachments here
if (m_attachments[kvp.Key].Count == 0)
m_attachments.Remove(kvp.Key);
return;
}
}
}
}
public void ClearAttachments()
{
m_attachments.Clear();
lock (m_attachments)
{
m_attachments.Clear();
}
}
#region Packing Functions
@ -537,11 +558,14 @@ namespace OpenSim.Framework
OSDBinary visualparams = new OSDBinary(m_visualparams);
data["visualparams"] = visualparams;
// Attachments
OSDArray attachs = new OSDArray(m_attachments.Count);
foreach (AvatarAttachment attach in GetAttachments())
attachs.Add(attach.Pack());
data["attachments"] = attachs;
lock (m_attachments)
{
// Attachments
OSDArray attachs = new OSDArray(m_attachments.Count);
foreach (AvatarAttachment attach in GetAttachments())
attachs.Add(attach.Pack());
data["attachments"] = attachs;
}
return data;
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Framework
{
public interface ICallingCardModule
{
UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID);
}
}

View File

@ -222,6 +222,12 @@ namespace OpenSim
m_moduleLoader = new ModuleLoader(m_config.Source);
LoadPlugins();
if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
{
Environment.Exit(1);
}
foreach (IApplicationPlugin plugin in m_plugins)
{
plugin.PostInitialise();

View File

@ -167,6 +167,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
{
if (XferUploaders.ContainsKey(transactionID))
{
m_log.DebugFormat("[XFER]: Asked to update item {0} ({1})",
item.Name, item.ID);
// Here we need to get the old asset to extract the
// texture UUIDs if it's a wearable.
if (item.AssetType == (int)AssetType.Bodypart ||
@ -191,6 +194,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
IInventoryService invService = m_Scene.InventoryService;
invService.UpdateItem(item);
m_log.DebugFormat("[XFER]: Updated item {0} ({1}) with asset {2}",
item.Name, item.ID, asset.FullID);
}
}
}

View File

@ -40,7 +40,12 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
public class AssetXferUploader
{
// Viewer's notion of the default texture
private UUID defaultID = new UUID("5748decc-f629-461c-9a36-a35a221fe21f");
private List<UUID> defaultIDs = new List<UUID> {
new UUID("5748decc-f629-461c-9a36-a35a221fe21f"),
new UUID("7ca39b4c-bd19-4699-aff7-f93fd03d3e7b"),
new UUID("6522e74d-1660-4e7f-b601-6f48c1659a77"),
new UUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97")
};
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private AssetBase m_asset;
@ -244,6 +249,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
item.Flags = (uint) wearableType;
item.CreationDate = Util.UnixTimeSinceEpoch();
m_log.DebugFormat("[XFER]: Created item {0} with asset {1}",
item.ID, item.AssetID);
if (m_Scene.AddInventoryItem(item))
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
else
@ -280,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
UUID tx = new UUID(parts[1]);
int id = Convert.ToInt32(parts[0]);
if (tx == defaultID || tx == UUID.Zero ||
if (defaultIDs.Contains(tx) || tx == UUID.Zero ||
(allowed.ContainsKey(id) && allowed[id] == tx))
{
validated.Add(parts[0] + " " + tx.ToString());
@ -293,7 +301,11 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
if ((perms & full) != full)
{
m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId);
validated.Add(parts[0] + " " + defaultID.ToString());
validated.Add(parts[0] + " " + UUID.Zero.ToString());
}
else
{
validated.Add(line);
}
}
textures--;

View File

@ -516,6 +516,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>();
if (ccm != null)
{
ccm.CreateCallingCard(agentID, friendID, UUID.Zero);
}
// Update the local cache
UpdateFriendsCache(agentID);
@ -679,6 +685,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
(byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>();
if (ccm != null)
{
ccm.CreateCallingCard(friendID, userID, UUID.Zero);
}
// Update the local cache
UpdateFriendsCache(friendID);