Merge branch 'master' into 0.9.0-post-fixes

0.9.0-post-fixes
Diva Canto 2017-01-08 10:11:45 -08:00
commit 7642233109
1007 changed files with 44353 additions and 48124 deletions

2
.gitignore vendored
View File

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

View File

@ -89,6 +89,7 @@ what it is today.
* dmiles (Daxtron Labs) * dmiles (Daxtron Labs)
* Dong Jun Lan (IBM) * Dong Jun Lan (IBM)
* DoranZemlja * DoranZemlja
* Drake Arconis
* dr0b3rts * dr0b3rts
* dslake * dslake
* eeyore * eeyore
@ -107,6 +108,7 @@ what it is today.
* Flyte Xevious * Flyte Xevious
* Freaky Tech * Freaky Tech
* Garmin Kawaguichi * Garmin Kawaguichi
* Geir Noklebye
* Glenn Martin (MOSES) * Glenn Martin (MOSES)
* Gryc Ueusp * Gryc Ueusp
* H-H-H (ginge264) * H-H-H (ginge264)
@ -115,6 +117,7 @@ what it is today.
* Imaze Rhiano * Imaze Rhiano
* Intimidated * Intimidated
* Jak Daniels * Jak Daniels
* Jeff Kelly
* Jeremy Bongio (IBM) * Jeremy Bongio (IBM)
* jhurliman * jhurliman
* John R Sohn (XenReborn) * John R Sohn (XenReborn)
@ -136,6 +139,7 @@ what it is today.
* Magnuz Binder * Magnuz Binder
* maimedleech * maimedleech
* Mana Janus * Mana Janus
* Mandarinka Tasty
* MarcelEdward * MarcelEdward
* Matt Lehmann * Matt Lehmann
* Mic Bowman * Mic Bowman
@ -158,6 +162,7 @@ what it is today.
* openlifegrid.com * openlifegrid.com
* otakup0pe * otakup0pe
* Pixel Tomsen * Pixel Tomsen
* Quill Littlefeather
* ralphos * ralphos
* RemedyTomm * RemedyTomm
* Revolution * Revolution
@ -183,6 +188,7 @@ what it is today.
* TBG Renfold * TBG Renfold
* tglion * tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
* TomDataWorks
* TomTheDragon (muckwaddle) * TomTheDragon (muckwaddle)
* tyre * tyre
* Vegaslon <vegaslon@gmail.com> * Vegaslon <vegaslon@gmail.com>

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -131,7 +131,7 @@ namespace OpenSim.Groups
{ {
if (!m_groupMessagingEnabled) if (!m_groupMessagingEnabled)
return; return;
scene.RegisterModuleInterface<IGroupsMessagingModule>(this); scene.RegisterModuleInterface<IGroupsMessagingModule>(this);
m_sceneList.Add(scene); m_sceneList.Add(scene);
@ -163,7 +163,7 @@ namespace OpenSim.Groups
if (m_groupData == null) if (m_groupData == null)
{ {
m_log.Error("[Groups.Messaging]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled."); m_log.Error("[Groups.Messaging]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
RemoveRegion(scene); RemoveRegion(scene);
return; return;
} }
@ -218,7 +218,7 @@ namespace OpenSim.Groups
m_msgTransferModule = null; m_msgTransferModule = null;
} }
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
get { return null; } get { return null; }
} }
@ -262,7 +262,7 @@ namespace OpenSim.Groups
{ {
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID.ToString(), groupID, null); GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID.ToString(), groupID, null);
if (groupInfo != null) if (groupInfo != null)
@ -279,7 +279,7 @@ namespace OpenSim.Groups
{ {
SendMessageToGroup(im, groupID, UUID.Zero, null); SendMessageToGroup(im, groupID, UUID.Zero, null);
} }
public void SendMessageToGroup( public void SendMessageToGroup(
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
{ {
@ -355,9 +355,9 @@ namespace OpenSim.Groups
{ {
if (!sendCondition(member)) if (!sendCondition(member))
{ {
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat( 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); member.AgentID);
continue; continue;
@ -366,7 +366,7 @@ namespace OpenSim.Groups
else if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID)) else if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID))
{ {
// Don't deliver messages to people who have dropped this session // 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); m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID);
continue; continue;
@ -414,7 +414,7 @@ namespace OpenSim.Groups
"[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", "[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms",
groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick);
} }
#region SimGridEventHandlers #region SimGridEventHandlers
void OnClientLogin(IClientAPI client) void OnClientLogin(IClientAPI client)
@ -445,13 +445,13 @@ namespace OpenSim.Groups
// The instant message module will only deliver messages of dialog types: // The instant message module will only deliver messages of dialog types:
// MessageFromAgent, StartTyping, StopTyping, MessageFromObject // 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 // Instant Message Module
UUID regionID = new UUID(msg.RegionID); UUID regionID = new UUID(msg.RegionID);
if (m_debugEnabled) 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); System.Reflection.MethodBase.GetCurrentMethod().Name, regionID);
DebugGridInstantMessage(msg); 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); m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he has an agent in region of origin", sp.UUID);
return; return;
} }
else else
{ {
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: not skipping agent {0}", sp.UUID); 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; break;
case (byte)InstantMessageDialog.SessionSend: 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. // maybe we should deliver it.
IClientAPI client = GetActiveClient(new UUID(msg.toAgentID)); IClientAPI client = GetActiveClient(new UUID(msg.toAgentID));
if (client != null) if (client != null)
@ -655,7 +655,7 @@ namespace OpenSim.Groups
UUID AgentID = new UUID(im.fromAgentID); UUID AgentID = new UUID(im.fromAgentID);
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null); GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null);
if (groupInfo != null) if (groupInfo != null)
{ {
AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
@ -681,7 +681,7 @@ namespace OpenSim.Groups
UUID GroupID = new UUID(im.imSessionID); UUID GroupID = new UUID(im.imSessionID);
UUID AgentID = new UUID(im.fromAgentID); 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()); 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 //If this agent is sending a message, then they want to be in the session

View File

@ -51,7 +51,7 @@ namespace OpenSim.Groups
private List<Scene> m_sceneList = new List<Scene>(); private List<Scene> m_sceneList = new List<Scene>();
private IMessageTransferModule m_msgTransferModule = null; private IMessageTransferModule m_msgTransferModule = null;
private IGroupsServicesConnector m_groupData = null; private IGroupsServicesConnector m_groupData = null;
private IUserManagement m_UserManagement; private IUserManagement m_UserManagement;
@ -210,7 +210,7 @@ namespace OpenSim.Groups
if (m_debugEnabled) m_log.Debug("[Groups]: Shutting down Groups module."); if (m_debugEnabled) m_log.Debug("[Groups]: Shutting down Groups module.");
} }
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
get { return null; } get { return null; }
} }
@ -318,7 +318,7 @@ namespace OpenSim.Groups
SendAgentGroupDataUpdate(remoteClient, false); 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 // 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 // they do get the group title with the avatar object update on arrivel to a region
} }
@ -453,9 +453,9 @@ namespace OpenSim.Groups
} }
if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message,
hasAttachment, hasAttachment,
(byte)(item == null ? 0 : item.AssetType), (byte)(item == null ? 0 : item.AssetType),
item == null ? null : item.Name, item == null ? null : item.Name,
item == null ? UUID.Zero : item.ID, item == null ? UUID.Zero : item.ID,
item == null ? UUID.Zero.ToString() : item.Owner.ToString())) item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
{ {
@ -463,7 +463,7 @@ namespace OpenSim.Groups
{ {
OnNewGroupNotice(GroupID, NoticeID); OnNewGroupNotice(GroupID, NoticeID);
} }
// Send notice out to everyone that wants notices // Send notice out to everyone that wants notices
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
{ {
@ -497,7 +497,7 @@ namespace OpenSim.Groups
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
string message; string message;
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
giver, notice.noticeData.AttachmentItemID, out message); giver, notice.noticeData.AttachmentItemID, out message);
if (itemCopy == null) if (itemCopy == null)
@ -509,10 +509,10 @@ namespace OpenSim.Groups
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
} }
} }
// Interop, received special 210 code for ejecting a group member // Interop, received special 210 code for ejecting a group member
// this only works within the comms servers domain, and won't work hypergrid // 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, // client actually is, and try contacting that region directly to notify them,
// or provide the notification via xmlrpc update queue // or provide the notification via xmlrpc update queue
if ((im.dialog == 210)) if ((im.dialog == 210))
@ -523,7 +523,7 @@ namespace OpenSim.Groups
UUID ejecteeID = new UUID(im.toAgentID); UUID ejecteeID = new UUID(im.toAgentID);
im.imSessionID = UUID.Zero.Guid; im.imSessionID = UUID.Zero.Guid;
im.dialog = (byte)InstantMessageDialog.MessageFromAgent; im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
OutgoingInstantMessage(im, ejecteeID); OutgoingInstantMessage(im, ejecteeID);
@ -577,7 +577,7 @@ namespace OpenSim.Groups
{ {
return m_groupData.GetGroupRecord(UUID.Zero.ToString(), UUID.Zero, name); return m_groupData.GetGroupRecord(UUID.Zero.ToString(), UUID.Zero, name);
} }
public void ActivateGroup(IClientAPI remoteClient, UUID groupID) public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
{ {
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@ -585,7 +585,7 @@ namespace OpenSim.Groups
m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID); m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID);
// Changing active group changes title, active powers, all kinds of things // 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 group info. At a minimum, they should get ScenePresence
// updated with new title. // updated with new title.
SendAgentGroupDataUpdate(remoteClient, true); SendAgentGroupDataUpdate(remoteClient, true);
@ -620,10 +620,10 @@ namespace OpenSim.Groups
public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
{ {
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat( m_log.DebugFormat(
"[Groups]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); "[Groups]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name);
List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), groupID); List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), groupID);
if (m_debugEnabled) if (m_debugEnabled)
@ -706,7 +706,7 @@ namespace OpenSim.Groups
public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
{ {
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat( m_log.DebugFormat(
"[Groups]: {0} called with groupID={1}, agentID={2}", "[Groups]: {0} called with groupID={1}, agentID={2}",
System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID);
@ -756,7 +756,7 @@ namespace OpenSim.Groups
if (avatar != null) if (avatar != null)
{ {
if (avatar.UserLevel < m_levelGroupCreate) if (avatar.GodController.UserLevel < m_levelGroupCreate)
{ {
remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate)); remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
return UUID.Zero; return UUID.Zero;
@ -776,13 +776,13 @@ namespace OpenSim.Groups
} }
string reason = string.Empty; 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); allowPublish, maturePublish, remoteClient.AgentId, out reason);
if (groupID != UUID.Zero) if (groupID != UUID.Zero)
{ {
if (money != null) if (money != null && money.GroupCreationCharge > 0)
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully"); remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
@ -823,7 +823,7 @@ namespace OpenSim.Groups
if (membership != null) if (membership != null)
{ {
return membership.GroupTitle; return membership.GroupTitle;
} }
return string.Empty; return string.Empty;
} }
@ -839,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 // 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 // the client currently has set active, then we need to do a scene presence update too
// if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
SendDataUpdate(remoteClient, true); SendDataUpdate(remoteClient, true);
} }
@ -899,7 +899,7 @@ namespace OpenSim.Groups
case 1: case 1:
// Remove // Remove
m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentIDStr(remoteClient), memberID.ToString(), groupID, roleID); m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentIDStr(remoteClient), memberID.ToString(), groupID, roleID);
break; break;
default: default:
m_log.ErrorFormat("[Groups]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); m_log.ErrorFormat("[Groups]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes);
@ -979,10 +979,28 @@ namespace OpenSim.Groups
{ {
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 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; 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 (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); remoteClient.SendJoinGroupReply(groupID, true);
@ -1072,7 +1090,7 @@ namespace OpenSim.Groups
// Send Message to Ejectee // Send Message to Ejectee
GridInstantMessage msg = new GridInstantMessage(); GridInstantMessage msg = new GridInstantMessage();
// if local send a normal message // if local send a normal message
if(ejecteeClient != null) if(ejecteeClient != null)
{ {
@ -1324,7 +1342,7 @@ namespace OpenSim.Groups
membershipArray = membershipData.ToArray(); membershipArray = membershipData.ToArray();
} }
} }
if (m_debugEnabled) if (m_debugEnabled)
{ {
m_log.InfoFormat("[Groups]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); 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) if (!m_Enabled)
return; 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); scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
m_Scenes.Add(scene); m_Scenes.Add(scene);
@ -135,7 +135,7 @@ namespace OpenSim.Groups
{ {
m_LocalGroupsConnector = new GroupsServiceLocalConnectorModule(m_Config, m_UserManagement); m_LocalGroupsConnector = new GroupsServiceLocalConnectorModule(m_Config, m_UserManagement);
// Also, if local, create the endpoint for the HGGroupsService // 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>()); scene.RequestModuleInterface<IOfflineIMService>(), scene.RequestModuleInterface<IUserAccountService>());
} }
@ -170,7 +170,7 @@ namespace OpenSim.Groups
if (sp is ScenePresence && ((ScenePresence)sp).PresenceType != PresenceType.Npc) if (sp is ScenePresence && ((ScenePresence)sp).PresenceType != PresenceType.Npc)
{ {
AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); 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) m_OfflineIM != null && m_Messaging != null)
{ {
List<GridInstantMessage> ims = m_OfflineIM.GetMessages(aCircuit.AgentID); List<GridInstantMessage> ims = m_OfflineIM.GetMessages(aCircuit.AgentID);
@ -184,12 +184,12 @@ namespace OpenSim.Groups
#region IGroupsServicesConnector #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) bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
if (m_UserManagement.IsLocalGridUser(RequestingAgentID)) 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); membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason);
else 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) bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
string url = string.Empty; string url = string.Empty;
string name = string.Empty; string name = string.Empty;
if (IsLocal(groupID, out url, out name)) 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); openEnrollment, allowPublish, maturePublish, out reason);
else else
{ {
@ -374,7 +374,7 @@ namespace OpenSim.Groups
} }
} }
return new List<GroupRoleMembersData>(); return new List<GroupRoleMembersData>();
} }
@ -626,7 +626,7 @@ namespace OpenSim.Groups
} }
if (agent != null) if (agent != null)
return Util.ProduceUserUniversalIdentifier(agent); return Util.ProduceUserUniversalIdentifier(agent);
// we don't know anything about this foreign user // we don't know anything about this foreign user
// try asking the user management module, which may know more // try asking the user management module, which may know more
return m_UserManagement.GetUserUUI(AgentID); return m_UserManagement.GetUserUUI(AgentID);
@ -664,7 +664,7 @@ namespace OpenSim.Groups
string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty; 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)) if (Util.ParseUniversalUserIdentifier(uID, out userID, out url, out first, out last, out tmp))
m_UserManagement.AddUser(userID, first, last, url); m_UserManagement.AddUser(userID, first, last, url);
return userID; return userID;
} }

View File

@ -64,8 +64,8 @@ namespace OpenSim.Groups
m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName); m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName);
string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty); new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty);
if (homeURI == string.Empty) if (homeURI == string.Empty)
throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName)); throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName));

View File

@ -34,9 +34,9 @@ namespace OpenSim.Groups
{ {
public interface IGroupsServicesConnector 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 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); bool openEnrollment, bool allowPublish, bool maturePublish, out string reason);
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName); ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName);
List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search); List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search);
@ -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. /// If the user is a member of the group then the data structure is returned. If not, then null is returned.
/// </returns> /// </returns>
ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID); ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID);
/// <summary> /// <summary>
/// Get information about the groups to which a user belongs. /// Get information about the groups to which a user belongs.
/// </summary> /// </summary>
@ -87,7 +87,7 @@ namespace OpenSim.Groups
/// </returns> /// </returns>
List<GroupMembershipData> GetAgentGroupMemberships(string RequestingAgentID, string AgentID); 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); bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID);
GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID); GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID);
List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID); List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID);

View File

@ -108,7 +108,7 @@ namespace OpenSim.Groups
if (!m_Enabled) if (!m_Enabled)
return; 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); scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
m_Scenes.Add(scene); m_Scenes.Add(scene);
} }
@ -146,16 +146,16 @@ namespace OpenSim.Groups
#region IGroupsServicesConnector #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) bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{ {
m_log.DebugFormat("[Groups]: Creating group {0}", name); m_log.DebugFormat("[Groups]: Creating group {0}", name);
reason = string.Empty; 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); 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) bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
@ -296,7 +296,7 @@ namespace OpenSim.Groups
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) 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); hasAttachment, attType, attName, attItemID, attOwnerID);
} }

View File

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

View File

@ -41,7 +41,7 @@ using Nini.Config;
namespace OpenSim.Groups namespace OpenSim.Groups
{ {
public class GroupsServiceRemoteConnector public class GroupsServiceRemoteConnector
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 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())); m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
} }

View File

@ -113,7 +113,7 @@ namespace OpenSim.Groups
if (!m_Enabled) if (!m_Enabled)
return; 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); scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
m_Scenes.Add(scene); m_Scenes.Add(scene);
} }
@ -151,7 +151,7 @@ namespace OpenSim.Groups
#region IGroupsServicesConnector #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) bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{ {
m_log.DebugFormat("[Groups.RemoteConnector]: Creating group {0}", name); m_log.DebugFormat("[Groups.RemoteConnector]: Creating group {0}", name);
@ -167,7 +167,7 @@ namespace OpenSim.Groups
return groupID; 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) bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
{ {
string r = string.Empty; string r = string.Empty;
@ -186,9 +186,9 @@ namespace OpenSim.Groups
if (GroupID == UUID.Zero && (GroupName == null || GroupName != null && GroupName == string.Empty)) if (GroupID == UUID.Zero && (GroupName == null || GroupName != null && GroupName == string.Empty))
return null; return null;
return m_CacheWrapper.GetGroupRecord(RequestingAgentID,GroupID,GroupName, delegate return m_CacheWrapper.GetGroupRecord(RequestingAgentID,GroupID,GroupName, delegate
{ {
return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName); return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName);
}); });
} }
@ -362,7 +362,7 @@ namespace OpenSim.Groups
m_GroupsService.RemoveAgentToGroupInvite(RequestingAgentID, inviteID); 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) bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
{ {
GroupNoticeInfo notice = new GroupNoticeInfo(); GroupNoticeInfo notice = new GroupNoticeInfo();

View File

@ -286,7 +286,7 @@ namespace OpenSim.Groups
string requestingAgentID = request["RequestingAgentID"].ToString(); string requestingAgentID = request["RequestingAgentID"].ToString();
if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID)) if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
NullResult(result, string.Format("Insufficient permissions.", agentID)); NullResult(result, string.Format("Insufficient permissions. {0}", agentID));
else else
result["RESULT"] = "true"; result["RESULT"] = "true";
} }
@ -393,7 +393,7 @@ namespace OpenSim.Groups
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("RoleID") || if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("RoleID") ||
!request.ContainsKey("Name") || !request.ContainsKey("Description") || !request.ContainsKey("Title") || !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"); NullResult(result, "Bad network data");
else else
@ -519,11 +519,11 @@ namespace OpenSim.Groups
bool success = false; bool success = false;
if (op == "ADD") 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())); new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()));
else if (op == "DELETE") 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())); new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()));
result["RESULT"] = success.ToString(); result["RESULT"] = success.ToString();
@ -647,8 +647,8 @@ namespace OpenSim.Groups
string op = request["OP"].ToString(); string op = request["OP"].ToString();
if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID")) 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["InviteID"].ToString()), new UUID(request["GroupID"].ToString()),
new UUID(request["RoleID"].ToString()), request["AgentID"].ToString()); new UUID(request["RoleID"].ToString()), request["AgentID"].ToString());
@ -664,7 +664,7 @@ namespace OpenSim.Groups
} }
else if (op == "GET") 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())); new UUID(request["InviteID"].ToString()));
if (invite != null) if (invite != null)

View File

