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

avinationmerge
Tom Grimshaw 2010-07-03 06:11:46 -07:00
commit e4739523d3
12 changed files with 48 additions and 79 deletions

View File

@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities
if (mm != null)
{
if (!mm.UploadCovered(client))
if (!mm.UploadCovered(client, mm.UploadCharge))
{
if (client != null)
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);

View File

@ -35,35 +35,15 @@ namespace OpenSim.Framework
bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
int amount);
int GetBalance(IClientAPI client);
void ApplyUploadCharge(UUID agentID);
bool UploadCovered(IClientAPI client);
void ApplyGroupCreationCharge(UUID agentID);
bool GroupCreationCovered(IClientAPI client);
int GetBalance(UUID agentID);
bool UploadCovered(IClientAPI client, int amount);
bool AmountCovered(IClientAPI client, int amount);
void ApplyCharge(UUID agentID, int amount, string text);
void ApplyUploadCharge(UUID agentID, int amount, string text);
EconomyData GetEconomyData();
int UploadCharge { get; }
int GroupCreationCharge { get; }
event ObjectPaid OnObjectPaid;
}
public struct EconomyData
{
public int ObjectCapacity;
public int ObjectCount;
public int PriceEnergyUnit;
public int PriceGroupCreate;
public int PriceObjectClaim;
public float PriceObjectRent;
public float PriceObjectScaleFactor;
public int PriceParcelClaim;
public float PriceParcelClaimFactor;
public int PriceParcelRent;
public int PricePublicObjectDecay;
public int PricePublicObjectDelete;
public int PriceRentLight;
public int PriceUpload;
public int TeleportMinPrice;
}
}

View File

@ -900,7 +900,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Start the IClientAPI
// Spin it off so that it doesn't clog up the LLUDPServer
Util.FireAndForget(delegate(object o) { client.Start(); });
//Util.FireAndForget(delegate(object o) { client.Start(); });
// NOTE: DO NOT CALL THIS ASYNCHRONOUSLY!!!!!
// This method will ultimately cause the modules to hook
// client events in OnNewClient. If they can't do this
// before further packets are processed, packets WILL BE LOST.
// This includes the all-important EconomyDataRequest!
// So using FireAndForget here WILL screw up money. Badly.
// You have been warned!
client.Start();
}
else
{

View File

@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
if (mm != null)
{
if (!mm.UploadCovered(remoteClient))
if (!mm.UploadCovered(remoteClient, mm.UploadCharge))
{
remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
return;

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
end = Utils.Clamp(end, 1, texture.Data.Length);
start = Utils.Clamp(start, 0, end - 1);
m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
if (end - start < texture.Data.Length)
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;

View File

@ -152,7 +152,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
urlData.urlcode = urlcode;
urlData.requests = new Dictionary<UUID, RequestData>();
m_UrlMap[url] = urlData;
string uri = "/lslhttp/" + urlcode.ToString();
@ -386,6 +385,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
return response;
}
public void HttpRequestHandler(UUID requestID, Hashtable request)
{
lock (request)
@ -400,8 +400,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
int pos1 = uri.IndexOf("/");// /lslhttp
int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/
string uri_tmp = uri.Substring(0, pos3 + 1);
int pos3 = pos2 + 37; // /lslhttp/urlcode
string uri_tmp = uri.Substring(0, pos3);
//HTTP server code doesn't provide us with QueryStrings
string pathInfo;
string queryString;

View File

@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes
IMoneyModule money=RequestModuleInterface<IMoneyModule>();
if (money != null)
{
money.ApplyUploadCharge(agentID);
money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
}
AddInventoryItem(agentID, item);

View File

@ -722,11 +722,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (money != null)
{
// do the transaction, that is if the agent has got sufficient funds
if (!money.GroupCreationCovered(remoteClient)) {
if (!money.AmountCovered(remoteClient, money.GroupCreationCharge)) {
remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group.");
return UUID.Zero;
}
money.ApplyGroupCreationCharge(GetRequestingAgentID(remoteClient));
money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation");
}
UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));

View File

@ -108,6 +108,16 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
public event ObjectPaid OnObjectPaid;
public int UploadCharge
{
get { return 0; }
}
public int GroupCreationCharge
{
get { return 0; }
}
/// <summary>
/// Startup
/// </summary>
@ -188,17 +198,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
// Please do not refactor these to be just one method
// Existing implementations need the distinction
//
public void ApplyUploadCharge(UUID agentID)
{
}
public void ApplyGroupCreationCharge(UUID agentID)
{
}
public void ApplyCharge(UUID agentID, int amount, string text)
{
}
public void ApplyUploadCharge(UUID agentID, int amount, string text)
{
}
public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount)
{
@ -268,27 +273,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
}
public EconomyData GetEconomyData()
{
EconomyData edata = new EconomyData();
edata.ObjectCapacity = ObjectCapacity;
edata.ObjectCount = ObjectCount;
edata.PriceEnergyUnit = PriceEnergyUnit;
edata.PriceGroupCreate = PriceGroupCreate;
edata.PriceObjectClaim = PriceObjectClaim;
edata.PriceObjectRent = PriceObjectRent;
edata.PriceObjectScaleFactor = PriceObjectScaleFactor;
edata.PriceParcelClaim = PriceParcelClaim;
edata.PriceParcelClaimFactor = PriceParcelClaimFactor;
edata.PriceParcelRent = PriceParcelRent;
edata.PricePublicObjectDecay = PricePublicObjectDecay;
edata.PricePublicObjectDelete = PricePublicObjectDelete;
edata.PriceRentLight = PriceRentLight;
edata.PriceUpload = PriceUpload;
edata.TeleportMinPrice = TeleportMinPrice;
return edata;
}
private void GetClientFunds(IClientAPI client)
{
CheckExistAndRefreshFunds(client.AgentId);
@ -790,7 +774,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
//m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString());
}
public int GetBalance(IClientAPI client)
public int GetBalance(UUID agentID)
{
return 0;
}
@ -798,16 +782,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
// Please do not refactor these to be just one method
// Existing implementations need the distinction
//
public bool UploadCovered(IClientAPI client)
public bool UploadCovered(IClientAPI client, int amount)
{
return AmountCovered(client, PriceUpload);
return true;
}
public bool GroupCreationCovered(IClientAPI client)
{
return AmountCovered(client, PriceGroupCreate);
}
public bool AmountCovered(IClientAPI client, int amount)
{
return true;

View File

@ -5247,7 +5247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ',':
if (parens == 0)
{
result.Add(src.Substring(start,length).Trim());
result.Add(new LSL_String(src.Substring(start,length).Trim()));
start += length+1;
length = 0;
}

View File

@ -663,13 +663,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
Object[] ret;
if (start < 0)
start=m_data.Length-start;
start=m_data.Length+start;
if (start < 0)
start=0;
if (end < 0)
end=m_data.Length-end;
end=m_data.Length+end;
if (end < 0)
end=0;

View File

@ -840,8 +840,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
item.Name, startParam, postOnRez,
stateSource, m_MaxScriptQueue);
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString());
m_log.DebugFormat(
"[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
if (presence != null)
{