Compare commits

..

4 Commits

Author SHA1 Message Date
UbitUmarov df7468ffa2 fix a cast 2016-09-21 14:41:14 +01:00
UbitUmarov 5648f4ae6e kick mr jenkins 2016-09-21 14:23:08 +01:00
UbitUmarov c2dfa48604 missing file 2016-09-21 14:18:14 +01:00
UbitUmarov 8b1a174430 ****DANGER**** try to make LSL_Types.key to work. bin/ScriptEngines contents must be deleted to recompile scripts. Needs more testing on all uses of key type ****DANGER**** 2016-09-21 14:04:23 +01:00
1423 changed files with 167794 additions and 191150 deletions

2
.gitignore vendored
View File

@ -31,7 +31,6 @@
*/*/*/*/*/bin
*/*/*/*/*/*/bin
*/*/*/*/*/*/*/bin
.vs/
addon-modules/
bin/Debug/*.dll
bin/*.dll.mdb
@ -94,6 +93,7 @@ TAGS
Makefile.local
bin/.version
compile.bat
addon-modules
OpenSim/Data/Tests/test-results/
OpenSim/Framework/Serialization/Tests/test-results/
OpenSim/Framework/Servers/Tests/test-results/

View File

@ -145,12 +145,7 @@
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.permissions">
<arg value="./bin/OpenSim.Tests.Permissions.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.permissions)==0}" />
<delete dir="%temp%"/>
<delete dir="%temp%"/>
</target>
<target name="test-stress" depends="build, find-nunit">
@ -265,11 +260,6 @@
<arg value="-xml=test-results/OpenSim.Services.InventoryService.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.tests.permissions">
<arg value="./bin/OpenSim.Tests.Permissions.dll" />
<arg value="-xml=test-results/OpenSim.Tests.Permissions.dll-Results.xml" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
@ -281,7 +271,6 @@
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.permissions)==0}" />
</target>
<target name="doxygen">

View File

@ -1,35 +1,38 @@
# Building on Windows
Steps:
* runprebuild.bat
* Load OpenSim.sln into Visual Studio .NET and build the solution.
* chdir bin
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
* run OpenSim.exe
# Building on Linux / Mac
# Building on Linux
Prereqs:
* Mono > 5.0
* On some Linux distributions you may need to install additional packages.
* msbuild or xbuild if still supported by the mono version
* See http://opensimulator.org/wiki/Dependencies for more information.
* Mono >= 2.4.3
* Nant >= 0.85
* On some Linux distributions you may need to install additional packages.
See http://opensimulator.org/wiki/Dependencies for more information.
* May also use xbuild (included in mono distributions)
* May use Monodevelop, a cross-platform IDE
From the distribution type:
* ./runprebuild.sh
* type msbuild or xbuild
* nant (or !* xbuild)
* cd bin
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
* review and change those ini files according to your needs
* windows: execute opensim.exe or opensim32.exe for small regions
* linux: run ./opensim.sh
* msbuild (xbuild) option switches
* clean: msbuild /target:clean
* debug: (default) msbuild /property:Configuration=Debug
* release: msbuild /property:Configuration=Release
* run mono OpenSim.exe
!* xbuild option switches
!* clean: xbuild /target:clean
!* debug: (default) xbuild /property:Configuration=Debug
!* release: xbuild /property:Configuration=Release
# Using Monodevelop
From the distribution type:
* ./runprebuild.sh
* type monodevelop OpenSim.sln
# References

View File

@ -4,9 +4,14 @@ The following people have contributed to OpenSim (Thank you for your effort!)
These folks represent the current core team for OpenSim, and are the
people that make the day to day of OpenSim happen.
* justincc (OSVW Consulting, justincc.org)
* Melanie Thielker
* Diva (Crista Lopes, University of California, Irvine)
* BlueWall (James Hughes)
* Nebadon Izumi (Michael Cerquoni, OSgrid)
* Snoopy Pfeffer
* Robert Adams (MisterBlue)
* Oren Hurvitz (Kitely)
* Kevin Cozens
* Leal Duarte (Ubit Umarov)
@ -15,8 +20,11 @@ Core developers who have temporarily (we hope) gone chasing the white rabbit.
They are in all similar to the active core developers, except that they haven't
been that active lately, so their voting rights are awaiting their come back.
* Nebadon Izumi (Michael Cerquoni, OSgrid)
* Alicia Raven
* Teravus (w3z)
* Arthur Rodrigo S Valadares (IBM)
* Dan Lake
* Marck
* Mic Bowman
= Past Open Sim Developers =
These folks are alumns of the OpenSim core group, but are now
@ -49,15 +57,7 @@ where we are today.
* John Hurliman
* chi11ken (Genkii)
* dahlia
* justincc (OSVW Consulting, justincc.org)
* Arthur Rodrigo S Valadares (IBM)
* BlueWall (James Hughes)
* Dan Lake
* Marck
* Mic Bowman
* Oren Hurvitz (Kitely)
* Snoopy Pfeffer
* Teravus (w3z)
= Additional OpenSim Contributors =
These folks have contributed code patches or content to OpenSimulator to help make it
@ -69,9 +69,9 @@ what it is today.
* alex_carnell
* Alan Webb (IBM)
* Aleric
* Alicia Raven
* Allen Kerensky
* BigFootAg
* Bill Blight
* BlueWall Slade
* bobshaffer2
* brianw/Sir_Ahzz
@ -89,7 +89,6 @@ what it is today.
* dmiles (Daxtron Labs)
* Dong Jun Lan (IBM)
* DoranZemlja
* Drake Arconis
* dr0b3rts
* dslake
* eeyore
@ -108,7 +107,6 @@ what it is today.
* Flyte Xevious
* Freaky Tech
* Garmin Kawaguichi
* Geir Noklebye
* Glenn Martin (MOSES)
* Gryc Ueusp
* H-H-H (ginge264)
@ -117,7 +115,6 @@ what it is today.
* Imaze Rhiano
* Intimidated
* Jak Daniels
* Jeff Kelly
* Jeremy Bongio (IBM)
* jhurliman
* John R Sohn (XenReborn)
@ -131,7 +128,6 @@ what it is today.
* KittyLiu
* Kurt Taylor (IBM)
* Lani Global
* lickx
* lillith_xue
* lkalif
* LuciusSirnah
@ -140,10 +136,8 @@ what it is today.
* Magnuz Binder
* maimedleech
* Mana Janus
* Mandarinka Tasty
* MarcelEdward
* Matt Lehmann
* mewtwo0641
* Mic Bowman
* Michelle Argus
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
@ -151,7 +145,6 @@ what it is today.
* Micheil Merlin
* Mike Osias (IBM)
* Mike Pitman (IBM)
* Mike Rieker (Dreamnation)
* mikemig
* mikkopa/_someone - RealXtend
* Misterblue
@ -165,7 +158,6 @@ what it is today.
* openlifegrid.com
* otakup0pe
* Pixel Tomsen
* Quill Littlefeather
* ralphos
* RemedyTomm
* Revolution
@ -185,20 +177,15 @@ what it is today.
* SpotOn3D
* Stefan_Boom / stoehr
* Steven Zielinski (MOSES)
* Stolen Ruby
* Strawberry Fride
* Talun
* TechplexEngineer (Blake Bourque)
* TBG Renfold
* Terry Ford
* tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
* TomDataWorks
* TomTheDragon (muckwaddle)
* tyre
* uriesk
* Vegaslon <vegaslon@gmail.com>
* Vincent Sylvester
* VikingErik
* Vytek
* webmage (IBM)

7241
OpenSim.FxCop Normal file

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ namespace OpenSim.Groups
public string AccessToken;
}
public class ExtendedGroupMembersData
public class ExtendedGroupMembersData
{
// This is the only difference: this is a string
public string AgentID;
@ -65,7 +65,7 @@ namespace OpenSim.Groups
public UUID RoleID;
// This is the only difference: this is a string
public string MemberID;
}
public struct ExtendedGroupNoticeData

105
OpenSim/Addons/Groups/GroupsMessagingModule.cs Executable file → Normal file
View File

@ -131,7 +131,7 @@ namespace OpenSim.Groups
{
if (!m_groupMessagingEnabled)
return;
scene.RegisterModuleInterface<IGroupsMessagingModule>(this);
m_sceneList.Add(scene);
@ -163,7 +163,7 @@ namespace OpenSim.Groups
if (m_groupData == null)
{
m_log.Error("[Groups.Messaging]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
RemoveRegion(scene);
RemoveRegion(scene);
return;
}
@ -218,7 +218,7 @@ namespace OpenSim.Groups
m_msgTransferModule = null;
}
public Type ReplaceableInterface
public Type ReplaceableInterface
{
get { return null; }
}
@ -252,7 +252,7 @@ namespace OpenSim.Groups
m_debugEnabled = verbose;
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
}
/// <summary>
@ -262,7 +262,7 @@ namespace OpenSim.Groups
{
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID.ToString(), groupID, null);
if (groupInfo != null)
@ -279,7 +279,7 @@ namespace OpenSim.Groups
{
SendMessageToGroup(im, groupID, UUID.Zero, null);
}
public void SendMessageToGroup(
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
{
@ -355,9 +355,9 @@ namespace OpenSim.Groups
{
if (!sendCondition(member))
{
if (m_debugEnabled)
if (m_debugEnabled)
m_log.DebugFormat(
"[Groups.Messaging]: Not sending to {0} as they do not fulfill send condition",
"[Groups.Messaging]: Not sending to {0} as they do not fulfill send condition",
member.AgentID);
continue;
@ -366,7 +366,7 @@ namespace OpenSim.Groups
else if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID))
{
// Don't deliver messages to people who have dropped this session
if (m_debugEnabled)
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID);
continue;
@ -414,7 +414,7 @@ namespace OpenSim.Groups
"[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms",
groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick);
}
#region SimGridEventHandlers
void OnClientLogin(IClientAPI client)
@ -445,13 +445,13 @@ namespace OpenSim.Groups
// The instant message module will only deliver messages of dialog types:
// MessageFromAgent, StartTyping, StopTyping, MessageFromObject
//
// Any other message type will not be delivered to a client by the
// Any other message type will not be delivered to a client by the
// Instant Message Module
UUID regionID = new UUID(msg.RegionID);
if (m_debugEnabled)
{
m_log.DebugFormat("[Groups.Messaging]: {0} called, IM from region {1}",
m_log.DebugFormat("[Groups.Messaging]: {0} called, IM from region {1}",
System.Reflection.MethodBase.GetCurrentMethod().Name, regionID);
DebugGridInstantMessage(msg);
@ -508,7 +508,7 @@ namespace OpenSim.Groups
m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he has an agent in region of origin", sp.UUID);
return;
}
else
else
{
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: not skipping agent {0}", sp.UUID);
@ -531,7 +531,7 @@ namespace OpenSim.Groups
}
}
});
}
}
}
@ -555,7 +555,7 @@ namespace OpenSim.Groups
break;
case (byte)InstantMessageDialog.SessionSend:
// User hasn't dropped, so they're in the session,
// User hasn't dropped, so they're in the session,
// maybe we should deliver it.
IClientAPI client = GetActiveClient(new UUID(msg.toAgentID));
if (client != null)
@ -599,34 +599,36 @@ namespace OpenSim.Groups
{
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message");
UUID fromAgent = new UUID(msg.fromAgentID);
// Force? open the group session dialog???
// and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
eq.ChatterboxInvitation(
GroupID
, groupInfo.GroupName
, fromAgent
, msg.message
, AgentID
, msg.fromAgentName
, msg.dialog
, msg.timestamp
, msg.offline == 1
, (int)msg.ParentEstateID
, msg.Position
, 1
, new UUID(msg.imSessionID)
, msg.fromGroup
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
);
eq.ChatterboxInvitation(
GroupID
, groupInfo.GroupName
, new UUID(msg.fromAgentID)
, msg.message
, AgentID
, msg.fromAgentName
, msg.dialog
, msg.timestamp
, msg.offline == 1
, (int)msg.ParentEstateID
, msg.Position
, 1
, new UUID(msg.imSessionID)
, msg.fromGroup
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
);
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
eq.ChatterBoxSessionAgentListUpdates(GroupID, new UUID(msg.toAgentID), updates);
}
eq.ChatterBoxSessionAgentListUpdates(
new UUID(GroupID)
, AgentID
, new UUID(msg.toAgentID)
, false //canVoiceChat
, false //isModerator
, false //text mute
, true // Enter
);
}
}
}
@ -653,7 +655,7 @@ namespace OpenSim.Groups
UUID AgentID = new UUID(im.fromAgentID);
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null);
if (groupInfo != null)
{
AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
@ -661,12 +663,15 @@ namespace OpenSim.Groups
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
if (queue != null)
{
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
queue.ChatterBoxSessionAgentListUpdates(GroupID, remoteClient.AgentId, updates);
}
queue.ChatterBoxSessionAgentListUpdates(
GroupID
, AgentID
, new UUID(im.toAgentID)
, false //canVoiceChat
, false //isModerator
, false //text mute
, true
);
}
}
@ -676,7 +681,7 @@ namespace OpenSim.Groups
UUID GroupID = new UUID(im.imSessionID);
UUID AgentID = new UUID(im.fromAgentID);
if (m_debugEnabled)
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
//If this agent is sending a message, then they want to be in the session
@ -708,7 +713,11 @@ namespace OpenSim.Groups
bodyMap.Add("session_info", sessionMap);
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
queue?.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
if (queue != null)
{
queue.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
}
}
private void DebugGridInstantMessage(GridInstantMessage im)

356
OpenSim/Addons/Groups/GroupsModule.cs Executable file → Normal file
View File

@ -38,7 +38,7 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using PermissionMask = OpenSim.Framework.PermissionMask;
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
namespace OpenSim.Groups
{
@ -51,7 +51,7 @@ namespace OpenSim.Groups
private List<Scene> m_sceneList = new List<Scene>();
private IMessageTransferModule m_msgTransferModule = null;
private IGroupsServicesConnector m_groupData = null;
private IUserManagement m_UserManagement;
@ -127,7 +127,7 @@ namespace OpenSim.Groups
m_debugEnabled = verbose;
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
}
public void RegionLoaded(Scene scene)
@ -210,7 +210,7 @@ namespace OpenSim.Groups
if (m_debugEnabled) m_log.Debug("[Groups]: Shutting down Groups module.");
}
public Type ReplaceableInterface
public Type ReplaceableInterface
{
get { return null; }
}
@ -233,7 +233,7 @@ namespace OpenSim.Groups
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
//client.OnRequestAvatarProperties += OnRequestAvatarProperties;
client.OnRequestAvatarProperties += OnRequestAvatarProperties;
}
@ -249,7 +249,7 @@ namespace OpenSim.Groups
// There might be some problem with the thread we're generating this on but not
// doing the update at this time causes problems (Mantis #7920 and #7915)
// TODO: move sending this update to a later time in the rootification of the client.
if(!sp.m_haveGroupInformation)
if(!sp.haveGroupInformation)
SendAgentGroupDataUpdate(sp.ControllingClient, false);
}
@ -261,7 +261,7 @@ namespace OpenSim.Groups
// Used for Notices and Group Invites/Accept/Reject
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
}
/*
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@ -269,7 +269,7 @@ namespace OpenSim.Groups
GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
}
*/
private void OnClientClosed(UUID AgentId, Scene scene)
{
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@ -281,7 +281,7 @@ namespace OpenSim.Groups
if (client != null)
{
client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
//client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
// make child possible not called?
client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
client.OnInstantMessage -= OnInstantMessage;
@ -318,7 +318,7 @@ namespace OpenSim.Groups
SendAgentGroupDataUpdate(remoteClient, false);
// also current viewers do ignore it and ask later on a much nicer thread
// also current viewers do ignore it and ask later on a much nicer thread
// its a info request not a change, so nothing is sent to others
// they do get the group title with the avatar object update on arrivel to a region
}
@ -344,24 +344,14 @@ namespace OpenSim.Groups
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
{
if (m_debugEnabled)
m_log.DebugFormat("[Groups]: OnInstantMessage called");
if(remoteClient == null || !remoteClient.IsActive || remoteClient.AgentId == UUID.Zero)
return;
Scene scene = (Scene)remoteClient.Scene;
if (scene == null)
return;
string remoteAgentIDstr = remoteClient.AgentId.ToString();
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
//m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
// Group invitations
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
{
UUID inviteID = new UUID(im.imSessionID);
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(remoteAgentIDstr, inviteID);
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
if (inviteInfo == null)
{
@ -384,7 +374,7 @@ namespace OpenSim.Groups
// and the sessionid is the role
string reason = string.Empty;
if (!m_groupData.AddAgentToGroup(remoteAgentIDstr, invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
if (!m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
remoteClient.SendAgentAlertMessage("Unable to add you to the group: " + reason, false);
else
{
@ -411,106 +401,79 @@ namespace OpenSim.Groups
}
}
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
}
// Reject
if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
{
if (m_debugEnabled)
m_log.DebugFormat("[Groups]: Received a reject invite notice.");
if (m_debugEnabled) m_log.DebugFormat("[Groups]: Received a reject invite notice.");
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
m_groupData.RemoveAgentFromGroup(remoteAgentIDstr, inviteInfo.AgentID, inviteInfo.GroupID);
m_groupData.RemoveAgentFromGroup(GetRequestingAgentIDStr(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID);
}
}
}
// Group notices
else if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
{
if (!m_groupNoticesEnabled)
{
return;
}
UUID GroupID = new UUID(im.toAgentID);
GroupMembershipData grpMemberData = m_groupData.GetAgentGroupMembership(remoteAgentIDstr, remoteAgentIDstr, GroupID);
if (grpMemberData == null)
if (m_groupData.GetGroupRecord(GetRequestingAgentIDStr(remoteClient), GroupID, null) != null)
{
remoteClient.SendAgentAlertMessage("Group membership not found", false);
return;
}
UUID NoticeID = UUID.Random();
string Subject = im.message.Substring(0, im.message.IndexOf('|'));
string Message = im.message.Substring(Subject.Length + 1);
if ((grpMemberData.GroupPowers & (ulong)GroupPowers.SendNotices) == 0)
{
remoteClient.SendAgentAlertMessage("No permission to send notice to group", false);
return;
}
InventoryItemBase item = null;
bool hasAttachment = false;
int index = im.message.IndexOf('|');
if (index < 0)
return;
string Subject = im.message.Substring(0, index);
string Message = im.message.Substring(index + 1);
UUID NoticeID = UUID.Random();
InventoryItemBase item = null;
bool hasAttachment = false;
if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0)
{
UUID itemID = UUID.Zero;
UUID ownerID = UUID.Zero;
try
if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0)
{
string binBucket = Utils.BytesToString(im.binaryBucket);
binBucket = binBucket.Substring(15); // remove extra LLSD pre header
OSDMap binBucketMAP = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket);
itemID = binBucketMAP["item_id"].AsUUID();
ownerID = binBucketMAP["owner_id"].AsUUID();
}
catch
{
m_log.DebugFormat("[GROUPS]: failed to decode group notice bucket");
return;
}
if (itemID != UUID.Zero && ownerID != UUID.Zero)
{
item = scene.InventoryService.GetItem(ownerID, itemID);
if(item != null)
{
if ((item.CurrentPermissions & (uint)(PermissionMask.Transfer | PermissionMask.Copy)) !=
(uint)(PermissionMask.Transfer | PermissionMask.Copy))
{
remoteClient.SendAgentAlertMessage("Item must be have Copy and Transfer rights to attach to group notice", false);
return;
}
}
hasAttachment = true;
}
}
string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
binBucket = binBucket.Remove(0, 14).Trim();
if (m_groupData.AddGroupNotice(remoteAgentIDstr, GroupID, NoticeID, im.fromAgentName, Subject, Message,
hasAttachment,
(byte)(item == null ? 0 : item.AssetType),
item == null ? null : item.Name,
item == null ? UUID.Zero : item.ID,
item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
{
OnNewGroupNotice?.Invoke(GroupID, NoticeID);
// Send notice out to everyone that wants notices
foreach (GroupMembersData member in m_groupData.GetGroupMembers(remoteAgentIDstr, GroupID))
{
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)InstantMessageDialog.GroupNotice);
if (member.AcceptNotices)
OSD binBucketOSD = OSDParser.DeserializeLLSDXml(binBucket);
if (binBucketOSD is OSDMap)
{
// Build notice IIM, one of reach, because the sending may be async
msg.toAgentID = member.AgentID.Guid;
OutgoingInstantMessage(msg, member.AgentID);
OSDMap binBucketMap = (OSDMap)binBucketOSD;
UUID itemID = binBucketMap["item_id"].AsUUID();
UUID ownerID = binBucketMap["owner_id"].AsUUID();
item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID);
}
else
m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());
}
if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message,
hasAttachment,
(byte)(item == null ? 0 : item.AssetType),
item == null ? null : item.Name,
item == null ? UUID.Zero : item.ID,
item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
{
if (OnNewGroupNotice != null)
{
OnNewGroupNotice(GroupID, NoticeID);
}
// Send notice out to everyone that wants notices
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
{
if (member.AcceptNotices)
{
// Build notice IIM, one of reach, because the sending may be async
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
msg.toAgentID = member.AgentID.Guid;
OutgoingInstantMessage(msg, member.AgentID);
}
}
}
}
@ -518,130 +481,41 @@ namespace OpenSim.Groups
if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted)
{
if (!m_groupNoticesEnabled)
if (im.binaryBucket.Length < 16) // Invalid
return;
//// 16 bytes are the UUID. Maybe.
// UUID folderID = new UUID(im.binaryBucket, 0);
UUID noticeID = new UUID(im.imSessionID);
if (m_debugEnabled)
m_log.DebugFormat("[xmlGROUPS]: Accepted notice {0} for {1}", noticeID, remoteClient.AgentId);
if (noticeID == UUID.Zero)
return;
UUID folderID = UUID.Zero;
try
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID);
if (notice != null)
{
if (im.binaryBucket != null && im.binaryBucket.Length >= 16)
folderID = new UUID(im.binaryBucket, 0);
UUID giver = new UUID(im.toAgentID);
string tmp = string.Empty;
Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
string message;
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
giver, notice.noticeData.AttachmentItemID, out message);
if (itemCopy == null)
{
remoteClient.SendAgentAlertMessage(message, false);
return;
}
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
}
catch
{
m_log.DebugFormat("[xmlGROUPS]: GroupNoticeInventoryAccepted failed to decode target folder");
return;
}
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
if (notice == null)
{
if (m_debugEnabled)
m_log.DebugFormat(
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
noticeID, remoteClient.AgentId);
return;
}
string tmp;
UUID giver = new UUID(im.toAgentID);
Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
string message = "Could not find group notice attached item";
InventoryItemBase itemCopy = scene.GiveInventoryItem(remoteClient.AgentId,
giver, notice.noticeData.AttachmentItemID, folderID, out message);
if (itemCopy == null)
{
remoteClient.SendAgentAlertMessage(message, false);
return;
}
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
}
else if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryDeclined)
{
if (!m_groupNoticesEnabled)
return;
UUID noticeID = new UUID(im.imSessionID);
if (m_debugEnabled)
m_log.DebugFormat("[GROUPS]: Accepted notice {0} for {1}", noticeID, remoteAgentIDstr);
if (noticeID == UUID.Zero)
return;
UUID remoteAgentID = remoteClient.AgentId;
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
if (notice == null)
{
if (m_debugEnabled)
m_log.DebugFormat(
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
noticeID, remoteClient.AgentId);
return;
}
string giver = notice.noticeData.AttachmentOwnerID;
UUID attachmentUUID = notice.noticeData.AttachmentItemID;
if (attachmentUUID == null ||
attachmentUUID == UUID.Zero ||
giver == null ||
giver == UUID.Zero.ToString()
)
return;
if (m_debugEnabled)
m_log.DebugFormat("[xmlGroups]: Deny inventory from {0} to {1}", giver, remoteAgentIDstr);
string message = String.Empty;
InventoryItemBase itemCopy = scene.InventoryService.GetItem(remoteAgentID, attachmentUUID);
if (itemCopy == null)
return;
InventoryFolderBase trash = scene.InventoryService.GetFolderForType(remoteAgentID, FolderType.Trash);
if (trash == null)
{
m_log.DebugFormat("[GROUPS]: failed to find trash folder for {0} ", remoteAgentID);
return;
}
if (itemCopy.Folder == trash.ID || remoteAgentIDstr == notice.noticeData.AttachmentOwnerID)
return;
itemCopy.Folder = trash.ID;
scene.InventoryService.MoveItems(itemCopy.Owner, new List<InventoryItemBase>() { itemCopy });
if (itemCopy == null)
{
remoteClient.SendAgentAlertMessage(message, false);
return;
}
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
}
// Interop, received special 210 code for ejecting a group member
// this only works within the comms servers domain, and won't work hypergrid
// TODO:FIXME: Use a presense server of some kind to find out where the
// TODO:FIXME: Use a presense server of some kind to find out where the
// client actually is, and try contacting that region directly to notify them,
// or provide the notification via xmlrpc update queue
else if ((im.dialog == 210))
if ((im.dialog == 210))
{
// This is sent from the region that the ejectee was ejected from
// if it's being delivered here, then the ejectee is here
@ -649,7 +523,7 @@ namespace OpenSim.Groups
UUID ejecteeID = new UUID(im.toAgentID);
im.imSessionID = UUID.Zero.Guid;
im.imSessionID = UUID.Zero.Guid;
im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
OutgoingInstantMessage(im, ejecteeID);
@ -703,7 +577,7 @@ namespace OpenSim.Groups
{
return m_groupData.GetGroupRecord(UUID.Zero.ToString(), UUID.Zero, name);
}
public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@ -711,7 +585,7 @@ namespace OpenSim.Groups
m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID);
// Changing active group changes title, active powers, all kinds of things
// anyone who is in any region that can see this client, should probably be
// anyone who is in any region that can see this client, should probably be
// updated with new group info. At a minimum, they should get ScenePresence
// updated with new title.
SendAgentGroupDataUpdate(remoteClient, true);
@ -746,10 +620,10 @@ namespace OpenSim.Groups
public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
{
if (m_debugEnabled)
if (m_debugEnabled)
m_log.DebugFormat(
"[Groups]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name);
List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), groupID);
if (m_debugEnabled)
@ -832,7 +706,7 @@ namespace OpenSim.Groups
public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
{
if (m_debugEnabled)
if (m_debugEnabled)
m_log.DebugFormat(
"[Groups]: {0} called with groupID={1}, agentID={2}",
System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID);
@ -882,7 +756,7 @@ namespace OpenSim.Groups
if (avatar != null)
{
if (avatar.GodController.UserLevel < m_levelGroupCreate)
if (avatar.UserLevel < m_levelGroupCreate)
{
remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
return UUID.Zero;
@ -902,18 +776,18 @@ namespace OpenSim.Groups
}
string reason = string.Empty;
UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment,
UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment,
allowPublish, maturePublish, remoteClient.AgentId, out reason);
if (groupID != UUID.Zero)
{
if (money != null && money.GroupCreationCharge > 0)
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
if (money != null)
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
// Update the founder with new group information.
SendAgentGroupDataUpdate(remoteClient, true);
SendAgentGroupDataUpdate(remoteClient, false);
}
else
remoteClient.SendCreateGroupReply(groupID, false, reason);
@ -949,7 +823,7 @@ namespace OpenSim.Groups
if (membership != null)
{
return membership.GroupTitle;
}
}
return string.Empty;
}
@ -965,7 +839,7 @@ namespace OpenSim.Groups
// TODO: Not sure what all is needed here, but if the active group role change is for the group
// the client currently has set active, then we need to do a scene presence update too
// if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
SendDataUpdate(remoteClient, true);
}
@ -1025,7 +899,7 @@ namespace OpenSim.Groups
case 1:
// Remove
m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentIDStr(remoteClient), memberID.ToString(), groupID, roleID);
break;
default:
m_log.ErrorFormat("[Groups]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes);
@ -1075,7 +949,6 @@ namespace OpenSim.Groups
bucket = new byte[19 + name.Length];
bucket[0] = 1; // has attachment?
bucket[1] = info.noticeData.AttachmentType; // attachment type
info.GroupID.ToBytes(bucket, 2);
name.CopyTo(bucket, 18);
}
else
@ -1086,6 +959,7 @@ namespace OpenSim.Groups
bucket[18] = 0; // null terminated
}
info.GroupID.ToBytes(bucket, 2);
msg.binaryBucket = bucket;
}
else
@ -1105,28 +979,10 @@ namespace OpenSim.Groups
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
GroupRecord groupRecord = GetGroupRecord(groupID);
IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
// Should check to see if there's an outstanding invitation
if (money != null && groupRecord.MembershipFee > 0)
{
// Does the agent have the funds to cover the group join fee?
if (!money.AmountCovered(remoteClient.AgentId, groupRecord.MembershipFee))
{
remoteClient.SendAlertMessage("Insufficient funds to join the group.");
remoteClient.SendJoinGroupReply(groupID, false);
return;
}
}
string reason = string.Empty;
// Should check to see if OpenEnrollment, or if there's an outstanding invitation
if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason))
{
if (money != null && groupRecord.MembershipFee > 0)
money.ApplyCharge(remoteClient.AgentId, groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName);
remoteClient.SendJoinGroupReply(groupID, true);
@ -1216,7 +1072,7 @@ namespace OpenSim.Groups
// Send Message to Ejectee
GridInstantMessage msg = new GridInstantMessage();
// if local send a normal message
if(ejecteeClient != null)
{
@ -1334,7 +1190,7 @@ namespace OpenSim.Groups
public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query)
{
return m_groupData.FindGroups(remoteClient.AgentId.ToString(), query);
return m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), query);
}
#endregion
@ -1468,7 +1324,7 @@ namespace OpenSim.Groups
membershipArray = membershipData.ToArray();
}
}
if (m_debugEnabled)
{
m_log.InfoFormat("[Groups]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId);

View File

@ -103,7 +103,7 @@ namespace OpenSim.Groups
if (!m_Enabled)
return;
m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
m_Scenes.Add(scene);
@ -135,7 +135,7 @@ namespace OpenSim.Groups
{
m_LocalGroupsConnector = new GroupsServiceLocalConnectorModule(m_Config, m_UserManagement);
// Also, if local, create the endpoint for the HGGroupsService
new HGGroupsServiceRobustConnector(m_Config, MainServer.Instance, string.Empty,
new HGGroupsServiceRobustConnector(m_Config, MainServer.Instance, string.Empty,
scene.RequestModuleInterface<IOfflineIMService>(), scene.RequestModuleInterface<IUserAccountService>());
}
@ -170,7 +170,7 @@ namespace OpenSim.Groups
if (sp is ScenePresence && ((ScenePresence)sp).PresenceType != PresenceType.Npc)
{
AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId);
if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 &&
if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 &&
m_OfflineIM != null && m_Messaging != null)
{
List<GridInstantMessage> ims = m_OfflineIM.GetMessages(aCircuit.AgentID);
@ -184,12 +184,12 @@ namespace OpenSim.Groups
#region IGroupsServicesConnector
public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{
reason = string.Empty;
if (m_UserManagement.IsLocalGridUser(RequestingAgentID))
return m_LocalGroupsConnector.CreateGroup(RequestingAgentID, name, charter, showInList, insigniaID,
return m_LocalGroupsConnector.CreateGroup(RequestingAgentID, name, charter, showInList, insigniaID,
membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason);
else
{
@ -198,14 +198,14 @@ namespace OpenSim.Groups
}
}
public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
{
reason = string.Empty;
string url = string.Empty;
string name = string.Empty;
if (IsLocal(groupID, out url, out name))
return m_LocalGroupsConnector.UpdateGroup(AgentUUI(RequestingAgentID), groupID, charter, showInList, insigniaID, membershipFee,
return m_LocalGroupsConnector.UpdateGroup(AgentUUI(RequestingAgentID), groupID, charter, showInList, insigniaID, membershipFee,
openEnrollment, allowPublish, maturePublish, out reason);
else
{
@ -246,9 +246,9 @@ namespace OpenSim.Groups
return null;
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
{
return m_LocalGroupsConnector.FindGroups(RequestingAgentIDstr, search);
return m_LocalGroupsConnector.FindGroups(AgentUUI(RequestingAgentID), search);
}
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
@ -374,7 +374,7 @@ namespace OpenSim.Groups
}
}
return new List<GroupRoleMembersData>();
}
@ -605,8 +605,14 @@ namespace OpenSim.Groups
private string AgentUUI(string AgentIDStr)
{
UUID AgentID = UUID.Zero;
if (!UUID.TryParse(AgentIDStr, out AgentID) || AgentID == UUID.Zero)
return UUID.Zero.ToString();
try
{
AgentID = new UUID(AgentIDStr);
}
catch (FormatException)
{
return AgentID.ToString();
}
if (m_UserManagement.IsLocalGridUser(AgentID))
return AgentID.ToString();
@ -620,7 +626,7 @@ namespace OpenSim.Groups
}
if (agent != null)
return Util.ProduceUserUniversalIdentifier(agent);
// we don't know anything about this foreign user
// try asking the user management module, which may know more
return m_UserManagement.GetUserUUI(AgentID);
@ -630,8 +636,14 @@ namespace OpenSim.Groups
private string AgentUUIForOutside(string AgentIDStr)
{
UUID AgentID = UUID.Zero;
if (!UUID.TryParse(AgentIDStr, out AgentID) || AgentID == UUID.Zero)
return UUID.Zero.ToString();
try
{
AgentID = new UUID(AgentIDStr);
}
catch (FormatException)
{
return AgentID.ToString();
}
AgentCircuitData agent = null;
foreach (Scene scene in m_Scenes)
@ -652,7 +664,7 @@ namespace OpenSim.Groups
string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
if (Util.ParseUniversalUserIdentifier(uID, out userID, out url, out first, out last, out tmp))
m_UserManagement.AddUser(userID, first, last, url);
return userID;
}

View File

@ -64,8 +64,8 @@ namespace OpenSim.Groups
m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName);
string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty);
string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty);
if (homeURI == string.Empty)
throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName));
@ -115,10 +115,9 @@ namespace OpenSim.Groups
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -34,12 +34,12 @@ namespace OpenSim.Groups
{
public interface IGroupsServicesConnector
{
UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee,
UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee,
bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID, out string reason);
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason);
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName);
List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search);
List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search);
List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID);
bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason);
@ -75,7 +75,7 @@ namespace OpenSim.Groups
/// If the user is a member of the group then the data structure is returned. If not, then null is returned.
/// </returns>
ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID);
/// <summary>
/// Get information about the groups to which a user belongs.
/// </summary>
@ -87,7 +87,7 @@ namespace OpenSim.Groups
/// </returns>
List<GroupMembershipData> GetAgentGroupMemberships(string RequestingAgentID, string AgentID);
bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID);
GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID);
List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID);