@ -126,7 +126,7 @@ namespace OpenSim.Groups
#endregion #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) bool allowPublish, bool maturePublish, UUID founderID, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
@ -264,7 +264,7 @@ namespace OpenSim.Groups
if (ownerRole != null) if (ownerRole != null)
ownerRoleID = ownerRole.RoleID; ownerRoleID = ownerRole.RoleID;
// Check visibility? // Check visibility?
// When we don't want to check visibility, we pass it "all" as the requestingAgentID // When we don't want to check visibility, we pass it "all" as the requestingAgentID
bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString()); bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
@ -307,20 +307,20 @@ namespace OpenSim.Groups
m.Contribution = Int32.Parse(d.Data["Contribution"]); m.Contribution = Int32.Parse(d.Data["Contribution"]);
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false; m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
GridUserData gud = m_GridUserService.Get(d.PrincipalID); GridUserData gud = m_GridUserService.Get(d.PrincipalID);
if (gud != null) if (gud != null)
{ {
if (bool.Parse(gud.Data["Online"])) if (bool.Parse(gud.Data["Online"]))
{ {
m.OnlineStatus = @"Online"; m.OnlineStatus = @"Online";
} }
else else
{ {
int unixtime = int.Parse(gud.Data["Login"]); 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! // 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"); m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
} }
} }
// Is this person an owner of the group? // Is this person an owner of the group?
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false; m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
@ -496,7 +496,7 @@ namespace OpenSim.Groups
if (!unlimited && limited) if (!unlimited && limited)
{ {
// check whether person's has this role // check whether person's has this role
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
if (rolemembership == null) if (rolemembership == null)
{ {
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID); m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
@ -516,13 +516,26 @@ namespace OpenSim.Groups
return false; return false;
// check permissions // 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 (!unlimited) if (!limited && !unlimited)
{ {
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID); m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
return false; 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); RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
if (rolemember == null) if (rolemember == null)
@ -540,8 +553,8 @@ namespace OpenSim.Groups
{ {
newRoleID = r.RoleID; newRoleID = r.RoleID;
break; break;
} }
} }
MembershipData member = m_Database.RetrieveMember(GroupID, AgentID); MembershipData member = m_Database.RetrieveMember(GroupID, AgentID);
if (member != null) if (member != null)
@ -699,7 +712,7 @@ namespace OpenSim.Groups
m_Database.StoreMember(membership); 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) bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
{ {
// Check perms // Check perms
@ -812,7 +825,7 @@ namespace OpenSim.Groups
if (RoleID != UUID.Zero) if (RoleID != UUID.Zero)
_AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
// Make thit this active group // Make this the active group
PrincipalData pdata = new PrincipalData(); PrincipalData pdata = new PrincipalData();
pdata.PrincipalID = AgentID; pdata.PrincipalID = AgentID;
pdata.ActiveGroupID = GroupID; pdata.ActiveGroupID = GroupID;

View File

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

View File

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

View File

@ -77,7 +77,7 @@ namespace OpenSim.OfflineIM
break; 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())); 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>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["UserID"] = userID; sendData["UserID"] = userID;
MakeRequest("DELETE", sendData); MakeRequest("DELETE", sendData);
} }

View File

@ -90,7 +90,7 @@ namespace OpenSim.OfflineIM
public bool StoreMessage(GridInstantMessage im, out string reason) public bool StoreMessage(GridInstantMessage im, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
// Check limits // Check limits
UUID principalID = new UUID(im.toAgentID); UUID principalID = new UUID(im.toAgentID);
long count = m_Database.GetCount("PrincipalID", principalID.ToString()); long count = m_Database.GetCount("PrincipalID", principalID.ToString());

View File

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

View File

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

View File

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

View File

@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
} }
#region IApplicationPlugin implementation #region IApplicationPlugin implementation
public void Initialise (OpenSimBase openSim) public void Initialise (OpenSimBase openSim)
{ {
m_openSim = openSim; m_openSim = openSim;
@ -111,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[REGIONMODULES]: From plugin {0}, (version {1}), loaded {2} modules, {3} shared, {4} non-shared {5} unknown", "[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.Key.Version,
loadedModuleData.Value[0] + loadedModuleData.Value[1] + loadedModuleData.Value[2], loadedModuleData.Value[0] + loadedModuleData.Value[1] + loadedModuleData.Value[2],
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 #region Region Module interfacesController implementation
/// <summary> /// <summary>
/// Check that the given module is no disabled in the [Modules] section of the config files. /// Check that the given module is no disabled in the [Modules] section of the config files.
/// </summary> /// </summary>
@ -293,10 +293,10 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
if (className != String.Empty && if (className != String.Empty &&
node.Type.ToString() != className) node.Type.ToString() != className)
return false; return false;
} }
return true; return true;
} }
// The root of all evil. // The root of all evil.
// This is where we handle adding the modules to scenes when they // 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 System.Runtime.InteropServices;
using Mono.Addins; 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 // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RemoteController")] [assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RemoteController")]
@ -15,8 +15,8 @@ using Mono.Addins;
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // 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 // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
@ -26,7 +26,7 @@ using Mono.Addins;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //

View File

@ -575,7 +575,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
} }
responseData["success"] = true; responseData["success"] = true;
m_log.Info("[RADMIN]: Shutdown Administrator Request complete"); m_log.Info("[RADMIN]: Shutdown Administrator Request complete");
} }
@ -747,9 +747,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
// No INI setting recorded. // No INI setting recorded.
} }
string regionIniPath; string regionIniPath;
if (requestData.Contains("region_file")) if (requestData.Contains("region_file"))
{ {
// Make sure that the file to be created is in a subdirectory of the region storage directory. // Make sure that the file to be created is in a subdirectory of the region storage directory.
@ -773,7 +773,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
region.RegionName.Replace(" ", "_").Replace(":", "_"). region.RegionName.Replace(" ", "_").Replace(":", "_").
Replace("/", "_"))); Replace("/", "_")));
} }
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionIniPath); region.RegionID, regionIniPath);
region.SaveRegionToFile("dynamic region", regionIniPath); region.SaveRegionToFile("dynamic region", regionIniPath);
@ -782,9 +782,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
region.Persistent = false; region.Persistent = false;
} }
// Set the estate // Set the estate
// Check for an existing estate // Check for an existing estate
List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]); List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]);
if (estateIDs.Count < 1) if (estateIDs.Count < 1)
@ -795,12 +795,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// ok, client wants us to use an explicit UUID // ok, client wants us to use an explicit UUID
// regardless of what the avatar name provided // regardless of what the avatar name provided
userID = new UUID((string) requestData["estate_owner_uuid"]); userID = new UUID((string) requestData["estate_owner_uuid"]);
// Check that the specified user exists // Check that the specified user exists
Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene; Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
IUserAccountService accountService = currentOrFirst.UserAccountService; IUserAccountService accountService = currentOrFirst.UserAccountService;
UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, userID); UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, userID);
if (user == null) if (user == null)
throw new Exception("Specified user was not found."); throw new Exception("Specified user was not found.");
} }
@ -809,23 +809,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// We need to look up the UUID for the avatar with the provided name. // We need to look up the UUID for the avatar with the provided name.
string ownerFirst = (string) requestData["estate_owner_first"]; string ownerFirst = (string) requestData["estate_owner_first"];
string ownerLast = (string) requestData["estate_owner_last"]; string ownerLast = (string) requestData["estate_owner_last"];
Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene; Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
IUserAccountService accountService = currentOrFirst.UserAccountService; IUserAccountService accountService = currentOrFirst.UserAccountService;
UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID,
ownerFirst, ownerLast); ownerFirst, ownerLast);
// Check that the specified user exists // Check that the specified user exists
if (user == null) if (user == null)
throw new Exception("Specified user was not found."); throw new Exception("Specified user was not found.");
userID = user.PrincipalID; userID = user.PrincipalID;
} }
else else
{ {
throw new Exception("Estate owner details not provided."); throw new Exception("Estate owner details not provided.");
} }
// Create a new estate with the name provided // Create a new estate with the name provided
region.EstateSettings = m_application.EstateDataService.CreateNewEstate(); region.EstateSettings = m_application.EstateDataService.CreateNewEstate();
@ -852,7 +852,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
throw new Exception("Failed to join estate."); throw new Exception("Failed to join estate.");
} }
} }
// Create the region and perform any initial initialization // Create the region and perform any initial initialization
IScene newScene; IScene newScene;
@ -1159,7 +1159,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set home position // Set home position
GridRegion home = scene.GridService.GetRegionByPosition(scopeID, GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
(int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation)); (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation));
if (null == home) if (null == home)
{ {
@ -1389,7 +1389,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if ((null != regionXLocation) && (null != regionYLocation)) 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)); (int)Util.RegionToWorldLoc((uint)regionXLocation), (int)Util.RegionToWorldLoc((uint)regionYLocation));
if (null == home) { if (null == home) {
m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName); m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName);
@ -1416,7 +1416,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
throw e; throw e;
} }
m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
} }
} }
@ -1608,7 +1608,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
GetSceneFromRegionParams(requestData, responseData, out scene); GetSceneFromRegionParams(requestData, responseData, out scene);
string filename = (string) requestData["filename"]; string filename = (string) requestData["filename"];
bool mergeOar = false; bool mergeOar = false;
bool skipAssets = false; bool skipAssets = false;
@ -1735,7 +1735,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted;
m_log.InfoFormat( 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); scene.Name, filename, requestId);
archiver.ArchiveRegion(filename, requestId, options); archiver.ArchiveRegion(filename, requestId, options);
@ -2082,8 +2082,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable responseData = (Hashtable)response.Value; Hashtable responseData = (Hashtable)response.Value;
// Hashtable requestData = (Hashtable)request.Params[0]; // Hashtable requestData = (Hashtable)request.Params[0];
m_application.SceneManager.ForEachScene(s => m_application.SceneManager.ForEachScene(s =>
s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false) s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false)
); );
responseData["success"] = true; responseData["success"] = true;
@ -2815,7 +2815,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (destinationFolder.Type != (short)FolderType.Clothing) if (destinationFolder.Type != (short)FolderType.Clothing)
{ {
destinationFolder = new InventoryFolderBase(); destinationFolder = new InventoryFolderBase();
destinationFolder.ID = UUID.Random(); destinationFolder.ID = UUID.Random();
destinationFolder.Name = "Clothing"; destinationFolder.Name = "Clothing";
destinationFolder.Owner = destination; destinationFolder.Owner = destination;
@ -2951,11 +2951,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
sourceFolder = new InventoryFolderBase(); sourceFolder = new InventoryFolderBase();
sourceFolder.ID = UUID.Random(); sourceFolder.ID = UUID.Random();
if (assetType == FolderType.Clothing) if (assetType == FolderType.Clothing)
{ {
sourceFolder.Name = "Clothing"; sourceFolder.Name = "Clothing";
} }
else else
{ {
sourceFolder.Name = "Body Parts"; sourceFolder.Name = "Body Parts";
} }
@ -3053,11 +3053,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
{ {
uint perms = item.CurrentPermissions; if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms); item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
item.CurrentPermissions = perms; if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
} }
item.CurrentPermissions &= item.NextPermissions; item.CurrentPermissions &= item.NextPermissions;
item.BasePermissions &= item.NextPermissions; item.BasePermissions &= item.NextPermissions;
item.EveryOnePermissions &= item.NextPermissions; item.EveryOnePermissions &= item.NextPermissions;
@ -3168,7 +3170,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set home position // Set home position
GridRegion home = scene.GridService.GetRegionByPosition(scopeID, GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
(int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation)); (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation));
if (null == home) { if (null == home) {
m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]); m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]);

View File

@ -64,7 +64,7 @@ namespace OpenSim.Framework.Capabilities
private CapsHandlers m_capsHandlers; private CapsHandlers m_capsHandlers;
private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
= new Dictionary<string, PollServiceEventArgs>(); = new Dictionary<string, PollServiceEventArgs>();
private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>(); private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
@ -136,11 +136,16 @@ namespace OpenSim.Framework.Capabilities
} }
m_agentID = agent; m_agentID = agent;
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort);
m_regionName = regionName; m_regionName = regionName;
m_capsActive.Reset(); m_capsActive.Reset();
} }
~Caps()
{
m_capsActive.Dispose();
}
/// <summary> /// <summary>
/// Register a handler. This allows modules to register handlers. /// Register a handler. This allows modules to register handlers.
/// </summary> /// </summary>
@ -155,7 +160,7 @@ namespace OpenSim.Framework.Capabilities
public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler) public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
{ {
// m_log.DebugFormat( // 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); // capName, pollServiceHandler.Url, m_agentID, m_regionName);
m_pollServiceHandlers.Add(capName, pollServiceHandler); m_pollServiceHandlers.Add(capName, pollServiceHandler);
@ -165,7 +170,7 @@ namespace OpenSim.Framework.Capabilities
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; // uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
// string protocol = "http"; // string protocol = "http";
// string hostName = m_httpListenerHostName; // string hostName = m_httpListenerHostName;
// //
// if (MainServer.Instance.UseSSL) // if (MainServer.Instance.UseSSL)
// { // {
// hostName = MainServer.Instance.SSLCommonName; // hostName = MainServer.Instance.SSLCommonName;
@ -233,7 +238,7 @@ namespace OpenSim.Framework.Capabilities
string hostName = m_httpListenerHostName; string hostName = m_httpListenerHostName;
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
string protocol = "http"; string protocol = "http";
if (MainServer.Instance.UseSSL) if (MainServer.Instance.UseSSL)
{ {
hostName = MainServer.Instance.SSLCommonName; hostName = MainServer.Instance.SSLCommonName;

View File

@ -53,31 +53,15 @@ namespace OpenSim.Framework.Capabilities
/// <param name="httpListener">base HTTP server</param> /// <param name="httpListener">base HTTP server</param>
/// <param name="httpListenerHostname">host name of the HTTP server</param> /// <param name="httpListenerHostname">host name of the HTTP server</param>
/// <param name="httpListenerPort">HTTP port</param> /// <param name="httpListenerPort">HTTP port</param>
public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort) public CapsHandlers(IHttpServer 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_httpListener = httpListener;
m_httpListenerHostName = httpListenerHostname; m_httpListenerHostName = httpListenerHostname;
m_httpListenerPort = httpListenerPort; m_httpListenerPort = httpListenerPort;
m_useSSL = https; if (httpListener != null && httpListener.UseSSL)
if (httpListener != null && m_useSSL) m_useSSL = true;
{ else
m_httpListenerHostName = httpListener.SSLCommonName; m_useSSL = false;
m_httpListenerPort = httpListener.SSLPort;
}
} }
/// <summary> /// <summary>
@ -128,9 +112,9 @@ namespace OpenSim.Framework.Capabilities
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path); m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
m_capsHandlers.Remove(idx); m_capsHandlers.Remove(idx);
} }
if (null == value) return; if (null == value) return;
m_capsHandlers[idx] = value; m_capsHandlers[idx] = value;
m_httpListener.AddStreamHandler(value); m_httpListener.AddStreamHandler(value);
} }
@ -163,7 +147,7 @@ namespace OpenSim.Framework.Capabilities
{ {
Hashtable caps = new Hashtable(); Hashtable caps = new Hashtable();
string protocol = "http://"; string protocol = "http://";
if (m_useSSL) if (m_useSSL)
protocol = "https://"; protocol = "https://";

View File

@ -74,7 +74,7 @@ namespace OpenSim.Capabilities.Handlers
int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize)); int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber)); int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
// Full content request // Full content request
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
//httpResponse.ContentLength = ??; //httpResponse.ContentLength = ??;

View File

@ -43,7 +43,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers namespace OpenSim.Capabilities.Handlers
{ {
public class FetchInvDescHandler public class FetchInvDescHandler
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -53,14 +53,14 @@ namespace OpenSim.Capabilities.Handlers
private IScene m_Scene; private IScene m_Scene;
// private object m_fetchLock = new Object(); // private object m_fetchLock = new Object();
public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s) public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s)
{ {
m_InventoryService = invService; m_InventoryService = invService;
m_LibraryService = libService; m_LibraryService = libService;
m_Scene = s; m_Scene = s;
} }
public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
//m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request); //m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);
@ -72,14 +72,14 @@ namespace OpenSim.Capabilities.Handlers
// correctly mark it as a uuid // correctly mark it as a uuid
// //
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
// another hack <integer>1</integer> results in a // another hack <integer>1</integer> results in a
// System.ArgumentException: Object type System.Int32 cannot // System.ArgumentException: Object type System.Int32 cannot
// be converted to target type: System.Boolean // be converted to target type: System.Boolean
// //
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
try try
{ {
@ -90,9 +90,9 @@ namespace OpenSim.Capabilities.Handlers
m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace); m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
m_log.Error("Request: " + request); m_log.Error("Request: " + request);
} }
ArrayList foldersrequested = (ArrayList)hash["folders"]; ArrayList foldersrequested = (ArrayList)hash["folders"];
string response = ""; string response = "";
string bad_folders_response = ""; string bad_folders_response = "";
@ -516,7 +516,7 @@ from docs seems this was never a spec
// } // }
// } // }
// } // }
// //
// foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) // foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
// { // {
// m_log.DebugFormat( // m_log.DebugFormat(

View File

@ -80,7 +80,7 @@ namespace OpenSim.Capabilities.Handlers
{ {
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated // 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."); m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
items = new InventoryItemBase[itemsRequested.Count]; items = new InventoryItemBase[itemsRequested.Count];
foreach (UUID id in itemIDs) foreach (UUID id in itemIDs)
items[i++] = m_inventoryService.GetItem(m_agentID, id); items[i++] = m_inventoryService.GetItem(m_agentID, id);
} }

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>"; string request = "<llsd><map><key>items</key><array><map><key>item_id</key><uuid>";
request += "10000000-0000-0000-0000-000000000001"; // Notecard 1 request += "10000000-0000-0000-0000-000000000001"; // Notecard 1
request += "</uuid></map></array></map></llsd>"; request += "</uuid></map></array></map></llsd>";
string llsdresponse = handler.FetchInventoryRequest(request, "/FETCH", string.Empty, req, resp); string llsdresponse = handler.FetchInventoryRequest(request, "/FETCH", string.Empty, req, resp);
Assert.That(llsdresponse != null, Is.True, "Incorrect null response"); Assert.That(llsdresponse != null, Is.True, "Incorrect null response");

View File

@ -140,7 +140,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
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>"; 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 += m_rootFolderID;
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</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 = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp); string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
Assert.That(llsdresponse != null, Is.True, "Incorrect null response"); Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
@ -203,7 +203,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
// Make sure that the note card link is included // Make sure that the note card link is included
Assert.That(llsdresponse.Contains("Link to notecard"), Is.True, "Link to notecard is missing"); Assert.That(llsdresponse.Contains("Link to notecard"), Is.True, "Link to notecard is missing");
//Make sure the notecard item itself is included //Make sure the notecard item itself is included
Assert.That(llsdresponse.Contains("Test Notecard 2"), Is.True, "Notecard 2 item (the source) is missing"); Assert.That(llsdresponse.Contains("Test Notecard 2"), Is.True, "Notecard 2 item (the source) is missing");

View File

@ -87,12 +87,12 @@ namespace OpenSim.Capabilities.Handlers
OSDMap osdname = new OSDMap(); OSDMap osdname = new OSDMap();
if(parts[0] == "Unknown") if(parts[0] == "Unknown")
{ {
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1)); osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2)); osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
} }
else else
{ {
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
} }
osdname["display_name"] = OSD.FromString(kvp.Value); osdname["display_name"] = OSD.FromString(kvp.Value);

View File

@ -61,7 +61,7 @@ namespace OpenSim.Capabilities.Handlers
if (m_UserManagement == null) if (m_UserManagement == null)
throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName)); throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
server.AddStreamHandler( server.AddStreamHandler(
new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null)); new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
} }

View File

