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

@ -413,6 +413,8 @@ namespace OpenSim.Framework
/// duplicate attachpoints
/// </summary>
public List<AvatarAttachment> GetAttachments()
{
lock (m_attachments)
{
List<AvatarAttachment> alist = new List<AvatarAttachment>();
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
@ -423,19 +425,26 @@ namespace OpenSim.Framework
return alist;
}
}
internal void AppendAttachment(AvatarAttachment attach)
{
if (! m_attachments.ContainsKey(attach.AttachPoint))
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)
{
lock (m_attachments)
{
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
m_attachments[attach.AttachPoint].Add(attach);
}
}
/// <summary>
/// Add an attachment, if the attachpoint has the
@ -449,11 +458,14 @@ namespace OpenSim.Framework
return;
if (item == UUID.Zero)
{
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
if ((attachpoint & 0x80) > 0)
@ -469,6 +481,8 @@ namespace OpenSim.Framework
}
public int GetAttachpoint(UUID itemID)
{
lock (m_attachments)
{
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
{
@ -479,8 +493,11 @@ namespace OpenSim.Framework
return 0;
}
}
public void DetachAttachment(UUID itemID)
{
lock (m_attachments)
{
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
{
@ -497,11 +514,15 @@ namespace OpenSim.Framework
}
}
}
}
public void ClearAttachments()
{
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;
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);