View File

@ -108,7 +108,7 @@ namespace OpenSim.Groups
if (!m_Enabled)
return;
m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
m_Scenes.Add(scene);
}
@ -146,16 +146,16 @@ namespace OpenSim.Groups
#region IGroupsServicesConnector
public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{
m_log.DebugFormat("[Groups]: Creating group {0}", name);
reason = string.Empty;
return m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID,
return m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID,
membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason);
}
public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
{
reason = string.Empty;
@ -173,9 +173,9 @@ namespace OpenSim.Groups
return null;
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
{
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
return m_GroupsService.FindGroups(RequestingAgentID, search);
}
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
@ -296,7 +296,7 @@ namespace OpenSim.Groups
public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
{
return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message,
return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message,
hasAttachment, attType, attName, attItemID, attOwnerID);
}

View File

@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Mono.Addins;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Addons.Groups")]
@ -15,8 +15,8 @@ using Mono.Addins;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -26,7 +26,7 @@ using Mono.Addins;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -41,7 +41,7 @@ using Nini.Config;
namespace OpenSim.Groups
{
public class GroupsServiceRemoteConnector
public class GroupsServiceRemoteConnector
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -71,7 +71,7 @@ namespace OpenSim.Groups
}
///
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}",
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}",
m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
}
@ -153,7 +153,7 @@ namespace OpenSim.Groups
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string query)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
{
List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
if (string.IsNullOrEmpty(query))
@ -161,7 +161,7 @@ namespace OpenSim.Groups
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["Query"] = query;
sendData["RequestingAgentID"] = RequestingAgentIDstr;
sendData["RequestingAgentID"] = RequestingAgentID;
Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);

View File