@ -55,7 +55,7 @@ namespace OpenSim.Capabilities.Handlers
private IAssetService m_assetService; private IAssetService m_assetService;
public const string DefaultFormat = "x-j2c"; public const string DefaultFormat = "x-j2c";
public GetTextureHandler(IAssetService assService) public GetTextureHandler(IAssetService assService)
{ {
m_assetService = assService; m_assetService = assService;
@ -83,7 +83,7 @@ namespace OpenSim.Capabilities.Handlers
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
{ {
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID); // m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
string[] formats; string[] formats;
if (!string.IsNullOrEmpty(format)) if (!string.IsNullOrEmpty(format))
{ {
@ -129,7 +129,7 @@ namespace OpenSim.Capabilities.Handlers
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="httpRequest"></param> /// <param name="httpRequest"></param>
/// <param name="httpResponse"></param> /// <param name="httpResponse"></param>
@ -190,7 +190,7 @@ namespace OpenSim.Capabilities.Handlers
//response = new Hashtable(); //response = new Hashtable();
//WriteTextureData(request,response,null,format); //WriteTextureData(request,response,null,format);
// not found // not found
//m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); //m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
@ -287,7 +287,7 @@ namespace OpenSim.Capabilities.Handlers
response["content_type"] = texture.Metadata.ContentType; response["content_type"] = texture.Metadata.ContentType;
else else
response["content_type"] = "image/" + format; response["content_type"] = "image/" + format;
response["bin_response_data"] = texture.Data; response["bin_response_data"] = texture.Data;
response["int_bytes"] = texture.Data.Length; response["int_bytes"] = texture.Data.Length;
@ -400,7 +400,7 @@ namespace OpenSim.Capabilities.Handlers
if (image != null) if (image != null)
image.Dispose(); image.Dispose();
if(managedImage != null) if(managedImage != null)
managedImage.Clear(); managedImage.Clear();
if (imgstream != null) if (imgstream != null)

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -44,7 +44,7 @@ using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps; using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers namespace OpenSim.Capabilities.Handlers
{ {
public class GetTextureRobustHandler : BaseStreamHandler public class GetTextureRobustHandler : BaseStreamHandler
@ -52,9 +52,9 @@ namespace OpenSim.Capabilities.Handlers
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IAssetService m_assetService; private IAssetService m_assetService;
public const string DefaultFormat = "x-j2c"; public const string DefaultFormat = "x-j2c";
// TODO: Change this to a config option // TODO: Change this to a config option
private string m_RedirectURL = null; private string m_RedirectURL = null;
@ -66,27 +66,28 @@ namespace OpenSim.Capabilities.Handlers
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/")) if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
m_RedirectURL += "/"; m_RedirectURL += "/";
} }
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
// Try to parse the texture ID from the request URL // Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
string textureStr = query.GetOne("texture_id"); string textureStr = query.GetOne("texture_id");
string format = query.GetOne("format"); string format = query.GetOne("format");
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr); //m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
if (m_assetService == null) if (m_assetService == null)
{ {
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return null;
} }
UUID textureID; UUID textureID;
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
{ {
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID); // m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
string[] formats; string[] formats;
if (!string.IsNullOrEmpty(format)) if (!string.IsNullOrEmpty(format))
{ {
@ -97,10 +98,10 @@ namespace OpenSim.Capabilities.Handlers
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept")); formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
if (formats.Length == 0) if (formats.Length == 0)
formats = new string[1] { DefaultFormat }; // default formats = new string[1] { DefaultFormat }; // default
} }
// OK, we have an array with preferred formats, possibly with only one entry // OK, we have an array with preferred formats, possibly with only one entry
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
foreach (string f in formats) foreach (string f in formats)
{ {
@ -112,14 +113,14 @@ namespace OpenSim.Capabilities.Handlers
{ {
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url); m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
} }
// m_log.DebugFormat( // m_log.DebugFormat(
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}", // "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
// textureID, httpResponse.StatusCode, httpResponse.ContentLength); // textureID, httpResponse.StatusCode, httpResponse.ContentLength);
return null; return null;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -132,16 +133,16 @@ namespace OpenSim.Capabilities.Handlers
{ {
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format); // m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
AssetBase texture; AssetBase texture;
string fullID = textureID.ToString(); string fullID = textureID.ToString();
if (format != DefaultFormat) if (format != DefaultFormat)
fullID = fullID + "-" + format; fullID = fullID + "-" + format;
if (!String.IsNullOrEmpty(m_RedirectURL)) if (!String.IsNullOrEmpty(m_RedirectURL))
{ {
// Only try to fetch locally cached textures. Misses are redirected // Only try to fetch locally cached textures. Misses are redirected
texture = m_assetService.GetCached(fullID); texture = m_assetService.GetCached(fullID);
if (texture != null) if (texture != null)
{ {
if (texture.Type != (sbyte)AssetType.Texture) if (texture.Type != (sbyte)AssetType.Texture)
@ -150,6 +151,7 @@ namespace OpenSim.Capabilities.Handlers
return true; return true;
} }
WriteTextureData(httpRequest, httpResponse, texture, format); WriteTextureData(httpRequest, httpResponse, texture, format);
return true;
} }
else else
{ {
@ -164,14 +166,14 @@ namespace OpenSim.Capabilities.Handlers
{ {
// try the cache // try the cache
texture = m_assetService.GetCached(fullID); texture = m_assetService.GetCached(fullID);
if (texture == null) if (texture == null)
{ {
// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache"); // m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
// Fetch locally or remotely. Misses return a 404 // Fetch locally or remotely. Misses return a 404
texture = m_assetService.Get(textureID.ToString()); texture = m_assetService.Get(textureID.ToString());
if (texture != null) if (texture != null)
{ {
if (texture.Type != (sbyte)AssetType.Texture) if (texture.Type != (sbyte)AssetType.Texture)
@ -190,7 +192,7 @@ namespace OpenSim.Capabilities.Handlers
newTexture.Data = ConvertTextureData(texture, format); newTexture.Data = ConvertTextureData(texture, format);
if (newTexture.Data.Length == 0) if (newTexture.Data.Length == 0)
return false; // !!! Caller try another codec, please! return false; // !!! Caller try another codec, please!
newTexture.Flags = AssetFlags.Collectable; newTexture.Flags = AssetFlags.Collectable;
newTexture.Temporary = true; newTexture.Temporary = true;
newTexture.Local = true; newTexture.Local = true;
@ -207,17 +209,17 @@ namespace OpenSim.Capabilities.Handlers
return true; return true;
} }
} }
// not found // 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; httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return true; return true;
} }
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format) private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
{ {
string range = request.Headers.GetOne("Range"); string range = request.Headers.GetOne("Range");
if (!String.IsNullOrEmpty(range)) // JP2's only if (!String.IsNullOrEmpty(range)) // JP2's only
{ {
// Range request // Range request
@ -231,7 +233,7 @@ namespace OpenSim.Capabilities.Handlers
// m_log.DebugFormat( // m_log.DebugFormat(
// "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}", // "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}",
// texture.ID, start, texture.Data.Length); // texture.ID, start, texture.Data.Length);
// Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back // 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 // 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 // of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously
@ -242,7 +244,7 @@ namespace OpenSim.Capabilities.Handlers
// level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable // 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 // 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. // However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; // response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length)); // response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length));
// response.StatusCode = (int)System.Net.HttpStatusCode.OK; // response.StatusCode = (int)System.Net.HttpStatusCode.OK;
@ -255,13 +257,13 @@ namespace OpenSim.Capabilities.Handlers
// the rest of the entity. // the rest of the entity.
if (end == -1) if (end == -1)
end = int.MaxValue; end = int.MaxValue;
end = Utils.Clamp(end, 0, texture.Data.Length - 1); end = Utils.Clamp(end, 0, texture.Data.Length - 1);
start = Utils.Clamp(start, 0, end); start = Utils.Clamp(start, 0, end);
int len = end - start + 1; int len = end - start + 1;
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); // m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
// Always return PartialContent, even if the range covered the entire data length // Always return PartialContent, even if the range covered the entire data length
// We were accidentally sending back 404 before in this situation // 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 // https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
@ -273,11 +275,11 @@ namespace OpenSim.Capabilities.Handlers
// response.StatusCode = (int)System.Net.HttpStatusCode.OK; // response.StatusCode = (int)System.Net.HttpStatusCode.OK;
// else // else
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
response.ContentLength = len; response.ContentLength = len;
response.ContentType = texture.Metadata.ContentType; response.ContentType = texture.Metadata.ContentType;
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length)); response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
response.Body.Write(texture.Data, start, len); response.Body.Write(texture.Data, start, len);
} }
} }
@ -298,7 +300,7 @@ namespace OpenSim.Capabilities.Handlers
response.ContentType = "image/" + format; response.ContentType = "image/" + format;
response.Body.Write(texture.Data, 0, texture.Data.Length); response.Body.Write(texture.Data, 0, texture.Data.Length);
} }
// if (response.StatusCode < 200 || response.StatusCode > 299) // if (response.StatusCode < 200 || response.StatusCode > 299)
// m_log.WarnFormat( // m_log.WarnFormat(
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", // "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
@ -308,7 +310,7 @@ namespace OpenSim.Capabilities.Handlers
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})", // "[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); // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
} }
/// <summary> /// <summary>
/// Parse a range header. /// Parse a range header.
/// </summary> /// </summary>
@ -325,18 +327,18 @@ namespace OpenSim.Capabilities.Handlers
private bool TryParseRange(string header, out int start, out int end) private bool TryParseRange(string header, out int start, out int end)
{ {
start = end = 0; start = end = 0;
if (header.StartsWith("bytes=")) if (header.StartsWith("bytes="))
{ {
string[] rangeValues = header.Substring(6).Split('-'); string[] rangeValues = header.Substring(6).Split('-');
if (rangeValues.Length == 2) if (rangeValues.Length == 2)
{ {
if (!Int32.TryParse(rangeValues[0], out start)) if (!Int32.TryParse(rangeValues[0], out start))
return false; return false;
string rawEnd = rangeValues[1]; string rawEnd = rangeValues[1];
if (rawEnd == "") if (rawEnd == "")
{ {
end = -1; end = -1;
@ -348,27 +350,27 @@ namespace OpenSim.Capabilities.Handlers
} }
} }
} }
start = end = 0; start = end = 0;
return false; return false;
} }
private byte[] ConvertTextureData(AssetBase texture, string format) private byte[] ConvertTextureData(AssetBase texture, string format)
{ {
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format); m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
byte[] data = new byte[0]; byte[] data = new byte[0];
MemoryStream imgstream = new MemoryStream(); MemoryStream imgstream = new MemoryStream();
Bitmap mTexture = null; Bitmap mTexture = null;
ManagedImage managedImage = null; ManagedImage managedImage = null;
Image image = null; Image image = null;
try try
{ {
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
imgstream = new MemoryStream(); imgstream = new MemoryStream();
// Decode image to System.Drawing.Image // Decode image to System.Drawing.Image
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null) if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
{ {
@ -378,7 +380,7 @@ namespace OpenSim.Capabilities.Handlers
using(EncoderParameters myEncoderParameters = new EncoderParameters()) using(EncoderParameters myEncoderParameters = new EncoderParameters())
{ {
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L); myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
// Save bitmap to stream // Save bitmap to stream
ImageCodecInfo codec = GetEncoderInfo("image/" + format); ImageCodecInfo codec = GetEncoderInfo("image/" + format);
if (codec != null) if (codec != null)
@ -402,10 +404,10 @@ namespace OpenSim.Capabilities.Handlers
// If we encountered an exception, one or more of these will be null // If we encountered an exception, one or more of these will be null
if (mTexture != null) if (mTexture != null)
mTexture.Dispose(); mTexture.Dispose();
if (image != null) if (image != null)
image.Dispose(); image.Dispose();
if(managedImage != null) if(managedImage != null)
managedImage.Clear(); managedImage.Clear();
@ -415,10 +417,10 @@ namespace OpenSim.Capabilities.Handlers
imgstream.Dispose(); imgstream.Dispose();
} }
} }
return data; return data;
} }
// From msdn // From msdn
private static ImageCodecInfo GetEncoderInfo(String mimeType) private static ImageCodecInfo GetEncoderInfo(String mimeType)
{ {

View File

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

View File

@ -51,7 +51,7 @@ namespace OpenSim.Capabilities.Handlers
{ {
public class UploadBakedTextureHandler public class UploadBakedTextureHandler
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Caps m_HostCapsObj; private Caps m_HostCapsObj;
@ -81,7 +81,7 @@ namespace OpenSim.Capabilities.Handlers
{ {
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader = BakedTextureUploader uploader =
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID); new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
uploader.OnUpLoad += BakedTextureUploaded; uploader.OnUpLoad += BakedTextureUploaded;
@ -127,7 +127,7 @@ namespace OpenSim.Capabilities.Handlers
asset.Temporary = true; asset.Temporary = true;
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
m_assetService.Store(asset); m_assetService.Store(asset);
} }
} }
@ -151,7 +151,7 @@ namespace OpenSim.Capabilities.Handlers
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
} }
/// <summary> /// <summary>
/// Handle raw uploaded baked texture data. /// Handle raw uploaded baked texture data.

View File

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

View File

@ -42,7 +42,7 @@ namespace OpenSim.Framework.Capabilities
{ {
public string username; public string username;
public string display_name; 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_first_name;
public string legacy_last_name; public string legacy_last_name;
public UUID id; public UUID id;

View File

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

View File

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

View File

@ -178,7 +178,7 @@ namespace OpenSim.ConsoleClient
Requester.MakeRequest(requestUrl, requestData, ReadResponses); Requester.MakeRequest(requestUrl, requestData, ReadResponses);
return; return;
} }
List<string> lines = new List<string>(); List<string> lines = new List<string>();
foreach (XmlNode part in rootNodeL[0].ChildNodes) foreach (XmlNode part in rootNodeL[0].ChildNodes)
@ -202,7 +202,7 @@ namespace OpenSim.ConsoleClient
string[] parts = l.Split(new char[] {':'}, 3); string[] parts = l.Split(new char[] {':'}, 3);
if (parts.Length != 3) if (parts.Length != 3)
continue; continue;
if (parts[2].StartsWith("+++") || parts[2].StartsWith("-++")) if (parts[2].StartsWith("+++") || parts[2].StartsWith("-++"))
prompt = parts[2]; prompt = parts[2];
else else

View File

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

View File

@ -38,7 +38,7 @@ namespace OpenSim.Data
/// <summary>This function converts a value returned from the database in one of the /// <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 /// supported formats into a UUID. This function is not actually DBMS-specific right
/// now /// now
/// ///
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>

View File

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

View File

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

View File

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

View File