@ -113,7 +113,7 @@ namespace OpenSim.Groups
if (!m_Enabled)
return;
m_log.DebugFormat("[Groups.RemoteConnector]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
m_log.DebugFormat("[Groups.RemoteConnector]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
m_Scenes.Add(scene);
}
@ -151,7 +151,7 @@ namespace OpenSim.Groups
#region IGroupsServicesConnector
public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{
m_log.DebugFormat("[Groups.RemoteConnector]: Creating group {0}", name);
@ -167,7 +167,7 @@ namespace OpenSim.Groups
return groupID;
}
public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
{
string r = string.Empty;
@ -186,16 +186,16 @@ namespace OpenSim.Groups
if (GroupID == UUID.Zero && (GroupName == null || GroupName != null && GroupName == string.Empty))
return null;
return m_CacheWrapper.GetGroupRecord(RequestingAgentID,GroupID,GroupName, delegate
{
return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName);
return m_CacheWrapper.GetGroupRecord(RequestingAgentID,GroupID,GroupName, delegate
{
return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName);
});
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
{
// TODO!
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
return m_GroupsService.FindGroups(RequestingAgentID, search);
}
public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
@ -362,7 +362,7 @@ namespace OpenSim.Groups
m_GroupsService.RemoveAgentToGroupInvite(RequestingAgentID, inviteID);
}
public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
{
GroupNoticeInfo notice = new GroupNoticeInfo();

View File

@ -91,10 +91,9 @@ namespace OpenSim.Groups
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);
@ -287,7 +286,7 @@ namespace OpenSim.Groups
string requestingAgentID = request["RequestingAgentID"].ToString();
if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
NullResult(result, string.Format("Insufficient permissions. {0}", agentID));
NullResult(result, string.Format("Insufficient permissions.", agentID));
else
result["RESULT"] = "true";
}
@ -394,7 +393,7 @@ namespace OpenSim.Groups
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("RoleID") ||
!request.ContainsKey("Name") || !request.ContainsKey("Description") || !request.ContainsKey("Title") ||
!request.ContainsKey("Powers") || !request.ContainsKey("OP"))
!request.ContainsKey("Powers") || !request.ContainsKey("OP"))
NullResult(result, "Bad network data");
else
@ -520,11 +519,11 @@ namespace OpenSim.Groups
bool success = false;
if (op == "ADD")
success = m_GroupsService.AddAgentToGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(),
success = m_GroupsService.AddAgentToGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(),
new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()));
else if (op == "DELETE")
success = m_GroupsService.RemoveAgentFromGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(),
success = m_GroupsService.RemoveAgentFromGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(),
new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()));
result["RESULT"] = success.ToString();
@ -648,8 +647,8 @@ namespace OpenSim.Groups
string op = request["OP"].ToString();
if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID"))
{
bool success = m_GroupsService.AddAgentToGroupInvite(request["RequestingAgentID"].ToString(),
{
bool success = m_GroupsService.AddAgentToGroupInvite(request["RequestingAgentID"].ToString(),
new UUID(request["InviteID"].ToString()), new UUID(request["GroupID"].ToString()),
new UUID(request["RoleID"].ToString()), request["AgentID"].ToString());
@ -665,7 +664,7 @@ namespace OpenSim.Groups
}
else if (op == "GET")
{
GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request["RequestingAgentID"].ToString(),
GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request["RequestingAgentID"].ToString(),
new UUID(request["InviteID"].ToString()));
if (invite != null)

View File

@ -43,63 +43,60 @@ namespace OpenSim.Groups
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public const GroupPowers DefaultEveryonePowers =
GroupPowers.AllowSetHome |
GroupPowers.Accountable |
GroupPowers.JoinChat |
GroupPowers.AllowVoiceChat |
GroupPowers.ReceiveNotices |
GroupPowers.StartProposal |
GroupPowers.VoteOnProposal;
public const GroupPowers DefaultEveryonePowers = GroupPowers.AllowSetHome |
GroupPowers.Accountable |
GroupPowers.JoinChat |
GroupPowers.AllowVoiceChat |
GroupPowers.ReceiveNotices |
GroupPowers.StartProposal |
GroupPowers.VoteOnProposal;
public const GroupPowers OfficersPowers = DefaultEveryonePowers |
GroupPowers.AllowFly |
GroupPowers.AllowLandmark |
GroupPowers.AllowRez |
GroupPowers.AssignMemberLimited |
GroupPowers.ChangeIdentity |
GroupPowers.ChangeMedia |
GroupPowers.ChangeOptions |
GroupPowers.DeedObject |
GroupPowers.Eject |
GroupPowers.FindPlaces |
GroupPowers.Invite |
GroupPowers.LandChangeIdentity |
GroupPowers.LandDeed |
GroupPowers.LandDivideJoin |
GroupPowers.LandEdit |
GroupPowers.AllowEnvironment |
GroupPowers.LandEjectAndFreeze |
GroupPowers.LandGardening |
GroupPowers.LandManageAllowed |
GroupPowers.LandManageBanned |
GroupPowers.LandManagePasses |
GroupPowers.LandOptions |
GroupPowers.LandRelease |
GroupPowers.LandSetSale |
GroupPowers.MemberVisible |
GroupPowers.ModerateChat |
GroupPowers.ObjectManipulate |
GroupPowers.ObjectSetForSale |
GroupPowers.ReturnGroupOwned |
GroupPowers.ReturnGroupSet |
GroupPowers.ReturnNonGroup |
GroupPowers.RoleProperties |
GroupPowers.SendNotices |
GroupPowers.SetLandingPoint;
public const GroupPowers OwnerPowers = OfficersPowers |
GroupPowers.Accountable |
GroupPowers.AllowEditLand |
GroupPowers.AssignMember |
GroupPowers.ChangeActions |
GroupPowers.CreateRole |
GroupPowers.DeleteRole |
GroupPowers.ExperienceAdmin |
GroupPowers.ExperienceCreator |
GroupPowers.GroupBanAccess |
GroupPowers.HostEvent |
GroupPowers.RemoveMember;
public const GroupPowers OwnerPowers = GroupPowers.Accountable |
GroupPowers.AllowEditLand |
GroupPowers.AllowFly |
GroupPowers.AllowLandmark |
GroupPowers.AllowRez |
GroupPowers.AllowSetHome |
GroupPowers.AllowVoiceChat |
GroupPowers.AssignMember |
GroupPowers.AssignMemberLimited |
GroupPowers.ChangeActions |
GroupPowers.ChangeIdentity |
GroupPowers.ChangeMedia |
GroupPowers.ChangeOptions |
GroupPowers.CreateRole |
GroupPowers.DeedObject |
GroupPowers.DeleteRole |
GroupPowers.Eject |
GroupPowers.FindPlaces |
GroupPowers.HostEvent |
GroupPowers.Invite |
GroupPowers.JoinChat |
GroupPowers.LandChangeIdentity |
GroupPowers.LandDeed |
GroupPowers.LandDivideJoin |
GroupPowers.LandEdit |
GroupPowers.LandEjectAndFreeze |
GroupPowers.LandGardening |
GroupPowers.LandManageAllowed |
GroupPowers.LandManageBanned |
GroupPowers.LandManagePasses |
GroupPowers.LandOptions |
GroupPowers.LandRelease |
GroupPowers.LandSetSale |
GroupPowers.ModerateChat |
GroupPowers.ObjectManipulate |
GroupPowers.ObjectSetForSale |
GroupPowers.ReceiveNotices |
GroupPowers.RemoveMember |
GroupPowers.ReturnGroupOwned |
GroupPowers.ReturnGroupSet |
GroupPowers.ReturnNonGroup |
GroupPowers.RoleProperties |
GroupPowers.SendNotices |
GroupPowers.SetLandingPoint |
GroupPowers.StartProposal |
GroupPowers.VoteOnProposal;
#region Daily Cleanup
@ -129,7 +126,7 @@ namespace OpenSim.Groups
#endregion
public UUID CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
public UUID CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{
reason = string.Empty;
@ -154,25 +151,20 @@ namespace OpenSim.Groups
data.Data["ShowInList"] = showInList ? "1" : "0";
data.Data["AllowPublish"] = allowPublish ? "1" : "0";
data.Data["MaturePublish"] = maturePublish ? "1" : "0";
UUID ownerRoleID = UUID.Random();
data.Data["OwnerRoleID"] = ownerRoleID.ToString();
UUID roleID = UUID.Random();
data.Data["OwnerRoleID"] = roleID.ToString();
if (!m_Database.StoreGroup(data))
return UUID.Zero;
// Create Everyone role
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group is in the everyone role.", "Member of " + name, (ulong)DefaultEveryonePowers, true);
// Create Officers role
UUID officersRoleID = UUID.Random();
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, officersRoleID, "Officers", "The officers of the group, with more powers than regular members.", "Officer of " + name, (ulong)OfficersPowers, true);
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group", "Member of " + name, (ulong)DefaultEveryonePowers, true);
// Create Owner role
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, ownerRoleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, roleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
// Add founder to group
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, ownerRoleID);
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, officersRoleID);
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, roleID);
return data.GroupID;
}
@ -231,22 +223,15 @@ namespace OpenSim.Groups
if (d.Data.ContainsKey("Location") && d.Data["Location"] != string.Empty)
continue;
int nmembers = m_Database.MemberCount(d.GroupID);
if(nmembers == 0)
continue;
DirGroupsReplyData g = new DirGroupsReplyData();
g.groupID = d.GroupID;
if (d.Data.ContainsKey("Name"))
g.groupName = d.Data["Name"];
else
{
m_log.DebugFormat("[Groups]: Key Name not found");
continue;
}
g.groupID = d.GroupID;
g.members = nmembers;
g.members = m_Database.MemberCount(d.GroupID);
groups.Add(g);
}
@ -279,7 +264,7 @@ namespace OpenSim.Groups
if (ownerRole != null)
ownerRoleID = ownerRole.RoleID;
// Check visibility?
// Check visibility?
// When we don't want to check visibility, we pass it "all" as the requestingAgentID
bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
@ -322,20 +307,20 @@ namespace OpenSim.Groups
m.Contribution = Int32.Parse(d.Data["Contribution"]);
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
GridUserData gud = m_GridUserService.Get(d.PrincipalID);
if (gud != null)
{
if (bool.Parse(gud.Data["Online"]))
{
m.OnlineStatus = @"Online";
}
else
{
int unixtime = int.Parse(gud.Data["Login"]);
// The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
}
}
GridUserData gud = m_GridUserService.Get(d.PrincipalID);
if (gud != null)
{
if (bool.Parse(gud.Data["Online"]))
{
m.OnlineStatus = @"Online";
}
else
{
int unixtime = int.Parse(gud.Data["Login"]);
// The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
}
}
// Is this person an owner of the group?
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
@ -500,7 +485,7 @@ namespace OpenSim.Groups
// check permissions
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID);
if (!limited && !unlimited)
{
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
@ -511,7 +496,7 @@ namespace OpenSim.Groups
if (!unlimited && limited)
{
// check whether person's has this role
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
if (rolemembership == null)
{
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
@ -531,26 +516,13 @@ namespace OpenSim.Groups
return false;
// check permissions
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
if (!limited && !unlimited)
if (!unlimited)
{
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
return false;
}
// AssignMemberLimited means that the person can assign another person to the same roles that she has in the group
if (!unlimited && limited)
{
// check whether person's has this role
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
if (rolemembership == null)
{
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
return false;
}
}
RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
if (rolemember == null)
@ -568,8 +540,8 @@ namespace OpenSim.Groups
{
newRoleID = r.RoleID;
break;
}
}
}
}
MembershipData member = m_Database.RetrieveMember(GroupID, AgentID);
if (member != null)
@ -727,7 +699,7 @@ namespace OpenSim.Groups
m_Database.StoreMember(membership);
}
public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
{
// Check perms
@ -840,7 +812,7 @@ namespace OpenSim.Groups
if (RoleID != UUID.Zero)
_AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
// Make this the active group
// Make thit this active group
PrincipalData pdata = new PrincipalData();
pdata.PrincipalID = AgentID;
pdata.ActiveGroupID = GroupID;
@ -858,7 +830,7 @@ namespace OpenSim.Groups
return false;
}
if (!add && data == null) // it doesn't exist, can't update
if (!add && data == null) // it deosn't exist, can't update
{
m_log.DebugFormat("[Groups]: Group {0} doesn't exist. Can't update it", groupID);
return false;

View File

@ -35,67 +35,67 @@ using OpenSim.Services.Base;
namespace OpenSim.Groups
{
public class GroupsServiceBase : ServiceBase
{
protected IGroupsData m_Database = null;
protected IGridUserData m_GridUserService = null;
public class GroupsServiceBase : ServiceBase
{
protected IGroupsData m_Database = null;
protected IGridUserData m_GridUserService = null;
public GroupsServiceBase(IConfigSource config, string cName)
: base(config)
{
string dllName = String.Empty;
string connString = String.Empty;
string realm = "os_groups";
string usersRealm = "GridUser";
string configName = (cName == string.Empty) ? "Groups" : cName;
public GroupsServiceBase(IConfigSource config, string cName)
: base(config)
{
string dllName = String.Empty;
string connString = String.Empty;
string realm = "os_groups";
string usersRealm = "GridUser";
string configName = (cName == string.Empty) ? "Groups" : cName;
//
// Try reading the [DatabaseService] section, if it exists
//
IConfig dbConfig = config.Configs["DatabaseService"];
if (dbConfig != null)
{
if (dllName == String.Empty)
dllName = dbConfig.GetString("StorageProvider", String.Empty);
if (connString == String.Empty)
connString = dbConfig.GetString("ConnectionString", String.Empty);
}
//
// Try reading the [DatabaseService] section, if it exists
//
IConfig dbConfig = config.Configs["DatabaseService"];
if (dbConfig != null)
{
if (dllName == String.Empty)
dllName = dbConfig.GetString("StorageProvider", String.Empty);
if (connString == String.Empty)
connString = dbConfig.GetString("ConnectionString", String.Empty);
}
//
// [Groups] section overrides [DatabaseService], if it exists
//
IConfig groupsConfig = config.Configs[configName];
if (groupsConfig != null)
{
dllName = groupsConfig.GetString("StorageProvider", dllName);
connString = groupsConfig.GetString("ConnectionString", connString);
realm = groupsConfig.GetString("Realm", realm);
}
//
// [Groups] section overrides [DatabaseService], if it exists
//
IConfig groupsConfig = config.Configs[configName];
if (groupsConfig != null)
{
dllName = groupsConfig.GetString("StorageProvider", dllName);
connString = groupsConfig.GetString("ConnectionString", connString);
realm = groupsConfig.GetString("Realm", realm);
}
//
// We tried, but this doesn't exist. We can't proceed.
//
if (dllName.Equals(String.Empty))
throw new Exception("No StorageProvider configured");
//
// We tried, but this doesn't exist. We can't proceed.
//
if (dllName.Equals(String.Empty))
throw new Exception("No StorageProvider configured");
m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm });
if (m_Database == null)
throw new Exception("Could not find a storage interface in the given module " + dllName);
m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm });
if (m_Database == null)
throw new Exception("Could not find a storage interface in the given module " + dllName);
//
// [GridUserService] section overrides [DatabaseService], if it exists
//
IConfig usersConfig = config.Configs["GridUserService"];
if (usersConfig != null)
{
dllName = usersConfig.GetString("StorageProvider", dllName);
connString = usersConfig.GetString("ConnectionString", connString);
//
// [GridUserService] section overrides [DatabaseService], if it exists
//
IConfig usersConfig = config.Configs["GridUserService"];
if (usersConfig != null)
{
dllName = usersConfig.GetString("StorageProvider", dllName);
connString = usersConfig.GetString("ConnectionString", connString);
usersRealm = usersConfig.GetString("Realm", usersRealm);
}
}
m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm });
if (m_GridUserService == null)
throw new Exception("Could not find a storage inferface for the given users module " + dllName);
}
}
m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm });
if (m_GridUserService == null)
throw new Exception("Could not find a storage inferface for the given users module " + dllName);
}
}
}

View File

@ -76,7 +76,7 @@ namespace OpenSim.Groups
// Check if it already exists
GroupData grec = m_Database.RetrieveGroup(groupID);
if (grec == null ||
if (grec == null ||
(grec != null && grec.Data["Location"] != string.Empty && grec.Data["Location"].ToLower() != serviceLocation.ToLower()))
{
// Create the group

View File

@ -114,6 +114,7 @@ namespace OpenSim.OfflineIM
scene.ForEachClient(delegate(IClientAPI client)
{
client.OnRetrieveInstantMessages -= RetrieveInstantMessages;
client.OnMuteListRequest -= OnMuteListRequest;
});
}
@ -161,6 +162,7 @@ namespace OpenSim.OfflineIM
private void OnNewClient(IClientAPI client)
{
client.OnRetrieveInstantMessages += RetrieveInstantMessages;
client.OnMuteListRequest += OnMuteListRequest;
}
private void RetrieveInstantMessages(IClientAPI client)
@ -192,6 +194,20 @@ namespace OpenSim.OfflineIM
}
}
// Apparently this is needed in order for the viewer to request the IMs.
private void OnMuteListRequest(IClientAPI client, uint crc)
{
m_log.DebugFormat("[OfflineIM.V2] Got mute list request for crc {0}", crc);
string filename = "mutes" + client.AgentId.ToString();
IXfer xfer = client.Scene.RequestModuleInterface<IXfer>();
if (xfer != null)
{
xfer.AddNewFile(filename, new Byte[0]);
client.SendMuteListUpdate(filename);
}
}
private void UndeliveredMessage(GridInstantMessage im)
{
if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&

View File

@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Mono.Addins;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Addons.OfflineIM")]
@ -15,8 +15,8 @@ using Mono.Addins;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -26,7 +26,7 @@ using Mono.Addins;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -77,7 +77,7 @@ namespace OpenSim.OfflineIM
break;
}
///
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}",
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}",
m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
}
@ -140,7 +140,7 @@ namespace OpenSim.OfflineIM
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["UserID"] = userID;
MakeRequest("DELETE", sendData);
}

View File

@ -90,7 +90,7 @@ namespace OpenSim.OfflineIM
public bool StoreMessage(GridInstantMessage im, out string reason)
{
reason = string.Empty;
// Check limits
UUID principalID = new UUID(im.toAgentID);
long count = m_Database.GetCount("PrincipalID", principalID.ToString());
@ -110,8 +110,9 @@ namespace OpenSim.OfflineIM
{
m_serializer.Serialize(writer, im);
writer.Flush();
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
}
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
}
OfflineIMData data = new OfflineIMData();

View File

@ -124,7 +124,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_log.Debug("[LOAD REGIONS PLUGIN]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
Thread.CurrentThread.ManagedThreadId.ToString() +
")");
bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);

View File

@ -38,7 +38,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
public class RegionLoaderFileSystem : IRegionLoader
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_configSource;
public void SetIniConfigSource(IConfigSource configSource)
@ -72,11 +72,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
// Create an empty Regions.ini if there are no existing config files.
if (!allowRegionless && configFiles.Length == 0 && iniFiles.Length == 0)
{
{
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
}
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath);
List<RegionInfo> regionInfos = new List<RegionInfo>();
@ -85,16 +85,16 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
foreach (string file in iniFiles)
{
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
IConfigSource source = new IniConfigSource(file);
foreach (IConfig config in source.Configs)
{
{
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
regionInfos.Add(regionInfo);
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
i++;
}
}
@ -102,12 +102,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
foreach (string file in configFiles)
{
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
regionInfos.Add(regionInfo);
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
i++;
}

View File

@ -122,7 +122,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
throw ex;
}
if (regionCount > 0 || allowRegionless)
if (regionCount > 0 | allowRegionless)
return regionInfos;
m_log.Debug("[WEBLOADER]: Request yielded no regions.");

View File

@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Mono.Addins;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RegionModulesController")]
@ -15,8 +15,8 @@ using Mono.Addins;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -26,7 +26,7 @@ using Mono.Addins;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
}
#region IApplicationPlugin implementation
public void Initialise (OpenSimBase openSim)
{
m_openSim = openSim;
@ -111,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
{
m_log.InfoFormat(
"[REGIONMODULES]: From plugin {0}, (version {1}), loaded {2} modules, {3} shared, {4} non-shared {5} unknown",
loadedModuleData.Key.Id,
loadedModuleData.Key.Id,
loadedModuleData.Key.Version,
loadedModuleData.Value[0] + loadedModuleData.Value[1] + loadedModuleData.Value[2],
loadedModuleData.Value[0], loadedModuleData.Value[1], loadedModuleData.Value[2]);
@ -261,7 +261,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
}
#region Region Module interfacesController implementation
/// <summary>
/// Check that the given module is no disabled in the [Modules] section of the config files.
/// </summary>
@ -293,10 +293,10 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
if (className != String.Empty &&
node.Type.ToString() != className)
return false;
}
}
return true;
}
}
// The root of all evil.
// This is where we handle adding the modules to scenes when they

View File

@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Mono.Addins;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RemoteController")]
@ -15,8 +15,8 @@ using Mono.Addins;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -26,7 +26,7 @@ using Mono.Addins;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -359,42 +359,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
notice = false;
}
if (startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false))
{
m_log.Info("[RADMIN]: Counting affected avatars");
int agents = 0;
if (restartAll)
{
foreach (Scene s in m_application.SceneManager.Scenes)
{
foreach (ScenePresence sp in s.GetScenePresences())
{
if (!sp.IsChildAgent && !sp.IsNPC)
agents++;
}
}
}
else
{
foreach (ScenePresence sp in rebootedScene.GetScenePresences())
{
if (!sp.IsChildAgent && !sp.IsNPC)
agents++;
}
}
m_log.InfoFormat("[RADMIN]: Avatars in region: {0}", agents);
if (agents == 0)
{
m_log.Info("[RADMIN]: No avatars detected, shutting down without delay");
times.Clear();
times.Add(0);
}
}
List<Scene> restartList;
if (restartAll)
@ -412,10 +376,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
// m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
responseData["rebooting"] = false;
throw;
throw e;
}
m_log.Info("[RADMIN]: Restart Region request complete");
@ -611,7 +575,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
responseData["success"] = true;
m_log.Info("[RADMIN]: Shutdown Administrator Request complete");
}
@ -783,9 +747,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
// No INI setting recorded.
}
string regionIniPath;
if (requestData.Contains("region_file"))
{
// Make sure that the file to be created is in a subdirectory of the region storage directory.
@ -809,7 +773,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
region.RegionName.Replace(" ", "_").Replace(":", "_").
Replace("/", "_")));
}
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionIniPath);
region.SaveRegionToFile("dynamic region", regionIniPath);
@ -818,9 +782,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
region.Persistent = false;
}
// Set the estate
// Check for an existing estate
List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]);
if (estateIDs.Count < 1)
@ -831,12 +795,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// ok, client wants us to use an explicit UUID
// regardless of what the avatar name provided
userID = new UUID((string) requestData["estate_owner_uuid"]);
// Check that the specified user exists
Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
IUserAccountService accountService = currentOrFirst.UserAccountService;
UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, userID);
if (user == null)
throw new Exception("Specified user was not found.");
}
@ -845,23 +809,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// We need to look up the UUID for the avatar with the provided name.
string ownerFirst = (string) requestData["estate_owner_first"];
string ownerLast = (string) requestData["estate_owner_last"];
Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
IUserAccountService accountService = currentOrFirst.UserAccountService;
UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID,
ownerFirst, ownerLast);
// Check that the specified user exists
if (user == null)
throw new Exception("Specified user was not found.");
userID = user.PrincipalID;
}
else
{
throw new Exception("Estate owner details not provided.");
}
// Create a new estate with the name provided
region.EstateSettings = m_application.EstateDataService.CreateNewEstate();
@ -888,7 +852,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
throw new Exception("Failed to join estate.");
}
}
// Create the region and perform any initial initialization
IScene newScene;
@ -1195,7 +1159,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set home position
GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
(int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation));
if (null == home)
{
@ -1425,7 +1389,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if ((null != regionXLocation) && (null != regionYLocation))
{
GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
(int)Util.RegionToWorldLoc((uint)regionXLocation), (int)Util.RegionToWorldLoc((uint)regionYLocation));
if (null == home) {
m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName);
@ -1452,7 +1416,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
throw e;
}
m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
}
}
@ -1644,7 +1608,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
GetSceneFromRegionParams(requestData, responseData, out scene);
string filename = (string) requestData["filename"];
bool mergeOar = false;
bool skipAssets = false;
@ -1771,7 +1735,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted;
m_log.InfoFormat(
"[RADMIN]: Submitting save OAR request for {0} to file {1}, request ID {2}",
"[RADMIN]: Submitting save OAR request for {0} to file {1}, request ID {2}",
scene.Name, filename, requestId);
archiver.ArchiveRegion(filename, requestId, options);
@ -1934,7 +1898,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
GetSceneFromRegionParams(requestData, responseData, out scene);
health = scene.GetHealth(out flags, out text);
}
catch
catch (Exception e)
{
responseData["error"] = null;
}
@ -2118,8 +2082,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable responseData = (Hashtable)response.Value;
// Hashtable requestData = (Hashtable)request.Params[0];
m_application.SceneManager.ForEachScene(s =>
s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false)
m_application.SceneManager.ForEachScene(s =>
s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false)
);
responseData["success"] = true;
@ -2851,7 +2815,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (destinationFolder.Type != (short)FolderType.Clothing)
{
destinationFolder = new InventoryFolderBase();
destinationFolder.ID = UUID.Random();
destinationFolder.Name = "Clothing";
destinationFolder.Owner = destination;
@ -2987,11 +2951,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
sourceFolder = new InventoryFolderBase();
sourceFolder.ID = UUID.Random();
if (assetType == FolderType.Clothing)
if (assetType == FolderType.Clothing)
{
sourceFolder.Name = "Clothing";
}
else
}
else
{
sourceFolder.Name = "Body Parts";
}
@ -3087,7 +3051,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// </summary>
private void ApplyNextOwnerPermissions(InventoryItemBase item)
{
if (item.InvType == (int)InventoryType.Object)
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
{
uint perms = item.CurrentPermissions;
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
@ -3204,7 +3168,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set home position
GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
(int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation));
if (null == home) {
m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]);

View File