@ -48,7 +48,7 @@ namespace OpenSim.Data
/// <summary> /// <summary>
/// An interface for connecting to the user grid datastore /// An interface for connecting to the user grid datastore
/// </summary> /// </summary>
public interface IHGTravelingData public interface IHGTravelingData
{ {
HGTravelingData Get(UUID sessionID); HGTravelingData Get(UUID sessionID);
HGTravelingData[] GetSessions(UUID userID); 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); OfflineIMData[] Get(string field, string val);
long GetCount(string field, string key); long GetCount(string field, string key);

View File

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

View File

@ -67,7 +67,7 @@ namespace OpenSim.Data
/// <summary> /// <summary>
/// An interface for connecting to the authentication datastore /// An interface for connecting to the authentication datastore
/// </summary> /// </summary>
public interface IRegionData public interface IRegionData
{ {
RegionData Get(UUID regionID, UUID ScopeID); RegionData Get(UUID regionID, UUID ScopeID);
List<RegionData> Get(string regionName, UUID ScopeID); List<RegionData> Get(string regionName, UUID ScopeID);

View File

@ -38,12 +38,12 @@ namespace OpenSim.Data
public UUID ownerRoleID; public UUID ownerRoleID;
public string name; public string name;
public string charter; public string charter;
public bool showInList; public bool showInList;
public UUID insigniaID; public UUID insigniaID;
public int membershipFee; public int membershipFee;
public bool openEnrollment; public bool openEnrollment;
public bool allowPublish; public bool allowPublish;
public bool maturePublish; public bool maturePublish;
public UUID founderID; public UUID founderID;
public ulong everyonePowers; public ulong everyonePowers;
public ulong ownersPowers; 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. /// <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 /// 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> /// </summary>
public Migration() public Migration()
{ {
} }
public Migration(DbConnection conn, Assembly assem, string subtype, string type) public Migration(DbConnection conn, Assembly assem, string subtype, string type)
@ -91,7 +91,7 @@ namespace OpenSim.Data
Initialize(conn, assem, type, subtype); 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, ""); Initialize(conn, assem, type, "");
} }
@ -191,7 +191,7 @@ namespace OpenSim.Data
int newversion = kvp.Key; int newversion = kvp.Key;
// we need to up the command timeout to infinite as we might be doing long migrations. // 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. * 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 * 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 * 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(); private delegate void FlushProc();
/// <summary>Scans for migration resources in either old-style "scattered" (one file per version) /// <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 /// 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 /// 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. /// and don't support the ':GO' feature.
@ -301,12 +301,12 @@ namespace OpenSim.Data
{ {
/* The filename should be '<StoreName>.migrations[.NNN]' where NNN /* 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 * 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') * the file anyway and use the version numbers inside. Any unrecognized suffix (such as '.sql')
* is valid but ignored. * is valid but ignored.
* *
* NOTE that we expect only one 'merged' migration file. If there are several, we take the last one. * 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 * 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') * 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 (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
{ {
if (sb.Length == 0) continue; if (sb.Length == 0) continue;
if (nVersion > after) if (nVersion > after)
script.Add(sb.ToString()); script.Add(sb.ToString());
sb.Length = 0; sb.Length = 0;
continue; 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); m_log.DebugFormat("[MIGRATIONS]: {0} data tables already up to date at revision {1}", _type, after);
return migrations; return migrations;
} }
} }

View File

@ -329,8 +329,8 @@ namespace OpenSim.Data.MySQL
{ {
m_log.Error( m_log.Error(
string.Format( string.Format(
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ", "[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
start, count), start, count),
e); e);
} }
} }

View File

@ -77,21 +77,21 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
IDataReader result = cmd.ExecuteReader(); IDataReader result = cmd.ExecuteReader();
if (result.Read()) if (result.Read())
{ {
ret.PrincipalID = principalID; ret.PrincipalID = principalID;
CheckColumnNames(result); CheckColumnNames(result);
foreach (string s in m_ColumnNames) foreach (string s in m_ColumnNames)
{ {
if (s == "UUID") if (s == "UUID")
continue; continue;
ret.Data[s] = result[s].ToString(); ret.Data[s] = result[s].ToString();
} }
return ret; return ret;
} }
else else
@ -132,25 +132,25 @@ namespace OpenSim.Data.MySQL
if (!first) if (!first)
update += ", "; update += ", ";
update += "`" + field + "` = ?"+field; update += "`" + field + "` = ?"+field;
first = false; first = false;
cmd.Parameters.AddWithValue("?"+field, data.Data[field]); cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
} }
update += " where UUID = ?principalID"; update += " where UUID = ?principalID";
cmd.CommandText = update; cmd.CommandText = update;
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
if (ExecuteNonQuery(cmd) < 1) if (ExecuteNonQuery(cmd) < 1)
{ {
string insert = "insert into `" + m_Realm + "` (`UUID`, `" + string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
String.Join("`, `", fields) + String.Join("`, `", fields) +
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; "`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
cmd.CommandText = insert; cmd.CommandText = insert;
if (ExecuteNonQuery(cmd) < 1) if (ExecuteNonQuery(cmd) < 1)
return false; return false;
} }
@ -166,7 +166,7 @@ namespace OpenSim.Data.MySQL
{ {
cmd.Parameters.AddWithValue("?"+item, value); cmd.Parameters.AddWithValue("?"+item, value);
cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
if (ExecuteNonQuery(cmd) > 0) if (ExecuteNonQuery(cmd) > 0)
return true; return true;
} }
@ -186,7 +186,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
cmd.Parameters.AddWithValue("?token", token); cmd.Parameters.AddWithValue("?token", token);
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
if (ExecuteNonQuery(cmd) > 0) if (ExecuteNonQuery(cmd) > 0)
return true; 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.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?Name", name); cmd.Parameters.AddWithValue("?Name", name);
if (ExecuteNonQuery(cmd) > 0) if (ExecuteNonQuery(cmd) > 0)
return true; return true;
} }

View File

@ -403,19 +403,19 @@ namespace OpenSim.Data.MySQL
return e; return e;
} }
} }
public List<EstateSettings> LoadEstateSettingsAll() public List<EstateSettings> LoadEstateSettingsAll()
{ {
List<EstateSettings> allEstateSettings = new List<EstateSettings>(); List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<int> allEstateIds = GetEstatesAll(); List<int> allEstateIds = GetEstatesAll();
foreach (int estateId in allEstateIds) foreach (int estateId in allEstateIds)
allEstateSettings.Add(LoadEstateSettings(estateId)); allEstateSettings.Add(LoadEstateSettings(estateId));
return allEstateSettings; return allEstateSettings;
} }
public List<int> GetEstatesAll() public List<int> GetEstatesAll()
{ {
List<int> result = new List<int>(); List<int> result = new List<int>();
@ -441,7 +441,7 @@ namespace OpenSim.Data.MySQL
dbcon.Close(); dbcon.Close();
} }
return result; return result;
} }
public List<int> GetEstates(string search) public List<int> GetEstates(string search)

View File

@ -54,7 +54,7 @@ namespace OpenSim.Data.MySQL
{ {
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySQLFSAssetData() public MySQLFSAssetData()
{ {
} }

View File

@ -40,7 +40,7 @@ namespace OpenSim.Data.MySQL
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<string, FieldInfo> m_Fields = protected Dictionary<string, FieldInfo> m_Fields =
new Dictionary<string, FieldInfo>(); new Dictionary<string, FieldInfo>();
@ -58,7 +58,7 @@ namespace OpenSim.Data.MySQL
{ {
m_Realm = realm; m_Realm = realm;
m_connectionString = connectionString; m_connectionString = connectionString;
if (storeName != String.Empty) if (storeName != String.Empty)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
@ -130,7 +130,7 @@ namespace OpenSim.Data.MySQL
m_Realm, where); m_Realm, where);
cmd.CommandText = query; cmd.CommandText = query;
return DoQuery(cmd); return DoQuery(cmd);
} }
} }
@ -185,7 +185,7 @@ namespace OpenSim.Data.MySQL
m_Fields[name].SetValue(row, reader[name]); m_Fields[name].SetValue(row, reader[name]);
} }
} }
if (m_DataField != null) if (m_DataField != null)
{ {
Dictionary<string, string> data = Dictionary<string, string> data =
@ -215,9 +215,9 @@ namespace OpenSim.Data.MySQL
{ {
string query = String.Format("select * from {0} where {1}", string query = String.Format("select * from {0} where {1}",
m_Realm, where); m_Realm, where);
cmd.CommandText = query; cmd.CommandText = query;
return DoQuery(cmd); return DoQuery(cmd);
} }
} }
@ -236,16 +236,16 @@ namespace OpenSim.Data.MySQL
{ {
names.Add(fi.Name); names.Add(fi.Name);
values.Add("?" + fi.Name); values.Add("?" + fi.Name);
// Temporarily return more information about what field is unexpectedly null for // 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. // InventoryTransferModule or we may be required to substitute a DBNull here.
if (fi.GetValue(row) == null) if (fi.GetValue(row) == null)
throw new NullReferenceException( throw new NullReferenceException(
string.Format( 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)); fi.Name, row));
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
} }

View File

@ -133,10 +133,10 @@ namespace OpenSim.Data.MySQL
public bool DeleteMember(UUID groupID, string pricipalID) 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 }); new string[] { groupID.ToString(), pricipalID });
} }
public int MemberCount(UUID groupID) public int MemberCount(UUID groupID)
{ {
return (int)m_Membership.GetCount("GroupID", groupID.ToString()); return (int)m_Membership.GetCount("GroupID", groupID.ToString());
@ -168,7 +168,7 @@ namespace OpenSim.Data.MySQL
public bool DeleteRole(UUID groupID, UUID roleID) 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() }); new string[] { groupID.ToString(), roleID.ToString() });
} }
@ -360,7 +360,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySqlGroupsGroupsHandler(string connectionString, string realm, string store) public MySqlGroupsGroupsHandler(string connectionString, string realm, string store)
: base(connectionString, realm, store) : base(connectionString, realm, store)
{ {
} }
@ -375,7 +375,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySqlGroupsMembershipHandler(string connectionString, string realm) public MySqlGroupsMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -390,7 +390,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySqlGroupsRolesHandler(string connectionString, string realm) public MySqlGroupsRolesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -405,7 +405,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySqlGroupsRoleMembershipHandler(string connectionString, string realm) public MySqlGroupsRoleMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -420,7 +420,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySqlGroupsInvitesHandler(string connectionString, string realm) public MySqlGroupsInvitesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -447,7 +447,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySqlGroupsNoticesHandler(string connectionString, string realm) public MySqlGroupsNoticesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -475,7 +475,7 @@ namespace OpenSim.Data.MySQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public MySqlGroupsPrincipalsHandler(string connectionString, string realm) public MySqlGroupsPrincipalsHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }

View File

@ -288,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. // 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) // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
item.CreatorId = reader["creatorID"].ToString(); item.CreatorId = reader["creatorID"].ToString();
// Be a bit safer in parsing these because the // Be a bit safer in parsing these because the
// database doesn't enforce them to be not null, and // database doesn't enforce them to be not null, and
// the inventory still works if these are weird in the // the inventory still works if these are weird in the
@ -453,7 +453,7 @@ namespace OpenSim.Data.MySQL
itemName = item.Name.Substring(0, 64); 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"); m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length + " to " + itemName.Length + " characters on add item");
} }
string itemDesc = item.Description; string itemDesc = item.Description;
if (item.Description.Length > 128) if (item.Description.Length > 128)
{ {
@ -490,10 +490,10 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?groupID", item.GroupID); result.Parameters.AddWithValue("?groupID", item.GroupID);
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
result.Parameters.AddWithValue("?flags", item.Flags); result.Parameters.AddWithValue("?flags", item.Flags);
lock (m_dbLock) lock (m_dbLock)
result.ExecuteNonQuery(); result.ExecuteNonQuery();
result.Dispose(); result.Dispose();
} }
@ -630,7 +630,7 @@ namespace OpenSim.Data.MySQL
{ {
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
try try
{ {
lock (m_dbLock) lock (m_dbLock)
@ -860,7 +860,7 @@ namespace OpenSim.Data.MySQL
deleteOneFolder(folderID); deleteOneFolder(folderID);
deleteItemsInFolder(folderID); deleteItemsInFolder(folderID);
} }
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
{ {
lock (m_dbLock) lock (m_dbLock)

View File

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

View File

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

View File

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

View File

@ -204,7 +204,7 @@ namespace OpenSim.Data.MySQL
foreach (RegionData r in dbret) foreach (RegionData r in dbret)
{ {
if (r.posX + r.sizeX > startX && r.posX <= endX if (r.posX + r.sizeX > startX && r.posX <= endX
&& r.posY + r.sizeX > startY && r.posY <= endY) && r.posY + r.sizeY > startY && r.posY <= endY)
ret.Add(r); ret.Add(r);
} }
return ret; return ret;
@ -410,7 +410,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(command)) using (MySqlCommand cmd = new MySqlCommand(command))
{ {
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd); return RunCommand(cmd);
} }
} }

View File

@ -55,7 +55,7 @@ namespace OpenSim.Data.MySQL
/// <summary> /// <summary>
/// This lock was being used to serialize database operations when the connection was shared, but this has /// This lock was being used to serialize database operations when the connection was shared, but this has
/// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead. /// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead.
/// FIXME: However, the locks remain in many places since they are effectively providing a level of /// FIXME: However, the locks remain in many places since they are effectively providing a level of
/// transactionality. This should be replaced by more efficient database transactions which would not require /// transactionality. This should be replaced by more efficient database transactions which would not require
/// unrelated operations to block each other or unrelated operations on the same tables from blocking each /// unrelated operations to block each other or unrelated operations on the same tables from blocking each
/// other. /// other.
@ -167,7 +167,7 @@ namespace OpenSim.Data.MySQL
"SitTargetOrientY, SitTargetOrientZ, " + "SitTargetOrientY, SitTargetOrientZ, " +
"RegionUUID, CreatorID, " + "RegionUUID, CreatorID, " +
"OwnerID, GroupID, " + "OwnerID, GroupID, " +
"LastOwnerID, SceneGroupID, " + "LastOwnerID, RezzerID, SceneGroupID, " +
"PayPrice, PayButton1, " + "PayPrice, PayButton1, " +
"PayButton2, PayButton3, " + "PayButton2, PayButton3, " +
"PayButton4, LoopedSound, " + "PayButton4, LoopedSound, " +
@ -207,7 +207,7 @@ namespace OpenSim.Data.MySQL
"?SitTargetOrientW, ?SitTargetOrientX, " + "?SitTargetOrientW, ?SitTargetOrientX, " +
"?SitTargetOrientY, ?SitTargetOrientZ, " + "?SitTargetOrientY, ?SitTargetOrientZ, " +
"?RegionUUID, ?CreatorID, ?OwnerID, " + "?RegionUUID, ?CreatorID, ?OwnerID, " +
"?GroupID, ?LastOwnerID, ?SceneGroupID, " + "?GroupID, ?LastOwnerID, ?RezzerID, ?SceneGroupID, " +
"?PayPrice, ?PayButton1, ?PayButton2, " + "?PayPrice, ?PayButton1, ?PayButton2, " +
"?PayButton3, ?PayButton4, ?LoopedSound, " + "?PayButton3, ?PayButton4, ?LoopedSound, " +
"?LoopedSoundGain, ?TextureAnimation, " + "?LoopedSoundGain, ?TextureAnimation, " +
@ -268,7 +268,7 @@ namespace OpenSim.Data.MySQL
public virtual void RemoveObject(UUID obj, UUID regionUUID) public virtual void RemoveObject(UUID obj, UUID regionUUID)
{ {
// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
List<UUID> uuids = new List<UUID>(); List<UUID> uuids = new List<UUID>();
// Formerly, this used to check the region UUID. // Formerly, this used to check the region UUID.
@ -509,7 +509,7 @@ namespace OpenSim.Data.MySQL
#region Prim Inventory Loading #region Prim Inventory Loading
// Instead of attempting to LoadItems on every prim, // Instead of attempting to LoadItems on every prim,
// most of which probably have no items... get a // most of which probably have no items... get a
// list from DB of all prims which have items and // list from DB of all prims which have items and
// LoadItems only on those // LoadItems only on those
List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>();
@ -807,7 +807,7 @@ namespace OpenSim.Data.MySQL
"UserLocationX, UserLocationY, UserLocationZ, " + "UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
"SeeAVs, AnyAVSounds, GroupAVSounds) values (" + "SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
"?UUID, ?RegionUUID, " + "?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@ -1081,7 +1081,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
} }
@ -1273,12 +1273,16 @@ namespace OpenSim.Data.MySQL
{ {
SceneObjectPart prim = new SceneObjectPart(); SceneObjectPart prim = new SceneObjectPart();
// depending on the MySQL connector version, CHAR(36) may be already converted to Guid! // depending on the MySQL connector version, CHAR(36) may be already converted to Guid!
prim.UUID = DBGuid.FromDB(row["UUID"]); prim.UUID = DBGuid.FromDB(row["UUID"]);
prim.CreatorIdentification = (string)row["CreatorID"]; prim.CreatorIdentification = (string)row["CreatorID"];
prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); prim.OwnerID = DBGuid.FromDB(row["OwnerID"]);
prim.GroupID = DBGuid.FromDB(row["GroupID"]); prim.GroupID = DBGuid.FromDB(row["GroupID"]);
prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]);
if (row["RezzerID"] != DBNull.Value)
prim.RezzerID = DBGuid.FromDB(row["RezzerID"]);
else
prim.RezzerID = UUID.Zero;
// explicit conversion of integers is required, which sort // explicit conversion of integers is required, which sort
// of sucks. No idea if there is a shortcut here or not. // of sucks. No idea if there is a shortcut here or not.
@ -1397,11 +1401,11 @@ namespace OpenSim.Data.MySQL
prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]);
prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
prim.PassTouches = ((sbyte)row["PassTouches"] != 0); prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
prim.LinkNum = (int)row["LinkNumber"]; prim.LinkNum = (int)row["LinkNumber"];
if (!(row["MediaURL"] is System.DBNull)) if (!(row["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)row["MediaURL"]; prim.MediaUrl = (string)row["MediaURL"];
@ -1417,7 +1421,7 @@ namespace OpenSim.Data.MySQL
if (!(row["DynAttrs"] is System.DBNull)) if (!(row["DynAttrs"] is System.DBNull))
prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]);
else else
prim.DynAttrs = new DAMap(); prim.DynAttrs = new DAMap();
if (!(row["KeyframeMotion"] is DBNull)) if (!(row["KeyframeMotion"] is DBNull))
{ {
@ -1539,10 +1543,10 @@ namespace OpenSim.Data.MySQL
newSettings.Covenant = DBGuid.FromDB(row["covenant"]); newSettings.Covenant = DBGuid.FromDB(row["covenant"]);
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
if (row["loaded_creation_id"] is DBNull) if (row["loaded_creation_id"] is DBNull)
newSettings.LoadedCreationID = ""; newSettings.LoadedCreationID = "";
else else
newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]);
@ -1682,6 +1686,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString());
cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString());
cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString());
cmd.Parameters.AddWithValue("RezzerID", prim.RezzerID.ToString());
cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask);
cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask);
cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask);
@ -2018,7 +2023,7 @@ namespace OpenSim.Data.MySQL
s.State = (byte)(int)row["State"]; s.State = (byte)(int)row["State"];
s.LastAttachPoint = (byte)(int)row["LastAttachPoint"]; s.LastAttachPoint = (byte)(int)row["LastAttachPoint"];
if (!(row["Media"] is System.DBNull)) if (!(row["Media"] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
@ -2098,13 +2103,13 @@ namespace OpenSim.Data.MySQL
"?flags, ?itemID, ?primID, ?assetID, " + "?flags, ?itemID, ?primID, ?assetID, " +
"?parentFolderID, ?creatorID, ?ownerID, " + "?parentFolderID, ?creatorID, ?ownerID, " +
"?groupID, ?lastOwnerID)"; "?groupID, ?lastOwnerID)";
foreach (TaskInventoryItem item in items) foreach (TaskInventoryItem item in items)
{ {
cmd.Parameters.Clear(); cmd.Parameters.Clear();
FillItemCommand(cmd, item); FillItemCommand(cmd, item);
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
} }

View File

@ -40,39 +40,39 @@ namespace OpenSim.Data.MySQL
public class UserProfilesData: IProfilesData public class UserProfilesData: IProfilesData
{ {
static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region Properites #region Properites
string ConnectionString string ConnectionString
{ {
get; set; get; set;
} }
protected virtual Assembly Assembly protected virtual Assembly Assembly
{ {
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
#endregion Properties #endregion Properties
#region class Member Functions #region class Member Functions
public UserProfilesData(string connectionString) public UserProfilesData(string connectionString)
{ {
ConnectionString = connectionString; ConnectionString = connectionString;
Init(); Init();
} }
void Init() void Init()
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{ {
dbcon.Open(); dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "UserProfiles"); Migration m = new Migration(dbcon, Assembly, "UserProfiles");
m.Update(); m.Update();
} }
} }
#endregion Member Functions #endregion Member Functions
#region Classifieds Queries #region Classifieds Queries
/// <summary> /// <summary>
/// Gets the classified records. /// Gets the classified records.
@ -86,7 +86,7 @@ namespace OpenSim.Data.MySQL
public OSDArray GetClassifiedRecords(UUID creatorId) public OSDArray GetClassifiedRecords(UUID creatorId)
{ {
OSDArray data = new OSDArray(); OSDArray data = new OSDArray();
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{ {
string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id"; string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
@ -102,7 +102,7 @@ namespace OpenSim.Data.MySQL
{ {
OSDMap n = new OSDMap(); OSDMap n = new OSDMap();
UUID Id = UUID.Zero; UUID Id = UUID.Zero;
string Name = null; string Name = null;
try try
{ {
@ -124,12 +124,12 @@ namespace OpenSim.Data.MySQL
} }
return data; return data;
} }
public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "INSERT INTO classifieds ("; query += "INSERT INTO classifieds (";
query += "`classifieduuid`,"; query += "`classifieduuid`,";
query += "`creatoruuid`,"; query += "`creatoruuid`,";
@ -173,21 +173,21 @@ namespace OpenSim.Data.MySQL
query += "classifiedflags=?Flags, "; query += "classifiedflags=?Flags, ";
query += "priceforlisting=?ListingPrice, "; query += "priceforlisting=?ListingPrice, ";
query += "snapshotuuid=?SnapshotId"; query += "snapshotuuid=?SnapshotId";
if(string.IsNullOrEmpty(ad.ParcelName)) if(string.IsNullOrEmpty(ad.ParcelName))
ad.ParcelName = "Unknown"; ad.ParcelName = "Unknown";
if(ad.ParcelId == null) if(ad.ParcelId == null)
ad.ParcelId = UUID.Zero; ad.ParcelId = UUID.Zero;
if(string.IsNullOrEmpty(ad.Description)) if(string.IsNullOrEmpty(ad.Description))
ad.Description = "No Description"; ad.Description = "No Description";
DateTime epoch = new DateTime(1970, 1, 1); DateTime epoch = new DateTime(1970, 1, 1);
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
TimeSpan epochnow = now - epoch; TimeSpan epochnow = now - epoch;
TimeSpan duration; TimeSpan duration;
DateTime expiration; DateTime expiration;
TimeSpan epochexp; TimeSpan epochexp;
if(ad.Flags == 2) if(ad.Flags == 2)
{ {
duration = new TimeSpan(7,0,0,0); duration = new TimeSpan(7,0,0,0);
@ -202,7 +202,7 @@ namespace OpenSim.Data.MySQL
} }
ad.CreationDate = (int)epochnow.TotalSeconds; ad.CreationDate = (int)epochnow.TotalSeconds;
ad.ExpirationDate = (int)epochexp.TotalSeconds; ad.ExpirationDate = (int)epochexp.TotalSeconds;
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -225,7 +225,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?ParcelName", ad.ParcelName.ToString()); cmd.Parameters.AddWithValue("?ParcelName", ad.ParcelName.ToString());
cmd.Parameters.AddWithValue("?Flags", ad.Flags.ToString()); cmd.Parameters.AddWithValue("?Flags", ad.Flags.ToString());
cmd.Parameters.AddWithValue("?ListingPrice", ad.Price.ToString ()); cmd.Parameters.AddWithValue("?ListingPrice", ad.Price.ToString ());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -239,20 +239,20 @@ namespace OpenSim.Data.MySQL
} }
return true; return true;
} }
public bool DeleteClassifiedRecord(UUID recordId) public bool DeleteClassifiedRecord(UUID recordId)
{ {
string query = string.Empty; string query = string.Empty;
query += "DELETE FROM classifieds WHERE "; query += "DELETE FROM classifieds WHERE ";
query += "classifieduuid = ?recordId"; query += "classifieduuid = ?recordId";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{ {
dbcon.Open(); dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
@ -268,14 +268,14 @@ namespace OpenSim.Data.MySQL
} }
return true; return true;
} }
public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "SELECT * FROM classifieds WHERE "; query += "SELECT * FROM classifieds WHERE ";
query += "classifieduuid = ?AdId"; query += "classifieduuid = ?AdId";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?AdId", ad.ClassifiedId.ToString()); cmd.Parameters.AddWithValue("?AdId", ad.ClassifiedId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader()) using (MySqlDataReader reader = cmd.ExecuteReader())
{ {
if(reader.Read ()) if(reader.Read ())
@ -303,7 +303,7 @@ namespace OpenSim.Data.MySQL
ad.SimName = reader.GetString("simname"); ad.SimName = reader.GetString("simname");
ad.GlobalPos = reader.GetString("posglobal"); ad.GlobalPos = reader.GetString("posglobal");
ad.ParcelName = reader.GetString("parcelname"); ad.ParcelName = reader.GetString("parcelname");
} }
} }
} }
@ -318,16 +318,16 @@ namespace OpenSim.Data.MySQL
return true; return true;
} }
#endregion Classifieds Queries #endregion Classifieds Queries
#region Picks Queries #region Picks Queries
public OSDArray GetAvatarPicks(UUID avatarId) public OSDArray GetAvatarPicks(UUID avatarId)
{ {
string query = string.Empty; string query = string.Empty;
query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; query += "SELECT `pickuuid`,`name` FROM userpicks WHERE ";
query += "creatoruuid = ?Id"; query += "creatoruuid = ?Id";
OSDArray data = new OSDArray(); OSDArray data = new OSDArray();
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -336,7 +336,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader()) using (MySqlDataReader reader = cmd.ExecuteReader())
{ {
if(reader.HasRows) if(reader.HasRows)
@ -344,7 +344,7 @@ namespace OpenSim.Data.MySQL
while (reader.Read()) while (reader.Read())
{ {
OSDMap record = new OSDMap(); OSDMap record = new OSDMap();
record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"]));
record.Add("name",OSD.FromString((string)reader["name"])); record.Add("name",OSD.FromString((string)reader["name"]));
data.Add(record); data.Add(record);
@ -361,16 +361,16 @@ namespace OpenSim.Data.MySQL
} }
return data; return data;
} }
public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId)
{ {
string query = string.Empty; string query = string.Empty;
UserProfilePick pick = new UserProfilePick(); UserProfilePick pick = new UserProfilePick();
query += "SELECT * FROM userpicks WHERE "; query += "SELECT * FROM userpicks WHERE ";
query += "creatoruuid = ?CreatorId AND "; query += "creatoruuid = ?CreatorId AND ";
query += "pickuuid = ?PickId"; query += "pickuuid = ?PickId";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -380,18 +380,18 @@ namespace OpenSim.Data.MySQL
{ {
cmd.Parameters.AddWithValue("?CreatorId", avatarId.ToString()); cmd.Parameters.AddWithValue("?CreatorId", avatarId.ToString());
cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); cmd.Parameters.AddWithValue("?PickId", pickId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader()) using (MySqlDataReader reader = cmd.ExecuteReader())
{ {
if(reader.HasRows) if(reader.HasRows)
{ {
reader.Read(); reader.Read();
string description = (string)reader["description"]; string description = (string)reader["description"];
if (string.IsNullOrEmpty(description)) if (string.IsNullOrEmpty(description))
description = "No description given."; description = "No description given.";
UUID.TryParse((string)reader["pickuuid"], out pick.PickId); UUID.TryParse((string)reader["pickuuid"], out pick.PickId);
UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId);
UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId);
@ -419,11 +419,11 @@ namespace OpenSim.Data.MySQL
} }
return pick; return pick;
} }
public bool UpdatePicksRecord(UserProfilePick pick) public bool UpdatePicksRecord(UserProfilePick pick)
{ {
string query = string.Empty; string query = string.Empty;
query += "INSERT INTO userpicks VALUES ("; query += "INSERT INTO userpicks VALUES (";
query += "?PickId,"; query += "?PickId,";
query += "?CreatorId,"; query += "?CreatorId,";
@ -449,7 +449,7 @@ namespace OpenSim.Data.MySQL
query += "pickuuid=?PickId,"; query += "pickuuid=?PickId,";
query += "posglobal=?GlobalPos,"; query += "posglobal=?GlobalPos,";
query += "gatekeeper=?Gatekeeper"; query += "gatekeeper=?Gatekeeper";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -471,7 +471,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper); cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper);
cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ()); cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ());
cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString()); cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -484,24 +484,24 @@ namespace OpenSim.Data.MySQL
} }
return true; return true;
} }
public bool DeletePicksRecord(UUID pickId) public bool DeletePicksRecord(UUID pickId)
{ {
string query = string.Empty; string query = string.Empty;
query += "DELETE FROM userpicks WHERE "; query += "DELETE FROM userpicks WHERE ";
query += "pickuuid = ?PickId"; query += "pickuuid = ?PickId";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{ {
dbcon.Open(); dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); cmd.Parameters.AddWithValue("?PickId", pickId.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -515,12 +515,12 @@ namespace OpenSim.Data.MySQL
return true; return true;
} }
#endregion Picks Queries #endregion Picks Queries
#region Avatar Notes Queries #region Avatar Notes Queries
public bool GetAvatarNotes(ref UserProfileNotes notes) public bool GetAvatarNotes(ref UserProfileNotes notes)
{ // WIP { // WIP
string query = string.Empty; string query = string.Empty;
query += "SELECT `notes` FROM usernotes WHERE "; query += "SELECT `notes` FROM usernotes WHERE ";
query += "useruuid = ?Id AND "; query += "useruuid = ?Id AND ";
query += "targetuuid = ?TargetId"; query += "targetuuid = ?TargetId";
@ -534,7 +534,7 @@ namespace OpenSim.Data.MySQL
{ {
cmd.Parameters.AddWithValue("?Id", notes.UserId.ToString()); cmd.Parameters.AddWithValue("?Id", notes.UserId.ToString());
cmd.Parameters.AddWithValue("?TargetId", notes.TargetId.ToString()); cmd.Parameters.AddWithValue("?TargetId", notes.TargetId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if(reader.HasRows) if(reader.HasRows)
@ -557,12 +557,12 @@ namespace OpenSim.Data.MySQL
} }
return true; return true;
} }
public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
bool remove; bool remove;
if(string.IsNullOrEmpty(note.Notes)) if(string.IsNullOrEmpty(note.Notes))
{ {
remove = true; remove = true;
@ -581,7 +581,7 @@ namespace OpenSim.Data.MySQL
query += "UPDATE "; query += "UPDATE ";
query += "notes=?Notes"; query += "notes=?Notes";
} }
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -593,7 +593,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?Notes", note.Notes); cmd.Parameters.AddWithValue("?Notes", note.Notes);
cmd.Parameters.AddWithValue("?TargetId", note.TargetId.ToString ()); cmd.Parameters.AddWithValue("?TargetId", note.TargetId.ToString ());
cmd.Parameters.AddWithValue("?UserId", note.UserId.ToString()); cmd.Parameters.AddWithValue("?UserId", note.UserId.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -605,18 +605,18 @@ namespace OpenSim.Data.MySQL
return false; return false;
} }
return true; return true;
} }
#endregion Avatar Notes Queries #endregion Avatar Notes Queries
#region Avatar Properties #region Avatar Properties
public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) public bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "SELECT * FROM userprofile WHERE "; query += "SELECT * FROM userprofile WHERE ";
query += "useruuid = ?Id"; query += "useruuid = ?Id";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -625,7 +625,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); cmd.Parameters.AddWithValue("?Id", props.UserId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if(reader.HasRows) if(reader.HasRows)
@ -649,7 +649,7 @@ namespace OpenSim.Data.MySQL
{ {
m_log.DebugFormat("[PROFILES_DATA]" + m_log.DebugFormat("[PROFILES_DATA]" +
": No data for {0}", props.UserId); ": No data for {0}", props.UserId);
props.WebUrl = string.Empty; props.WebUrl = string.Empty;
props.ImageId = UUID.Zero; props.ImageId = UUID.Zero;
props.AboutText = string.Empty; props.AboutText = string.Empty;
@ -730,11 +730,11 @@ namespace OpenSim.Data.MySQL
} }
return true; return true;
} }
public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profileURL=?profileURL, "; query += "profileURL=?profileURL, ";
query += "profileImage=?image, "; query += "profileImage=?image, ";
@ -742,7 +742,7 @@ namespace OpenSim.Data.MySQL
query += "profileFirstImage=?firstlifeimage,"; query += "profileFirstImage=?firstlifeimage,";
query += "profileFirstText=?firstlifetext "; query += "profileFirstText=?firstlifetext ";
query += "WHERE useruuid=?uuid"; query += "WHERE useruuid=?uuid";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -756,7 +756,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString());
cmd.Parameters.AddWithValue("?firstlifetext", props.FirstLifeText); cmd.Parameters.AddWithValue("?firstlifetext", props.FirstLifeText);
cmd.Parameters.AddWithValue("?uuid", props.UserId.ToString()); cmd.Parameters.AddWithValue("?uuid", props.UserId.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -765,18 +765,18 @@ namespace OpenSim.Data.MySQL
{ {
m_log.ErrorFormat("[PROFILES_DATA]" + m_log.ErrorFormat("[PROFILES_DATA]" +
": AgentPropertiesUpdate exception {0}", e.Message); ": AgentPropertiesUpdate exception {0}", e.Message);
return false; return false;
} }
return true; return true;
} }
#endregion Avatar Properties #endregion Avatar Properties
#region Avatar Interests #region Avatar Interests
public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profileWantToMask=?WantMask, "; query += "profileWantToMask=?WantMask, ";
query += "profileWantToText=?WantText,"; query += "profileWantToText=?WantText,";
@ -784,7 +784,7 @@ namespace OpenSim.Data.MySQL
query += "profileSkillsText=?SkillsText, "; query += "profileSkillsText=?SkillsText, ";
query += "profileLanguages=?Languages "; query += "profileLanguages=?Languages ";
query += "WHERE useruuid=?uuid"; query += "WHERE useruuid=?uuid";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -798,7 +798,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?SkillsText", up.SkillsText); cmd.Parameters.AddWithValue("?SkillsText", up.SkillsText);
cmd.Parameters.AddWithValue("?Languages", up.Language); cmd.Parameters.AddWithValue("?Languages", up.Language);
cmd.Parameters.AddWithValue("?uuid", up.UserId.ToString()); cmd.Parameters.AddWithValue("?uuid", up.UserId.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -820,8 +820,8 @@ namespace OpenSim.Data.MySQL
string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
// Get classified image assets // Get classified image assets
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -831,7 +831,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon)) using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon))
{ {
cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if(reader.HasRows) if(reader.HasRows)
@ -850,7 +850,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
{ {
cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if(reader.HasRows) if(reader.HasRows)
@ -862,7 +862,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close(); dbcon.Close();
dbcon.Open(); dbcon.Open();
@ -871,7 +871,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
{ {
cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if(reader.HasRows) if(reader.HasRows)
@ -893,7 +893,7 @@ namespace OpenSim.Data.MySQL
} }
return data; return data;
} }
#region User Preferences #region User Preferences
public bool GetUserPreferences(ref UserPreferences pref, ref string result) public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{ {
@ -987,16 +987,16 @@ namespace OpenSim.Data.MySQL
return true; return true;
} }
#endregion User Preferences #endregion User Preferences
#region Integration #region Integration
public bool GetUserAppData(ref UserAppData props, ref string result) public bool GetUserAppData(ref UserAppData props, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "SELECT * FROM `userdata` WHERE "; query += "SELECT * FROM `userdata` WHERE ";
query += "UserId = ?Id AND "; query += "UserId = ?Id AND ";
query += "TagId = ?TagId"; query += "TagId = ?TagId";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@ -1006,7 +1006,7 @@ namespace OpenSim.Data.MySQL
{ {
cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); cmd.Parameters.AddWithValue("?Id", props.UserId.ToString());
cmd.Parameters.AddWithValue ("?TagId", props.TagId.ToString()); cmd.Parameters.AddWithValue ("?TagId", props.TagId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if(reader.HasRows) if(reader.HasRows)
@ -1022,7 +1022,7 @@ namespace OpenSim.Data.MySQL
query += "?TagId,"; query += "?TagId,";
query += "?DataKey,"; query += "?DataKey,";
query += "?DataVal) "; query += "?DataVal) ";
using (MySqlCommand put = new MySqlCommand(query, dbcon)) using (MySqlCommand put = new MySqlCommand(query, dbcon))
{ {
put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); put.Parameters.AddWithValue("?UserId", props.UserId.ToString());
@ -1048,16 +1048,16 @@ namespace OpenSim.Data.MySQL
} }
public bool SetUserAppData(UserAppData props, ref string result) public bool SetUserAppData(UserAppData props, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "UPDATE userdata SET "; query += "UPDATE userdata SET ";
query += "TagId = ?TagId, "; query += "TagId = ?TagId, ";
query += "DataKey = ?DataKey, "; query += "DataKey = ?DataKey, ";
query += "DataVal = ?DataVal WHERE "; query += "DataVal = ?DataVal WHERE ";
query += "UserId = ?UserId AND "; query += "UserId = ?UserId AND ";
query += "TagId = ?TagId"; query += "TagId = ?TagId";
try try
{ {
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))

View File

@ -209,7 +209,7 @@ namespace OpenSim.Data.MySQL
{ {
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
m_log.WarnFormat( 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); asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
@ -218,7 +218,7 @@ namespace OpenSim.Data.MySQL
{ {
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
m_log.WarnFormat( 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); asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
@ -341,7 +341,7 @@ namespace OpenSim.Data.MySQL
catch (Exception) catch (Exception)
{ {
m_log.ErrorFormat( 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); assetMetadata.ID, assetMetadata.Name);
} }
} }

View File

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

View File

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

View File

@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `prims` (
PRIMARY KEY (`UUID`), PRIMARY KEY (`UUID`),
KEY `prims_regionuuid` (`RegionUUID`), KEY `prims_regionuuid` (`RegionUUID`),
KEY `prims_scenegroupid` (`SceneGroupID`) KEY `prims_scenegroupid` (`SceneGroupID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `primshapes` ( CREATE TABLE IF NOT EXISTS `primshapes` (
`Shape` int(11) DEFAULT NULL, `Shape` int(11) DEFAULT NULL,
@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `primshapes` (
`Media` text, `Media` text,
`LastAttachPoint` int(4) NOT NULL DEFAULT '0', `LastAttachPoint` int(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`UUID`) PRIMARY KEY (`UUID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `primitems` ( CREATE TABLE IF NOT EXISTS `primitems` (
`invType` int(11) DEFAULT NULL, `invType` int(11) DEFAULT NULL,
@ -154,13 +154,13 @@ CREATE TABLE IF NOT EXISTS `primitems` (
`lastOwnerID` char(36) DEFAULT NULL, `lastOwnerID` char(36) DEFAULT NULL,
PRIMARY KEY (`itemID`), PRIMARY KEY (`itemID`),
KEY `primitems_primid` (`primID`) KEY `primitems_primid` (`primID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `terrain` ( CREATE TABLE IF NOT EXISTS `terrain` (
`RegionUUID` varchar(255) DEFAULT NULL, `RegionUUID` varchar(255) DEFAULT NULL,
`Revision` int(11) DEFAULT NULL, `Revision` int(11) DEFAULT NULL,
`Heightfield` longblob `Heightfield` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `land` ( CREATE TABLE IF NOT EXISTS `land` (
`UUID` varchar(255) NOT NULL, `UUID` varchar(255) NOT NULL,
@ -204,21 +204,21 @@ CREATE TABLE IF NOT EXISTS `land` (
`ObscureMusic` tinyint(1) NOT NULL DEFAULT '0', `ObscureMusic` tinyint(1) NOT NULL DEFAULT '0',
`ObscureMedia` tinyint(1) NOT NULL DEFAULT '0', `ObscureMedia` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`UUID`) PRIMARY KEY (`UUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `landaccesslist` ( CREATE TABLE IF NOT EXISTS `landaccesslist` (
`LandUUID` varchar(255) DEFAULT NULL, `LandUUID` varchar(255) DEFAULT NULL,
`AccessUUID` varchar(255) DEFAULT NULL, `AccessUUID` varchar(255) DEFAULT NULL,
`Flags` int(11) DEFAULT NULL, `Flags` int(11) DEFAULT NULL,
`Expires` int(11) NOT NULL DEFAULT '0' `Expires` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `regionban` ( CREATE TABLE IF NOT EXISTS `regionban` (
`regionUUID` varchar(36) NOT NULL, `regionUUID` varchar(36) NOT NULL,
`bannedUUID` varchar(36) NOT NULL, `bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL, `bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL `bannedIpHostMask` varchar(16) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `regionsettings` ( CREATE TABLE IF NOT EXISTS `regionsettings` (
`regionUUID` char(36) NOT NULL, `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', `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0', `covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`regionUUID`) PRIMARY KEY (`regionUUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `regionwindlight` ( CREATE TABLE IF NOT EXISTS `regionwindlight` (
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
@ -390,3 +390,74 @@ CREATE TABLE IF NOT EXISTS `bakedterrain` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT; 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;

View File

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

View File

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

View File

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

View File

@ -79,7 +79,7 @@ namespace OpenSim.Data.Null
{ {
return fdata.PrincipalID == userID.ToString(); return fdata.PrincipalID == userID.ToString();
}); });
if (lst != null) if (lst != null)
{ {
lst.ForEach(f => lst.ForEach(f =>
@ -87,14 +87,14 @@ namespace OpenSim.Data.Null
FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID); FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID);
if (f2 != null) if (f2 != null)
f.Data["TheirFlags"] = f2.Data["Flags"]; f.Data["TheirFlags"] = f2.Data["Flags"];
// m_log.DebugFormat( // m_log.DebugFormat(
// "[NULL FRIENDS DATA]: Got {0} {1} {2} for {3}", // "[NULL FRIENDS DATA]: Got {0} {1} {2} for {3}",
// f.Friend, f.Data["Flags"], f2 != null ? f.Data["TheirFlags"] : "not found!", f.PrincipalID); // f.Friend, f.Data["Flags"], f2 != null ? f.Data["TheirFlags"] : "not found!", f.PrincipalID);
}); });
// m_log.DebugFormat("[NULL FRIENDS DATA]: Got {0} friends for {1}", lst.Count, userID); // m_log.DebugFormat("[NULL FRIENDS DATA]: Got {0} friends for {1}", lst.Count, userID);
return lst.ToArray(); return lst.ToArray();
} }
} }
@ -134,7 +134,7 @@ namespace OpenSim.Data.Null
// m_log.DebugFormat( // m_log.DebugFormat(
// "[NULL FRIENDS DATA]: Deleting friend {0} {1} for {2}", // "[NULL FRIENDS DATA]: Deleting friend {0} {1} for {2}",
// friend.Friend, friend.Data["Flags"], friend.PrincipalID); // friend.Friend, friend.Data["Flags"], friend.PrincipalID);
m_Data.Remove(friend); m_Data.Remove(friend);
return true; return true;
} }

View File

@ -39,7 +39,7 @@ namespace OpenSim.Data.Null
public class NullPresenceData : IPresenceData public class NullPresenceData : IPresenceData
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static NullPresenceData Instance; public static NullPresenceData Instance;
Dictionary<UUID, PresenceData> m_presenceData = new Dictionary<UUID, PresenceData>(); Dictionary<UUID, PresenceData> m_presenceData = new Dictionary<UUID, PresenceData>();
@ -100,7 +100,7 @@ namespace OpenSim.Data.Null
{ {
if (Instance != this) if (Instance != this)
return Instance.ReportAgent(sessionID, regionID); return Instance.ReportAgent(sessionID, regionID);
if (m_presenceData.ContainsKey(sessionID)) if (m_presenceData.ContainsKey(sessionID))
{ {
m_presenceData[sessionID].RegionID = regionID; m_presenceData[sessionID].RegionID = regionID;
@ -129,7 +129,7 @@ namespace OpenSim.Data.Null
// Console.WriteLine("HOME for " + p.UserID + " is " + (p.Data.ContainsKey("HomeRegionID") ? p.Data["HomeRegionID"] : "Not found")); // Console.WriteLine("HOME for " + p.UserID + " is " + (p.Data.ContainsKey("HomeRegionID") ? p.Data["HomeRegionID"] : "Not found"));
} }
} }
return presences.ToArray(); return presences.ToArray();
} }
else if (field == "SessionID") else if (field == "SessionID")
@ -172,7 +172,7 @@ namespace OpenSim.Data.Null
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[NULL PRESENCE DATA]: Deleting presence data for field {0} with parameter {1}", field, data); // "[NULL PRESENCE DATA]: Deleting presence data for field {0} with parameter {1}", field, data);
if (Instance != this) if (Instance != this)
return Instance.Delete(field, data); return Instance.Delete(field, data);

View File

@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
public class NullUserAccountData : IUserAccountData public class NullUserAccountData : IUserAccountData
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>(); private Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>();
private Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>(); private Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>();
private Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>(); private Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>();
@ -48,7 +48,7 @@ namespace OpenSim.Data.Null
public NullUserAccountData(string connectionString, string realm) public NullUserAccountData(string connectionString, string realm)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]", // "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]",
// connectionString, realm); // connectionString, realm);
} }
@ -65,12 +65,12 @@ namespace OpenSim.Data.Null
// if (m_log.IsDebugEnabled) // if (m_log.IsDebugEnabled)
// { // {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]", // "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]",
// string.Join(", ", fields), string.Join(", ", values)); // string.Join(", ", fields), string.Join(", ", values));
// } // }
UserAccountData[] userAccounts = new UserAccountData[0]; UserAccountData[] userAccounts = new UserAccountData[0];
List<string> fieldsLst = new List<string>(fields); List<string> fieldsLst = new List<string>(fields);
if (fieldsLst.Contains("PrincipalID")) if (fieldsLst.Contains("PrincipalID"))
{ {
@ -79,33 +79,33 @@ namespace OpenSim.Data.Null
if (UUID.TryParse(values[i], out id)) if (UUID.TryParse(values[i], out id))
if (m_DataByUUID.ContainsKey(id)) if (m_DataByUUID.ContainsKey(id))
userAccounts = new UserAccountData[] { m_DataByUUID[id] }; userAccounts = new UserAccountData[] { m_DataByUUID[id] };
} }
else if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName")) else if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName"))
{ {
int findex = fieldsLst.IndexOf("FirstName"); int findex = fieldsLst.IndexOf("FirstName");
int lindex = fieldsLst.IndexOf("LastName"); int lindex = fieldsLst.IndexOf("LastName");
if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex])) if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex]))
{ {
userAccounts = new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] }; userAccounts = new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] };
} }
} }
else if (fieldsLst.Contains("Email")) else if (fieldsLst.Contains("Email"))
{ {
int i = fieldsLst.IndexOf("Email"); int i = fieldsLst.IndexOf("Email");
if (m_DataByEmail.ContainsKey(values[i])) if (m_DataByEmail.ContainsKey(values[i]))
userAccounts = new UserAccountData[] { m_DataByEmail[values[i]] }; userAccounts = new UserAccountData[] { m_DataByEmail[values[i]] };
} }
// if (m_log.IsDebugEnabled) // if (m_log.IsDebugEnabled)
// { // {
// StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
// foreach (UserAccountData uad in userAccounts) // foreach (UserAccountData uad in userAccounts)
// sb.AppendFormat("({0} {1} {2}) ", uad.FirstName, uad.LastName, uad.PrincipalID); // sb.AppendFormat("({0} {1} {2}) ", uad.FirstName, uad.LastName, uad.PrincipalID);
// //
// m_log.DebugFormat( // m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Returning {0} user accounts out of {1}: [{2}]", userAccounts.Length, m_DataByName.Count, sb); // "[NULL USER ACCOUNT DATA]: Returning {0} user accounts out of {1}: [{2}]", userAccounts.Length, m_DataByName.Count, sb);
// } // }
return userAccounts; return userAccounts;
} }
@ -113,16 +113,16 @@ namespace OpenSim.Data.Null
{ {
if (data == null) if (data == null)
return false; return false;
m_log.DebugFormat( m_log.DebugFormat(
"[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}", "[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}",
data.FirstName, data.LastName, data.PrincipalID, this.GetHashCode()); data.FirstName, data.LastName, data.PrincipalID, this.GetHashCode());
m_DataByUUID[data.PrincipalID] = data; m_DataByUUID[data.PrincipalID] = data;
m_DataByName[data.FirstName + " " + data.LastName] = data; m_DataByName[data.FirstName + " " + data.LastName] = data;
if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty) if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty)
m_DataByEmail[data.Data["Email"]] = data; m_DataByEmail[data.Data["Email"]] = data;
// m_log.DebugFormat("m_DataByUUID count is {0}, m_DataByName count is {1}", m_DataByUUID.Count, m_DataByName.Count); // m_log.DebugFormat("m_DataByUUID count is {0}, m_DataByName count is {1}", m_DataByUUID.Count, m_DataByName.Count);
return true; return true;
@ -132,7 +132,7 @@ namespace OpenSim.Data.Null
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Called GetUsers with scope [{0}], query [{1}]", scopeID, query); // "[NULL USER ACCOUNT DATA]: Called GetUsers with scope [{0}], query [{1}]", scopeID, query);
string[] words = query.Split(new char[] { ' ' }); string[] words = query.Split(new char[] { ' ' });
for (int i = 0; i < words.Length; i++) for (int i = 0; i < words.Length; i++)

View File

@ -151,35 +151,35 @@ namespace OpenSim.Data.PGSQL
/// <param name="asset">the asset</param> /// <param name="asset">the asset</param>
override public bool StoreAsset(AssetBase asset) override public bool StoreAsset(AssetBase asset)
{ {
string sql = string sql =
@"UPDATE assets set name = :name, description = :description, " + "\"assetType\" " + @" = :assetType, @"UPDATE assets set name = :name, description = :description, " + "\"assetType\" " + @" = :assetType,
local = :local, temporary = :temporary, creatorid = :creatorid, data = :data local = :local, temporary = :temporary, creatorid = :creatorid, data = :data
WHERE id=:id; WHERE id=:id;
INSERT INTO assets INSERT INTO assets
(id, name, description, " + "\"assetType\" " + @", local, (id, name, description, " + "\"assetType\" " + @", local,
temporary, create_time, access_time, creatorid, asset_flags, data) temporary, create_time, access_time, creatorid, asset_flags, data)
Select :id, :name, :description, :assetType, :local, Select :id, :name, :description, :assetType, :local,
:temporary, :create_time, :access_time, :creatorid, :asset_flags, :data :temporary, :create_time, :access_time, :creatorid, :asset_flags, :data
Where not EXISTS(SELECT * FROM assets WHERE id=:id) Where not EXISTS(SELECT * FROM assets WHERE id=:id)
"; ";
string assetName = asset.Name; string assetName = asset.Name;
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
{ {
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
m_log.WarnFormat( m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length); asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
{ {
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
m_log.WarnFormat( m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
@ -278,7 +278,7 @@ namespace OpenSim.Data.PGSQL
{ {
List<AssetMetadata> retList = new List<AssetMetadata>(count); List<AssetMetadata> retList = new List<AssetMetadata>(count);
string sql = @" SELECT id, name, description, " + "\"assetType\"" + @", temporary, creatorid string sql = @" SELECT id, name, description, " + "\"assetType\"" + @", temporary, creatorid
FROM assets FROM assets
order by id order by id
limit :stop limit :stop
offset :start;"; offset :start;";

View File

@ -145,7 +145,7 @@ namespace OpenSim.Data.PGSQL
updateBuilder.AppendFormat("\"{0}\" = :{0}",field); updateBuilder.AppendFormat("\"{0}\" = :{0}",field);
first = false; first = false;
cmd.Parameters.Add(m_database.CreateParameter("" + field, data.Data[field])); cmd.Parameters.Add(m_database.CreateParameter("" + field, data.Data[field]));
} }
@ -154,7 +154,7 @@ namespace OpenSim.Data.PGSQL
cmd.CommandText = updateBuilder.ToString(); cmd.CommandText = updateBuilder.ToString();
cmd.Connection = conn; cmd.Connection = conn;
cmd.Parameters.Add(m_database.CreateParameter("principalID", data.PrincipalID)); cmd.Parameters.Add(m_database.CreateParameter("principalID", data.PrincipalID));
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() < 1) if (cmd.ExecuteNonQuery() < 1)
{ {
@ -195,7 +195,7 @@ namespace OpenSim.Data.PGSQL
{ {
if (System.Environment.TickCount - m_LastExpire > 30000) if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire(); DoExpire();
string sql = "insert into tokens (uuid, token, validity) values (:principalID, :token, :lifetime)"; string sql = "insert into tokens (uuid, token, validity) values (:principalID, :token, :lifetime)";
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))

View File

@ -45,7 +45,7 @@ namespace OpenSim.Data.PGSQL
IAvatarData IAvatarData
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public PGSQLAvatarData(string connectionString, string realm) : public PGSQLAvatarData(string connectionString, string realm) :
base(connectionString, realm, "Avatar") base(connectionString, realm, "Avatar")
{ {

View File

@ -594,7 +594,7 @@ namespace OpenSim.Data.PGSQL
public bool DeleteEstate(int estateID) public bool DeleteEstate(int estateID)
{ {
// TODO: Implementation! // TODO: Implementation!
return false; return false;
} }
#endregion #endregion

View File

@ -50,7 +50,7 @@ namespace OpenSim.Data.PGSQL
} }
} }
public override bool Delete(string principalID, string friend) public override bool Delete(string principalID, string friend)
{ {
UUID princUUID = UUID.Zero; UUID princUUID = UUID.Zero;
@ -97,7 +97,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand()) using (NpgsqlCommand cmd = new NpgsqlCommand())
{ {
cmd.CommandText = String.Format("select a.*,case when b.\"Flags\" is null then '-1' else b.\"Flags\" end as \"TheirFlags\" from {0} as a " + cmd.CommandText = String.Format("select a.*,case when b.\"Flags\" is null then '-1' else b.\"Flags\" end as \"TheirFlags\" from {0} as a " +
" left join {0} as b on a.\"PrincipalID\" = b.\"Friend\" and a.\"Friend\" = b.\"PrincipalID\" " + " left join {0} as b on a.\"PrincipalID\" = b.\"Friend\" and a.\"Friend\" = b.\"PrincipalID\" " +
" where a.\"PrincipalID\" = :PrincipalID", m_Realm); " where a.\"PrincipalID\" = :PrincipalID", m_Realm);
cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID.ToString())); cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID.ToString()));
@ -111,6 +111,6 @@ namespace OpenSim.Data.PGSQL
{ {
return GetFriends(principalID); return GetFriends(principalID);
} }
} }
} }

View File

@ -64,7 +64,7 @@ namespace OpenSim.Data.PGSQL
: base(connectionString) : base(connectionString)
{ {
m_Realm = realm; m_Realm = realm;
m_ConnectionString = connectionString; m_ConnectionString = connectionString;
if (storeName != String.Empty) if (storeName != String.Empty)
@ -104,7 +104,7 @@ namespace OpenSim.Data.PGSQL
m_FieldTypes = new Dictionary<string, string>(); m_FieldTypes = new Dictionary<string, string>();
string query = string.Format(@"select column_name,data_type string query = string.Format(@"select column_name,data_type
from INFORMATION_SCHEMA.COLUMNS from INFORMATION_SCHEMA.COLUMNS
where table_name = lower('{0}'); where table_name = lower('{0}');
", m_Realm); ", m_Realm);
@ -232,7 +232,7 @@ namespace OpenSim.Data.PGSQL
if (reader == null) if (reader == null)
return new T[0]; return new T[0];
CheckColumnNames(reader); CheckColumnNames(reader);
while (reader.Read()) while (reader.Read())
{ {
@ -339,7 +339,7 @@ namespace OpenSim.Data.PGSQL
names.Add(fi.Name); names.Add(fi.Name);
values.Add(":" + fi.Name); values.Add(":" + fi.Name);
// Temporarily return more information about what field is unexpectedly null for // 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. // InventoryTransferModule or we may be required to substitute a DBNull here.
if (fi.GetValue(row) == null) if (fi.GetValue(row) == null)
throw new NullReferenceException( throw new NullReferenceException(
@ -395,11 +395,11 @@ namespace OpenSim.Data.PGSQL
} }
string where = String.Join(" AND ", terms.ToArray()); string where = String.Join(" AND ", terms.ToArray());
query.AppendFormat(" WHERE {0} ", where); query.AppendFormat(" WHERE {0} ", where);
} }
cmd.Connection = conn; cmd.Connection = conn;
cmd.CommandText = query.ToString(); cmd.CommandText = query.ToString();
conn.Open(); conn.Open();
if (cmd.ExecuteNonQuery() > 0) if (cmd.ExecuteNonQuery() > 0)
{ {
@ -416,7 +416,7 @@ namespace OpenSim.Data.PGSQL
query.Append("\") values (" + String.Join(",", values.ToArray()) + ")"); query.Append("\") values (" + String.Join(",", values.ToArray()) + ")");
cmd.Connection = conn; cmd.Connection = conn;
cmd.CommandText = query.ToString(); cmd.CommandText = query.ToString();
// m_log.WarnFormat("[PGSQLGenericTable]: Inserting into {0} sql {1}", m_Realm, cmd.CommandText); // m_log.WarnFormat("[PGSQLGenericTable]: Inserting into {0} sql {1}", m_Realm, cmd.CommandText);
if (conn.State != ConnectionState.Open) if (conn.State != ConnectionState.Open)

View File

@ -37,7 +37,7 @@ using Npgsql;
namespace OpenSim.Data.PGSQL namespace OpenSim.Data.PGSQL
{ {
public class PGSQLGroupsData : IGroupsData public class PGSQLGroupsData : IGroupsData
{ {
private PGSqlGroupsGroupsHandler m_Groups; private PGSqlGroupsGroupsHandler m_Groups;
private PGSqlGroupsMembershipHandler m_Membership; private PGSqlGroupsMembershipHandler m_Membership;
private PGSqlGroupsRolesHandler m_Roles; private PGSqlGroupsRolesHandler m_Roles;
@ -83,17 +83,17 @@ namespace OpenSim.Data.PGSQL
public GroupData[] RetrieveGroups(string pattern) public GroupData[] RetrieveGroups(string pattern)
{ {
if (string.IsNullOrEmpty(pattern)) // True for where clause if (string.IsNullOrEmpty(pattern)) // True for where clause
{ {
pattern = " 1 ORDER BY lower(\"Name\") LIMIT 100"; pattern = " 1 ORDER BY lower(\"Name\") LIMIT 100";
return m_Groups.Get(pattern); return m_Groups.Get(pattern);
} }
else else
{ {
pattern = " \"ShowInList\" = 1 AND lower(\"Name\") LIKE lower('%" + pattern + "%') ORDER BY lower(\"Name\") LIMIT 100"; pattern = " \"ShowInList\" = 1 AND lower(\"Name\") LIKE lower('%" + pattern + "%') ORDER BY lower(\"Name\") LIMIT 100";
return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern)); return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern));
} }
} }
@ -138,10 +138,10 @@ namespace OpenSim.Data.PGSQL
public bool DeleteMember(UUID groupID, string pricipalID) 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 }); new string[] { groupID.ToString(), pricipalID });
} }
public int MemberCount(UUID groupID) public int MemberCount(UUID groupID)
{ {
return (int)m_Membership.GetCount("GroupID", groupID.ToString()); return (int)m_Membership.GetCount("GroupID", groupID.ToString());
@ -173,7 +173,7 @@ namespace OpenSim.Data.PGSQL
public bool DeleteRole(UUID groupID, UUID roleID) 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() }); new string[] { groupID.ToString(), roleID.ToString() });
} }
@ -365,7 +365,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSqlGroupsGroupsHandler(string connectionString, string realm, string store) public PGSqlGroupsGroupsHandler(string connectionString, string realm, string store)
: base(connectionString, realm, store) : base(connectionString, realm, store)
{ {
} }
@ -380,7 +380,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSqlGroupsMembershipHandler(string connectionString, string realm) public PGSqlGroupsMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -395,7 +395,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSqlGroupsRolesHandler(string connectionString, string realm) public PGSqlGroupsRolesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -410,7 +410,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSqlGroupsRoleMembershipHandler(string connectionString, string realm) public PGSqlGroupsRoleMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -425,7 +425,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSqlGroupsInvitesHandler(string connectionString, string realm) public PGSqlGroupsInvitesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -436,7 +436,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand()) using (NpgsqlCommand cmd = new NpgsqlCommand())
{ {
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
@ -451,7 +451,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSqlGroupsNoticesHandler(string connectionString, string realm) public PGSqlGroupsNoticesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }
@ -462,7 +462,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand()) using (NpgsqlCommand cmd = new NpgsqlCommand())
{ {
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
@ -477,7 +477,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSqlGroupsPrincipalsHandler(string connectionString, string realm) public PGSqlGroupsPrincipalsHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty) : base(connectionString, realm, string.Empty)
{ {
} }

View File

@ -69,7 +69,7 @@ namespace OpenSim.Data.PGSQL
{ {
m_connectionString = connectionString; m_connectionString = connectionString;
database = new PGSQLManager(connectionString); database = new PGSQLManager(connectionString);
//New migrations check of store //New migrations check of store
database.CheckMigration(_migrationStore); database.CheckMigration(_migrationStore);
} }
@ -190,8 +190,8 @@ namespace OpenSim.Data.PGSQL
/* NOTE: the implementation below is very inefficient (makes a separate request to get subfolders for /* NOTE: the implementation below is very inefficient (makes a separate request to get subfolders for
* every found folder, recursively). Inventory code for other DBs has been already rewritten to get ALL * every found folder, recursively). Inventory code for other DBs has been already rewritten to get ALL
* inventory for a specific user at once. * inventory for a specific user at once.
* *
* Meanwhile, one little thing is corrected: getFolderHierarchy(UUID.Zero) doesn't make sense and should never * Meanwhile, one little thing is corrected: getFolderHierarchy(UUID.Zero) doesn't make sense and should never
* be used, so check for that and return an empty list. * be used, so check for that and return an empty list.
*/ */
@ -264,11 +264,11 @@ namespace OpenSim.Data.PGSQL
/// <param name="folder">Folder to update</param> /// <param name="folder">Folder to update</param>
public void updateInventoryFolder(InventoryFolderBase folder) public void updateInventoryFolder(InventoryFolderBase folder)
{ {
string sql = @"UPDATE inventoryfolders SET ""agentID"" = :agentID, string sql = @"UPDATE inventoryfolders SET ""agentID"" = :agentID,
""parentFolderID"" = :parentFolderID, ""parentFolderID"" = :parentFolderID,
""folderName"" = :folderName, ""folderName"" = :folderName,
type = :type, type = :type,
version = :version version = :version
WHERE folderID = :folderID"; WHERE folderID = :folderID";
string folderName = folder.Name; string folderName = folder.Name;
@ -337,7 +337,7 @@ namespace OpenSim.Data.PGSQL
cmd.Parameters.Add(database.CreateParameter("parentID", UUID.Zero)); cmd.Parameters.Add(database.CreateParameter("parentID", UUID.Zero));
conn.Open(); conn.Open();
subFolders = getFolderHierarchy(folderID, cmd); subFolders = getFolderHierarchy(folderID, cmd);
//Delete all sub-folders //Delete all sub-folders
foreach (InventoryFolderBase f in subFolders) foreach (InventoryFolderBase f in subFolders)
@ -403,7 +403,7 @@ namespace OpenSim.Data.PGSQL
} }
} }
} }
m_log.InfoFormat("[INVENTORY DB]: Found no inventory item with ID : {0}", itemID); m_log.InfoFormat("[INVENTORY DB]: Found no inventory item with ID : {0}", itemID);
return null; return null;
} }
@ -420,24 +420,24 @@ namespace OpenSim.Data.PGSQL
return; return;
} }
string sql = @"INSERT INTO inventoryitems string sql = @"INSERT INTO inventoryitems
(""inventoryID"", ""assetID"", ""assetType"", ""parentFolderID"", ""avatarID"", ""inventoryName"", (""inventoryID"", ""assetID"", ""assetType"", ""parentFolderID"", ""avatarID"", ""inventoryName"",
""inventoryDescription"", ""inventoryNextPermissions"", ""inventoryCurrentPermissions"", ""inventoryDescription"", ""inventoryNextPermissions"", ""inventoryCurrentPermissions"",
""invType"", ""creatorID"", ""inventoryBasePermissions"", ""inventoryEveryOnePermissions"", ""inventoryGroupPermissions"", ""invType"", ""creatorID"", ""inventoryBasePermissions"", ""inventoryEveryOnePermissions"", ""inventoryGroupPermissions"",
""salePrice"", ""SaleType"", ""creationDate"", ""groupID"", ""groupOwned"", flags) ""salePrice"", ""SaleType"", ""creationDate"", ""groupID"", ""groupOwned"", flags)
VALUES VALUES
(:inventoryID, :assetID, :assetType, :parentFolderID, :avatarID, :inventoryName, :inventoryDescription, (:inventoryID, :assetID, :assetType, :parentFolderID, :avatarID, :inventoryName, :inventoryDescription,
:inventoryNextPermissions, :inventoryCurrentPermissions, :invType, :creatorID, :inventoryNextPermissions, :inventoryCurrentPermissions, :invType, :creatorID,
:inventoryBasePermissions, :inventoryEveryOnePermissions, :inventoryGroupPermissions, :SalePrice, :SaleType, :inventoryBasePermissions, :inventoryEveryOnePermissions, :inventoryGroupPermissions, :SalePrice, :SaleType,
:creationDate, :groupID, :groupOwned, :flags)"; :creationDate, :groupID, :groupOwned, :flags)";
string itemName = item.Name; string itemName = item.Name;
if (item.Name.Length > 64) if (item.Name.Length > 64)
{ {
itemName = item.Name.Substring(0, 64); itemName = item.Name.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters"); m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters");
} }
string itemDesc = item.Description; string itemDesc = item.Description;
if (item.Description.Length > 128) if (item.Description.Length > 128)
{ {
@ -502,25 +502,25 @@ namespace OpenSim.Data.PGSQL
/// <param name="item">Inventory item to update</param> /// <param name="item">Inventory item to update</param>
public void updateInventoryItem(InventoryItemBase item) public void updateInventoryItem(InventoryItemBase item)
{ {
string sql = @"UPDATE inventoryitems SET ""assetID"" = :assetID, string sql = @"UPDATE inventoryitems SET ""assetID"" = :assetID,
""assetType"" = :assetType, ""assetType"" = :assetType,
""parentFolderID"" = :parentFolderID, ""parentFolderID"" = :parentFolderID,
""avatarID"" = :avatarID, ""avatarID"" = :avatarID,
""inventoryName"" = :inventoryName, ""inventoryName"" = :inventoryName,
""inventoryDescription"" = :inventoryDescription, ""inventoryDescription"" = :inventoryDescription,
""inventoryNextPermissions"" = :inventoryNextPermissions, ""inventoryNextPermissions"" = :inventoryNextPermissions,
""inventoryCurrentPermissions"" = :inventoryCurrentPermissions, ""inventoryCurrentPermissions"" = :inventoryCurrentPermissions,
""invType"" = :invType, ""invType"" = :invType,
""creatorID"" = :creatorID, ""creatorID"" = :creatorID,
""inventoryBasePermissions"" = :inventoryBasePermissions, ""inventoryBasePermissions"" = :inventoryBasePermissions,
""inventoryEveryOnePermissions"" = :inventoryEveryOnePermissions, ""inventoryEveryOnePermissions"" = :inventoryEveryOnePermissions,
""inventoryGroupPermissions"" = :inventoryGroupPermissions, ""inventoryGroupPermissions"" = :inventoryGroupPermissions,
""salePrice"" = :SalePrice, ""salePrice"" = :SalePrice,
""saleType"" = :SaleType, ""saleType"" = :SaleType,
""creationDate"" = :creationDate, ""creationDate"" = :creationDate,
""groupID"" = :groupID, ""groupID"" = :groupID,
""groupOwned"" = :groupOwned, ""groupOwned"" = :groupOwned,
flags = :flags flags = :flags
WHERE ""inventoryID"" = :inventoryID"; WHERE ""inventoryID"" = :inventoryID";
string itemName = item.Name; string itemName = item.Name;
@ -529,7 +529,7 @@ namespace OpenSim.Data.PGSQL
itemName = item.Name.Substring(0, 64); itemName = item.Name.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters on update"); m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters on update");
} }
string itemDesc = item.Description; string itemDesc = item.Description;
if (item.Description.Length > 128) if (item.Description.Length > 128)
{ {

View File

@ -326,7 +326,7 @@ namespace OpenSim.Data.PGSQL
/// <param name="migrationStore">migrationStore.</param> /// <param name="migrationStore">migrationStore.</param>
public void CheckMigration(string migrationStore) public void CheckMigration(string migrationStore)
{ {
using (NpgsqlConnection connection = new NpgsqlConnection(connectionString)) using (NpgsqlConnection connection = new NpgsqlConnection(connectionString))
{ {
connection.Open(); connection.Open();
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;

View File

@ -54,8 +54,8 @@ namespace OpenSim.Data.PGSQL
{ {
try try
{ {
cmd.CommandText = "select version from migrations where name = '" + type + "' " + cmd.CommandText = "select version from migrations where name = '" + type + "' " +
" order by version desc limit 1"; //Must be " order by version desc limit 1"; //Must be
using (NpgsqlDataReader reader = cmd.ExecuteReader()) using (NpgsqlDataReader reader = cmd.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())

View File

@ -47,7 +47,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand()) using (NpgsqlCommand cmd = new NpgsqlCommand())
{ {
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }

View File

@ -80,7 +80,7 @@ namespace OpenSim.Data.PGSQL
PresenceData[] pd = Get("SessionID", sessionID.ToString()); PresenceData[] pd = Get("SessionID", sessionID.ToString());
if (pd.Length == 0) if (pd.Length == 0)
return false; return false;
if (regionID == UUID.Zero) if (regionID == UUID.Zero)
return false; return false;
@ -103,7 +103,7 @@ namespace OpenSim.Data.PGSQL
public bool VerifyAgent(UUID agentId, UUID secureSessionID) public bool VerifyAgent(UUID agentId, UUID secureSessionID)
{ {
PresenceData[] ret = Get("SecureSessionID", secureSessionID.ToString()); PresenceData[] ret = Get("SecureSessionID", secureSessionID.ToString());
if (ret.Length == 0) if (ret.Length == 0)
return false; return false;

View File

@ -57,7 +57,7 @@ namespace OpenSim.Data.PGSQL
get { return GetType().Assembly; } get { return GetType().Assembly; }
} }
public PGSQLRegionData(string connectionString, string realm) public PGSQLRegionData(string connectionString, string realm)
{ {
m_Realm = realm; m_Realm = realm;
m_ConnectionString = connectionString; m_ConnectionString = connectionString;
@ -77,7 +77,7 @@ namespace OpenSim.Data.PGSQL
m_FieldTypes = new Dictionary<string, string>(); m_FieldTypes = new Dictionary<string, string>();
string query = string.Format(@"select column_name,data_type string query = string.Format(@"select column_name,data_type
from INFORMATION_SCHEMA.COLUMNS from INFORMATION_SCHEMA.COLUMNS
where table_name = lower('{0}'); where table_name = lower('{0}');
", m_Realm); ", m_Realm);
@ -107,7 +107,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{ {
cmd.Parameters.Add(m_database.CreateParameter("regionName", regionName)); cmd.Parameters.Add(m_database.CreateParameter("regionName", regionName));
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
conn.Open(); conn.Open();
return RunCommand(cmd); return RunCommand(cmd);
@ -134,7 +134,7 @@ namespace OpenSim.Data.PGSQL
cmd.Parameters.Add(m_database.CreateParameter("startY", startY)); cmd.Parameters.Add(m_database.CreateParameter("startY", startY));
cmd.Parameters.Add(m_database.CreateParameter("endX", endX)); cmd.Parameters.Add(m_database.CreateParameter("endX", endX));
cmd.Parameters.Add(m_database.CreateParameter("endY", endY)); cmd.Parameters.Add(m_database.CreateParameter("endY", endY));
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
conn.Open(); conn.Open();
ret = RunCommand(cmd); ret = RunCommand(cmd);
@ -167,7 +167,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{ {
cmd.Parameters.Add(m_database.CreateParameter("regionID", regionID)); cmd.Parameters.Add(m_database.CreateParameter("regionID", regionID));
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
conn.Open(); conn.Open();
List<RegionData> ret = RunCommand(cmd); List<RegionData> ret = RunCommand(cmd);
@ -196,7 +196,7 @@ namespace OpenSim.Data.PGSQL
cmd.Parameters.Add(m_database.CreateParameter("startY", qstartY)); cmd.Parameters.Add(m_database.CreateParameter("startY", qstartY));
cmd.Parameters.Add(m_database.CreateParameter("endX", endX)); cmd.Parameters.Add(m_database.CreateParameter("endX", endX));
cmd.Parameters.Add(m_database.CreateParameter("endY", endY)); cmd.Parameters.Add(m_database.CreateParameter("endY", endY));
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
conn.Open(); conn.Open();
@ -211,7 +211,7 @@ namespace OpenSim.Data.PGSQL
foreach (RegionData r in dbret) foreach (RegionData r in dbret)
{ {
if (r.posX + r.sizeX > startX && r.posX <= endX if (r.posX + r.sizeX > startX && r.posX <= endX
&& r.posY + r.sizeX > startY && r.posY <= endY) && r.posY + r.sizeY > startY && r.posY <= endY)
ret.Add(r); ret.Add(r);
} }
return ret; return ret;
@ -298,7 +298,7 @@ namespace OpenSim.Data.PGSQL
{ {
string update = "update " + m_Realm + " set \"locX\"=:posX, \"locY\"=:posY, \"sizeX\"=:sizeX, \"sizeY\"=:sizeY "; string update = "update " + m_Realm + " set \"locX\"=:posX, \"locY\"=:posY, \"sizeX\"=:sizeX, \"sizeY\"=:sizeY ";
foreach (string field in fields) foreach (string field in fields)
{ {

View File

@ -110,11 +110,11 @@ namespace OpenSim.Data.PGSQL
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
SceneObjectGroup grp = null; SceneObjectGroup grp = null;
string sql = @"SELECT *, string sql = @"SELECT *,
CASE WHEN prims.""UUID"" = prims.""SceneGroupID"" THEN 0 ELSE 1 END as sort CASE WHEN prims.""UUID"" = prims.""SceneGroupID"" THEN 0 ELSE 1 END as sort
FROM prims FROM prims
LEFT JOIN primshapes ON prims.""UUID"" = primshapes.""UUID"" LEFT JOIN primshapes ON prims.""UUID"" = primshapes.""UUID""
WHERE ""RegionUUID"" = :RegionUUID WHERE ""RegionUUID"" = :RegionUUID
ORDER BY ""SceneGroupID"" asc, sort asc, ""LinkNumber"" asc"; ORDER BY ""SceneGroupID"" asc, sort asc, ""LinkNumber"" asc";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@ -146,7 +146,7 @@ namespace OpenSim.Data.PGSQL
// There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are
// recorded as the root prim (for which the UUID must equal the persisted group UUID). In // recorded as the root prim (for which the UUID must equal the persisted group UUID). In
// this case, force the UUID to be the same as the group UUID so that at least these can be // this case, force the UUID to be the same as the group UUID so that at least these can be
// deleted (we need to change the UUID so that any other prims in the linkset can also be // deleted (we need to change the UUID so that any other prims in the linkset can also be
// deleted). // deleted).
if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero)
{ {
@ -178,7 +178,7 @@ namespace OpenSim.Data.PGSQL
objects[grp.UUID] = grp; objects[grp.UUID] = grp;
// Instead of attempting to LoadItems on every prim, // Instead of attempting to LoadItems on every prim,
// most of which probably have no items... get a // most of which probably have no items... get a
// list from DB of all prims which have items and // list from DB of all prims which have items and
// LoadItems only on those // LoadItems only on those
List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>();
@ -331,52 +331,52 @@ namespace OpenSim.Data.PGSQL
private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
{ {
//Big query to update or insert a new prim. //Big query to update or insert a new prim.
string queryPrims = @" string queryPrims = @"
UPDATE prims SET UPDATE prims SET
""CreationDate"" = :CreationDate, ""Name"" = :Name, ""Text"" = :Text, ""Description"" = :Description, ""SitName"" = :SitName, ""CreationDate"" = :CreationDate, ""Name"" = :Name, ""Text"" = :Text, ""Description"" = :Description, ""SitName"" = :SitName,
""TouchName"" = :TouchName, ""ObjectFlags"" = :ObjectFlags, ""OwnerMask"" = :OwnerMask, ""NextOwnerMask"" = :NextOwnerMask, ""GroupMask"" = :GroupMask, ""TouchName"" = :TouchName, ""ObjectFlags"" = :ObjectFlags, ""OwnerMask"" = :OwnerMask, ""NextOwnerMask"" = :NextOwnerMask, ""GroupMask"" = :GroupMask,
""EveryoneMask"" = :EveryoneMask, ""BaseMask"" = :BaseMask, ""PositionX"" = :PositionX, ""PositionY"" = :PositionY, ""PositionZ"" = :PositionZ, ""EveryoneMask"" = :EveryoneMask, ""BaseMask"" = :BaseMask, ""PositionX"" = :PositionX, ""PositionY"" = :PositionY, ""PositionZ"" = :PositionZ,
""GroupPositionX"" = :GroupPositionX, ""GroupPositionY"" = :GroupPositionY, ""GroupPositionZ"" = :GroupPositionZ, ""VelocityX"" = :VelocityX, ""GroupPositionX"" = :GroupPositionX, ""GroupPositionY"" = :GroupPositionY, ""GroupPositionZ"" = :GroupPositionZ, ""VelocityX"" = :VelocityX,
""VelocityY"" = :VelocityY, ""VelocityZ"" = :VelocityZ, ""AngularVelocityX"" = :AngularVelocityX, ""AngularVelocityY"" = :AngularVelocityY, ""VelocityY"" = :VelocityY, ""VelocityZ"" = :VelocityZ, ""AngularVelocityX"" = :AngularVelocityX, ""AngularVelocityY"" = :AngularVelocityY,
""AngularVelocityZ"" = :AngularVelocityZ, ""AccelerationX"" = :AccelerationX, ""AccelerationY"" = :AccelerationY, ""AngularVelocityZ"" = :AngularVelocityZ, ""AccelerationX"" = :AccelerationX, ""AccelerationY"" = :AccelerationY,
""AccelerationZ"" = :AccelerationZ, ""RotationX"" = :RotationX, ""RotationY"" = :RotationY, ""RotationZ"" = :RotationZ, ""RotationW"" = :RotationW, ""AccelerationZ"" = :AccelerationZ, ""RotationX"" = :RotationX, ""RotationY"" = :RotationY, ""RotationZ"" = :RotationZ, ""RotationW"" = :RotationW,
""SitTargetOffsetX"" = :SitTargetOffsetX, ""SitTargetOffsetY"" = :SitTargetOffsetY, ""SitTargetOffsetZ"" = :SitTargetOffsetZ, ""SitTargetOffsetX"" = :SitTargetOffsetX, ""SitTargetOffsetY"" = :SitTargetOffsetY, ""SitTargetOffsetZ"" = :SitTargetOffsetZ,
""SitTargetOrientW"" = :SitTargetOrientW, ""SitTargetOrientX"" = :SitTargetOrientX, ""SitTargetOrientY"" = :SitTargetOrientY, ""SitTargetOrientW"" = :SitTargetOrientW, ""SitTargetOrientX"" = :SitTargetOrientX, ""SitTargetOrientY"" = :SitTargetOrientY,
""SitTargetOrientZ"" = :SitTargetOrientZ, ""RegionUUID"" = :RegionUUID, ""CreatorID"" = :CreatorID, ""OwnerID"" = :OwnerID, ""GroupID"" = :GroupID, ""SitTargetOrientZ"" = :SitTargetOrientZ, ""RegionUUID"" = :RegionUUID, ""CreatorID"" = :CreatorID, ""OwnerID"" = :OwnerID, ""GroupID"" = :GroupID,
""LastOwnerID"" = :LastOwnerID, ""SceneGroupID"" = :SceneGroupID, ""PayPrice"" = :PayPrice, ""PayButton1"" = :PayButton1, ""PayButton2"" = :PayButton2, ""LastOwnerID"" = :LastOwnerID, ""SceneGroupID"" = :SceneGroupID, ""PayPrice"" = :PayPrice, ""PayButton1"" = :PayButton1, ""PayButton2"" = :PayButton2,
""PayButton3"" = :PayButton3, ""PayButton4"" = :PayButton4, ""LoopedSound"" = :LoopedSound, ""LoopedSoundGain"" = :LoopedSoundGain, ""PayButton3"" = :PayButton3, ""PayButton4"" = :PayButton4, ""LoopedSound"" = :LoopedSound, ""LoopedSoundGain"" = :LoopedSoundGain,
""TextureAnimation"" = :TextureAnimation, ""OmegaX"" = :OmegaX, ""OmegaY"" = :OmegaY, ""OmegaZ"" = :OmegaZ, ""CameraEyeOffsetX"" = :CameraEyeOffsetX, ""TextureAnimation"" = :TextureAnimation, ""OmegaX"" = :OmegaX, ""OmegaY"" = :OmegaY, ""OmegaZ"" = :OmegaZ, ""CameraEyeOffsetX"" = :CameraEyeOffsetX,
""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX, ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook, ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice, ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem, ""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem,
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches, ""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution
WHERE ""UUID"" = :UUID ; WHERE ""UUID"" = :UUID ;
INSERT INTO INSERT INTO
prims ( prims (
""UUID"", ""CreationDate"", ""Name"", ""Text"", ""Description"", ""SitName"", ""TouchName"", ""ObjectFlags"", ""OwnerMask"", ""NextOwnerMask"", ""GroupMask"", ""UUID"", ""CreationDate"", ""Name"", ""Text"", ""Description"", ""SitName"", ""TouchName"", ""ObjectFlags"", ""OwnerMask"", ""NextOwnerMask"", ""GroupMask"",
""EveryoneMask"", ""BaseMask"", ""PositionX"", ""PositionY"", ""PositionZ"", ""GroupPositionX"", ""GroupPositionY"", ""GroupPositionZ"", ""VelocityX"", ""EveryoneMask"", ""BaseMask"", ""PositionX"", ""PositionY"", ""PositionZ"", ""GroupPositionX"", ""GroupPositionY"", ""GroupPositionZ"", ""VelocityX"",
""VelocityY"", ""VelocityZ"", ""AngularVelocityX"", ""AngularVelocityY"", ""AngularVelocityZ"", ""AccelerationX"", ""AccelerationY"", ""AccelerationZ"", ""VelocityY"", ""VelocityZ"", ""AngularVelocityX"", ""AngularVelocityY"", ""AngularVelocityZ"", ""AccelerationX"", ""AccelerationY"", ""AccelerationZ"",
""RotationX"", ""RotationY"", ""RotationZ"", ""RotationW"", ""SitTargetOffsetX"", ""SitTargetOffsetY"", ""SitTargetOffsetZ"", ""SitTargetOrientW"", ""RotationX"", ""RotationY"", ""RotationZ"", ""RotationW"", ""SitTargetOffsetX"", ""SitTargetOffsetY"", ""SitTargetOffsetZ"", ""SitTargetOrientW"",
""SitTargetOrientX"", ""SitTargetOrientY"", ""SitTargetOrientZ"", ""RegionUUID"", ""CreatorID"", ""OwnerID"", ""GroupID"", ""LastOwnerID"", ""SceneGroupID"", ""SitTargetOrientX"", ""SitTargetOrientY"", ""SitTargetOrientZ"", ""RegionUUID"", ""CreatorID"", ""OwnerID"", ""GroupID"", ""LastOwnerID"", ""SceneGroupID"",
""PayPrice"", ""PayButton1"", ""PayButton2"", ""PayButton3"", ""PayButton4"", ""LoopedSound"", ""LoopedSoundGain"", ""TextureAnimation"", ""OmegaX"", ""PayPrice"", ""PayButton1"", ""PayButton2"", ""PayButton3"", ""PayButton4"", ""LoopedSound"", ""LoopedSoundGain"", ""TextureAnimation"", ""OmegaX"",
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"", ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"", ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"", ""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"" ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution""
) Select ) Select
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask, :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX, :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
:VelocityY, :VelocityZ, :AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, :AccelerationX, :AccelerationY, :AccelerationZ, :VelocityY, :VelocityZ, :AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, :AccelerationX, :AccelerationY, :AccelerationZ,
:RotationX, :RotationY, :RotationZ, :RotationW, :SitTargetOffsetX, :SitTargetOffsetY, :SitTargetOffsetZ, :SitTargetOrientW, :RotationX, :RotationY, :RotationZ, :RotationW, :SitTargetOffsetX, :SitTargetOffsetY, :SitTargetOffsetZ, :SitTargetOrientW,
:SitTargetOrientX, :SitTargetOrientY, :SitTargetOrientZ, :RegionUUID, :CreatorID, :OwnerID, :GroupID, :LastOwnerID, :SceneGroupID, :SitTargetOrientX, :SitTargetOrientY, :SitTargetOrientZ, :RegionUUID, :CreatorID, :OwnerID, :GroupID, :LastOwnerID, :SceneGroupID,
:PayPrice, :PayButton1, :PayButton2, :PayButton3, :PayButton4, :LoopedSound, :LoopedSoundGain, :TextureAnimation, :OmegaX, :PayPrice, :PayButton1, :PayButton2, :PayButton3, :PayButton4, :LoopedSound, :LoopedSoundGain, :TextureAnimation, :OmegaX,
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ, :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA, :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs, :ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID); where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
@ -401,26 +401,26 @@ namespace OpenSim.Data.PGSQL
private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
{ {
//Big query to or insert or update primshapes //Big query to or insert or update primshapes
string queryPrimShapes = @" string queryPrimShapes = @"
UPDATE primshapes SET UPDATE primshapes SET
""Shape"" = :Shape, ""ScaleX"" = :ScaleX, ""ScaleY"" = :ScaleY, ""ScaleZ"" = :ScaleZ, ""PCode"" = :PCode, ""PathBegin"" = :PathBegin, ""Shape"" = :Shape, ""ScaleX"" = :ScaleX, ""ScaleY"" = :ScaleY, ""ScaleZ"" = :ScaleZ, ""PCode"" = :PCode, ""PathBegin"" = :PathBegin,
""PathEnd"" = :PathEnd, ""PathScaleX"" = :PathScaleX, ""PathScaleY"" = :PathScaleY, ""PathShearX"" = :PathShearX, ""PathShearY"" = :PathShearY, ""PathEnd"" = :PathEnd, ""PathScaleX"" = :PathScaleX, ""PathScaleY"" = :PathScaleY, ""PathShearX"" = :PathShearX, ""PathShearY"" = :PathShearY,
""PathSkew"" = :PathSkew, ""PathCurve"" = :PathCurve, ""PathRadiusOffset"" = :PathRadiusOffset, ""PathRevolutions"" = :PathRevolutions, ""PathSkew"" = :PathSkew, ""PathCurve"" = :PathCurve, ""PathRadiusOffset"" = :PathRadiusOffset, ""PathRevolutions"" = :PathRevolutions,
""PathTaperX"" = :PathTaperX, ""PathTaperY"" = :PathTaperY, ""PathTwist"" = :PathTwist, ""PathTwistBegin"" = :PathTwistBegin, ""PathTaperX"" = :PathTaperX, ""PathTaperY"" = :PathTaperY, ""PathTwist"" = :PathTwist, ""PathTwistBegin"" = :PathTwistBegin,
""ProfileBegin"" = :ProfileBegin, ""ProfileEnd"" = :ProfileEnd, ""ProfileCurve"" = :ProfileCurve, ""ProfileHollow"" = :ProfileHollow, ""ProfileBegin"" = :ProfileBegin, ""ProfileEnd"" = :ProfileEnd, ""ProfileCurve"" = :ProfileCurve, ""ProfileHollow"" = :ProfileHollow,
""Texture"" = :Texture, ""ExtraParams"" = :ExtraParams, ""State"" = :State, ""Media"" = :Media ""Texture"" = :Texture, ""ExtraParams"" = :ExtraParams, ""State"" = :State, ""Media"" = :Media
WHERE ""UUID"" = :UUID ; WHERE ""UUID"" = :UUID ;
INSERT INTO INSERT INTO
primshapes ( primshapes (
""UUID"", ""Shape"", ""ScaleX"", ""ScaleY"", ""ScaleZ"", ""PCode"", ""PathBegin"", ""PathEnd"", ""PathScaleX"", ""PathScaleY"", ""PathShearX"", ""PathShearY"", ""UUID"", ""Shape"", ""ScaleX"", ""ScaleY"", ""ScaleZ"", ""PCode"", ""PathBegin"", ""PathEnd"", ""PathScaleX"", ""PathScaleY"", ""PathShearX"", ""PathShearY"",
""PathSkew"", ""PathCurve"", ""PathRadiusOffset"", ""PathRevolutions"", ""PathTaperX"", ""PathTaperY"", ""PathTwist"", ""PathTwistBegin"", ""ProfileBegin"", ""PathSkew"", ""PathCurve"", ""PathRadiusOffset"", ""PathRevolutions"", ""PathTaperX"", ""PathTaperY"", ""PathTwist"", ""PathTwistBegin"", ""ProfileBegin"",
""ProfileEnd"", ""ProfileCurve"", ""ProfileHollow"", ""Texture"", ""ExtraParams"", ""State"", ""Media"" ""ProfileEnd"", ""ProfileCurve"", ""ProfileHollow"", ""Texture"", ""ExtraParams"", ""State"", ""Media""
) )
Select Select
:UUID, :Shape, :ScaleX, :ScaleY, :ScaleZ, :PCode, :PathBegin, :PathEnd, :PathScaleX, :PathScaleY, :PathShearX, :PathShearY, :UUID, :Shape, :ScaleX, :ScaleY, :ScaleZ, :PCode, :PathBegin, :PathEnd, :PathScaleX, :PathScaleY, :PathShearX, :PathShearY,
:PathSkew, :PathCurve, :PathRadiusOffset, :PathRevolutions, :PathTaperX, :PathTaperY, :PathTwist, :PathTwistBegin, :ProfileBegin, :PathSkew, :PathCurve, :PathRadiusOffset, :PathRevolutions, :PathTaperX, :PathTaperY, :PathTwist, :PathTwistBegin, :ProfileBegin,
:ProfileEnd, :ProfileCurve, :ProfileHollow, :Texture, :ExtraParams, :State, :Media :ProfileEnd, :ProfileCurve, :ProfileHollow, :Texture, :ExtraParams, :State, :Media
where not EXISTS (SELECT ""UUID"" FROM primshapes WHERE ""UUID"" = :UUID); where not EXISTS (SELECT ""UUID"" FROM primshapes WHERE ""UUID"" = :UUID);
"; ";
@ -500,7 +500,7 @@ namespace OpenSim.Data.PGSQL
sql = sql =
@"INSERT INTO primitems ( @"INSERT INTO primitems (
""itemID"",""primID"",""assetID"",""parentFolderID"",""invType"",""assetType"",""name"",""description"",""creationDate"",""creatorID"",""ownerID"",""lastOwnerID"",""groupID"", ""itemID"",""primID"",""assetID"",""parentFolderID"",""invType"",""assetType"",""name"",""description"",""creationDate"",""creatorID"",""ownerID"",""lastOwnerID"",""groupID"",
""nextPermissions"",""currentPermissions"",""basePermissions"",""everyonePermissions"",""groupPermissions"",""flags"") ""nextPermissions"",""currentPermissions"",""basePermissions"",""everyonePermissions"",""groupPermissions"",""flags"")
VALUES (:itemID,:primID,:assetID,:parentFolderID,:invType,:assetType,:name,:description,:creationDate,:creatorID,:ownerID, VALUES (:itemID,:primID,:assetID,:parentFolderID,:invType,:assetType,:name,:description,:creationDate,:creatorID,:ownerID,
:lastOwnerID,:groupID,:nextPermissions,:currentPermissions,:basePermissions,:everyonePermissions,:groupPermissions,:flags)"; :lastOwnerID,:groupID,:nextPermissions,:currentPermissions,:basePermissions,:everyonePermissions,:groupPermissions,:flags)";
@ -538,7 +538,7 @@ namespace OpenSim.Data.PGSQL
{ {
TerrainData terrData = null; TerrainData terrData = null;
string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from terrain string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from terrain
where ""RegionUUID"" = :RegionUUID order by ""Revision"" desc limit 1; "; where ""RegionUUID"" = :RegionUUID order by ""Revision"" desc limit 1; ";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@ -577,7 +577,7 @@ namespace OpenSim.Data.PGSQL
{ {
TerrainData terrData = null; TerrainData terrData = null;
string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain
where ""RegionUUID"" = :RegionUUID; "; where ""RegionUUID"" = :RegionUUID; ";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@ -1319,7 +1319,7 @@ namespace OpenSim.Data.PGSQL
{ {
{ {
string sql = "DELETE FROM regionenvironment WHERE region_id = :region_id ;"; string sql = "DELETE FROM regionenvironment WHERE region_id = :region_id ;";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{ {
@ -1420,17 +1420,17 @@ namespace OpenSim.Data.PGSQL
{ {
//This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB
sql = sql =
@"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage @"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage
,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide ,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide
,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity ,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity
,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics ,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics
,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3 ,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3
,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw ,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw
,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se ,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se
,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit ,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit
,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position ,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz, ,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz,
""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID, ""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID,
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID ""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID
WHERE ""regionUUID"" = :regionUUID"; WHERE ""regionUUID"" = :regionUUID";
@ -1465,13 +1465,13 @@ namespace OpenSim.Data.PGSQL
elevation_2_ne,elevation_1_se,elevation_2_se,elevation_1_sw,elevation_2_sw,water_height,terrain_raise_limit, elevation_2_ne,elevation_1_se,elevation_2_se,elevation_1_sw,elevation_2_sw,water_height,terrain_raise_limit,
terrain_lower_limit,use_estate_sun,fixed_sun,sun_position,covenant,covenant_datetime,sunvectorx, sunvectory, sunvectorz, terrain_lower_limit,use_estate_sun,fixed_sun,sun_position,covenant,covenant_datetime,sunvectorx, sunvectory, sunvectorz,
""Sandbox"", loaded_creation_datetime, loaded_creation_id ""Sandbox"", loaded_creation_datetime, loaded_creation_id
) )
VALUES VALUES
(:regionUUID,:block_terraform,:block_fly,:allow_damage,:restrict_pushing,:allow_land_resell,:allow_land_join_divide, (:regionUUID,:block_terraform,:block_fly,:allow_damage,:restrict_pushing,:allow_land_resell,:allow_land_join_divide,
:block_show_in_search,:agent_limit,:object_bonus,:maturity,:disable_scripts,:disable_collisions,:disable_physics, :block_show_in_search,:agent_limit,:object_bonus,:maturity,:disable_scripts,:disable_collisions,:disable_physics,
:terrain_texture_1,:terrain_texture_2,:terrain_texture_3,:terrain_texture_4,:elevation_1_nw,:elevation_2_nw,:elevation_1_ne, :terrain_texture_1,:terrain_texture_2,:terrain_texture_3,:terrain_texture_4,:elevation_1_nw,:elevation_2_nw,:elevation_1_ne,
:elevation_2_ne,:elevation_1_se,:elevation_2_se,:elevation_1_sw,:elevation_2_sw,:water_height,:terrain_raise_limit, :elevation_2_ne,:elevation_1_se,:elevation_2_se,:elevation_1_sw,:elevation_2_sw,:water_height,:terrain_raise_limit,
:terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory, :terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory,
:sunvectorz, :Sandbox, :loaded_creation_datetime, :loaded_creation_id )"; :sunvectorz, :Sandbox, :loaded_creation_datetime, :loaded_creation_id )";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@ -1626,7 +1626,7 @@ namespace OpenSim.Data.PGSQL
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]); newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]);
newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]); newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]); newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
@ -1789,7 +1789,7 @@ namespace OpenSim.Data.PGSQL
if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "") if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "")
prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]); prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]);
else else
prim.DynAttrs = new DAMap(); prim.DynAttrs = new DAMap();
prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]); prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]);
prim.Density = Convert.ToSingle(primRow["Density"]); prim.Density = Convert.ToSingle(primRow["Density"]);
@ -2195,17 +2195,17 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches)); parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches));
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
if (prim.DynAttrs.CountNamespaces > 0) if (prim.DynAttrs.CountNamespaces > 0)
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
else else
parameters.Add(_Database.CreateParameter("DynAttrs", null)); parameters.Add(_Database.CreateParameter("DynAttrs", null));
parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType)); parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType));
parameters.Add(_Database.CreateParameter("Density", (double)prim.Density)); parameters.Add(_Database.CreateParameter("Density", (double)prim.Density));
parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier)); parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));

View File

@ -42,13 +42,13 @@ namespace OpenSim.Data.PGSQL
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public PGSQLUserAccountData(string connectionString, string realm) : public PGSQLUserAccountData(string connectionString, string realm) :
base(connectionString, realm, "UserAccount") base(connectionString, realm, "UserAccount")
{ {
} }
/* /*
private string m_Realm; private string m_Realm;
private List<string> m_ColumnNames = null; private List<string> m_ColumnNames = null;
private PGSQLManager m_database; private PGSQLManager m_database;
@ -122,7 +122,7 @@ namespace OpenSim.Data.PGSQL
{ {
cmd.Parameters.Add(m_database.CreateParameter("principalID", principalID)); cmd.Parameters.Add(m_database.CreateParameter("principalID", principalID));
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID)); cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
conn.Open(); conn.Open();
using (NpgsqlDataReader result = cmd.ExecuteReader()) using (NpgsqlDataReader result = cmd.ExecuteReader())
{ {
@ -158,8 +158,8 @@ namespace OpenSim.Data.PGSQL
} }
return null; return null;
} }
public override bool Store(UserAccountData data) public override bool Store(UserAccountData data)
{ {
if (data.Data.ContainsKey("PrincipalID")) if (data.Data.ContainsKey("PrincipalID"))
@ -214,7 +214,7 @@ namespace OpenSim.Data.PGSQL
catch (Exception e){ catch (Exception e){
m_log.ErrorFormat("[USER]: ERROR opened update user {0} ", e.Message); m_log.ErrorFormat("[USER]: ERROR opened update user {0} ", e.Message);
} }
if (conta < 1) if (conta < 1)
{ {
@ -242,14 +242,14 @@ namespace OpenSim.Data.PGSQL
} }
return true; return true;
} }
public bool Store(UserAccountData data, UUID principalID, string token) public bool Store(UserAccountData data, UUID principalID, string token)
{ {
return false; return false;
} }
public bool SetDataItem(UUID principalID, string item, string value) public bool SetDataItem(UUID principalID, string item, string value)
{ {
string sql = string.Format(@"update {0} set {1} = :{1} where ""UUID"" = :UUID", m_Realm, item); string sql = string.Format(@"update {0} set {1} = :{1} where ""UUID"" = :UUID", m_Realm, item);
@ -299,7 +299,7 @@ namespace OpenSim.Data.PGSQL
string sql = ""; string sql = "";
UUID scope_id; UUID scope_id;
UUID.TryParse(scopeID.ToString(), out scope_id); UUID.TryParse(scopeID.ToString(), out scope_id);
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand()) using (NpgsqlCommand cmd = new NpgsqlCommand())

View File

@ -412,15 +412,15 @@ namespace OpenSim.Data.PGSQL
query = @"WITH upsert AS ( query = @"WITH upsert AS (
UPDATE userpicks SET UPDATE userpicks SET
pickuuid = :PickId, creatoruuid = :CreatorId, toppick = :TopPick, parceluuid = :ParcelId, pickuuid = :PickId, creatoruuid = :CreatorId, toppick = :TopPick, parceluuid = :ParcelId,
name = :Name, description = :Desc, snapshotuuid = :SnapshotId, ""user"" = :User, name = :Name, description = :Desc, snapshotuuid = :SnapshotId, ""user"" = :User,
originalname = :Original, simname = :SimName, posglobal = :GlobalPos, originalname = :Original, simname = :SimName, posglobal = :GlobalPos,
sortorder = :SortOrder, enabled = :Enabled sortorder = :SortOrder, enabled = :Enabled
RETURNING * ) RETURNING * )
INSERT INTO userpicks (pickuuid,creatoruuid,toppick,parceluuid,name,description, INSERT INTO userpicks (pickuuid,creatoruuid,toppick,parceluuid,name,description,
snapshotuuid,""user"",originalname,simname,posglobal,sortorder,enabled) snapshotuuid,""user"",originalname,simname,posglobal,sortorder,enabled)
SELECT SELECT
:PickId,:CreatorId,:TopPick,:ParcelId,:Name,:Desc,:SnapshotId,:User, :PickId,:CreatorId,:TopPick,:ParcelId,:Name,:Desc,:SnapshotId,:User,
:Original,:SimName,:GlobalPos,:SortOrder,:Enabled :Original,:SimName,:GlobalPos,:SortOrder,:Enabled
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT * FROM upsert )"; SELECT * FROM upsert )";

View File

@ -141,7 +141,7 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand( using (NpgsqlCommand cmd = new NpgsqlCommand(
@"SELECT name, description, access_time, ""AssetType"", local, temporary, asset_flags, creatorid, data @"SELECT name, description, access_time, ""AssetType"", local, temporary, asset_flags, creatorid, data
FROM XAssetsMeta FROM XAssetsMeta
JOIN XAssetsData ON XAssetsMeta.hash = XAssetsData.Hash WHERE id=:ID", JOIN XAssetsData ON XAssetsMeta.hash = XAssetsData.Hash WHERE id=:ID",
dbcon)) dbcon))
{ {
@ -179,7 +179,7 @@ namespace OpenSim.Data.PGSQL
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length; // int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray(); asset.Data = outputStream.ToArray();
// m_log.DebugFormat( // m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength); // asset.ID, asset.Name, asset.Data.Length, compressedLength);
@ -223,16 +223,16 @@ namespace OpenSim.Data.PGSQL
{ {
assetName = asset.Name.Substring(0, 64); assetName = asset.Name.Substring(0, 64);
m_log.WarnFormat( 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); asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > 64) if (asset.Description.Length > 64)
{ {
assetDescription = asset.Description.Substring(0, 64); assetDescription = asset.Description.Substring(0, 64);
m_log.WarnFormat( 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); asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
@ -268,8 +268,8 @@ namespace OpenSim.Data.PGSQL
where not exists( Select id from XAssetsMeta where id = :ID); where not exists( Select id from XAssetsMeta where id = :ID);
update XAssetsMeta update XAssetsMeta
set id = :ID, hash = :Hash, name = :Name, description = :Description, set id = :ID, hash = :Hash, name = :Name, description = :Description,
""AssetType"" = :AssetType, local = :Local, temporary = :Temporary, create_time = :CreateTime, ""AssetType"" = :AssetType, local = :Local, temporary = :Temporary, create_time = :CreateTime,
access_time = :AccessTime, asset_flags = :AssetFlags, creatorid = :CreatorID access_time = :AccessTime, asset_flags = :AssetFlags, creatorid = :CreatorID
where id = :ID; where id = :ID;
", ",
@ -321,13 +321,13 @@ namespace OpenSim.Data.PGSQL
{ {
m_log.ErrorFormat("[XASSET DB]: PGSQL failure creating asset data {0} with name \"{1}\". Error: {2}", m_log.ErrorFormat("[XASSET DB]: PGSQL failure creating asset data {0} with name \"{1}\". Error: {2}",
asset.FullID, asset.Name, e.Message); asset.FullID, asset.Name, e.Message);
transaction.Rollback(); transaction.Rollback();
return; return;
} }
} }
transaction.Commit(); transaction.Commit();
} }
} }
@ -374,7 +374,7 @@ namespace OpenSim.Data.PGSQL
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[XASSET PGSQL DB]: Failure updating access_time for asset {0} with name {1} : {2}", "[XASSET PGSQL DB]: Failure updating access_time for asset {0} with name {1} : {2}",
assetMetadata.ID, assetMetadata.Name, e.Message); assetMetadata.ID, assetMetadata.Name, e.Message);
} }
} }
@ -519,7 +519,7 @@ namespace OpenSim.Data.PGSQL
{ {
dbcon.Open(); dbcon.Open();
using(NpgsqlCommand cmd = new NpgsqlCommand(@"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid using(NpgsqlCommand cmd = new NpgsqlCommand(@"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid
FROM XAssetsMeta FROM XAssetsMeta
LIMIT :start, :count",dbcon)) LIMIT :start, :count",dbcon))
{ {
cmd.Parameters.Add(m_database.CreateParameter("start",start)); cmd.Parameters.Add(m_database.CreateParameter("start",start));

View File

@ -174,7 +174,9 @@ namespace OpenSim.Data.PGSQL
{ {
using (NpgsqlCommand cmd = new NpgsqlCommand()) using (NpgsqlCommand cmd = new NpgsqlCommand())
{ {
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", m_Realm);
cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1");
UUID princID = UUID.Zero; UUID princID = UUID.Zero;
UUID.TryParse(principalID, out princID); UUID.TryParse(principalID, out princID);
@ -194,11 +196,18 @@ namespace OpenSim.Data.PGSQL
{ {
using (NpgsqlCommand cmd = new NpgsqlCommand()) using (NpgsqlCommand cmd = new NpgsqlCommand())
{ {
cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" /*
from inventoryitems cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions""
where ""avatarID"" = :PrincipalID from inventoryitems
and ""assetID"" = :AssetID where ""avatarID"" = :PrincipalID
and ""assetID"" = :AssetID
group by ""assetID"" ", m_Realm); group by ""assetID"" ", m_Realm);
*/
cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions""
from inventoryitems
where ""avatarID""::uuid = :PrincipalID
and ""assetID"" = :AssetID
group by ""assetID"" ");
cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID)); cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID));
cmd.Parameters.Add(m_database.CreateParameter("AssetID", assetID)); cmd.Parameters.Add(m_database.CreateParameter("AssetID", assetID));

View File

@ -363,3 +363,11 @@ CREATE TABLE IF NOT EXISTS bakedterrain(
Heightfield blob); Heightfield blob);
COMMIT; COMMIT;
:VERSION 35 #----- Add RezzerID field in table prims
BEGIN;
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
COMMIT;

View File

@ -138,7 +138,7 @@ namespace OpenSim.Data.SQLite
{ {
assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
m_log.WarnFormat( m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length); asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLite
{ {
assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
m_log.WarnFormat( m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }

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