@ -28,7 +28,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.IO;
using System.Reflection;
using System.Threading;
@ -50,9 +49,9 @@ namespace OpenSim.Framework.Capabilities
/// </summary>
public delegate IClientAPI GetClientDelegate(UUID agentID);
public class Caps : IDisposable
public class Caps
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_httpListenerHostName;
private uint m_httpListenPort;
@ -65,8 +64,8 @@ namespace OpenSim.Framework.Capabilities
private CapsHandlers m_capsHandlers;
private ConcurrentDictionary<string, PollServiceEventArgs> m_pollServiceHandlers
= new ConcurrentDictionary<string, PollServiceEventArgs>();
private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
= new Dictionary<string, PollServiceEventArgs>();
private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
@ -120,19 +119,6 @@ namespace OpenSim.Framework.Capabilities
get { return m_externalCapsHandlers; }
}
[Flags]
public enum CapsFlags:uint
{
None = 0,
SentSeeds = 1,
ObjectAnim = 0x100,
WLEnv = 0x200,
AdvEnv = 0x400
}
public CapsFlags Flags { get; set;}
public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
UUID agent, string regionName)
{
@ -150,39 +136,11 @@ namespace OpenSim.Framework.Capabilities
}
m_agentID = agent;
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort);
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
m_regionName = regionName;
Flags = CapsFlags.None;
m_capsActive.Reset();
}
~Caps()
{
Flags = CapsFlags.None;
if (m_capsActive!= null)
{
m_capsActive.Dispose();
m_capsActive = null;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public void Dispose(bool disposing)
{
Flags = CapsFlags.None;
if (m_capsActive != null)
{
DeregisterHandlers();
m_capsActive.Dispose();
m_capsActive = null;
}
}
/// <summary>
/// Register a handler. This allows modules to register handlers.
/// </summary>
@ -194,32 +152,20 @@ namespace OpenSim.Framework.Capabilities
m_capsHandlers[capName] = handler;
}
public void RegisterSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
{
//m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
m_capsHandlers.AddSimpleHandler(capName, handler, addToListener);
}
public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
{
// m_log.DebugFormat(
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
// capName, pollServiceHandler.Url, m_agentID, m_regionName);
if(!m_pollServiceHandlers.TryAdd(capName, pollServiceHandler))
{
m_log.ErrorFormat(
"[CAPS]: Handler with name {0} already registered (ulr {1}, agent {2}, region {3}",
capName, pollServiceHandler.Url, m_agentID, m_regionName);
return;
}
m_pollServiceHandlers.Add(capName, pollServiceHandler);
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler);
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
// string protocol = "http";
// string hostName = m_httpListenerHostName;
//
//
// if (MainServer.Instance.UseSSL)
// {
// hostName = MainServer.Instance.SSLCommonName;
@ -254,9 +200,8 @@ namespace OpenSim.Framework.Capabilities
foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
{
m_httpListener.RemovePollServiceHTTPHandler(handler.Url);
m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
}
m_pollServiceHandlers.Clear();
}
public bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
@ -288,13 +233,16 @@ namespace OpenSim.Framework.Capabilities
string hostName = m_httpListenerHostName;
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
string protocol = "http";
if (MainServer.Instance.UseSSL)
{
hostName = MainServer.Instance.SSLCommonName;
port = MainServer.Instance.SSLPort;
protocol = "https";
}
//
// caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
}
}
@ -308,7 +256,6 @@ namespace OpenSim.Framework.Capabilities
caps[kvp.Key] = kvp.Value;
}
return caps;
}

View File

@ -27,7 +27,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
@ -41,7 +40,6 @@ namespace OpenSim.Framework.Capabilities
public class CapsHandlers
{
private Dictionary<string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
private ConcurrentDictionary<string, ISimpleStreamHandler> m_capsSimpleHandlers = new ConcurrentDictionary<string, ISimpleStreamHandler>();
private IHttpServer m_httpListener;
private string m_httpListenerHostName;
private uint m_httpListenerPort;
@ -55,15 +53,31 @@ namespace OpenSim.Framework.Capabilities
/// <param name="httpListener">base HTTP server</param>
/// <param name="httpListenerHostname">host name of the HTTP server</param>
/// <param name="httpListenerPort">HTTP port</param>
public CapsHandlers(IHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
{
public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
: this(httpListener,httpListenerHostname,httpListenerPort, false)
{
}
/// <summary></summary>
/// CapsHandlers is a cap handler container but also takes
/// care of adding and removing cap handlers to and from the
/// supplied BaseHttpServer.
/// </summary>
/// <param name="httpListener">base HTTP server</param>
/// <param name="httpListenerHostname">host name of the HTTP
/// server</param>
/// <param name="httpListenerPort">HTTP port</param>
public CapsHandlers(IHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https)
{
m_httpListener = httpListener;
m_httpListenerHostName = httpListenerHostname;
m_httpListenerPort = httpListenerPort;
if (httpListener != null && httpListener.UseSSL)
m_useSSL = true;
else
m_useSSL = false;
m_useSSL = https;
if (httpListener != null && m_useSSL)
{
m_httpListenerHostName = httpListener.SSLCommonName;
m_httpListenerPort = httpListener.SSLPort;
}
}
/// <summary>
@ -75,35 +89,17 @@ namespace OpenSim.Framework.Capabilities
{
lock (m_capsHandlers)
{
if(m_capsHandlers.ContainsKey(capsName))
{
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[capsName].Path);
m_capsHandlers.Remove(capsName);
}
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
m_capsHandlers.Remove(capsName);
}
if(m_capsSimpleHandlers.TryRemove(capsName, out ISimpleStreamHandler hdr))
{
m_httpListener.RemoveSimpleStreamHandler(hdr.Path);
}
}
public void AddSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
{
if(ContainsCap(capName))
Remove(capName);
if(m_capsSimpleHandlers.TryAdd(capName, handler) && addToListener)
m_httpListener.AddSimpleStreamHandler(handler);
}
public bool ContainsCap(string cap)
{
lock (m_capsHandlers)
if (m_capsHandlers.ContainsKey(cap))
return true;
return m_capsSimpleHandlers.ContainsKey(cap);
return m_capsHandlers.ContainsKey(cap);
}
/// <summary>
@ -130,14 +126,11 @@ namespace OpenSim.Framework.Capabilities
if (m_capsHandlers.ContainsKey(idx))
{
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[idx].Path);
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[idx].Path);
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[idx].Path);
m_capsHandlers.Remove(idx);
}
if (null == value) return;
m_capsHandlers[idx] = value;
m_httpListener.AddStreamHandler(value);
}
@ -154,9 +147,8 @@ namespace OpenSim.Framework.Capabilities
{
lock (m_capsHandlers)
{
string[] __keys = new string[m_capsHandlers.Keys.Count + m_capsSimpleHandlers.Keys.Count];
string[] __keys = new string[m_capsHandlers.Keys.Count];
m_capsHandlers.Keys.CopyTo(__keys, 0);
m_capsSimpleHandlers.Keys.CopyTo(__keys, m_capsHandlers.Keys.Count);
return __keys;
}
}
@ -170,39 +162,24 @@ namespace OpenSim.Framework.Capabilities
public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
{
Hashtable caps = new Hashtable();
string protocol = "http://";
if (m_useSSL)
protocol = "https://";
string protocol = m_useSSL ? "https://" : "http://";
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
if (requestedCaps == null)
{
lock (m_capsHandlers)
{
foreach (KeyValuePair<string, ISimpleStreamHandler> kvp in m_capsSimpleHandlers)
caps[kvp.Key] = baseUrl + kvp.Value.Path;
foreach (KeyValuePair<string, IRequestHandler> kvp in m_capsHandlers)
caps[kvp.Key] = baseUrl + kvp.Value.Path;
}
return caps;
}
lock (m_capsHandlers)
{
for(int i = 0; i < requestedCaps.Count; ++i)
foreach (string capsName in m_capsHandlers.Keys)
{
string capsName = requestedCaps[i];
if (excludeSeed && "SEED" == capsName)
continue;
if (m_capsSimpleHandlers.TryGetValue(capsName, out ISimpleStreamHandler shdr))
{
caps[capsName] = baseUrl + shdr.Path;
if (requestedCaps != null && !requestedCaps.Contains(capsName))
continue;
}
if (m_capsHandlers.TryGetValue(capsName, out IRequestHandler chdr))
{
caps[capsName] = baseUrl + chdr.Path;
}
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
}
}

View File

@ -0,0 +1,116 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Reflection;
using System.Web;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
//using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class AvatarPickerSearchHandler : BaseStreamHandler
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IPeople m_PeopleService;
public AvatarPickerSearchHandler(string path, IPeople peopleService, string name, string description)
: base("GET", path, name, description)
{
m_PeopleService = peopleService;
}
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
string names = query.GetOne("names");
string psize = query.GetOne("page_size");
string pnumber = query.GetOne("page");
if (m_PeopleService == null)
return FailureResponse(names, (int)System.Net.HttpStatusCode.InternalServerError, httpResponse);
if (string.IsNullOrEmpty(names) || names.Length < 3)
return FailureResponse(names, (int)System.Net.HttpStatusCode.BadRequest, httpResponse);
m_log.DebugFormat("[AVATAR PICKER SEARCH]: search for {0}", names);
int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
// Full content request
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
//httpResponse.ContentLength = ??;
httpResponse.ContentType = "application/llsd+xml";
List<UserData> users = m_PeopleService.GetUserData(names, page_size, page_number);
LLSDAvatarPicker osdReply = new LLSDAvatarPicker();
osdReply.next_page_url = httpRequest.RawUrl;
foreach (UserData u in users)
osdReply.agents.Array.Add(ConvertUserData(u));
string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
return System.Text.Encoding.UTF8.GetBytes(reply);
}
private LLSDPerson ConvertUserData(UserData user)
{
LLSDPerson p = new LLSDPerson();
p.legacy_first_name = user.FirstName;
p.legacy_last_name = user.LastName;
p.display_name = user.FirstName + " " + user.LastName;
if (user.LastName.StartsWith("@"))
p.username = user.FirstName.ToLower() + user.LastName.ToLower();
else
p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
p.id = user.Id;
p.is_display_name_default = false;
return p;
}
private byte[] FailureResponse(string names, int statuscode, IOSHttpResponse httpResponse)
{
m_log.Error("[AVATAR PICKER SEARCH]: Error searching for " + names);
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return System.Text.Encoding.UTF8.GetBytes(string.Empty);
}
}
}

View File

@ -29,12 +29,9 @@ using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Capabilities.Handlers
{
@ -70,16 +67,16 @@ namespace OpenSim.Capabilities.Handlers
m_LibraryService =
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
ExpiringKey<UUID> m_badRequests = new ExpiringKey<UUID>(30000);
FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
ISimpleStreamHandler reqHandler
= new SimpleStreamHandler("/CAPS/WebFetchInvDesc/", delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
webFetchHandler.FetchInventoryDescendentsRequest(httpRequest, httpResponse, m_badRequests);
});
server.AddSimpleStreamHandler(reqHandler);
IRequestHandler reqHandler
= new RestStreamHandler(
"POST",
"/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/,
webFetchHandler.FetchInventoryDescendentsRequest,
"FetchInvDescendents",
null);
server.AddStreamHandler(reqHandler);
}
}
}

View File

@ -25,12 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Net;
using System.Reflection;
using System.Text;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
@ -60,6 +59,9 @@ namespace OpenSim.Capabilities.Handlers
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
OSDArray itemsRequested = (OSDArray)requestmap["items"];
string reply;
LLSDFetchInventory llsdReply = new LLSDFetchInventory();
UUID[] itemIDs = new UUID[itemsRequested.Count];
int i = 0;
@ -73,6 +75,15 @@ namespace OpenSim.Capabilities.Handlers
if (m_agentID != UUID.Zero)
{
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
if (items == null)
{
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
items = new InventoryItemBase[itemsRequested.Count];
foreach (UUID id in itemIDs)
items[i++] = m_inventoryService.GetItem(m_agentID, id);
}
}
else
{
@ -81,86 +92,55 @@ namespace OpenSim.Capabilities.Handlers
items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
}
StringBuilder lsl = LLSDxmlEncode.Start(4096);
LLSDxmlEncode.AddMap(lsl);
if(m_agentID == UUID.Zero && items.Length > 0)
LLSDxmlEncode.AddElem("agent_id", items[0].Owner, lsl);
else
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
if(items == null || items.Length == 0)
foreach (InventoryItemBase item in items)
{
LLSDxmlEncode.AddEmptyArray("items", lsl);
}
else
{
LLSDxmlEncode.AddArray("items", lsl);
foreach (InventoryItemBase item in items)
if (item != null)
{
if (item != null)
item.ToLLSDxml(lsl, 0xff);
// We don't know the agent that this request belongs to so we'll use the agent id of the item
// which will be the same for all items.
llsdReply.agent_id = item.Owner;
llsdReply.items.Array.Add(ConvertInventoryItem(item));
}
LLSDxmlEncode.AddEndArray(lsl);
}
}
LLSDxmlEncode.AddEndMap(lsl);
return LLSDxmlEncode.End(lsl);
reply = LLSDHelpers.SerialiseLLSDReply(llsdReply);
return reply;
}
public void FetchInventorySimpleRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap requestmap, ExpiringKey<UUID> BadRequests)
/// <summary>
/// Convert an internal inventory item object into an LLSD object.
/// </summary>
/// <param name="invItem"></param>
/// <returns></returns>
private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
{
//m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request);
LLSDInventoryItem llsdItem = new LLSDInventoryItem();
llsdItem.asset_id = invItem.AssetID;
llsdItem.created_at = invItem.CreationDate;
llsdItem.desc = invItem.Description;
llsdItem.flags = ((int)invItem.Flags) & 0xff;
llsdItem.item_id = invItem.ID;
llsdItem.name = invItem.Name;
llsdItem.parent_id = invItem.Folder;
llsdItem.type = invItem.AssetType;
llsdItem.inv_type = invItem.InvType;
if(BadRequests == null)
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
return;
}
llsdItem.permissions = new LLSDPermissions();
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
llsdItem.permissions.group_id = invItem.GroupID;
llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
llsdItem.permissions.is_owner_group = invItem.GroupOwned;
llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
llsdItem.permissions.owner_id = invItem.Owner;
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
llsdItem.sale_info = new LLSDSaleInfo();
llsdItem.sale_info.sale_price = invItem.SalePrice;
llsdItem.sale_info.sale_type = invItem.SaleType;
OSDArray itemsRequested = (OSDArray)requestmap["items"];
UUID[] itemIDs = new UUID[itemsRequested.Count];
int i = 0;
foreach (OSDMap osdItemId in itemsRequested)
{
UUID id = osdItemId["item_id"].AsUUID();
if(!BadRequests.ContainsKey(id))
itemIDs[i++] = id;
}
InventoryItemBase[] items = null;
try
{
// badrequests still not filled
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
}
catch{ }
StringBuilder lsl = LLSDxmlEncode.Start(4096);
LLSDxmlEncode.AddMap(lsl);
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
if (items == null || items.Length == 0)
{
LLSDxmlEncode.AddEmptyArray("items", lsl);
}
else
{
LLSDxmlEncode.AddArray("items", lsl);
foreach (InventoryItemBase item in items)
{
if (item != null)
item.ToLLSDxml(lsl, 0xff);
}
LLSDxmlEncode.AddEndArray(lsl);
}
LLSDxmlEncode.AddEndMap(lsl);
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
httpResponse.StatusCode = (int)HttpStatusCode.OK;
return llsdItem;
}
}
}

View File

@ -120,7 +120,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
string request = "<llsd><map><key>items</key><array><map><key>item_id</key><uuid>";
request += "10000000-0000-0000-0000-000000000001"; // Notecard 1
request += "</uuid></map></array></map></llsd>";
string llsdresponse = handler.FetchInventoryRequest(request, "/FETCH", string.Empty, req, resp);
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");

View File

@ -28,7 +28,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
using log4net;
using log4net.Config;
@ -46,7 +46,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
[TestFixture]
public class FetchInventoryDescendents2HandlerTests : OpenSimTestCase
{
private UUID m_userID = new UUID("00000000-0000-0000-0000-000000000001");
private UUID m_userID = UUID.Zero;
private Scene m_scene;
private UUID m_rootFolderID;
private int m_rootDescendents;
@ -103,7 +103,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
// Add a folder
InventoryFolderBase folder = new InventoryFolderBase(new UUID("f0000000-0000-0000-0000-00000000000f"), "Test Folder", m_userID, m_rootFolderID);
folder.Type = (short)FolderType.None;
m_scene.InventoryService.AddFolder(folder);
// Add a link to notecard 2 in Test Folder
@ -127,19 +126,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
Console.WriteLine("Number of descendents: " + m_rootDescendents);
}
private string dorequest(FetchInvDescHandler handler, string request)
{
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
using(ExpiringKey<UUID> bad = new ExpiringKey<UUID>(5000)) // bad but this is test
using (MemoryStream ms = new MemoryStream(Utils.StringToBytes(request), false))
{
req.InputStream = ms;
handler.FetchInventoryDescendentsRequest(req, resp, bad);
}
return Util.UTF8.GetString(resp.RawBuffer);
}
[Test]
public void Test_001_SimpleFolder()
{
@ -148,18 +134,18 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
Init();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += m_rootFolderID;
request += "</uuid><key>owner_id</key><uuid>";
request += m_userID.ToString();
request += "</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
string llsdresponse = dorequest(handler, request);
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
Assert.That(llsdresponse.Contains(m_userID.ToString()), Is.True, "Response should contain userID");
Assert.That(llsdresponse.Contains("00000000-0000-0000-0000-000000000000"), Is.True, "Response should contain userID");
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
Assert.That(llsdresponse.Contains(descendents), Is.True, "Incorrect number of descendents");
@ -172,17 +158,19 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
TestHelpers.InMethod();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array>";
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += m_rootFolderID;
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map>";
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += m_notecardsFolder;
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map>";
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
request += "</array></map></llsd>";
string llsdresponse = dorequest(handler, request);
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
Console.WriteLine(llsdresponse);
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
@ -200,12 +188,14 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
TestHelpers.InMethod();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += "f0000000-0000-0000-0000-00000000000f";
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
string llsdresponse = dorequest(handler, request);
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
Console.WriteLine(llsdresponse);
string descendents = "descendents</key><integer>2</integer>";
@ -213,7 +203,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
// Make sure that the note card link is included
Assert.That(llsdresponse.Contains("Link to notecard"), Is.True, "Link to notecard is missing");
//Make sure the notecard item itself is included
Assert.That(llsdresponse.Contains("Test Notecard 2"), Is.True, "Notecard 2 item (the source) is missing");
@ -242,6 +232,8 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
TestHelpers.InMethod();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array>";
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
@ -258,7 +250,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
request += "</array></map></llsd>";
string llsdresponse = dorequest(handler, request);
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
Console.WriteLine(llsdresponse);
string root_folder = "<key>folder_id</key><uuid>" + m_rootFolderID + "</uuid>";
@ -275,26 +267,27 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
[Test]
public void Test_005_FolderZero()
{
TestHelpers.InMethod();
Init();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += UUID.Zero;
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
string llsdresponse = dorequest(handler, request);
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
// we do return a answer now
//Assert.That(llsdresponse.Contains("bad_folders</key><array><uuid>00000000-0000-0000-0000-000000000000"), Is.True, "Folder Zero should be a bad folder");
Assert.That(llsdresponse.Contains("bad_folders</key><array><uuid>00000000-0000-0000-0000-000000000000"), Is.True, "Folder Zero should be a bad folder");
Console.WriteLine(llsdresponse);
}
}
}

View File

@ -1,190 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class GetAssetsHandler
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly Dictionary<string, AssetType> queryTypes = new Dictionary<string, AssetType>()
{
{"texture_id", AssetType.Texture},
{"sound_id", AssetType.Sound},
{"callcard_id", AssetType.CallingCard},
{"landmark_id", AssetType.Landmark},
{"script_id", AssetType.LSLText},
{"clothing_id", AssetType.Clothing},
{"object_id", AssetType.Object},
{"notecard_id", AssetType.Notecard},
{"lsltext_id", AssetType.LSLText},
{"lslbyte_id", AssetType.LSLBytecode},
{"txtr_tga_id", AssetType.TextureTGA},
{"bodypart_id", AssetType.Bodypart},
{"snd_wav_id", AssetType.SoundWAV},
{"img_tga_id", AssetType.ImageTGA},
{"jpeg_id", AssetType.ImageJPEG},
{"animatn_id", AssetType.Animation},
{"gesture_id", AssetType.Gesture},
{"mesh_id", AssetType.Mesh},
{"settings_id", AssetType.Settings}
};
private IAssetService m_assetService;
public GetAssetsHandler(IAssetService assService)
{
m_assetService = assService;
}
public void Handle(OSHttpRequest req, OSHttpResponse response)
{
response.ContentType = "text/plain";
if (m_assetService == null)
{
response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
response.KeepAlive = false;
return;
}
response.StatusCode = (int)HttpStatusCode.BadRequest;
var queries = req.QueryAsDictionary;
if(queries.Count == 0)
return;
AssetType type = AssetType.Unknown;
string assetStr = string.Empty;
foreach (KeyValuePair<string,string> kvp in queries)
{
if (queryTypes.ContainsKey(kvp.Key))
{
type = queryTypes[kvp.Key];
assetStr = kvp.Value;
break;
}
}
if(type == AssetType.Unknown)
{
//m_log.Warn("[GETASSET]: Unknown type: " + query);
m_log.Warn("[GETASSET]: Unknown type");
response.StatusCode = (int)HttpStatusCode.NotFound;
return;
}
if (String.IsNullOrEmpty(assetStr))
return;
UUID assetID = UUID.Zero;
if(!UUID.TryParse(assetStr, out assetID))
return;
AssetBase asset = m_assetService.Get(assetID.ToString());
if(asset == null)
{
// m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
response.StatusCode = (int)HttpStatusCode.NotFound;
return;
}
if (asset.Type != (sbyte)type)
return;
int len = asset.Data.Length;
string range = null;
if (req.Headers["Range"] != null)
range = req.Headers["Range"];
else if (req.Headers["range"] != null)
range = req.Headers["range"];
// range request
int start, end;
if (Util.TryParseHttpRange(range, out start, out end))
{
// Before clamping start make sure we can satisfy it in order to avoid
// sending back the last byte instead of an error status
if (start >= asset.Data.Length)
{
response.StatusCode = (int)HttpStatusCode.RequestedRangeNotSatisfiable;
return;
}
if (end == -1)
end = asset.Data.Length - 1;
else
end = Utils.Clamp(end, 0, asset.Data.Length - 1);
start = Utils.Clamp(start, 0, end);
len = end - start + 1;
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length));
response.StatusCode = (int)HttpStatusCode.PartialContent;
response.RawBufferStart = start;
}
else
response.StatusCode = (int)HttpStatusCode.OK;
response.ContentType = asset.Metadata.ContentType;
response.RawBuffer = asset.Data;
response.RawBufferLen = len;
if (type == AssetType.Mesh || type == AssetType.Texture)
{
if(len > 8196)
{
//if(type == AssetType.Texture && ((asset.Flags & AssetFlags.AvatarBake)!= 0))
// responsedata["prio"] = 1;
//else
response.Priority = 2;
}
else
response.Priority = 1;
}
else
response.Priority = -1;
}
}
}

View File

@ -0,0 +1,117 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection;
using System.IO;
using System.Web;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
namespace OpenSim.Capabilities.Handlers
{
public class GetDisplayNamesHandler : BaseStreamHandler
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IUserManagement m_UserManagement;
public GetDisplayNamesHandler(string path, IUserManagement umService, string name, string description)
: base("GET", path, name, description)
{
m_UserManagement = umService;
}
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[GET_DISPLAY_NAMES]: called {0}", httpRequest.Url.Query);
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
string[] ids = query.GetValues("ids");
if (m_UserManagement == null)
{
m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component");
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
return new byte[0];
}
Dictionary<UUID,string> names = m_UserManagement.GetUsersNames(ids);
OSDMap osdReply = new OSDMap();
OSDArray agents = new OSDArray();
osdReply["agents"] = agents;
foreach (KeyValuePair<UUID,string> kvp in names)
{
if (string.IsNullOrEmpty(kvp.Value))
continue;
if(kvp.Key == UUID.Zero)
continue;
string[] parts = kvp.Value.Split(new char[] {' '});
OSDMap osdname = new OSDMap();
if(parts[0] == "Unknown")
{
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
}
else
{
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
}
osdname["display_name"] = OSD.FromString(kvp.Value);
osdname["legacy_first_name"] = parts[0];
osdname["legacy_last_name"] = parts[1];
osdname["username"] = OSD.FromString(kvp.Value);
osdname["id"] = OSD.FromUUID(kvp.Key);
osdname["is_display_name_default"] = OSD.FromBoolean(true);
agents.Add(osdname);
}
// Full content request
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
//httpResponse.ContentLength = ??;
httpResponse.ContentType = "application/llsd+xml";
string reply = OSDParser.SerializeLLSDXmlString(osdReply);
return System.Text.Encoding.UTF8.GetBytes(reply);
}
}
}

View File

@ -29,35 +29,41 @@ using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenMetaverse;
namespace OpenSim.Server.Handlers.GridUser
namespace OpenSim.Capabilities.Handlers
{
public class MuteListServiceConnector : ServiceConnector
public class GetDisplayNamesServerConnector : ServiceConnector
{
private IMuteListService m_MuteListService;
private string m_ConfigName = "MuteListService";
private IUserManagement m_UserManagement;
private string m_ConfigName = "CapsService";
public MuteListServiceConnector(IConfigSource config, IHttpServer server, string configName) :
public GetDisplayNamesServerConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string service = serverConfig.GetString("LocalServiceModule", String.Empty);
string umService = serverConfig.GetString("AssetService", String.Empty);
if (service == String.Empty)
throw new Exception("LocalServiceModule not present in MuteListService config file MuteListService section");
if (umService == String.Empty)
throw new Exception("No AssetService in config file");
Object[] args = new Object[] { config };
m_MuteListService = ServerUtils.LoadPlugin<IMuteListService>(service, args);
m_UserManagement =
ServerUtils.LoadPlugin<IUserManagement>(umService, args);
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new MuteListServerPostHandler(m_MuteListService, auth));
if (m_UserManagement == null)
throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
server.AddStreamHandler(
new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
}
}
}
}

View File

@ -41,6 +41,9 @@ using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class GetMeshHandler
@ -58,98 +61,211 @@ namespace OpenSim.Capabilities.Handlers
}
public Hashtable Handle(Hashtable request)
{
return ProcessGetMesh(request, UUID.Zero, null); ;
}
Hashtable ret = new Hashtable();
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
ret["content_type"] = "text/plain";
ret["keepalive"] = false;
ret["reusecontext"] = false;
ret["int_bytes"] = 0;
ret["int_lod"] = 0;
string MeshStr = (string)request["mesh_id"];
//m_log.DebugFormat("[GETMESH]: called {0}", MeshStr);
if (m_assetService == null)
{
m_log.Error("[GETMESH]: Cannot fetch mesh " + MeshStr + " without an asset service");
}
UUID meshID;
if (!String.IsNullOrEmpty(MeshStr) && UUID.TryParse(MeshStr, out meshID))
{
// m_log.DebugFormat("[GETMESH]: Received request for mesh id {0}", meshID);
ret = ProcessGetMesh(request, UUID.Zero, null);
}
else
{
m_log.Warn("[GETMESH]: Failed to parse a mesh_id from GetMesh request: " + (string)request["uri"]);
}
return ret;
}
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
{
Hashtable responsedata = new Hashtable();
if (m_assetService == null)
{
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.ServiceUnavailable;
responsedata["str_response_string"] = "The asset service is unavailable";
responsedata["keepalive"] = false;
return responsedata;
}
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.BadRequest;
responsedata["int_response_code"] = 400; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Request wasn't what was expected";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 0;
responsedata["int_bytes"] = 0;
string meshStr = string.Empty;
if (request.ContainsKey("mesh_id"))
meshStr = request["mesh_id"].ToString();
if (String.IsNullOrEmpty(meshStr))
return responsedata;
UUID meshID = UUID.Zero;
if(!UUID.TryParse(meshStr, out meshID))
return responsedata;
AssetBase mesh = m_assetService.Get(meshID.ToString());
if(mesh == null)
if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
{
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
responsedata["str_response_string"] = "Mesh not found.";
return responsedata;
}
if (mesh.Type != (SByte)AssetType.Mesh)
{
responsedata["str_response_string"] = "Asset isn't a mesh.";
return responsedata;
}
string range = String.Empty;
if (((Hashtable)request["headers"])["range"] != null)
range = (string)((Hashtable)request["headers"])["range"];
else if (((Hashtable)request["headers"])["Range"] != null)
range = (string)((Hashtable)request["headers"])["Range"];
responsedata["content_type"] = "application/vnd.ll.mesh";
if (String.IsNullOrEmpty(range))
{
// full mesh
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
return responsedata;
}
// range request
int start, end;
if (Util.TryParseHttpRange(range, out start, out end))
{
// Before clamping start make sure we can satisfy it in order to avoid
// sending back the last byte instead of an error status
if (start >= mesh.Data.Length)
if (m_assetService == null)
{
responsedata["str_response_string"] = "This range doesnt exist.";
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
responsedata["reusecontext"] = false;
return responsedata;
}
end = Utils.Clamp(end, 0, mesh.Data.Length - 1);
start = Utils.Clamp(start, 0, end);
int len = end - start + 1;
AssetBase mesh = m_assetService.Get(meshID.ToString());
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
Hashtable headers = new Hashtable();
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, mesh.Data.Length);
responsedata["headers"] = headers;
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
if (mesh != null)
{
if (mesh.Type == (SByte)AssetType.Mesh)
{
byte[] d = new byte[len];
Array.Copy(mesh.Data, start, d, 0, len);
responsedata["bin_response_data"] = d;
responsedata["int_bytes"] = len;
return responsedata;
Hashtable headers = new Hashtable();
responsedata["headers"] = headers;
string range = String.Empty;
if (((Hashtable)request["headers"])["range"] != null)
range = (string)((Hashtable)request["headers"])["range"];
else if (((Hashtable)request["headers"])["Range"] != null)
range = (string)((Hashtable)request["headers"])["Range"];
if (!String.IsNullOrEmpty(range)) // Mesh Asset LOD // Physics
{
// Range request
int start, end;
if (TryParseRange(range, out start, out end))
{
// Before clamping start make sure we can satisfy it in order to avoid
// sending back the last byte instead of an error status
if (start >= mesh.Data.Length)
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "This range doesnt exist.";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
return responsedata;
}
else
{
end = Utils.Clamp(end, 0, mesh.Data.Length - 1);
start = Utils.Clamp(start, 0, end);
int len = end - start + 1;
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
if (start > 20000)
{
responsedata["int_lod"] = 3;
}
else if (start < 4097)
{
responsedata["int_lod"] = 1;
}
else
{
responsedata["int_lod"] = 2;
}
if (start == 0 && len == mesh.Data.Length) // well redudante maybe
{
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
responsedata["bin_response_data"] = mesh.Data;
responsedata["int_bytes"] = mesh.Data.Length;
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
}
else
{
responsedata["int_response_code"] =
(int)System.Net.HttpStatusCode.PartialContent;
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end,
mesh.Data.Length);
byte[] d = new byte[len];
Array.Copy(mesh.Data, start, d, 0, len);
responsedata["bin_response_data"] = d;
responsedata["int_bytes"] = len;
responsedata["reusecontext"] = false;
}
}
}
else
{
m_log.Warn("[GETMESH]: Failed to parse a range from GetMesh request, sending full asset: " + (string)request["uri"]);
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["content_type"] = "application/vnd.ll.mesh";
responsedata["int_response_code"] = 200;
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
}
}
else
{
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["content_type"] = "application/vnd.ll.mesh";
responsedata["int_response_code"] = 200;
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 3;
}
}
// Optionally add additional mesh types here
else
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 1;
return responsedata;
}
}
else
{
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
responsedata["reusecontext"] = false;
responsedata["int_lod"] = 0;
return responsedata;
}
}
m_log.Warn("[GETMESH]: Failed to parse a range from GetMesh request, sending full asset: " + (string)request["uri"]);
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
return responsedata;
}
private bool TryParseRange(string header, out int start, out int end)
{
if (header.StartsWith("bytes="))
{
string[] rangeValues = header.Substring(6).Split('-');
if (rangeValues.Length == 2)
{
if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end))
return true;
}
}
start = end = 0;
return false;
}
}
}

View File

@ -68,7 +68,7 @@ namespace OpenSim.Capabilities.Handlers
IRequestHandler reqHandler
= new RestHTTPHandler(
"GET",
"/" + UUID.Random(),
"/CAPS/" + UUID.Random(),
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
"GetMesh",
null);

View File

@ -55,7 +55,7 @@ namespace OpenSim.Capabilities.Handlers
private IAssetService m_assetService;
public const string DefaultFormat = "x-j2c";
public GetTextureHandler(IAssetService assService)
{
m_assetService = assService;
@ -66,6 +66,8 @@ namespace OpenSim.Capabilities.Handlers
Hashtable ret = new Hashtable();
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
ret["content_type"] = "text/plain";
ret["keepalive"] = false;
ret["reusecontext"] = false;
ret["int_bytes"] = 0;
string textureStr = (string)request["texture_id"];
string format = (string)request["format"];
@ -81,7 +83,7 @@ namespace OpenSim.Capabilities.Handlers
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
{
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
string[] formats;
if (!string.IsNullOrEmpty(format))
{
@ -110,6 +112,8 @@ namespace OpenSim.Capabilities.Handlers
ret["error_status_text"] = "not found";
ret["str_response_string"] = "not found";
ret["content_type"] = "text/plain";
ret["keepalive"] = false;
ret["reusecontext"] = false;
ret["int_bytes"] = 0;
}
}
@ -125,7 +129,7 @@ namespace OpenSim.Capabilities.Handlers
}
/// <summary>
///
///
/// </summary>
/// <param name="httpRequest"></param>
/// <param name="httpResponse"></param>
@ -186,7 +190,7 @@ namespace OpenSim.Capabilities.Handlers
//response = new Hashtable();
//WriteTextureData(request,response,null,format);
// not found
//m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
@ -210,7 +214,7 @@ namespace OpenSim.Capabilities.Handlers
{
// Range request
int start, end;
if (Util.TryParseHttpRange(range, out start, out end))
if (TryParseRange(range, out start, out end))
{
// Before clamping start make sure we can satisfy it in order to avoid
// sending back the last byte instead of an error status
@ -249,13 +253,24 @@ namespace OpenSim.Capabilities.Handlers
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
response["content-type"] = texture.Metadata.ContentType;
response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length);
byte[] d = new byte[len];
Array.Copy(texture.Data, start, d, 0, len);
response["bin_response_data"] = d;
response["int_bytes"] = len;
if (start == 0 && len == texture.Data.Length) // well redudante maybe
{
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
response["bin_response_data"] = texture.Data;
response["int_bytes"] = texture.Data.Length;
}
else
{
response["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length);
byte[] d = new byte[len];
Array.Copy(texture.Data, start, d, 0, len);
response["bin_response_data"] = d;
response["int_bytes"] = len;
}
// response.Body.Write(texture.Data, start, len);
}
}
else
@ -272,7 +287,7 @@ namespace OpenSim.Capabilities.Handlers
response["content_type"] = texture.Metadata.ContentType;
else
response["content_type"] = "image/" + format;
response["bin_response_data"] = texture.Data;
response["int_bytes"] = texture.Data.Length;
@ -289,6 +304,50 @@ namespace OpenSim.Capabilities.Handlers
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
}
/// <summary>
/// Parse a range header.
/// </summary>
/// <remarks>
/// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html,
/// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-).
/// Where there is no value, -1 is returned.
/// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1
/// for start.</remarks>
/// <returns></returns>
/// <param name='header'></param>
/// <param name='start'>Start of the range. Undefined if this was not a number.</param>
/// <param name='end'>End of the range. Will be -1 if no end specified. Undefined if there was a raw string but this was not a number.</param>
private bool TryParseRange(string header, out int start, out int end)
{
start = end = 0;
if (header.StartsWith("bytes="))
{
string[] rangeValues = header.Substring(6).Split('-');
if (rangeValues.Length == 2)
{
if (!Int32.TryParse(rangeValues[0], out start))
return false;
string rawEnd = rangeValues[1];
if (rawEnd == "")
{
end = -1;
return true;
}
else if (Int32.TryParse(rawEnd, out end))
{
return true;
}
}
}
start = end = 0;
return false;
}
private byte[] ConvertTextureData(AssetBase texture, string format)
{
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
@ -303,6 +362,8 @@ namespace OpenSim.Capabilities.Handlers
{
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
imgstream = new MemoryStream();
// Decode image to System.Drawing.Image
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
{
@ -339,11 +400,14 @@ namespace OpenSim.Capabilities.Handlers
if (image != null)
image.Dispose();
if(managedImage != null)
managedImage.Clear();
if (imgstream != null)
{
imgstream.Close();
imgstream.Dispose();
}
}
return data;

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Specialized;
@ -32,7 +32,6 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.IO;
using System.Net;
using System.Web;
using log4net;
using Nini.Config;
@ -45,7 +44,7 @@ using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class GetTextureRobustHandler : BaseStreamHandler
@ -53,9 +52,9 @@ namespace OpenSim.Capabilities.Handlers
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IAssetService m_assetService;
public const string DefaultFormat = "x-j2c";
// TODO: Change this to a config option
private string m_RedirectURL = null;
@ -67,28 +66,27 @@ namespace OpenSim.Capabilities.Handlers
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
m_RedirectURL += "/";
}
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
string textureStr = query.GetOne("texture_id");
string format = query.GetOne("format");
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
if (m_assetService == null)
{
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return null;
}
UUID textureID;
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
{
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
string[] formats;
if (!string.IsNullOrEmpty(format))
{
@ -99,10 +97,10 @@ namespace OpenSim.Capabilities.Handlers
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
if (formats.Length == 0)
formats = new string[1] { DefaultFormat }; // default
}
// OK, we have an array with preferred formats, possibly with only one entry
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
foreach (string f in formats)
{
@ -114,14 +112,14 @@ namespace OpenSim.Capabilities.Handlers
{
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
}
// m_log.DebugFormat(
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
return null;
}
/// <summary>
///
/// </summary>
@ -132,54 +130,94 @@ namespace OpenSim.Capabilities.Handlers
/// <returns>False for "caller try another codec"; true otherwise</returns>
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
{
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
if(!String.IsNullOrEmpty(m_RedirectURL))
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
AssetBase texture;
string fullID = textureID.ToString();
if (format != DefaultFormat)
fullID = fullID + "-" + format;
if (!String.IsNullOrEmpty(m_RedirectURL))
{
string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
httpResponse.StatusCode = (int)HttpStatusCode.Moved;
httpResponse.AddHeader("Location:", textureUrl);
return true;
}
// Fetch, Misses or invalid return a 404
AssetBase texture = m_assetService.Get(textureID.ToString());
if (texture != null)
{
if (texture.Type != (sbyte)AssetType.Texture)
{
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return true;
}
if (format == DefaultFormat)
// Only try to fetch locally cached textures. Misses are redirected
texture = m_assetService.GetCached(fullID);
if (texture != null)
{
if (texture.Type != (sbyte)AssetType.Texture)
{
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return true;
}
WriteTextureData(httpRequest, httpResponse, texture, format);
}
else
{
string textureUrl = m_RedirectURL + "?texture_id="+ textureID.ToString();
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
httpResponse.RedirectLocation = textureUrl;
return true;
}
// need to convert format
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
newTexture.Data = ConvertTextureData(texture, format);
if (newTexture.Data.Length == 0)
return false; // !!! Caller try another codec, please!
newTexture.Flags = AssetFlags.Collectable;
newTexture.Temporary = true;
newTexture.Local = true;
WriteTextureData(httpRequest, httpResponse, newTexture, format);
return true;
}
else // no redirect
{
// try the cache
texture = m_assetService.GetCached(fullID);
if (texture == null)
{
// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
// Fetch locally or remotely. Misses return a 404
texture = m_assetService.Get(textureID.ToString());
if (texture != null)
{
if (texture.Type != (sbyte)AssetType.Texture)
{
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return true;
}
if (format == DefaultFormat)
{
WriteTextureData(httpRequest, httpResponse, texture, format);
return true;
}
else
{
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
newTexture.Data = ConvertTextureData(texture, format);
if (newTexture.Data.Length == 0)
return false; // !!! Caller try another codec, please!
newTexture.Flags = AssetFlags.Collectable;
newTexture.Temporary = true;
newTexture.Local = true;
m_assetService.Store(newTexture);
WriteTextureData(httpRequest, httpResponse, newTexture, format);
return true;
}
}
}
else // it was on the cache
{
// m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
WriteTextureData(httpRequest, httpResponse, texture, format);
return true;
}
}
// not found
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return true;
}
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
{
string range = request.Headers.GetOne("Range");
if (!String.IsNullOrEmpty(range)) // JP2's only
{
// Range request
@ -193,7 +231,7 @@ namespace OpenSim.Capabilities.Handlers
// m_log.DebugFormat(
// "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}",
// texture.ID, start, texture.Data.Length);
// Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back
// Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations
// of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously
@ -204,7 +242,7 @@ namespace OpenSim.Capabilities.Handlers
// level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable
// here will cause the viewer to treat the texture as bad and never display the full resolution
// However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length));
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
@ -217,13 +255,13 @@ namespace OpenSim.Capabilities.Handlers
// the rest of the entity.
if (end == -1)
end = int.MaxValue;
end = Utils.Clamp(end, 0, texture.Data.Length - 1);
start = Utils.Clamp(start, 0, end);
int len = end - start + 1;
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
// Always return PartialContent, even if the range covered the entire data length
// We were accidentally sending back 404 before in this situation
// https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
@ -235,13 +273,12 @@ namespace OpenSim.Capabilities.Handlers
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
// else
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
response.ContentLength = len;
response.ContentType = texture.Metadata.ContentType;
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
response.RawBuffer = texture.Data;
response.RawBufferStart = start;
response.RawBufferLen = len;
response.Body.Write(texture.Data, start, len);
}
}
else
@ -259,21 +296,19 @@ namespace OpenSim.Capabilities.Handlers
response.ContentType = texture.Metadata.ContentType;
else
response.ContentType = "image/" + format;
response.RawBuffer = texture.Data;
response.RawBufferStart = 0;
response.RawBufferLen = texture.Data.Length;
response.Body.Write(texture.Data, 0, texture.Data.Length);
}
// if (response.StatusCode < 200 || response.StatusCode > 299)
// m_log.WarnFormat(
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
// else
// m_log.DebugFormat(
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
// if (response.StatusCode < 200 || response.StatusCode > 299)
// m_log.WarnFormat(
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
// else
// m_log.DebugFormat(
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
}
/// <summary>
/// Parse a range header.
/// </summary>
@ -290,18 +325,18 @@ namespace OpenSim.Capabilities.Handlers
private bool TryParseRange(string header, out int start, out int end)
{
start = end = 0;
if (header.StartsWith("bytes="))
{
string[] rangeValues = header.Substring(6).Split('-');
if (rangeValues.Length == 2)
{
if (!Int32.TryParse(rangeValues[0], out start))
return false;
string rawEnd = rangeValues[1];
if (rawEnd == "")
{
end = -1;
@ -313,24 +348,27 @@ namespace OpenSim.Capabilities.Handlers
}
}
}
start = end = 0;
return false;
}
private byte[] ConvertTextureData(AssetBase texture, string format)
{
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
byte[] data = new byte[0];
MemoryStream imgstream = new MemoryStream();
Bitmap mTexture = null;
ManagedImage managedImage = null;
Image image = null;
try
{
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
imgstream = new MemoryStream();
// Decode image to System.Drawing.Image
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
{
@ -340,7 +378,7 @@ namespace OpenSim.Capabilities.Handlers
using(EncoderParameters myEncoderParameters = new EncoderParameters())
{
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
// Save bitmap to stream
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
if (codec != null)
@ -364,20 +402,23 @@ namespace OpenSim.Capabilities.Handlers
// If we encountered an exception, one or more of these will be null
if (mTexture != null)
mTexture.Dispose();
if (image != null)
image.Dispose();
if(managedImage != null)
managedImage.Clear();
if (imgstream != null)
{
imgstream.Close();
imgstream.Dispose();
}
}
return data;
}
// From msdn
private static ImageCodecInfo GetEncoderInfo(String mimeType)
{

View File

@ -66,7 +66,7 @@ namespace OpenSim.Capabilities.Handlers
string rurl = serverConfig.GetString("GetTextureRedirectURL");
;
server.AddStreamHandler(
new GetTextureRobustHandler("/CAPS/GetTexture", m_AssetService, "GetTexture", null, rurl));
new GetTextureRobustHandler("/CAPS/GetTexture/", m_AssetService, "GetTexture", null, rurl));
}
}
}

View File

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Capabilities.Handlers")]
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -0,0 +1,188 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.IO;
using System.Web;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenMetaverse.Imaging;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class UploadBakedTextureHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Caps m_HostCapsObj;
private IAssetService m_assetService;
private bool m_persistBakedTextures;
public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures)
{
m_HostCapsObj = caps;
m_assetService = assetService;
m_persistBakedTextures = persistBakedTextures;
}
/// <summary>
/// Handle a request from the client for a Uri to upload a baked texture.
/// </summary>
/// <param name="request"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <param name="httpRequest"></param>
/// <param name="httpResponse"></param>
/// <returns>The upload response if the request is successful, null otherwise.</returns>
public string UploadBakedTexture(
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
try
{
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader =
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
uploader.OnUpLoad += BakedTextureUploaded;
m_HostCapsObj.HttpListener.AddStreamHandler(
new BinaryStreamHandler(
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null));
string protocol = "http://";
if (m_HostCapsObj.SSLCaps)
protocol = "https://";
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL;
uploadResponse.state = "upload";
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
}
catch (Exception e)
{
m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
}
return null;
}
/// <summary>
/// Called when a baked texture has been successfully uploaded by a client.
/// </summary>
/// <param name="assetID"></param>
/// <param name="data"></param>
private void BakedTextureUploaded(UUID assetID, byte[] data)
{
m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
AssetBase asset;
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
asset.Data = data;
asset.Temporary = true;
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
m_assetService.Store(asset);
}
}
class BakedTextureUploader
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event Action<UUID, byte[]> OnUpLoad;
private string uploaderPath = String.Empty;
private UUID newAssetID;
private IHttpServer httpListener;
private UUID AgentId = UUID.Zero;
public BakedTextureUploader(string path, IHttpServer httpServer, UUID uUID)
{
newAssetID = UUID.Random();
uploaderPath = path;
httpListener = httpServer;
AgentId = uUID;
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
}
/// <summary>
/// Handle raw uploaded baked texture data.
/// </summary>
/// <param name="data"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <returns></returns>
public string uploaderCaps(byte[] data, string path, string param)
{
Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
// Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
// on another thread which might send out avatar updates before the asset has been put into the asset
// service.
if (handlerUpLoad != null)
handlerUpLoad(newAssetID, data);
string res = String.Empty;
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
uploadComplete.new_asset = newAssetID.ToString();
uploadComplete.new_inventory_item = UUID.Zero;
uploadComplete.state = "complete";
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
httpListener.RemoveStreamHandler("POST", uploaderPath);
// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID);
return res;
}
}
}

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenMetaverse;
namespace OpenSim.Capabilities.Handlers
{
public class UploadBakedTextureServerConnector : ServiceConnector
{
private IAssetService m_AssetService;
private string m_ConfigName = "CapsService";
public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string assetService = serverConfig.GetString("AssetService", String.Empty);
if (assetService == String.Empty)
throw new Exception("No AssetService in config file");
Object[] args = new Object[] { config };
m_AssetService =
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
if (m_AssetService == null)
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
// NEED TO FIX THIS
OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
server.AddStreamHandler(new RestStreamHandler(
"POST",
"/CAPS/UploadBakedTexture/",
new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
"UploadBakedTexture",
"Upload Baked Texture Capability"));
}
}
}

View File

@ -107,17 +107,17 @@ namespace OpenSim.Framework.Capabilities
/// <returns></returns>
public static byte[] LLSDSerialize(object obj)
{
using(StringWriter sw = new StringWriter())
using(XmlTextWriter writer = new XmlTextWriter(sw))
{
writer.Formatting = Formatting.None;
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
writer.Formatting = Formatting.None;
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
LLSDWriteOne(writer, obj);
writer.WriteEndElement();
writer.Flush();
return Util.UTF8.GetBytes(sw.ToString());
}
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
LLSDWriteOne(writer, obj);
writer.WriteEndElement();
writer.Close();
return Util.UTF8.GetBytes(sw.ToString());
}
/// <summary>
@ -566,7 +566,7 @@ namespace OpenSim.Framework.Capabilities
endPos = FindEnd(llsd, 1);
if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float,
Culture.NumberFormatInfo, out value))
Utils.EnUsCulture.NumberFormat, out value))
return value;
else
throw new LLSDParseException("Failed to parse double value type");

View File

@ -78,7 +78,7 @@ namespace OpenSim.Framework.Capabilities
public string state;
public int upload_price;
public string rsvp;
public LLSDNewFileAngentInventoryVariablePriceReplyResponse()
{
state = "confirm_upload";

View File

@ -42,7 +42,7 @@ namespace OpenSim.Framework.Capabilities
{
public string username;
public string display_name;
//'display_name_next_update':d"1970-01-01T00:00:00Z"
//'display_name_next_update':d"1970-01-01T00:00:00Z"
public string legacy_first_name;
public string legacy_last_name;
public UUID id;

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDEnvironmentRequest
{
public UUID messageID;
public UUID regionID;
}
[OSDMap]
public class LLSDEnvironmentSetResponse
{
public UUID regionID;
public UUID messageID;
public Boolean success;
public String fail_reason;
}
public class EnvironmentSettings
{
/// <summary>
/// generates a empty llsd settings response for viewer
/// </summary>
/// <param name="messageID">the message UUID</param>
/// <param name="regionID">the region UUID</param>
public static string EmptySettings(UUID messageID, UUID regionID)
{
OSDArray arr = new OSDArray();
LLSDEnvironmentRequest msg = new LLSDEnvironmentRequest();
msg.messageID = messageID;
msg.regionID = regionID;
arr.Array.Add(msg);
return LLSDHelpers.SerialiseLLSDReply(arr);
}
}
}

View File

@ -30,7 +30,6 @@ using System.Collections;
using System.IO;
using System.Reflection;
using System.Xml;
using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
@ -41,32 +40,17 @@ namespace OpenSim.Framework.Capabilities
public static string SerialiseLLSDReply(object obj)
{
using(StringWriter sw = new StringWriter())
using(XmlTextWriter writer = new XmlTextWriter(sw))
{
writer.Formatting = Formatting.None;
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
SerializeOSDType(writer, obj);
writer.WriteEndElement();
writer.Flush();
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
writer.Formatting = Formatting.None;
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
SerializeOSDType(writer, obj);
writer.WriteEndElement();
writer.Close();
//m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
return sw.ToString();
}
}
public static string SerialiseLLSDReplyNoHeader(object obj)
{
using(StringWriter sw = new StringWriter())
using(XmlTextWriter writer = new XmlTextWriter(sw))
{
writer.Formatting = Formatting.None;
SerializeOSDType(writer, obj);
writer.Flush();
//m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
return sw.ToString();
}
return sw.ToString();
}
private static void SerializeOSDType(XmlTextWriter writer, object obj)
@ -173,22 +157,6 @@ namespace OpenSim.Framework.Capabilities
// the LLSD map/array types in the array need to be deserialised
// but first we need to know the right class to deserialise them into.
}
else if(enumerator.Value is Boolean && field.FieldType == typeof(int) )
{
int i = (bool)enumerator.Value ? 1 : 0;
field.SetValue(obj, i);
}
else if(field.FieldType == typeof(bool) && enumerator.Value is int)
{
bool b = (int)enumerator.Value != 0;
field.SetValue(obj, b);
}
else if(field.FieldType == typeof(UUID) && enumerator.Value is string)
{
UUID u;
UUID.TryParse((string)enumerator.Value, out u);
field.SetValue(obj, u);
}
else
{
field.SetValue(obj, enumerator.Value);

View File

@ -37,6 +37,5 @@ namespace OpenSim.Framework.Capabilities
public string name;
public int type;
public int preferred_type;
public int version;
}
}

View File

@ -87,12 +87,12 @@ namespace OpenSim.Framework.Capabilities
[OSDMap]
public class LLSDInventoryFolderContents
{
public UUID agent_id;
public UUID agent_id;
public int descendents;
public UUID folder_id;
public UUID folder_id;
public OSDArray categories = new OSDArray();
public OSDArray items = new OSDArray();
public UUID owner_id;
public UUID owner_id;
public int version;
}

View File

@ -27,15 +27,15 @@
using OpenMetaverse;
namespace OpenSim.Framework
namespace OpenSim.Framework.Capabilities
{
public class MuteData
[OSDMap]
public class LLSDItemUpdate
{
public UUID AgentID;
public UUID MuteID;
public string MuteName;
public int MuteType;
public int MuteFlags;
public int Stamp;
public UUID item_id;
public LLSDItemUpdate()
{
}
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Collections;
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDParcelVoiceInfoResponse
{
public int parcel_local_id;
public string region_name;
public Hashtable voice_credentials;
public LLSDParcelVoiceInfoResponse()
{
}
public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
{
region_name = region;
parcel_local_id = localID;
voice_credentials = creds;
}
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
[LLSDType("MAP")]
public class LLSDRemoteParcelResponse
{
public UUID parcel_id;
public LLSDRemoteParcelResponse()
{
}
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDTaskScriptUpdate
{
/// <summary>
/// The item containing the script to update
/// </summary>
public UUID item_id;
/// <summary>
/// The task containing the script
/// </summary>
public UUID task_id;
/// <summary>
/// Signals whether the script is currently active
/// </summary>
public int is_script_running;
}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDVoiceAccountResponse
{
public string username;
public string password;
public string voice_sip_uri_hostname;
public string voice_account_server_name;
public LLSDVoiceAccountResponse()
{
}
public LLSDVoiceAccountResponse(string user, string pass)
{
username = user;
password = pass;
}
public LLSDVoiceAccountResponse(string user, string pass, string sipUriHost, string accountServer)
{
username = user;
password = pass;
voice_sip_uri_hostname = sipUriHost;
voice_account_server_name = accountServer;
}
}
}

View File

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Capabilities")]
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -80,7 +80,7 @@ namespace OpenSim.ConsoleClient
while (m_Server.Running)
{
System.Threading.Thread.Sleep(500);
MainConsole.Instance.Prompt();
// MainConsole.Instance.Prompt();
}
if (pidFile != String.Empty)
@ -178,7 +178,7 @@ namespace OpenSim.ConsoleClient
Requester.MakeRequest(requestUrl, requestData, ReadResponses);
return;
}
List<string> lines = new List<string>();
foreach (XmlNode part in rootNodeL[0].ChildNodes)
@ -202,7 +202,7 @@ namespace OpenSim.ConsoleClient
string[] parts = l.Split(new char[] {':'}, 3);
if (parts.Length != 3)
continue;
if (parts[2].StartsWith("+++") || parts[2].StartsWith("-++"))
prompt = parts[2];
else

View File

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.ConsoleClient")]
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//

View File

@ -38,7 +38,7 @@ namespace OpenSim.Data
/// <summary>This function converts a value returned from the database in one of the
/// supported formats into a UUID. This function is not actually DBMS-specific right
/// now
///
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
@ -47,25 +47,24 @@ namespace OpenSim.Data
if ((id == null) || (id == DBNull.Value))
return UUID.Zero;
Type idtype = id.GetType();
if (idtype == typeof(Guid))
if (id.GetType() == typeof(Guid))
return new UUID((Guid)id);
if (id.GetType() == typeof(string))
if (id.GetType() == typeof(byte[]))
{
Guid gg;
if (Guid.TryParse((string)id, out gg))
return new UUID(gg);
return UUID.Zero;
if (((byte[])id).Length == 0)
return UUID.Zero;
else if (((byte[])id).Length == 16)
return new UUID((byte[])id, 0);
}
else if (id.GetType() == typeof(string))
{
if (((string)id).Length == 0)
return UUID.Zero;
else if (((string)id).Length == 36)
return new UUID((string)id);
}
if (idtype == typeof(byte[]))
{
if (((byte[])id).Length < 16)
return UUID.Zero;
return new UUID((byte[])id, 0);
}
throw new Exception("Failed to convert db value to UUID: " + id.ToString());
}
}

View File

@ -39,7 +39,7 @@ namespace OpenSim.Data
public Dictionary<string, string> Data;
}
public interface IAvatarData
public interface IAvatarData
{
AvatarBaseData[] Get(string field, string val);
bool Store(AvatarBaseData data);

View File

@ -46,14 +46,14 @@ namespace OpenSim.Data
/// <param name="create">If true, then an estate is created if one is not found.</param>
/// <returns></returns>
EstateSettings LoadEstateSettings(UUID regionID, bool create);
/// <summary>
/// Load estate settings for an estate ID.
/// </summary>
/// <param name="estateID"></param>
/// <returns></returns>
EstateSettings LoadEstateSettings(int estateID);
/// <summary>
/// Create a new estate.
/// </summary>
@ -67,7 +67,7 @@ namespace OpenSim.Data
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<EstateSettings> LoadEstateSettingsAll();
/// <summary>
/// Store estate settings.
/// </summary>
@ -75,7 +75,7 @@ namespace OpenSim.Data
/// This is also called by EstateSettings.Save()</remarks>
/// <param name="es"></param>
void StoreEstateSettings(EstateSettings es);
/// <summary>
/// Get estate IDs.
/// </summary>
@ -88,13 +88,13 @@ namespace OpenSim.Data
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<int> GetEstatesByOwner(UUID ownerID);
/// <summary>
/// Get the IDs of all estates.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<int> GetEstatesAll();
/// <summary>
/// Link a region to an estate.
/// </summary>
@ -102,14 +102,14 @@ namespace OpenSim.Data
/// <param name="estateID"></param>
/// <returns>true if the link succeeded, false otherwise</returns>
bool LinkRegion(UUID regionID, int estateID);
/// <summary>
/// Get the UUIDs of all the regions in an estate.
/// </summary>
/// <param name="estateID"></param>
/// <returns></returns>
List<UUID> GetRegions(int estateID);
/// <summary>
/// Delete an estate
/// </summary>

View File

@ -47,7 +47,7 @@ namespace OpenSim.Data
/// <summary>
/// An interface for connecting to the user grid datastore
/// </summary>
public interface IGridUserData
public interface IGridUserData
{
GridUserData Get(string userID);
GridUserData[] GetAll(string query);

View File

@ -81,7 +81,7 @@ namespace OpenSim.Data
}
public interface IGroupsData
public interface IGroupsData
{
// groups table
bool StoreGroup(GroupData data);

View File

@ -48,7 +48,7 @@ namespace OpenSim.Data
/// <summary>
/// An interface for connecting to the user grid datastore
/// </summary>
public interface IHGTravelingData
public interface IHGTravelingData
{
HGTravelingData Get(UUID sessionID);
HGTravelingData[] GetSessions(UUID userID);

View File

@ -39,7 +39,7 @@ namespace OpenSim.Data
}
public interface IOfflineIMData
public interface IOfflineIMData
{
OfflineIMData[] Get(string field, string val);
long GetCount(string field, string key);

View File

@ -44,7 +44,7 @@ namespace OpenSim.Data
/// <summary>
/// An interface for connecting to the presence datastore
/// </summary>
public interface IPresenceData
public interface IPresenceData
{
bool Store(PresenceData data);

View File

@ -67,12 +67,10 @@ namespace OpenSim.Data
/// <summary>
/// An interface for connecting to the authentication datastore
/// </summary>
public interface IRegionData
public interface IRegionData
{
RegionData Get(UUID regionID, UUID ScopeID);
List<RegionData> Get(string regionName, UUID ScopeID);
RegionData GetSpecific(string regionName, UUID ScopeID);
RegionData Get(int x, int y, UUID ScopeID);
List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);

View File

@ -38,12 +38,12 @@ namespace OpenSim.Data
public UUID ownerRoleID;
public string name;
public string charter;
public bool showInList;
public UUID insigniaID;
public bool showInList;
public UUID insigniaID;
public int membershipFee;
public bool openEnrollment;
public bool allowPublish;
public bool maturePublish;
public bool maturePublish;
public UUID founderID;
public ulong everyonePowers;
public ulong ownersPowers;

View File

@ -80,10 +80,10 @@ namespace OpenSim.Data
/// <summary>Have the parameterless constructor just so we can specify it as a generic parameter with the new() constraint.
/// Currently this is only used in the tests. A Migration instance created this way must be then
/// initialized with Initialize(). Regular creation should be through the parameterized constructors.
/// initialized with Initialize(). Regular creation should be through the parameterized constructors.
/// </summary>
public Migration()
{
{
}
public Migration(DbConnection conn, Assembly assem, string subtype, string type)
@ -91,7 +91,7 @@ namespace OpenSim.Data
Initialize(conn, assem, type, subtype);
}
public Migration(DbConnection conn, Assembly assem, string type)
public Migration(DbConnection conn, Assembly assem, string type)
{
Initialize(conn, assem, type, "");
}
@ -191,7 +191,7 @@ namespace OpenSim.Data
int newversion = kvp.Key;
// we need to up the command timeout to infinite as we might be doing long migrations.
/* [AlexRa 01-May-10]: We can't always just run any SQL in a single batch (= ExecuteNonQuery()). Things like
/* [AlexRa 01-May-10]: We can't always just run any SQL in a single batch (= ExecuteNonQuery()). Things like
* stored proc definitions might have to be sent to the server each in a separate batch.
* This is certainly so for MS SQL; not sure how the MySQL connector sorts out the mess
* with 'delimiter @@'/'delimiter ;' around procs. So each "script" this code executes now is not
@ -276,7 +276,7 @@ namespace OpenSim.Data
private delegate void FlushProc();
/// <summary>Scans for migration resources in either old-style "scattered" (one file per version)
/// or new-style "integrated" format (single file with ":VERSION nnn" sections).
/// or new-style "integrated" format (single file with ":VERSION nnn" sections).
/// In the new-style migrations it also recognizes ':GO' separators for parts of the SQL script
/// that must be sent to the server separately. The old-style migrations are loaded each in one piece
/// and don't support the ':GO' feature.
@ -301,12 +301,12 @@ namespace OpenSim.Data
{
/* The filename should be '<StoreName>.migrations[.NNN]' where NNN
* is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip
* the file without looking inside if we have a higher version already. Without the suffix we read
* the file without looking inside if we have a higher version already. Without the suffix we read
* the file anyway and use the version numbers inside. Any unrecognized suffix (such as '.sql')
* is valid but ignored.
*
* NOTE that we expect only one 'merged' migration file. If there are several, we take the last one.
* If you are numbering them, leave only the latest one in the project or at least make sure they numbered
*
* NOTE that we expect only one 'merged' migration file. If there are several, we take the last one.
* If you are numbering them, leave only the latest one in the project or at least make sure they numbered
* to come up in the correct order (e.g. 'SomeStore.migrations.001' rather than 'SomeStore.migrations.1')
*/
@ -351,7 +351,7 @@ namespace OpenSim.Data
if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
{
if (sb.Length == 0) continue;
if (nVersion > after)
if (nVersion > after)
script.Add(sb.ToString());
sb.Length = 0;
continue;
@ -405,10 +405,10 @@ scan_old_style:
}
}
}
if (migrations.Count < 1)
if (migrations.Count < 1)
m_log.DebugFormat("[MIGRATIONS]: {0} data tables already up to date at revision {1}", _type, after);
return migrations;
}
}

View File

@ -75,7 +75,6 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AssetStore");
m.Update();
dbcon.Close();
}
}
@ -145,7 +144,6 @@ namespace OpenSim.Data.MySQL
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
}
}
dbcon.Close();
}
return asset;
@ -158,27 +156,28 @@ namespace OpenSim.Data.MySQL
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
override public bool StoreAsset(AssetBase asset)
{
string assetName = asset.Name;
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
{
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
}
string assetDescription = asset.Description;
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
{
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
string assetName = asset.Name;
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
{
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
}
string assetDescription = asset.Description;
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
{
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
using (MySqlCommand cmd =
new MySqlCommand(
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
@ -201,17 +200,15 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
cmd.Parameters.AddWithValue("?data", asset.Data);
cmd.ExecuteNonQuery();
dbcon.Close();
return true;
}
catch (Exception e)
{
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
asset.FullID, asset.Name, e.Message);
dbcon.Close();
return false;
}
}
}
}
}
@ -241,7 +238,6 @@ namespace OpenSim.Data.MySQL
e);
}
}
dbcon.Close();
}
}
@ -274,7 +270,6 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
bool[] results = new bool[uuids.Length];
@ -334,12 +329,11 @@ namespace OpenSim.Data.MySQL
{
m_log.Error(
string.Format(
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
start, count),
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
start, count),
e);
}
}
dbcon.Close();
}
return retList;
@ -356,7 +350,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", id);
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
return true;

View File

@ -59,7 +59,6 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AuthStore");
m.Update();
dbcon.Close();
}
}
@ -77,30 +76,27 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
using(IDataReader result = cmd.ExecuteReader())
IDataReader result = cmd.ExecuteReader();
if (result.Read())
{
if(result.Read())
ret.PrincipalID = principalID;
CheckColumnNames(result);
foreach (string s in m_ColumnNames)
{
ret.PrincipalID = principalID;
CheckColumnNames(result);
foreach(string s in m_ColumnNames)
{
if(s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
dbcon.Close();
return ret;
}
else
{
dbcon.Close();
return null;
if (s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
return ret;
}
else
{
return null;
}
}
}
@ -136,25 +132,25 @@ namespace OpenSim.Data.MySQL
if (!first)
update += ", ";
update += "`" + field + "` = ?"+field;
first = false;
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
}
update += " where UUID = ?principalID";
cmd.CommandText = update;
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
if (ExecuteNonQuery(cmd) < 1)
{
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
String.Join("`, `", fields) +
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
cmd.CommandText = insert;
if (ExecuteNonQuery(cmd) < 1)
return false;
}
@ -170,7 +166,7 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?"+item, value);
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}
@ -190,7 +186,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
cmd.Parameters.AddWithValue("?token", token);
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}

View File

@ -57,7 +57,7 @@ namespace OpenSim.Data.MySQL
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?Name", name);
if (ExecuteNonQuery(cmd) > 0)
return true;
}

View File

@ -82,7 +82,6 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(dbcon, Assembly, "EstateStore");
m.Update();
dbcon.Close();
Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic |
@ -144,6 +143,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
bool found = false;
@ -171,8 +171,6 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
cmd.Connection = null;
if (!found && create)
{
@ -233,7 +231,6 @@ namespace OpenSim.Data.MySQL
es.Save();
}
dbcon.Close();
}
}
@ -266,7 +263,6 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
SaveBanList(es);
@ -285,7 +281,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select * from estateban where EstateID = ?EstateID";
cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
using (IDataReader r = cmd.ExecuteReader())
@ -293,16 +289,17 @@ namespace OpenSim.Data.MySQL
while (r.Read())
{
EstateBan eb = new EstateBan();
eb.BannedUserID = DBGuid.FromDB(r["bannedUUID"]); ;
UUID uuid = new UUID();
UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
eb.BannedUserID = uuid;
eb.BannedHostAddress = "0.0.0.0";
eb.BannedHostIPMask = "0.0.0.0";
eb.BanningUserID = DBGuid.FromDB(r["banningUUID"]);
eb.BanTime = Convert.ToInt32(r["banTime"]);
es.AddBan(eb);
}
}
}
dbcon.Close();
}
}
@ -321,20 +318,17 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask, banningUUID, banTime) values ( ?EstateID, ?bannedUUID, '', '', '', ?banningUUID, ?banTime)";
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( ?EstateID, ?bannedUUID, '', '', '' )";
foreach (EstateBan b in es.EstateBans)
{
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
cmd.Parameters.AddWithValue("?bannedUUID", b.BannedUserID.ToString());
cmd.Parameters.AddWithValue("?banningUUID", b.BanningUserID.ToString());
cmd.Parameters.AddWithValue("?banTime", b.BanTime);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
dbcon.Close();
}
}
@ -364,7 +358,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
dbcon.Close();
}
}
@ -390,7 +383,6 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
return uuids.ToArray();
@ -411,19 +403,19 @@ namespace OpenSim.Data.MySQL
return e;
}
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<int> allEstateIds = GetEstatesAll();
foreach (int estateId in allEstateIds)
allEstateSettings.Add(LoadEstateSettings(estateId));
return allEstateSettings;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
@ -445,10 +437,11 @@ namespace OpenSim.Data.MySQL
reader.Close();
}
}
dbcon.Close();
}
return result;
return result;
}
public List<int> GetEstates(string search)
@ -473,6 +466,7 @@ namespace OpenSim.Data.MySQL
reader.Close();
}
}
dbcon.Close();
}

View File

@ -54,7 +54,7 @@ namespace OpenSim.Data.MySQL
{
get { return GetType().Assembly; }
}
public MySQLFSAssetData()
{
}
@ -78,7 +78,6 @@ namespace OpenSim.Data.MySQL
conn.Open();
Migration m = new Migration(conn, Assembly, "FSAssetStore");
m.Update();
conn.Close();
}
}
catch (MySqlException e)
@ -122,13 +121,9 @@ namespace OpenSim.Data.MySQL
}
catch (MySqlException e)
{
cmd.Connection = null;
conn.Close();
m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString());
return false;
}
conn.Close();
cmd.Connection = null;
}
return true;
@ -180,7 +175,7 @@ namespace OpenSim.Data.MySQL
UpdateAccessTime(id, AccessTime);
}
}
conn.Close();
}
return meta;
@ -211,7 +206,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", AssetID);
cmd.ExecuteNonQuery();
}
conn.Close();
}
}
@ -227,8 +221,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", meta.ID);
cmd.Parameters.AddWithValue("?name", meta.Name);
cmd.Parameters.AddWithValue("?description", meta.Description);
// cmd.Parameters.AddWithValue("?type", meta.Type.ToString());
cmd.Parameters.AddWithValue("?type", meta.Type);
cmd.Parameters.AddWithValue("?type", meta.Type.ToString());
cmd.Parameters.AddWithValue("?hash", hash);
cmd.Parameters.AddWithValue("?asset_flags", meta.Flags);
@ -246,12 +239,7 @@ namespace OpenSim.Data.MySQL
//ExecuteNonQuery(cmd);
}
// return false;
// if the asset already exits
// assume it was already correctly stored
// or regions will keep retry.
return true;
return false;
}
catch(Exception e)
{
@ -305,7 +293,6 @@ namespace OpenSim.Data.MySQL
}
}
}
conn.Close();
}
for (int i = 0; i < uuids.Length; i++)
@ -340,7 +327,6 @@ namespace OpenSim.Data.MySQL
count = Convert.ToInt32(reader["count"]);
}
}
conn.Close();
}
return count;
@ -421,8 +407,8 @@ namespace OpenSim.Data.MySQL
imported++;
}
}
}
importConn.Close();
}
MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));

View File

@ -36,7 +36,7 @@ using MySql.Data.MySqlClient;
namespace OpenSim.Data.MySQL
{
/// <summary>
/// Common code for a number of database modules
/// A database interface class to a user profile storage system
/// </summary>
public class MySqlFramework
{
@ -44,24 +44,14 @@ namespace OpenSim.Data.MySQL
log4net.LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected string m_connectionString = String.Empty;
protected MySqlTransaction m_trans = null;
protected string m_connectionString;
protected object m_dbLock = new object();
// Constructor using a connection string. Instances constructed
// this way will open a new connection for each call.
protected MySqlFramework(string connectionString)
{
m_connectionString = connectionString;
}
// Constructor using a connection object. Instances constructed
// this way will use the connection object and never create
// new connections.
protected MySqlFramework(MySqlTransaction trans)
{
m_trans = trans;
}
//////////////////////////////////////////////////////////////
//
// All non queries are funneled through one connection
@ -69,53 +59,33 @@ namespace OpenSim.Data.MySQL
//
protected int ExecuteNonQuery(MySqlCommand cmd)
{
if (m_trans == null)
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
int ret = ExecuteNonQueryWithConnection(cmd, dbcon);
dbcon.Close();
return ret;
}
}
else
{
return ExecuteNonQueryWithTransaction(cmd, m_trans);
}
}
try
{
dbcon.Open();
cmd.Connection = dbcon;
private int ExecuteNonQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
{
cmd.Transaction = trans;
return ExecuteNonQueryWithConnection(cmd, trans.Connection);
}
private int ExecuteNonQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
{
try
{
cmd.Connection = dbcon;
try
{
int ret = cmd.ExecuteNonQuery();
cmd.Connection = null;
return ret;
try
{
return cmd.ExecuteNonQuery();
}
catch (Exception e)
{
m_log.Error(e.Message, e);
m_log.Error(Environment.StackTrace.ToString());
return 0;
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return 0;
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
m_log.Error(Environment.StackTrace.ToString());
cmd.Connection = null;
return 0;
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return 0;
}
}
}
}
}

View File

@ -29,16 +29,18 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Text;
using log4net;
using MySql.Data.MySqlClient;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Data.MySQL
{
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<string, FieldInfo> m_Fields =
new Dictionary<string, FieldInfo>();
@ -51,27 +53,14 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySQLGenericTableHandler(MySqlTransaction trans,
string realm, string storeName) : base(trans)
{
m_Realm = realm;
CommonConstruct(storeName);
}
public MySQLGenericTableHandler(string connectionString,
string realm, string storeName) : base(connectionString)
{
m_Realm = realm;
CommonConstruct(storeName);
}
protected void CommonConstruct(string storeName)
{
m_connectionString = connectionString;
if (storeName != String.Empty)
{
// We always use a new connection for any Migrations
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -116,167 +105,107 @@ namespace OpenSim.Data.MySQL
}
public virtual T[] Get(string field, string key)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.Parameters.AddWithValue(field, key);
cmd.CommandText = string.Format("select * from {0} where `{1}` = ?{1}", m_Realm, field);
return DoQuery(cmd);
}
}
public virtual T[] Get(string field, string[] keys)
{
int flen = keys.Length;
if(flen == 0)
return new T[0];
int flast = flen - 1;
StringBuilder sb = new StringBuilder(1024);
sb.AppendFormat("select * from {0} where {1} IN (?", m_Realm, field);
using (MySqlCommand cmd = new MySqlCommand())
{
for (int i = 0 ; i < flen ; i++)
{
string fname = field + i.ToString();
cmd.Parameters.AddWithValue(fname, keys[i]);
sb.Append(fname);
if(i < flast)
sb.Append(",?");
else
sb.Append(")");
}
cmd.CommandText = sb.ToString();
return DoQuery(cmd);
}
return Get(new string[] { field }, new string[] { key });
}
public virtual T[] Get(string[] fields, string[] keys)
{
return Get(fields, keys, String.Empty);
}
public virtual T[] Get(string[] fields, string[] keys, string options)
{
int flen = fields.Length;
if (flen == 0 || flen != keys.Length)
if (fields.Length != keys.Length)
return new T[0];
int flast = flen - 1;
StringBuilder sb = new StringBuilder(1024);
sb.AppendFormat("select * from {0} where ", m_Realm);
List<string> terms = new List<string>();
using (MySqlCommand cmd = new MySqlCommand())
{
for (int i = 0 ; i < flen ; i++)
for (int i = 0 ; i < fields.Length ; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
if(i < flast)
sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
else
sb.AppendFormat("`{0}` = ?{0} ", fields[i]);
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
}
sb.Append(options);
cmd.CommandText = sb.ToString();
string where = String.Join(" and ", terms.ToArray());
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
}
protected T[] DoQuery(MySqlCommand cmd)
{
if (m_trans == null)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
T[] ret = DoQueryWithConnection(cmd, dbcon);
dbcon.Close();
return ret;
}
}
else
{
return DoQueryWithTransaction(cmd, m_trans);
}
}
protected T[] DoQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
{
cmd.Transaction = trans;
return DoQueryWithConnection(cmd, trans.Connection);
}
protected T[] DoQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
{
List<T> result = new List<T>();
cmd.Connection = dbcon;
using (IDataReader reader = cmd.ExecuteReader())
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
if (reader == null)
return new T[0];
dbcon.Open();
cmd.Connection = dbcon;
CheckColumnNames(reader);
while (reader.Read())
using (IDataReader reader = cmd.ExecuteReader())
{
T row = new T();
if (reader == null)
return new T[0];
foreach (string name in m_Fields.Keys)
CheckColumnNames(reader);
while (reader.Read())
{
if (reader[name] is DBNull)
T row = new T();
foreach (string name in m_Fields.Keys)
{
continue;
if (reader[name] is DBNull)
{
continue;
}
if (m_Fields[name].FieldType == typeof(bool))
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v != 0 ? true : false);
}
else if (m_Fields[name].FieldType == typeof(UUID))
{
m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name]));
}
else if (m_Fields[name].FieldType == typeof(int))
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v);
}
else if (m_Fields[name].FieldType == typeof(uint))
{
uint v = Convert.ToUInt32(reader[name]);
m_Fields[name].SetValue(row, v);
}
else
{
m_Fields[name].SetValue(row, reader[name]);
}
}
if (m_Fields[name].FieldType == typeof(bool))
if (m_DataField != null)
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v != 0);
}
else if (m_Fields[name].FieldType == typeof(UUID))
{
m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name]));
}
else if (m_Fields[name].FieldType == typeof(int))
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v);
}
else if (m_Fields[name].FieldType == typeof(uint))
{
uint v = Convert.ToUInt32(reader[name]);
m_Fields[name].SetValue(row, v);
}
else
{
m_Fields[name].SetValue(row, reader[name]);
Dictionary<string, string> data =
new Dictionary<string, string>();
foreach (string col in m_ColumnNames)
{
data[col] = reader[col].ToString();
if (data[col] == null)
data[col] = String.Empty;
}
m_DataField.SetValue(row, data);
}
result.Add(row);
}
if (m_DataField != null)
{
Dictionary<string, string> data =
new Dictionary<string, string>();
foreach (string col in m_ColumnNames)
{
data[col] = reader[col].ToString();
if (data[col] == null)
data[col] = String.Empty;
}
m_DataField.SetValue(row, data);
}
result.Add(row);
}
}
cmd.Connection = null;
return result.ToArray();
}
@ -286,9 +215,9 @@ namespace OpenSim.Data.MySQL
{
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
}
@ -307,16 +236,16 @@ namespace OpenSim.Data.MySQL
{
names.Add(fi.Name);
values.Add("?" + fi.Name);
// Temporarily return more information about what field is unexpectedly null for
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
// InventoryTransferModule or we may be required to substitute a DBNull here.
if (fi.GetValue(row) == null)
throw new NullReferenceException(
string.Format(
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
fi.Name, row));
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
}
@ -355,26 +284,25 @@ namespace OpenSim.Data.MySQL
// "[MYSQL GENERIC TABLE HANDLER]: Delete(string[] fields, string[] keys) invoked with {0}:{1}",
// string.Join(",", fields), string.Join(",", keys));
int flen = fields.Length;
if (flen == 0 || flen != keys.Length)
if (fields.Length != keys.Length)
return false;
int flast = flen - 1;
StringBuilder sb = new StringBuilder(1024);
sb.AppendFormat("delete from {0} where ", m_Realm);
List<string> terms = new List<string>();
using (MySqlCommand cmd = new MySqlCommand())
{
for (int i = 0 ; i < flen ; i++)
for (int i = 0 ; i < fields.Length ; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
if(i < flast)
sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
else
sb.AppendFormat("`{0}` = ?{0}", fields[i]);
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
}
cmd.CommandText = sb.ToString();
string where = String.Join(" and ", terms.ToArray());
string query = String.Format("delete from {0} where {1}", m_Realm, where);
cmd.CommandText = query;
return ExecuteNonQuery(cmd) > 0;
}
}
@ -386,27 +314,27 @@ namespace OpenSim.Data.MySQL
public long GetCount(string[] fields, string[] keys)
{
int flen = fields.Length;
if (flen == 0 || flen != keys.Length)
if (fields.Length != keys.Length)
return 0;
int flast = flen - 1;
StringBuilder sb = new StringBuilder(1024);
sb.AppendFormat("select count(*) from {0} where ", m_Realm);
List<string> terms = new List<string>();
using (MySqlCommand cmd = new MySqlCommand())
{
for (int i = 0 ; i < flen ; i++)
for (int i = 0; i < fields.Length; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
if(i < flast)
sb.AppendFormat("`{0}` = ?{0} and ", fields[i]);
else
sb.AppendFormat("`{0}` = ?{0}", fields[i]);
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
}
cmd.CommandText = sb.ToString();
object result = DoQueryScalar(cmd);
string where = String.Join(" and ", terms.ToArray());
string query = String.Format("select count(*) from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
Object result = DoQueryScalar(cmd);
return Convert.ToInt64(result);
}
@ -429,26 +357,14 @@ namespace OpenSim.Data.MySQL
public object DoQueryScalar(MySqlCommand cmd)
{
if (m_trans == null)
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
object ret = cmd.ExecuteScalar();
cmd.Connection = null;
dbcon.Close();
return ret;
}
}
else
{
cmd.Connection = m_trans.Connection;
cmd.Transaction = m_trans;
dbcon.Open();
cmd.Connection = dbcon;
return cmd.ExecuteScalar();
}
}
}
}

View File

@ -90,7 +90,7 @@ namespace OpenSim.Data.MySQL
else
pattern = string.Format("Name LIKE '%{0}%'", MySqlHelper.EscapeString(pattern));
return m_Groups.Get(string.Format("ShowInList=1 AND ({0})", pattern));
return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern));
}
public bool DeleteGroup(UUID groupID)
@ -133,10 +133,10 @@ namespace OpenSim.Data.MySQL
public bool DeleteMember(UUID groupID, string pricipalID)
{
return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" },
return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), pricipalID });
}
public int MemberCount(UUID groupID)
{
return (int)m_Membership.GetCount("GroupID", groupID.ToString());
@ -168,7 +168,7 @@ namespace OpenSim.Data.MySQL
public bool DeleteRole(UUID groupID, UUID roleID)
{
return m_Roles.Delete(new string[] { "GroupID", "RoleID" },
return m_Roles.Delete(new string[] { "GroupID", "RoleID" },
new string[] { groupID.ToString(), roleID.ToString() });
}
@ -360,7 +360,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsGroupsHandler(string connectionString, string realm, string store)
public MySqlGroupsGroupsHandler(string connectionString, string realm, string store)
: base(connectionString, realm, store)
{
}
@ -375,7 +375,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsMembershipHandler(string connectionString, string realm)
public MySqlGroupsMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@ -390,7 +390,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsRolesHandler(string connectionString, string realm)
public MySqlGroupsRolesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@ -405,7 +405,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsRoleMembershipHandler(string connectionString, string realm)
public MySqlGroupsRoleMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@ -420,7 +420,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsInvitesHandler(string connectionString, string realm)
public MySqlGroupsInvitesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@ -447,7 +447,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsNoticesHandler(string connectionString, string realm)
public MySqlGroupsNoticesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
@ -475,7 +475,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; }
}
public MySqlGroupsPrincipalsHandler(string connectionString, string realm)
public MySqlGroupsPrincipalsHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}

View File

@ -78,7 +78,6 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, assem, "InventoryStore");
m.Update();
dbcon.Close();
}
}
@ -131,7 +130,6 @@ namespace OpenSim.Data.MySQL
items.Add(item);
}
dbcon.Close();
return items;
}
}
@ -172,7 +170,6 @@ namespace OpenSim.Data.MySQL
while (reader.Read())
items.Add(readInventoryFolder(reader));
dbcon.Close();
return items;
}
}
@ -224,7 +221,6 @@ namespace OpenSim.Data.MySQL
if (items.Count > 0)
rootFolder = items[0];
dbcon.Close();
return rootFolder;
}
}
@ -265,7 +261,6 @@ namespace OpenSim.Data.MySQL
while (reader.Read())
items.Add(readInventoryFolder(reader));
dbcon.Close();
return items;
}
}
@ -293,7 +288,7 @@ namespace OpenSim.Data.MySQL
// TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
// (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
item.CreatorId = reader["creatorID"].ToString();
// Be a bit safer in parsing these because the
// database doesn't enforce them to be not null, and
// the inventory still works if these are weird in the
@ -357,7 +352,6 @@ namespace OpenSim.Data.MySQL
if (reader.Read())
item = readInventoryItem(reader);
dbcon.Close();
return item;
}
}
@ -423,7 +417,6 @@ namespace OpenSim.Data.MySQL
if (reader.Read())
folder = readInventoryFolder(reader);
dbcon.Close();
return folder;
}
}
@ -460,7 +453,7 @@ namespace OpenSim.Data.MySQL
itemName = item.Name.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length + " to " + itemName.Length + " characters on add item");
}
string itemDesc = item.Description;
if (item.Description.Length > 128)
{
@ -497,10 +490,10 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?groupID", item.GroupID);
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
result.Parameters.AddWithValue("?flags", item.Flags);
lock (m_dbLock)
result.ExecuteNonQuery();
result.Dispose();
}
@ -511,7 +504,6 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
result.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -548,7 +540,6 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -609,7 +600,6 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString());
}
}
dbcon.Close();
}
}
@ -640,7 +630,7 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
try
{
lock (m_dbLock)
@ -653,7 +643,6 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString());
}
}
dbcon.Close();
}
}
@ -817,7 +806,6 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -845,7 +833,6 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -873,7 +860,7 @@ namespace OpenSim.Data.MySQL
deleteOneFolder(folderID);
deleteItemsInFolder(folderID);
}
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
{
lock (m_dbLock)
@ -899,7 +886,6 @@ namespace OpenSim.Data.MySQL
if (item != null)
list.Add(item);
}
dbcon.Close();
return list;
}
}

View File

@ -39,16 +39,16 @@ namespace OpenSim.Data.MySQL
{
/// <summary>This is a MySQL-customized migration processor. The only difference is in how
/// it executes SQL scripts (using MySqlScript instead of MyCommand)
///
///
/// </summary>
public class MySqlMigration : Migration
{
public MySqlMigration()
: base()
{
{
}
public MySqlMigration(DbConnection conn, Assembly assem, string subtype, string type) :
public MySqlMigration(DbConnection conn, Assembly assem, string subtype, string type) :
base(conn, assem, subtype, type)
{
}

View File

@ -50,7 +50,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm);
ExecuteNonQuery(cmd);
}

View File

@ -66,9 +66,9 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
ExecuteNonQuery(cmd);
}
}
@ -85,10 +85,10 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
if (ExecuteNonQuery(cmd) == 0)
return false;
}

View File

@ -60,7 +60,6 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "GridStore");
m.Update();
dbcon.Close();
}
}
@ -81,15 +80,17 @@ namespace OpenSim.Data.MySQL
}
}
public RegionData GetSpecific(string regionName, UUID scopeID)
public RegionData Get(int posX, int posY, UUID scopeID)
{
string command = "select * from `" + m_Realm + "` where regionName = ?regionName";
/* fixed size regions
string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?regionName", regionName);
cmd.Parameters.AddWithValue("?posX", posX.ToString());
cmd.Parameters.AddWithValue("?posY", posY.ToString());
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
List<RegionData> ret = RunCommand(cmd);
@ -98,11 +99,8 @@ namespace OpenSim.Data.MySQL
return ret[0];
}
}
public RegionData Get(int posX, int posY, UUID scopeID)
{
*/
// extend database search for maximum region size area
string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
@ -206,7 +204,7 @@ namespace OpenSim.Data.MySQL
foreach (RegionData r in dbret)
{
if (r.posX + r.sizeX > startX && r.posX <= endX
&& r.posY + r.sizeY > startY && r.posY <= endY)
&& r.posY + r.sizeX > startY && r.posY <= endY)
ret.Add(r);
}
return ret;
@ -262,8 +260,6 @@ namespace OpenSim.Data.MySQL
retList.Add(ret);
}
}
cmd.Connection = null;
dbcon.Close();
}
return retList;
@ -414,7 +410,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -58,6 +58,11 @@ namespace OpenSim.Data.MySQL
private bool m_enableCompression = false;
private string m_connectionString;
/// <summary>
/// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
/// </summary>
private HashAlgorithm hasher = new SHA256CryptoServiceProvider();
#region IPlugin Members
public string Version { get { return "1.0.0.0"; } }
@ -92,7 +97,6 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "XAssetStore");
m.Update();
dbcon.Close();
}
}
@ -126,7 +130,6 @@ namespace OpenSim.Data.MySQL
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
AssetBase asset = null;
int accessTime = 0;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -137,6 +140,7 @@ namespace OpenSim.Data.MySQL
dbcon))
{
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
@ -155,7 +159,23 @@ namespace OpenSim.Data.MySQL
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
accessTime = (int)dbReader["AccessTime"];
if (m_enableCompression)
{
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
{
MemoryStream outputStream = new MemoryStream();
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
}
}
}
@ -164,38 +184,9 @@ namespace OpenSim.Data.MySQL
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
}
}
dbcon.Close();
}
if(asset == null)
return asset;
if(accessTime > 0)
{
try
{
UpdateAccessTime(asset.Metadata, accessTime);
}
catch { }
}
if (m_enableCompression && asset.Data != null)
{
using(MemoryStream ms = new MemoryStream(asset.Data))
using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
{
using(MemoryStream outputStream = new MemoryStream())
{
decompressionStream.CopyTo(outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
return asset;
return asset;
}
/// <summary>
@ -218,7 +209,7 @@ namespace OpenSim.Data.MySQL
{
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
m_log.WarnFormat(
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
}
@ -227,7 +218,7 @@ namespace OpenSim.Data.MySQL
{
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
m_log.WarnFormat(
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
@ -245,9 +236,7 @@ namespace OpenSim.Data.MySQL
}
}
byte[] hash;
using (HashAlgorithm hasher = new SHA256CryptoServiceProvider())
hash = hasher.ComputeHash(asset.Data);
byte[] hash = hasher.ComputeHash(asset.Data);
// m_log.DebugFormat(
// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}",
@ -314,7 +303,6 @@ namespace OpenSim.Data.MySQL
transaction.Commit();
}
dbcon.Close();
}
}
@ -353,10 +341,9 @@ namespace OpenSim.Data.MySQL
catch (Exception)
{
m_log.ErrorFormat(
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
assetMetadata.ID, assetMetadata.Name);
}
dbcon.Close();
}
}
@ -487,7 +474,6 @@ namespace OpenSim.Data.MySQL
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
}
}
dbcon.Close();
}
return retList;
@ -506,9 +492,9 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?ID", id);
cmd.ExecuteNonQuery();
}
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
// keep a reference count (?)
dbcon.Close();
}
return true;

View File

@ -80,7 +80,7 @@ namespace OpenSim.Data.MySQL
return m_Items.Store(item);
}
public bool DeleteFolders(string field, string val)
{
return m_Folders.Delete(field, val);
@ -193,9 +193,7 @@ namespace OpenSim.Data.MySQL
{
using (MySqlCommand cmd = new MySqlCommand())
{
// cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1");
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
@ -214,18 +212,15 @@ namespace OpenSim.Data.MySQL
{
cmd.Connection = dbcon;
// cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID");
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
using (IDataReader reader = cmd.ExecuteReader())
{
int perms = 0;
if (reader.Read())
{
perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);
@ -328,6 +323,7 @@ namespace OpenSim.Data.MySQL
{
return false;
}
cmd.Dispose();
}
dbcon.Close();

View File

@ -69,15 +69,3 @@ CREATE TABLE IF NOT EXISTS `estateban` (
COMMIT;
:VERSION 35
BEGIN;
ALTER TABLE `estateban`
ADD COLUMN `banningUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
ADD COLUMN `banTime` int(11) NOT NULL DEFAULT 0;
COMMIT;
:VERSION 36
BEGIN;
ALTER TABLE `estate_settings`
ADD COLUMN `AllowEnviromentOverride` tinyint(4) NOT NULL DEFAULT '0';
COMMIT;

View File

@ -16,9 +16,3 @@ CREATE TABLE `hg_traveling_data` (
COMMIT;
:VERSION 2 # --------------------------
ALTER TABLE `hg_traveling_data` MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
COMMIT;

View File

@ -11,6 +11,6 @@ CREATE TABLE IF NOT EXISTS `im_offline` (
PRIMARY KEY (`ID`),
KEY `PrincipalID` (`PrincipalID`),
KEY `FromID` (`FromID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
COMMIT;

View File

@ -1,16 +0,0 @@
:VERSION 1
BEGIN;
CREATE TABLE `MuteList` (
`AgentID` char(36) NOT NULL,
`MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`MuteName` varchar(64) NOT NULL DEFAULT '',
`MuteType` int(11) NOT NULL DEFAULT '1',
`MuteFlags` int(11) NOT NULL DEFAULT '0',
`Stamp` int(11) NOT NULL,
UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`),
KEY `AgentID` (`AgentID`)
);
COMMIT;

View File

@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `prims` (
PRIMARY KEY (`UUID`),
KEY `prims_regionuuid` (`RegionUUID`),
KEY `prims_scenegroupid` (`SceneGroupID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `primshapes` (
`Shape` int(11) DEFAULT NULL,
@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `primshapes` (
`Media` text,
`LastAttachPoint` int(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `primitems` (
`invType` int(11) DEFAULT NULL,
@ -154,13 +154,13 @@ CREATE TABLE IF NOT EXISTS `primitems` (
`lastOwnerID` char(36) DEFAULT NULL,
PRIMARY KEY (`itemID`),
KEY `primitems_primid` (`primID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `terrain` (
`RegionUUID` varchar(255) DEFAULT NULL,
`Revision` int(11) DEFAULT NULL,
`Heightfield` longblob
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `land` (
`UUID` varchar(255) NOT NULL,
@ -204,21 +204,21 @@ CREATE TABLE IF NOT EXISTS `land` (
`ObscureMusic` tinyint(1) NOT NULL DEFAULT '0',
`ObscureMedia` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `landaccesslist` (
`LandUUID` varchar(255) DEFAULT NULL,
`AccessUUID` varchar(255) DEFAULT NULL,
`Flags` int(11) DEFAULT NULL,
`Expires` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `regionban` (
`regionUUID` varchar(36) NOT NULL,
`bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `regionsettings` (
`regionUUID` char(36) NOT NULL,
@ -265,7 +265,7 @@ CREATE TABLE IF NOT EXISTS `regionsettings` (
`parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`regionUUID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `regionwindlight` (
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
@ -390,163 +390,3 @@ CREATE TABLE IF NOT EXISTS `bakedterrain` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;
:VERSION 55 #----- Increase float precision for windlight needed by scripts
BEGIN;
ALTER TABLE `regionwindlight`
MODIFY `water_fog_density_exponent` float(9,7) unsigned NOT NULL DEFAULT '4.0',
MODIFY `underwater_fog_modifier` float(9,8) unsigned NOT NULL DEFAULT '0.25',
MODIFY `reflection_wavelet_scale_1` float(9,7) unsigned NOT NULL DEFAULT '2.0',
MODIFY `reflection_wavelet_scale_2` float(9,7) unsigned NOT NULL DEFAULT '2.0',
MODIFY `reflection_wavelet_scale_3` float(9,7) unsigned NOT NULL DEFAULT '2.0',
MODIFY `fresnel_scale` float(9,8) unsigned NOT NULL DEFAULT '0.40',
MODIFY `fresnel_offset` float(9,8) unsigned NOT NULL DEFAULT '0.50',
MODIFY `refract_scale_above` float(9,8) unsigned NOT NULL DEFAULT '0.03',
MODIFY `refract_scale_below` float(9,8) unsigned NOT NULL DEFAULT '0.20',
MODIFY `blur_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.040',
MODIFY `big_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.05',
MODIFY `big_wave_direction_y` float(9,8) NOT NULL DEFAULT '-0.42',
MODIFY `little_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.11',
MODIFY `little_wave_direction_y` float(9,8) NOT NULL DEFAULT '-1.16',
MODIFY `horizon_r` float(9,8) unsigned NOT NULL DEFAULT '0.25',
MODIFY `horizon_g` float(9,8) unsigned NOT NULL DEFAULT '0.25',
MODIFY `horizon_b` float(9,8) unsigned NOT NULL DEFAULT '0.32',
MODIFY `horizon_i` float(9,8) unsigned NOT NULL DEFAULT '0.32',
MODIFY `haze_horizon` float(9,8) unsigned NOT NULL DEFAULT '0.19',
MODIFY `blue_density_r` float(9,8) unsigned NOT NULL DEFAULT '0.12',
MODIFY `blue_density_g` float(9,8) unsigned NOT NULL DEFAULT '0.22',
MODIFY `blue_density_b` float(9,8) unsigned NOT NULL DEFAULT '0.38',
MODIFY `blue_density_i` float(9,8) unsigned NOT NULL DEFAULT '0.38',
MODIFY `haze_density` float(9,8) unsigned NOT NULL DEFAULT '0.70',
MODIFY `density_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.18',
MODIFY `distance_multiplier` float(9,6) unsigned NOT NULL DEFAULT '0.8',
MODIFY `sun_moon_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.24',
MODIFY `sun_moon_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.26',
MODIFY `sun_moon_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.30',
MODIFY `sun_moon_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.30',
MODIFY `sun_moon_position` float(9,8) unsigned NOT NULL DEFAULT '0.317',
MODIFY `ambient_r` float(9,8) unsigned NOT NULL DEFAULT '0.35',
MODIFY `ambient_g` float(9,8) unsigned NOT NULL DEFAULT '0.35',
MODIFY `ambient_b` float(9,8) unsigned NOT NULL DEFAULT '0.35',
MODIFY `ambient_i` float(9,8) unsigned NOT NULL DEFAULT '0.35',
MODIFY `east_angle` float(9,8) unsigned NOT NULL DEFAULT '0.00',
MODIFY `sun_glow_focus` float(9,8) unsigned NOT NULL DEFAULT '0.10',
MODIFY `sun_glow_size` float(9,8) unsigned NOT NULL DEFAULT '1.75',
MODIFY `scene_gamma` float(9,7) unsigned NOT NULL DEFAULT '1.00',
MODIFY `star_brightness` float(9,8) unsigned NOT NULL DEFAULT '0.00',
MODIFY `cloud_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.41',
MODIFY `cloud_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.41',
MODIFY `cloud_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.41',
MODIFY `cloud_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.41',
MODIFY `cloud_x` float(9,8) unsigned NOT NULL DEFAULT '1.00',
MODIFY `cloud_y` float(9,8) unsigned NOT NULL DEFAULT '0.53',
MODIFY `cloud_density` float(9,8) unsigned NOT NULL DEFAULT '1.00',
MODIFY `cloud_coverage` float(9,8) unsigned NOT NULL DEFAULT '0.27',
MODIFY `cloud_scale` float(9,8) unsigned NOT NULL DEFAULT '0.42',
MODIFY `cloud_detail_x` float(9,8) unsigned NOT NULL DEFAULT '1.00',
MODIFY `cloud_detail_y` float(9,8) unsigned NOT NULL DEFAULT '0.53',
MODIFY `cloud_detail_density` float(9,8) unsigned NOT NULL DEFAULT '0.12',
MODIFY `cloud_scroll_x` float(9,7) NOT NULL DEFAULT '0.20',
MODIFY `cloud_scroll_y` float(9,7) NOT NULL DEFAULT '0.01';
COMMIT;
:VERSION 56 #----- Add RezzerID field in table prims
BEGIN;
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
COMMIT;
:VERSION 57 #----- Add physics inertia data
BEGIN;
ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
COMMIT;
:VERSION 58 #----- Add sop animations
BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
COMMIT;
:VERSION 59 #----- Add standtarget and sit range
BEGIN;
ALTER TABLE `prims`
ADD COLUMN `standtargetx` float DEFAULT '0.0',
ADD COLUMN `standtargety` float DEFAULT '0.0',
ADD COLUMN `standtargetz` float DEFAULT '0.0',
ADD COLUMN `sitactrange` float DEFAULT '0.0';
COMMIT;
:VERSION 60 #----- don't store float on double
BEGIN;
ALTER TABLE `prims`
MODIFY `PositionX` float DEFAULT '0.0',
MODIFY `PositionY` float DEFAULT '0.0',
MODIFY `PositionZ` float DEFAULT '0.0',
MODIFY `GroupPositionX` float DEFAULT '0.0',
MODIFY `GroupPositionY` float DEFAULT '0.0',
MODIFY `GroupPositionZ` float DEFAULT '0.0',
MODIFY `VelocityX` float DEFAULT '0.0',
MODIFY `VelocityY` float DEFAULT '0.0',
MODIFY `VelocityZ` float DEFAULT '0.0',
MODIFY `AngularVelocityX` float DEFAULT '0.0',
MODIFY `AngularVelocityY` float DEFAULT '0.0',
MODIFY `AngularVelocityZ` float DEFAULT '0.0',
MODIFY `AccelerationX` float DEFAULT '0.0',
MODIFY `AccelerationY` float DEFAULT '0.0',
MODIFY `AccelerationZ` float DEFAULT '0.0',
MODIFY `RotationX` float DEFAULT '0.0',
MODIFY `RotationY` float DEFAULT '0.0',
MODIFY `RotationZ` float DEFAULT '0.0',
MODIFY `RotationW` float DEFAULT '0.0',
MODIFY `SitTargetOffsetX` float DEFAULT '0.0',
MODIFY `SitTargetOffsetY` float DEFAULT '0.0',
MODIFY `SitTargetOffsetZ` float DEFAULT '0.0',
MODIFY `SitTargetOrientX` float DEFAULT '0.0',
MODIFY `SitTargetOrientY` float DEFAULT '0.0',
MODIFY `SitTargetOrientZ` float DEFAULT '0.0',
MODIFY `SitTargetOrientW` float DEFAULT '0.0',
MODIFY `OmegaX` float DEFAULT '0.0',
MODIFY `OmegaY` float DEFAULT '0.0',
MODIFY `OmegaZ` float DEFAULT '0.0',
MODIFY `CameraEyeOffsetX` float DEFAULT '0.0',
MODIFY `CameraEyeOffsetY` float DEFAULT '0.0',
MODIFY `CameraEyeOffsetZ` float DEFAULT '0.0',
MODIFY `CameraAtOffsetX` float DEFAULT '0.0',
MODIFY `CameraAtOffsetY` float DEFAULT '0.0',
MODIFY `CameraAtOffsetZ` float DEFAULT '0.0',
MODIFY `Density` float DEFAULT '1000.0',
MODIFY `GravityModifier` float DEFAULT '1.0',
MODIFY `Friction` float DEFAULT '0.6',
MODIFY `Restitution` float DEFAULT '0.5',
MODIFY `AttachedPosX` float DEFAULT '0',
MODIFY `AttachedPosY` float DEFAULT '0',
MODIFY `AttachedPosZ` float DEFAULT '0',
MODIFY `LoopedSoundGain` float DEFAULT '0';
COMMIT;
:VERSION 61 #----- Add pseudo CRC and region cache id
BEGIN;
ALTER TABLE `prims` ADD COLUMN `pseudocrc` int DEFAULT '0';
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` char(36) DEFAULT NULL;
COMMIT;
:VERSION 62 #----- increase size of environment settings
BEGIN;
ALTER TABLE `regionenvironment` MODIFY `llsd_settings` MEDIUMTEXT;
COMMIT;
:VERSION 63 #----- parcel environment store
BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` MEDIUMTEXT default NULL;
COMMIT;

View File

@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS `usernotes` (
`targetuuid` varchar(36) NOT NULL,
`notes` text NOT NULL,
UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userpicks` (
@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `userpicks` (
`enabled` enum('true','false') NOT NULL,
`gatekeeper` varchar(255),
PRIMARY KEY (`pickuuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userprofile` (
@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `userprofile` (
`profileFirstImage` varchar(36) NOT NULL,
`profileFirstText` text NOT NULL,
PRIMARY KEY (`useruuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userdata` (
`UserId` char(36) NOT NULL,
@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `userdata` (
`DataKey` varchar(255),
`DataVal` varchar(255),
PRIMARY KEY (`UserId`,`TagId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `usersettings` (
`useruuid` varchar(36) NOT NULL,
@ -81,6 +81,6 @@ CREATE TABLE IF NOT EXISTS `usersettings` (
`visible` enum('true','false') NOT NULL,
`email` varchar(254) NOT NULL,
PRIMARY KEY (`useruuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
commit;

View File

@ -31,7 +31,7 @@ CREATE TABLE `os_groups_membership` (
`AccessToken` char(36) NOT NULL default '',
PRIMARY KEY (`GroupID`,`PrincipalID`),
KEY `PrincipalID` (`PrincipalID`)
) ENGINE=InnoDB;
) ENGINE=MyISAM;
CREATE TABLE `os_groups_roles` (
@ -43,7 +43,7 @@ CREATE TABLE `os_groups_roles` (
`Powers` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`GroupID`,`RoleID`),
KEY `GroupID` (`GroupID`)
) ENGINE=InnoDB;
) ENGINE=MyISAM;
CREATE TABLE `os_groups_rolemembership` (
@ -52,7 +52,7 @@ CREATE TABLE `os_groups_rolemembership` (
`PrincipalID` VARCHAR(255) NOT NULL default '',
PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`),
KEY `PrincipalID` (`PrincipalID`)
) ENGINE=InnoDB;
) ENGINE=MyISAM;
CREATE TABLE `os_groups_invites` (
@ -63,7 +63,7 @@ CREATE TABLE `os_groups_invites` (
`TMStamp` timestamp NOT NULL,
PRIMARY KEY (`InviteID`),
UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`)
) ENGINE=InnoDB;
) ENGINE=MyISAM;
CREATE TABLE `os_groups_notices` (
@ -81,13 +81,13 @@ CREATE TABLE `os_groups_notices` (
PRIMARY KEY (`NoticeID`),
KEY `GroupID` (`GroupID`),
KEY `TMStamp` (`TMStamp`)
) ENGINE=InnoDB;
) ENGINE=MyISAM;
CREATE TABLE `os_groups_principals` (
`PrincipalID` VARCHAR(255) NOT NULL default '',
`ActiveGroupID` char(36) NOT NULL default '',
PRIMARY KEY (`PrincipalID`)
) ENGINE=InnoDB;
) ENGINE=MyISAM;
COMMIT;
@ -112,12 +112,4 @@ DROP TABLE `diva_groups_principals`;
DELETE FROM `migrations` WHERE name='diva_im_Store';
COMMIT;
:VERSION 3 # --------------------------
ALTER TABLE `os_groups_invites`
MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
COMMIT;
COMMIT;

View File

@ -102,19 +102,19 @@ namespace OpenSim.Data.Null
{
return new EstateSettings();
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
allEstateSettings.Add(GetEstate());
return allEstateSettings;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
result.Add((int)GetEstate().EstateID);
return result;
return result;
}
public List<int> GetEstates(string search)

Some files were not shown because too many files have changed in this diff Show More