Merge branch 'avination-current' into ubitwork

avinationmerge
UbitUmarov 2014-07-16 16:22:32 +01:00
commit 19d33c571d
53 changed files with 959 additions and 477 deletions

View File

@ -504,6 +504,30 @@ namespace OpenSim.Groups
return notice; return notice;
} }
public static Dictionary<string, object> DirGroupsReplyData(DirGroupsReplyData g)
{
Dictionary<string, object> dict = new Dictionary<string, object>();
dict["GroupID"] = g.groupID;
dict["Name"] = g.groupName;
dict["NMembers"] = g.members;
dict["SearchOrder"] = g.searchOrder;
return dict;
}
public static DirGroupsReplyData DirGroupsReplyData(Dictionary<string, object> dict)
{
DirGroupsReplyData g;
g.groupID = new UUID(dict["GroupID"].ToString());
g.groupName = dict["Name"].ToString();
Int32.TryParse(dict["NMembers"].ToString(), out g.members);
float.TryParse(dict["SearchOrder"].ToString(), out g.searchOrder);
return g;
}
} }
} }

View File

@ -39,6 +39,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Groups namespace OpenSim.Groups
{ {
@ -51,7 +52,7 @@ namespace OpenSim.Groups
private IPresenceService m_presenceService; private IPresenceService m_presenceService;
private IMessageTransferModule m_msgTransferModule = null; private IMessageTransferModule m_msgTransferModule = null;
private IUserManagement m_UserManagement = null;
private IGroupsServicesConnector m_groupData = null; private IGroupsServicesConnector m_groupData = null;
// Config Options // Config Options
@ -79,6 +80,10 @@ namespace OpenSim.Groups
private int m_usersOnlineCacheExpirySeconds = 20; private int m_usersOnlineCacheExpirySeconds = 20;
private Dictionary<UUID, List<string>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<string>>();
private Dictionary<UUID, List<string>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<string>>();
#region Region Module interfaceBase Members #region Region Module interfaceBase Members
public void Initialise(IConfigSource config) public void Initialise(IConfigSource config)
@ -124,10 +129,12 @@ namespace OpenSim.Groups
m_sceneList.Add(scene); m_sceneList.Add(scene);
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
scene.EventManager.OnClientLogin += OnClientLogin; scene.EventManager.OnClientLogin += OnClientLogin;
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
if (!m_groupMessagingEnabled) if (!m_groupMessagingEnabled)
@ -155,6 +162,17 @@ namespace OpenSim.Groups
return; return;
} }
m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
// No groups module, no groups messaging
if (m_UserManagement == null)
{
m_log.Error("[Groups.Messaging]: Could not get IUserManagement, GroupsMessagingModule is now disabled.");
RemoveRegion(scene);
return;
}
if (m_presenceService == null) if (m_presenceService == null)
m_presenceService = scene.PresenceService; m_presenceService = scene.PresenceService;
@ -227,87 +245,107 @@ namespace OpenSim.Groups
public void SendMessageToGroup(GridInstantMessage im, UUID groupID) public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
{ {
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(new UUID(im.fromAgentID).ToString(), groupID); UUID fromAgentID = new UUID(im.fromAgentID);
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), groupID);
int groupMembersCount = groupMembers.Count; int groupMembersCount = groupMembers.Count;
PresenceInfo[] onlineAgents = null;
if (m_messageOnlineAgentsOnly) // In V2 we always only send to online members.
// Sending to offline members is not an option.
string[] t1 = groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()).ToArray();
// We cache in order not to overwhlem the presence service on large grids with many groups. This does
// mean that members coming online will not see all group members until after m_usersOnlineCacheExpirySeconds has elapsed.
// (assuming this is the same across all grid simulators).
if (!m_usersOnlineCache.TryGetValue(groupID, out onlineAgents))
{ {
string[] t1 = groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()).ToArray(); onlineAgents = m_presenceService.GetAgents(t1);
m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds);
}
// We cache in order not to overwhlem the presence service on large grids with many groups. This does HashSet<string> onlineAgentsUuidSet = new HashSet<string>();
// mean that members coming online will not see all group members until after m_usersOnlineCacheExpirySeconds has elapsed. Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID));
// (assuming this is the same across all grid simulators).
PresenceInfo[] onlineAgents;
if (!m_usersOnlineCache.TryGetValue(groupID, out onlineAgents))
{
onlineAgents = m_presenceService.GetAgents(t1);
m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds);
}
HashSet<string> onlineAgentsUuidSet = new HashSet<string>(); groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID));
groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); // if (m_debugEnabled)
// if (m_debugEnabled)
// m_log.DebugFormat( // m_log.DebugFormat(
// "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online", // "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online",
// groupID, groupMembersCount, groupMembers.Count()); // groupID, groupMembersCount, groupMembers.Count());
}
else
{
if (m_debugEnabled)
m_log.DebugFormat(
"[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members",
groupID, groupMembers.Count);
}
int requestStartTick = Environment.TickCount; int requestStartTick = Environment.TickCount;
im.imSessionID = groupID.Guid;
im.fromGroup = true;
IClientAPI thisClient = GetActiveClient(fromAgentID);
if (thisClient != null)
{
im.RegionID = thisClient.Scene.RegionInfo.RegionID.Guid;
}
// Send to self first of all
im.toAgentID = im.fromAgentID;
im.fromGroup = true;
ProcessMessageFromGroupSession(im);
List<UUID> regions = new List<UUID>();
List<UUID> clientsAlreadySent = new List<UUID>();
// Then send to everybody else
foreach (GroupMembersData member in groupMembers) foreach (GroupMembersData member in groupMembers)
{ {
if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID)) if (member.AgentID.Guid == im.fromAgentID)
continue;
if (clientsAlreadySent.Contains(member.AgentID))
continue;
clientsAlreadySent.Add(member.AgentID);
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) m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID); if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID);
continue; continue;
} }
// Copy Message im.toAgentID = member.AgentID.Guid;
GridInstantMessage msg = new GridInstantMessage();
msg.imSessionID = groupID.Guid;
msg.fromAgentName = im.fromAgentName;
msg.message = im.message;
msg.dialog = im.dialog;
msg.offline = im.offline;
msg.ParentEstateID = im.ParentEstateID;
msg.Position = im.Position;
msg.RegionID = im.RegionID;
msg.binaryBucket = im.binaryBucket;
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
msg.fromAgentID = im.fromAgentID;
msg.fromGroup = true;
msg.toAgentID = member.AgentID.Guid;
IClientAPI client = GetActiveClient(member.AgentID); IClientAPI client = GetActiveClient(member.AgentID);
if (client == null) if (client == null)
{ {
// If they're not local, forward across the grid // If they're not local, forward across the grid
// BUT do it only once per region, please! Sim would be even better!
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} via Grid", member.AgentID); if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} via Grid", member.AgentID);
m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
bool reallySend = true;
if (onlineAgents != null)
{
PresenceInfo presence = onlineAgents.First(p => p.UserID == member.AgentID.ToString());
if (regions.Contains(presence.RegionID))
reallySend = false;
else
regions.Add(presence.RegionID);
}
if (reallySend)
{
// We have to create a new IM structure because the transfer module
// uses async send
GridInstantMessage msg = new GridInstantMessage(im, true);
m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
}
} }
else else
{ {
// Deliver locally, directly // Deliver locally, directly
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
ProcessMessageFromGroupSession(msg);
ProcessMessageFromGroupSession(im);
} }
} }
// Temporary for assessing how long it still takes to send messages to large online groups. if (m_debugEnabled)
if (m_messageOnlineAgentsOnly)
m_log.DebugFormat( m_log.DebugFormat(
"[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);
@ -324,9 +362,20 @@ namespace OpenSim.Groups
{ {
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: OnInstantMessage registered for {0}", client.Name); if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: OnInstantMessage registered for {0}", client.Name);
client.OnInstantMessage += OnInstantMessage; ResetAgentGroupChatSessions(client.AgentId.ToString());
} }
void OnMakeRootAgent(ScenePresence sp)
{
sp.ControllingClient.OnInstantMessage += OnInstantMessage;
}
void OnMakeChildAgent(ScenePresence sp)
{
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
}
private void OnGridInstantMessage(GridInstantMessage msg) private void OnGridInstantMessage(GridInstantMessage msg)
{ {
// The instant message module will only deliver messages of dialog types: // The instant message module will only deliver messages of dialog types:
@ -335,21 +384,91 @@ namespace OpenSim.Groups
// 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);
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, IM from region {1}",
System.Reflection.MethodBase.GetCurrentMethod().Name, regionID);
DebugGridInstantMessage(msg); DebugGridInstantMessage(msg);
} }
// Incoming message from a group // Incoming message from a group
if ((msg.fromGroup == true) && if ((msg.fromGroup == true) && (msg.dialog == (byte)InstantMessageDialog.SessionSend))
((msg.dialog == (byte)InstantMessageDialog.SessionSend)
|| (msg.dialog == (byte)InstantMessageDialog.SessionAdd)
|| (msg.dialog == (byte)InstantMessageDialog.SessionDrop)))
{ {
ProcessMessageFromGroupSession(msg); // We have to redistribute the message across all members of the group who are here
// on this sim
UUID GroupID = new UUID(msg.imSessionID);
Scene aScene = m_sceneList[0];
GridRegion regionOfOrigin = aScene.GridService.GetRegionByUUID(aScene.RegionInfo.ScopeID, regionID);
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), GroupID);
//if (m_debugEnabled)
// foreach (GroupMembersData m in groupMembers)
// m_log.DebugFormat("[Groups.Messaging]: member {0}", m.AgentID);
foreach (Scene s in m_sceneList)
{
s.ForEachScenePresence(sp =>
{
// If we got this via grid messaging, it's because the caller thinks
// that the root agent is here. We should only send the IM to root agents.
if (sp.IsChildAgent)
return;
GroupMembersData m = groupMembers.Find(gmd =>
{
return gmd.AgentID == sp.UUID;
});
if (m.AgentID == UUID.Zero)
{
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he is not a member of the group", sp.UUID);
return;
}
// Check if the user has an agent in the region where
// the IM came from, and if so, skip it, because the IM
// was already sent via that agent
if (regionOfOrigin != null)
{
AgentCircuitData aCircuit = s.AuthenticateHandler.GetAgentCircuitData(sp.UUID);
if (aCircuit != null)
{
if (aCircuit.ChildrenCapSeeds.Keys.Contains(regionOfOrigin.RegionHandle))
{
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he has an agent in region of origin", sp.UUID);
return;
}
else
{
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: not skipping agent {0}", sp.UUID);
}
}
}
UUID AgentID = sp.UUID;
msg.toAgentID = AgentID.Guid;
if (!hasAgentDroppedGroupChatSession(AgentID.ToString(), GroupID))
{
if (!hasAgentBeenInvitedToGroupChatSession(AgentID.ToString(), GroupID))
AddAgentToSession(AgentID, GroupID, msg);
else
{
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", sp.Name);
ProcessMessageFromGroupSession(msg);
}
}
});
}
} }
} }
@ -359,82 +478,40 @@ namespace OpenSim.Groups
UUID AgentID = new UUID(msg.fromAgentID); UUID AgentID = new UUID(msg.fromAgentID);
UUID GroupID = new UUID(msg.imSessionID); UUID GroupID = new UUID(msg.imSessionID);
UUID toAgentID = new UUID(msg.toAgentID);
switch (msg.dialog) switch (msg.dialog)
{ {
case (byte)InstantMessageDialog.SessionAdd: case (byte)InstantMessageDialog.SessionAdd:
m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
break; break;
case (byte)InstantMessageDialog.SessionDrop: case (byte)InstantMessageDialog.SessionDrop:
m_groupData.AgentDroppedFromGroupChatSession(AgentID.ToString(), GroupID); AgentDroppedFromGroupChatSession(AgentID.ToString(), GroupID);
break; break;
case (byte)InstantMessageDialog.SessionSend: case (byte)InstantMessageDialog.SessionSend:
if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID.ToString(), GroupID) // User hasn't dropped, so they're in the session,
&& !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID.ToString(), GroupID) // maybe we should deliver it.
) IClientAPI client = GetActiveClient(new UUID(msg.toAgentID));
if (client != null)
{ {
// Agent not in session and hasn't dropped from session // Deliver locally, directly
// Add them to the session for now, and Invite them if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} locally", client.Name);
m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
UUID toAgentID = new UUID(msg.toAgentID); if (!hasAgentDroppedGroupChatSession(toAgentID.ToString(), GroupID))
IClientAPI activeClient = GetActiveClient(toAgentID);
if (activeClient != null)
{ {
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null); if (!hasAgentBeenInvitedToGroupChatSession(toAgentID.ToString(), GroupID))
if (groupInfo != null) // This actually sends the message too, so no need to resend it
{ // with client.SendInstantMessage
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message"); AddAgentToSession(toAgentID, GroupID, msg);
else
// Force? open the group session dialog??? client.SendInstantMessage(msg);
// and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
eq.ChatterboxInvitation(
GroupID
, groupInfo.GroupName
, new UUID(msg.fromAgentID)
, msg.message
, new UUID(msg.toAgentID)
, msg.fromAgentName
, msg.dialog
, msg.timestamp
, msg.offline == 1
, (int)msg.ParentEstateID
, msg.Position
, 1
, new UUID(msg.imSessionID)
, msg.fromGroup
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
);
eq.ChatterBoxSessionAgentListUpdates(
new UUID(GroupID)
, new UUID(msg.fromAgentID)
, new UUID(msg.toAgentID)
, false //canVoiceChat
, false //isModerator
, false //text mute
);
}
} }
} }
else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID.ToString(), GroupID)) else
{ {
// User hasn't dropped, so they're in the session, m_log.WarnFormat("[Groups.Messaging]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
// maybe we should deliver it.
IClientAPI client = GetActiveClient(new UUID(msg.toAgentID));
if (client != null)
{
// Deliver locally, directly
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} locally", client.Name);
client.SendInstantMessage(msg);
}
else
{
m_log.WarnFormat("[Groups.Messaging]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
}
} }
break; break;
@ -444,6 +521,53 @@ namespace OpenSim.Groups
} }
} }
private void AddAgentToSession(UUID AgentID, UUID GroupID, GridInstantMessage msg)
{
// Agent not in session and hasn't dropped from session
// Add them to the session for now, and Invite them
AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
IClientAPI activeClient = GetActiveClient(AgentID);
if (activeClient != null)
{
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null);
if (groupInfo != null)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message");
// Force? open the group session dialog???
// and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
eq.ChatterboxInvitation(
GroupID
, groupInfo.GroupName
, new UUID(msg.fromAgentID)
, msg.message
, AgentID
, msg.fromAgentName
, msg.dialog
, msg.timestamp
, msg.offline == 1
, (int)msg.ParentEstateID
, msg.Position
, 1
, new UUID(msg.imSessionID)
, msg.fromGroup
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
);
eq.ChatterBoxSessionAgentListUpdates(
new UUID(GroupID)
, AgentID
, new UUID(msg.toAgentID)
, false //canVoiceChat
, false //isModerator
, false //text mute
);
}
}
}
#endregion #endregion
@ -469,7 +593,7 @@ namespace OpenSim.Groups
if (groupInfo != null) if (groupInfo != null)
{ {
m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
@ -495,7 +619,7 @@ namespace OpenSim.Groups
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
m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
SendMessageToGroup(im, GroupID); SendMessageToGroup(im, GroupID);
} }
@ -566,12 +690,12 @@ namespace OpenSim.Groups
{ {
if (!sp.IsChildAgent) if (!sp.IsChildAgent)
{ {
if (m_debugEnabled) m_log.WarnFormat("[Groups.Messaging]: Found root agent for client : {0}", sp.ControllingClient.Name); if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Found root agent for client : {0}", sp.ControllingClient.Name);
return sp.ControllingClient; return sp.ControllingClient;
} }
else else
{ {
if (m_debugEnabled) m_log.WarnFormat("[Groups.Messaging]: Found child agent for client : {0}", sp.ControllingClient.Name); if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Found child agent for client : {0}", sp.ControllingClient.Name);
child = sp.ControllingClient; child = sp.ControllingClient;
} }
} }
@ -590,5 +714,71 @@ namespace OpenSim.Groups
} }
#endregion #endregion
#region GroupSessionTracking
public void ResetAgentGroupChatSessions(string agentID)
{
foreach (List<string> agentList in m_groupsAgentsDroppedFromChatSession.Values)
agentList.Remove(agentID);
foreach (List<string> agentList in m_groupsAgentsInvitedToChatSession.Values)
agentList.Remove(agentID);
}
public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
{
// If we're tracking this group, and we can find them in the tracking, then they've been invited
return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID)
&& m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID);
}
public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
{
// If we're tracking drops for this group,
// and we find them, well... then they've dropped
return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)
&& m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID);
}
public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
{
if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
{
// If not in dropped list, add
if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
{
m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
}
}
}
public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
{
// Add Session Status if it doesn't exist for this session
CreateGroupChatSessionTracking(groupID);
// If nessesary, remove from dropped list
if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
{
m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
}
// Add to invited
if (!m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
m_groupsAgentsInvitedToChatSession[groupID].Add(agentID);
}
private void CreateGroupChatSessionTracking(UUID groupID)
{
if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
{
m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<string>());
m_groupsAgentsInvitedToChatSession.Add(groupID, new List<string>());
}
}
#endregion
} }
} }

View File

@ -141,6 +141,8 @@ 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);
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnMakeRootAgent += OnMakeRoot;
scene.EventManager.OnMakeChildAgent += OnMakeChild;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
// The InstantMessageModule itself doesn't do this, // The InstantMessageModule itself doesn't do this,
// so lets see if things explode if we don't do it // so lets see if things explode if we don't do it
@ -194,6 +196,8 @@ 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);
scene.EventManager.OnNewClient -= OnNewClient; scene.EventManager.OnNewClient -= OnNewClient;
scene.EventManager.OnMakeRootAgent -= OnMakeRoot;
scene.EventManager.OnMakeChildAgent -= OnMakeChild;
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
lock (m_sceneList) lock (m_sceneList)
@ -232,16 +236,29 @@ 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);
client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnDirFindQuery += OnDirFindQuery;
client.OnRequestAvatarProperties += OnRequestAvatarProperties; client.OnRequestAvatarProperties += OnRequestAvatarProperties;
}
private void OnMakeRoot(ScenePresence sp)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
// Used for Notices and Group Invites/Accept/Reject // Used for Notices and Group Invites/Accept/Reject
client.OnInstantMessage += OnInstantMessage; sp.ControllingClient.OnInstantMessage += OnInstantMessage;
// Send client their groups information. // Send client their groups information.
SendAgentGroupDataUpdate(client, client.AgentId); SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID);
}
private void OnMakeChild(ScenePresence sp)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
// Used for Notices and Group Invites/Accept/Reject
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
} }
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
@ -287,21 +304,6 @@ namespace OpenSim.Groups
} }
*/ */
void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
{
if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
{
if (m_debugEnabled)
m_log.DebugFormat(
"[Groups]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})",
System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);
// TODO: This currently ignores pretty much all the query flags including Mature and sort order
remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), queryText).ToArray());
}
}
private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
{ {
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);
@ -347,7 +349,7 @@ 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);
m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog); //m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
// Group invitations // Group invitations
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
{ {
@ -465,12 +467,12 @@ namespace OpenSim.Groups
} }
// Send notice out to everyone that wants notices // Send notice out to everyone that wants notices
// Build notice IIM
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
{ {
if (member.AcceptNotices) if (member.AcceptNotices)
{ {
// Build notice IIM, one of reach, because the sending may be async
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
msg.toAgentID = member.AgentID.Guid; msg.toAgentID = member.AgentID.Guid;
OutgoingInstantMessage(msg, member.AgentID); OutgoingInstantMessage(msg, member.AgentID);
} }
@ -485,7 +487,7 @@ namespace OpenSim.Groups
return; return;
//// 16 bytes are the UUID. Maybe. //// 16 bytes are the UUID. Maybe.
UUID folderID = new UUID(im.binaryBucket, 0); // UUID folderID = new UUID(im.binaryBucket, 0);
UUID noticeID = new UUID(im.imSessionID); UUID noticeID = new UUID(im.imSessionID);
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID); GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID);
@ -766,14 +768,17 @@ namespace OpenSim.Groups
remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group."); remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group.");
return UUID.Zero; return UUID.Zero;
} }
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
} }
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)
money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
// Update the founder with new group information. // Update the founder with new group information.
@ -904,23 +909,7 @@ namespace OpenSim.Groups
{ {
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called for notice {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, groupNoticeID); if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called for notice {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, groupNoticeID);
//GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), data.GroupID, null);
GridInstantMessage msg = CreateGroupNoticeIM(remoteClient.AgentId, groupNoticeID, (byte)InstantMessageDialog.GroupNoticeRequested); GridInstantMessage msg = CreateGroupNoticeIM(remoteClient.AgentId, groupNoticeID, (byte)InstantMessageDialog.GroupNoticeRequested);
//GridInstantMessage msg = new GridInstantMessage();
//msg.imSessionID = UUID.Zero.Guid;
//msg.fromAgentID = data.GroupID.Guid;
//msg.toAgentID = GetRequestingAgentID(remoteClient).Guid;
//msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
//msg.fromAgentName = "Group Notice : " + groupInfo == null ? "Unknown" : groupInfo.GroupName;
//msg.message = data.noticeData.Subject + "|" + data.Message;
//msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNoticeRequested;
//msg.fromGroup = true;
//msg.offline = (byte)0;
//msg.ParentEstateID = 0;
//msg.Position = Vector3.Zero;
//msg.RegionID = UUID.Zero.Guid;
//msg.binaryBucket = data.BinaryBucket;
OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient));
} }
@ -1002,6 +991,10 @@ namespace OpenSim.Groups
// Should this send updates to everyone in the group? // Should this send updates to everyone in the group?
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
if (reason != string.Empty)
// A warning
remoteClient.SendAlertMessage("Warning: " + reason);
} }
else else
remoteClient.SendJoinGroupReply(groupID, false); remoteClient.SendJoinGroupReply(groupID, false);
@ -1186,6 +1179,11 @@ namespace OpenSim.Groups
} }
} }
public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query)
{
return m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), query);
}
#endregion #endregion
#region Client/Update Tools #region Client/Update Tools
@ -1225,12 +1223,16 @@ namespace OpenSim.Groups
{ {
if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
// NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
// to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
return;
OSDArray AgentData = new OSDArray(1); OSDArray AgentData = new OSDArray(1);
OSDMap AgentDataMap = new OSDMap(1); OSDMap AgentDataMap = new OSDMap(1);
AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID)); AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
AgentData.Add(AgentDataMap); AgentData.Add(AgentDataMap);
OSDArray GroupData = new OSDArray(data.Length); OSDArray GroupData = new OSDArray(data.Length);
OSDArray NewGroupData = new OSDArray(data.Length); OSDArray NewGroupData = new OSDArray(data.Length);
@ -1276,8 +1278,7 @@ namespace OpenSim.Groups
if (queue != null) if (queue != null)
{ {
queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
} }
} }
private void SendScenePresenceUpdate(UUID AgentID, string Title) private void SendScenePresenceUpdate(UUID AgentID, string Title)
@ -1339,6 +1340,7 @@ namespace OpenSim.Groups
GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID);
SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
//remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); //remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
if (remoteClient.AgentId == dataForAgentID) if (remoteClient.AgentId == dataForAgentID)
remoteClient.RefreshGroupMembership(); remoteClient.RefreshGroupMembership();
@ -1399,19 +1401,18 @@ 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);
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID); string firstname = "Unknown", lastname = "Unknown";
string firstname, lastname; string name = m_UserManagement.GetUserName(dataForAgentID);
if (account != null) if (!string.IsNullOrEmpty(name))
{ {
firstname = account.FirstName; string[] parts = name.Split(new char[] { ' ' });
lastname = account.LastName; if (parts.Length >= 2)
{
firstname = parts[0];
lastname = parts[1];
}
} }
else
{
firstname = "Unknown";
lastname = "Unknown";
}
remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname,
lastname, activeGroupPowers, activeGroupName, lastname, activeGroupPowers, activeGroupName,
activeGroupTitle); activeGroupTitle);

View File

@ -186,7 +186,6 @@ namespace OpenSim.Groups
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);
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,
@ -255,7 +254,10 @@ namespace OpenSim.Groups
{ {
string url = string.Empty, gname = string.Empty; string url = string.Empty, gname = string.Empty;
if (IsLocal(GroupID, out url, out gname)) if (IsLocal(GroupID, out url, out gname))
return m_LocalGroupsConnector.GetGroupMembers(AgentUUI(RequestingAgentID), GroupID); {
string agentID = AgentUUI(RequestingAgentID);
return m_LocalGroupsConnector.GetGroupMembers(agentID, GroupID);
}
else if (!string.IsNullOrEmpty(url)) else if (!string.IsNullOrEmpty(url))
{ {
ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID); ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID);
@ -397,17 +399,21 @@ namespace OpenSim.Groups
if (success) if (success)
{ {
// Here we always return true. The user has been added to the local group,
// independent of whether the remote operation succeeds or not
url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI"); url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI");
if (url == string.Empty) if (url == string.Empty)
{ {
reason = "User doesn't have a groups server"; reason = "You don't have an accessible groups server in your home world. You membership to this group in only within this grid.";
return false; return true;
} }
GroupsServiceHGConnector c = GetConnector(url); GroupsServiceHGConnector c = GetConnector(url);
if (c != null) if (c != null)
return c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason); c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason);
return true;
} }
return false;
} }
} }
else if (m_UserManagement.IsLocalGridUser(uid)) // local user else if (m_UserManagement.IsLocalGridUser(uid)) // local user
@ -544,7 +550,6 @@ namespace OpenSim.Groups
List<string> urls = new List<string>(); List<string> urls = new List<string>();
foreach (GroupMembersData m in members) foreach (GroupMembersData m in members)
{ {
UUID userID = UUID.Zero;
if (!m_UserManagement.IsLocalGridUser(m.AgentID)) if (!m_UserManagement.IsLocalGridUser(m.AgentID))
{ {
string gURL = m_UserManagement.GetUserServerURL(m.AgentID, "GroupsServerURI"); string gURL = m_UserManagement.GetUserServerURL(m.AgentID, "GroupsServerURI");
@ -592,28 +597,6 @@ namespace OpenSim.Groups
return m_LocalGroupsConnector.GetGroupNotices(AgentUUI(RequestingAgentID), GroupID); return m_LocalGroupsConnector.GetGroupNotices(AgentUUI(RequestingAgentID), GroupID);
} }
public void ResetAgentGroupChatSessions(string agentID)
{
}
public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
{
return false;
}
public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
{
return false;
}
public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
{
}
public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
{
}
#endregion #endregion
#region hypergrid groups #region hypergrid groups
@ -685,6 +668,9 @@ namespace OpenSim.Groups
{ {
serviceLocation = string.Empty; serviceLocation = string.Empty;
name = string.Empty; name = string.Empty;
if (groupID.Equals(UUID.Zero))
return true;
ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty); ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty);
if (group == null) if (group == null)
{ {

View File

@ -47,7 +47,6 @@ namespace OpenSim.Groups
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HGGroupsService m_GroupsService; private HGGroupsService m_GroupsService;
private string m_HomeURI = string.Empty;
private string m_ConfigName = "Groups"; private string m_ConfigName = "Groups";
// Called by Robust shell // Called by Robust shell
@ -209,7 +208,6 @@ namespace OpenSim.Groups
UUID groupID = new UUID(request["GroupID"].ToString()); UUID groupID = new UUID(request["GroupID"].ToString());
string agentID = request["AgentID"].ToString(); string agentID = request["AgentID"].ToString();
string token = request["AccessToken"].ToString(); string token = request["AccessToken"].ToString();
string reason = string.Empty;
m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token); m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token);
} }

View File

@ -92,12 +92,6 @@ namespace OpenSim.Groups
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);
void ResetAgentGroupChatSessions(string agentID);
bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID);
bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID);
void AgentDroppedFromGroupChatSession(string agentID, UUID groupID);
void AgentInvitedToGroupChatSession(string agentID, UUID groupID);
} }
public class GroupInviteInfo public class GroupInviteInfo

View File

@ -320,28 +320,6 @@ namespace OpenSim.Groups
return m_GroupsService.GetGroupNotices(RequestingAgentID, GroupID); return m_GroupsService.GetGroupNotices(RequestingAgentID, GroupID);
} }
public void ResetAgentGroupChatSessions(string agentID)
{
}
public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
{
return false;
}
public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
{
return false;
}
public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
{
}
public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
{
}
#endregion #endregion
} }
} }

View File

@ -133,6 +133,36 @@ namespace OpenSim.Groups
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]); return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
} }
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
{
List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
if (string.IsNullOrEmpty(query))
return hits;
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["Query"] = query;
sendData["RequestingAgentID"] = RequestingAgentID;
Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);
if (ret == null)
return hits;
if (!ret.ContainsKey("RESULT"))
return hits;
if (ret["RESULT"].ToString() == "NULL")
return hits;
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
{
DirGroupsReplyData m = GroupsDataUtils.DirGroupsReplyData((Dictionary<string, object>)v);
hits.Add(m);
}
return hits;
}
public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
@ -226,6 +256,7 @@ namespace OpenSim.Groups
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["GroupID"] = GroupID.ToString(); sendData["GroupID"] = GroupID.ToString();
sendData["RequestingAgentID"] = RequestingAgentID; sendData["RequestingAgentID"] = RequestingAgentID;
Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData); Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData);
if (ret == null) if (ret == null)

View File

@ -199,7 +199,7 @@ namespace OpenSim.Groups
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search) public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
{ {
// TODO! // TODO!
return new List<DirGroupsReplyData>(); return m_GroupsService.FindGroups(RequestingAgentID, search);
} }
public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
@ -406,28 +406,6 @@ namespace OpenSim.Groups
}); });
} }
public void ResetAgentGroupChatSessions(string agentID)
{
}
public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
{
return false;
}
public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
{
return false;
}
public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
{
}
public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
{
}
#endregion #endregion
} }

View File

@ -133,6 +133,8 @@ namespace OpenSim.Groups
return HandleAddNotice(request); return HandleAddNotice(request);
case "GETNOTICES": case "GETNOTICES":
return HandleGetNotices(request); return HandleGetNotices(request);
case "FINDGROUPS":
return HandleFindGroups(request);
} }
m_log.DebugFormat("[GROUPS HANDLER]: unknown method request: {0}", method); m_log.DebugFormat("[GROUPS HANDLER]: unknown method request: {0}", method);
} }
@ -170,11 +172,16 @@ namespace OpenSim.Groups
} }
grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID); if (grec.GroupID != UUID.Zero)
if (grec == null) {
NullResult(result, "Internal Error"); grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID);
if (grec == null)
NullResult(result, "Internal Error");
else
result["RESULT"] = GroupsDataUtils.GroupRecord(grec);
}
else else
result["RESULT"] = GroupsDataUtils.GroupRecord(grec); NullResult(result, reason);
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
@ -264,7 +271,6 @@ namespace OpenSim.Groups
UUID groupID = new UUID(request["GroupID"].ToString()); UUID groupID = new UUID(request["GroupID"].ToString());
string agentID = request["AgentID"].ToString(); string agentID = request["AgentID"].ToString();
string requestingAgentID = request["RequestingAgentID"].ToString(); string requestingAgentID = request["RequestingAgentID"].ToString();
string reason = string.Empty;
m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID); m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID);
} }
@ -495,7 +501,6 @@ namespace OpenSim.Groups
else else
{ {
string op = request["OP"].ToString(); string op = request["OP"].ToString();
string reason = string.Empty;
bool success = false; bool success = false;
if (op == "ADD") if (op == "ADD")
@ -563,7 +568,6 @@ namespace OpenSim.Groups
else else
{ {
string op = request["OP"].ToString(); string op = request["OP"].ToString();
string reason = string.Empty;
if (op == "GROUP") if (op == "GROUP")
{ {
@ -626,7 +630,6 @@ namespace OpenSim.Groups
else else
{ {
string op = request["OP"].ToString(); string op = request["OP"].ToString();
string reason = string.Empty;
if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID")) if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID"))
{ {
@ -739,6 +742,32 @@ namespace OpenSim.Groups
return Util.UTF8NoBomEncoding.GetBytes(xmlString); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
} }
byte[] HandleFindGroups(Dictionary<string, object> request)
{
Dictionary<string, object> result = new Dictionary<string, object>();
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("Query"))
NullResult(result, "Bad network data");
List<DirGroupsReplyData> hits = m_GroupsService.FindGroups(request["RequestingAgentID"].ToString(), request["Query"].ToString());
if (hits == null || (hits != null && hits.Count == 0))
NullResult(result, "No hits");
else
{
Dictionary<string, object> dict = new Dictionary<string, object>();
int i = 0;
foreach (DirGroupsReplyData n in hits)
dict["n-" + i++] = GroupsDataUtils.DirGroupsReplyData(n);
result["RESULT"] = dict;
}
string xmlString = ServerUtils.BuildXmlResponse(result);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
}
#region Helpers #region Helpers

View File

@ -53,7 +53,7 @@ namespace OpenSim.Groups
private ForeignImporter m_ForeignImporter; private ForeignImporter m_ForeignImporter;
private Dictionary<string, bool> m_ActiveRequests = new Dictionary<string, bool>(); private Dictionary<string, bool> m_ActiveRequests = new Dictionary<string, bool>();
private const int GROUPS_CACHE_TIMEOUT = 5 * 60; // 5 minutes private const int GROUPS_CACHE_TIMEOUT = 1 * 60; // 1 minutes
// This all important cache cahces objects of different types: // This all important cache cahces objects of different types:
// group-<GroupID> or group-<Name> => ExtendedGroupRecord // group-<GroupID> or group-<Name> => ExtendedGroupRecord
@ -209,13 +209,10 @@ namespace OpenSim.Groups
public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d) public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d)
{ {
GroupMembershipData activeGroup = d(); GroupMembershipData activeGroup = d();
if (activeGroup != null) string cacheKey = "active-" + AgentID.ToString();
{ lock (m_Cache)
string cacheKey = "active-" + AgentID.ToString(); if (m_Cache.Contains(cacheKey))
lock (m_Cache) m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT);
if (m_Cache.Contains(cacheKey))
m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT);
}
} }
public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d) public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d)

View File

@ -130,6 +130,13 @@ namespace OpenSim.Groups
{ {
reason = string.Empty; reason = string.Empty;
// Check if the group already exists
if (m_Database.RetrieveGroup(name) != null)
{
reason = "A group with that name already exists";
return UUID.Zero;
}
// Create the group // Create the group
GroupData data = new GroupData(); GroupData data = new GroupData();
data.GroupID = UUID.Random(); data.GroupID = UUID.Random();
@ -248,13 +255,20 @@ namespace OpenSim.Groups
return members; return members;
List<RoleData> rolesList = new List<RoleData>(roles); List<RoleData> rolesList = new List<RoleData>(roles);
// Is the requester a member of the group? // Check visibility?
bool isInGroup = false; // When we don't want to check visibility, we pass it "all" as the requestingAgentID
if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null) bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
isInGroup = true;
if (!isInGroup) // reduce the roles to the visible ones if (checkVisibility)
rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0); {
// Is the requester a member of the group?
bool isInGroup = false;
if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null)
isInGroup = true;
if (!isInGroup) // reduce the roles to the visible ones
rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0);
}
MembershipData[] datas = m_Database.RetrieveMembers(GroupID); MembershipData[] datas = m_Database.RetrieveMembers(GroupID);
if (datas == null || (datas != null && datas.Length == 0)) if (datas == null || (datas != null && datas.Length == 0))
@ -723,12 +737,12 @@ namespace OpenSim.Groups
#region Actions without permission checks #region Actions without permission checks
private void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) protected void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
{ {
_AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, string.Empty); _AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, string.Empty);
} }
public void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID) protected void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
{ {
// 1. Delete membership // 1. Delete membership
m_Database.DeleteMember(GroupID, AgentID); m_Database.DeleteMember(GroupID, AgentID);
@ -780,7 +794,7 @@ namespace OpenSim.Groups
} }
private bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add) protected bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add)
{ {
RoleData data = m_Database.RetrieveRole(groupID, roleID); RoleData data = m_Database.RetrieveRole(groupID, roleID);
@ -810,12 +824,12 @@ namespace OpenSim.Groups
return m_Database.StoreRole(data); return m_Database.StoreRole(data);
} }
private void _RemoveGroupRole(UUID groupID, UUID roleID) protected void _RemoveGroupRole(UUID groupID, UUID roleID)
{ {
m_Database.DeleteRole(groupID, roleID); m_Database.DeleteRole(groupID, roleID);
} }
private void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) protected void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
{ {
RoleMembershipData data = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); RoleMembershipData data = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
if (data != null) if (data != null)
@ -840,7 +854,7 @@ namespace OpenSim.Groups
} }
private List<GroupRolesData> _GetGroupRoles(UUID groupID) protected List<GroupRolesData> _GetGroupRoles(UUID groupID)
{ {
List<GroupRolesData> roles = new List<GroupRolesData>(); List<GroupRolesData> roles = new List<GroupRolesData>();
@ -865,7 +879,7 @@ namespace OpenSim.Groups
return roles; return roles;
} }
private List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup) protected List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup)
{ {
List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>(); List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>();

View File

@ -458,8 +458,6 @@ namespace OpenSim.Data.MySQL
if (prim.ParentUUID == UUID.Zero) if (prim.ParentUUID == UUID.Zero)
{ {
objects[prim.UUID] = new SceneObjectGroup(prim); objects[prim.UUID] = new SceneObjectGroup(prim);
if (prim.KeyframeMotion != null)
prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
} }
} }

View File

@ -732,9 +732,12 @@ namespace OpenSim.Data.SQLite
} }
SceneObjectGroup group = new SceneObjectGroup(prim); SceneObjectGroup group = new SceneObjectGroup(prim);
createdObjects.Add(group.UUID, group); createdObjects.Add(group.UUID, group);
retvals.Add(group); retvals.Add(group);
LoadItems(prim); LoadItems(prim);
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -53,6 +53,24 @@ namespace OpenSim.Framework
binaryBucket = new byte[0]; binaryBucket = new byte[0];
} }
public GridInstantMessage(GridInstantMessage im, bool addTimestamp)
{
fromAgentID = im.fromAgentID;
fromAgentName = im.fromAgentName;
toAgentID = im.toAgentID;
dialog = im.dialog;
fromGroup = im.fromGroup;
message = im.message;
imSessionID = im.imSessionID;
offline = im.offline;
Position = im.Position;
binaryBucket = im.binaryBucket;
RegionID = im.RegionID;
if (addTimestamp)
timestamp = (uint)Util.UnixTimeSinceEpoch();
}
public GridInstantMessage(IScene scene, UUID _fromAgentID, public GridInstantMessage(IScene scene, UUID _fromAgentID,
string _fromAgentName, UUID _toAgentID, string _fromAgentName, UUID _toAgentID,
byte _dialog, bool _fromGroup, string _message, byte _dialog, bool _fromGroup, string _message,

View File

@ -33,7 +33,7 @@ namespace OpenSim.Framework
public interface IMoneyModule public interface IMoneyModule
{ {
bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
int amount, UUID txn); int amount, UUID txn, out string reason);
int GetBalance(UUID agentID); int GetBalance(UUID agentID);
bool UploadCovered(UUID agentID, int amount); bool UploadCovered(UUID agentID, int amount);

View File

@ -41,6 +41,7 @@ namespace OpenSim.Framework
// "Out of band" managemnt https // "Out of band" managemnt https
public bool ssl_listener = false; public bool ssl_listener = false;
public bool ssl_external = false;
public uint https_port = 0; public uint https_port = 0;
public string cert_path = String.Empty; public string cert_path = String.Empty;
public string cert_pass = String.Empty; public string cert_pass = String.Empty;
@ -64,6 +65,7 @@ namespace OpenSim.Framework
// "Out of band management https" // "Out of band management https"
ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false);
ssl_external = config.Configs["Network"].GetBoolean("https_external",false);
if( ssl_listener) if( ssl_listener)
{ {
cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); cert_path = config.Configs["Network"].GetString("cert_path",String.Empty);

View File

@ -224,10 +224,12 @@ namespace OpenSim.Framework
// //
public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
{ {
// m_configSource = configSource; XmlElement elem = (XmlElement)xmlNode;
configMember = string name = elem.GetAttribute("Name");
new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); string xmlstr = "<Nini>" + xmlNode.OuterXml + "</Nini>";
configMember.performConfigurationRetrieve(); XmlConfigSource source = new XmlConfigSource(XmlReader.Create(new StringReader(xmlstr)));
ReadNiniConfig(source, name);
m_serverURI = string.Empty; m_serverURI = string.Empty;
} }

View File

@ -93,8 +93,8 @@ namespace OpenSim.Framework.RegionLoader.Web
xmlSource.Length); xmlSource.Length);
XmlDocument xmlDoc = new XmlDocument(); XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlSource); xmlDoc.LoadXml(xmlSource);
if (xmlDoc.FirstChild.Name == "Regions") if (xmlDoc.FirstChild.Name == "Nini")
{ {
regionCount = xmlDoc.FirstChild.ChildNodes.Count; regionCount = xmlDoc.FirstChild.ChildNodes.Count;
if (regionCount > 0) if (regionCount > 0)

View File

@ -195,7 +195,9 @@ namespace OpenSim
m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true); m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true);
string permissionModules = startupConfig.GetString("permissionmodules", "DefaultPermissionsModule"); string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules",
new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
m_permsModules = new List<string>(permissionModules.Split(',')); m_permsModules = new List<string>(permissionModules.Split(','));
} }
@ -392,29 +394,19 @@ namespace OpenSim
} }
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing..."); else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
// XPTO: Fix this if (m_securePermissionsLoading)
// if (m_securePermissionsLoading) {
// { foreach (string s in m_permsModules)
// foreach (string s in m_permsModules) {
// { if (!scene.RegionModules.ContainsKey(s))
// if (!scene.RegionModules.ContainsKey(s)) {
// { m_log.Fatal("[MODULES]: Required module " + s + " not found.");
// bool found = false; Environment.Exit(0);
// foreach (IRegionModule m in modules) }
// { }
// if (m.Name == s)
// { m_log.InfoFormat("[SCENE]: Secure permissions loading enabled, modules loaded: {0}", String.Join(" ", m_permsModules.ToArray()));
// found = true; }
// }
// }
// if (!found)
// {
// m_log.Fatal("[MODULES]: Required module " + s + " not found.");
// Environment.Exit(0);
// }
// }
// }
// }
scene.SetModuleInterfaces(); scene.SetModuleInterfaces();
// First Step of bootreport sequence // First Step of bootreport sequence

View File

@ -990,13 +990,20 @@ namespace OpenSim.Region.ClientStack.Linden
else else
prim.Name = assetName + "#" + i.ToString(); prim.Name = assetName + "#" + i.ToString();
prim.EveryoneMask = 0;
prim.GroupMask = 0;
if (restrictPerms) if (restrictPerms)
{ {
prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
prim.EveryoneMask = 0;
prim.GroupMask = 0;
prim.NextOwnerMask = 0;
prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
prim.NextOwnerMask = 0;
}
else
{
prim.BaseMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
prim.OwnerMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
prim.NextOwnerMask = (uint)PermissionMask.Transfer;
} }
if(istest) if(istest)
@ -1099,21 +1106,17 @@ namespace OpenSim.Region.ClientStack.Linden
if (restrictPerms) if (restrictPerms)
{ {
item.CurrentPermissions
= (uint)(PermissionMask.Move | PermissionMask.Modify);
item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
item.EveryOnePermissions = 0; item.EveryOnePermissions = 0;
item.NextPermissions = 0; item.NextPermissions = 0;
} }
else else
{ {
item.CurrentPermissions
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
item.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
item.EveryOnePermissions = 0; item.EveryOnePermissions = 0;
item.NextPermissions = (uint)PermissionMask.All; item.NextPermissions = (uint)PermissionMask.Transfer;
} }
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();

View File

@ -77,6 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
private static Thread[] m_workerThreads = null; private static Thread[] m_workerThreads = null;
private string m_Url = "localhost";
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
new OpenMetaverse.BlockingQueue<aPollRequest>(); new OpenMetaverse.BlockingQueue<aPollRequest>();
@ -86,6 +88,9 @@ namespace OpenSim.Region.ClientStack.Linden
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig config = source.Configs["ClientStack.LindenCaps"];
if (config != null)
m_Url = config.GetString("Cap_GetTexture", "localhost");
} }
public void AddRegion(Scene s) public void AddRegion(Scene s)
@ -343,27 +348,34 @@ namespace OpenSim.Region.ClientStack.Linden
private void RegisterCaps(UUID agentID, Caps caps) private void RegisterCaps(UUID agentID, Caps caps)
{ {
string capUrl = "/CAPS/" + UUID.Random() + "/"; if (m_Url == "localhost")
// Register this as a poll service
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
args.Type = PollServiceEventArgs.EventType.Texture;
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
string hostName = m_scene.RegionInfo.ExternalHostName;
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
string protocol = "http";
if (MainServer.Instance.UseSSL)
{ {
hostName = MainServer.Instance.SSLCommonName; string capUrl = "/CAPS/" + UUID.Random() + "/";
port = MainServer.Instance.SSLPort;
protocol = "https"; // Register this as a poll service
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
args.Type = PollServiceEventArgs.EventType.Texture;
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
string hostName = m_scene.RegionInfo.ExternalHostName;
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
string protocol = "http";
if (MainServer.Instance.UseSSL)
{
hostName = MainServer.Instance.SSLCommonName;
port = MainServer.Instance.SSLPort;
protocol = "https";
}
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
m_pollservices[agentID] = args;
m_capsDict[agentID] = capUrl;
}
else
{
caps.RegisterHandler("GetTexture", m_Url);
} }
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
m_pollservices[agentID] = args;
m_capsDict[agentID] = capUrl;
} }
private void DeregisterCaps(UUID agentID, Caps caps) private void DeregisterCaps(UUID agentID, Caps caps)

View File

@ -2233,9 +2233,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
{ {
m_activeGroupID = activegroupid; if (agentid == AgentId)
m_activeGroupName = groupname; {
m_activeGroupPowers = grouppowers; m_activeGroupID = activegroupid;
m_activeGroupName = groupname;
m_activeGroupPowers = grouppowers;
}
AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid;
@ -3933,6 +3936,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
part.Shape.ProfileHollow = 27500; part.Shape.ProfileHollow = 27500;
} }
} }
else if (update.Entity is ScenePresence)
{
ScenePresence presence = (ScenePresence)update.Entity;
// If ParentUUID is not UUID.Zero and ParentID is 0, this
// avatar is in the process of crossing regions while
// sat on an object. In this state, we don't want any
// updates because they will visually orbit the avatar.
// Update will be forced once crossing is completed anyway.
if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0)
continue;
}
++updatesThisCall; ++updatesThisCall;

View File

@ -100,13 +100,25 @@ namespace OpenSim.Region.ClientStack
// "OOB" Server // "OOB" Server
if (m_networkServersInfo.ssl_listener) if (m_networkServersInfo.ssl_listener)
{ {
BaseHttpServer server = new BaseHttpServer( if (!m_networkServersInfo.ssl_external)
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, {
m_networkServersInfo.cert_pass); BaseHttpServer server = new BaseHttpServer(
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
m_networkServersInfo.cert_pass);
m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
MainServer.AddHttpServer(server); MainServer.AddHttpServer(server);
server.Start(); server.Start();
}
else
{
BaseHttpServer server = new BaseHttpServer(
m_networkServersInfo.https_port);
m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port);
MainServer.AddHttpServer(server);
server.Start();
}
} }
base.StartupSpecific(); base.StartupSpecific();
@ -132,4 +144,4 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
} }
} }
} }

View File

@ -302,7 +302,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// If we're an NPC then skip all the item checks and manipulations since we don't have an // If we're an NPC then skip all the item checks and manipulations since we don't have an
// inventory right now. // inventory right now.
RezSingleAttachmentFromInventoryInternal( RezSingleAttachmentFromInventoryInternal(
sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p, true, null); sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p, true, d);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -182,6 +182,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
try try
{ {
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (obj == null)
return;
if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
|| avatar.Scene.RegionInfo.RegionSettings.AllowDamage) || avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
{ {

View File

@ -40,6 +40,13 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{ {
public struct SendReply
{
public bool Success;
public string Message;
public int Disposition;
}
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")]
public class OfflineMessageModule : ISharedRegionModule public class OfflineMessageModule : ISharedRegionModule
{ {
@ -50,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private string m_RestURL = String.Empty; private string m_RestURL = String.Empty;
IMessageTransferModule m_TransferModule = null; IMessageTransferModule m_TransferModule = null;
private bool m_ForwardOfflineGroupMessages = true; private bool m_ForwardOfflineGroupMessages = true;
private Dictionary<IClientAPI, List<UUID>> m_repliesSent= new Dictionary<IClientAPI, List<UUID>>();
public void Initialise(IConfigSource config) public void Initialise(IConfigSource config)
{ {
@ -169,6 +177,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
client.OnRetrieveInstantMessages += RetrieveInstantMessages; client.OnRetrieveInstantMessages += RetrieveInstantMessages;
client.OnLogout += OnClientLoggedOut;
}
public void OnClientLoggedOut(IClientAPI client)
{
m_repliesSent.Remove(client);
} }
private void RetrieveInstantMessages(IClientAPI client) private void RetrieveInstantMessages(IClientAPI client)
@ -228,7 +242,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (scene == null) if (scene == null)
scene = m_SceneList[0]; scene = m_SceneList[0];
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
"POST", m_RestURL+"/SaveMessage/?scope=" + "POST", m_RestURL+"/SaveMessage/?scope=" +
scene.RegionInfo.ScopeID.ToString(), im); scene.RegionInfo.ScopeID.ToString(), im);
@ -238,13 +252,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (client == null) if (client == null)
return; return;
client.SendInstantMessage(new GridInstantMessage( if (reply.Message == String.Empty)
null, new UUID(im.toAgentID), reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
"System", new UUID(im.fromAgentID),
(byte)InstantMessageDialog.MessageFromAgent, bool sendReply = true;
"User is not logged in. "+
(success ? "Message saved." : "Message not saved"), switch (reply.Disposition)
false, new Vector3())); {
case 0: // Normal
break;
case 1: // Only once per user
if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
{
sendReply = false;
}
else
{
if (!m_repliesSent.ContainsKey(client))
m_repliesSent[client] = new List<UUID>();
m_repliesSent[client].Add(new UUID(im.toAgentID));
}
break;
}
if (sendReply)
{
client.SendInstantMessage(new GridInstantMessage(
null, new UUID(im.toAgentID),
"System", new UUID(im.fromAgentID),
(byte)InstantMessageDialog.MessageFromAgent,
reply.Message,
false, new Vector3()));
}
} }
} }
} }

View File

@ -265,7 +265,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return UUID.Zero; return UUID.Zero;
} }
remoteClient.SendAgentAlertMessage("Notecard saved", false); remoteClient.SendAlertMessage("Notecard saved");
} }
else if ((InventoryType)item.InvType == InventoryType.LSL) else if ((InventoryType)item.InvType == InventoryType.LSL)
{ {
@ -275,7 +275,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return UUID.Zero; return UUID.Zero;
} }
remoteClient.SendAgentAlertMessage("Script saved", false); remoteClient.SendAlertMessage("Script saved");
} }
AssetBase asset = AssetBase asset =
@ -799,6 +799,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlData); doc.LoadXml(xmlData);
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
Vector3 rez_pos;
if (e == null || attachment) // Single if (e == null || attachment) // Single
{ {
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
@ -820,6 +821,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
RayStart, RayEnd, RayTargetID, Quaternion.Identity, RayStart, RayEnd, RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false);
pos.Z += offsetHeight; pos.Z += offsetHeight;
rez_pos = pos;
} }
else else
{ {
@ -834,6 +836,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
BypassRayCast, bRayEndIsIntersection, true, BypassRayCast, bRayEndIsIntersection, true,
bbox, false); bbox, false);
rez_pos = pos;
pos -= bbox / 2; pos -= bbox / 2;
XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
@ -870,7 +874,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
primcount += g.PrimCount; primcount += g.PrimCount;
if (!m_Scene.Permissions.CanRezObject( if (!m_Scene.Permissions.CanRezObject(
primcount, remoteClient.AgentId, pos) primcount, remoteClient.AgentId, rez_pos)
&& !attachment) && !attachment)
{ {
// The client operates in no fail mode. It will // The client operates in no fail mode. It will
@ -887,7 +891,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return null; return null;
} }
if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, rez_pos, attachment))
return null; return null;
for (int i = 0; i < objlist.Count; i++) for (int i = 0; i < objlist.Count; i++)

View File

@ -96,6 +96,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_commands = new EstateManagementCommands(this); m_commands = new EstateManagementCommands(this);
m_commands.Initialise(); m_commands.Initialise();
m_regionChangeTimer.Interval = 10000;
m_regionChangeTimer.Elapsed += RaiseRegionInfoChange;
m_regionChangeTimer.AutoReset = false;
} }
public void RemoveRegion(Scene scene) {} public void RemoveRegion(Scene scene) {}

View File

@ -565,7 +565,7 @@ namespace OpenSim.Region.CoreModules.World.Land
requiredPowers = GroupPowers.LandManageBanned; requiredPowers = GroupPowers.LandManageBanned;
if (m_scene.Permissions.CanEditParcelProperties(agentID, if (m_scene.Permissions.CanEditParcelProperties(agentID,
land, requiredPowers)) land, requiredPowers, false))
{ {
land.UpdateAccessList(flags, transactionID, sequenceID, land.UpdateAccessList(flags, transactionID, sequenceID,
sections, entries, remote_client); sections, entries, remote_client);
@ -927,7 +927,7 @@ namespace OpenSim.Region.CoreModules.World.Land
//If we are still here, then they are subdividing within one piece of land //If we are still here, then they are subdividing within one piece of land
//Check owner //Check owner
if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin)) if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin, true))
{ {
return; return;
} }
@ -996,7 +996,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
return; return;
} }
if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin)) if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin, true))
{ {
return; return;
} }
@ -1727,7 +1727,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (land == null) return; if (land == null) return;
if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions)) if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions, false))
return; return;
land.LandData.OtherCleanTime = otherCleanTime; land.LandData.OtherCleanTime = otherCleanTime;
@ -1827,7 +1827,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (targetAvatar.UserLevel == 0) if (targetAvatar.UserLevel == 0)
{ {
ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true))
return; return;
if (flags == 0) if (flags == 0)
{ {
@ -1876,7 +1876,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// Check if you even have permission to do this // Check if you even have permission to do this
ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) && if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true) &&
!m_scene.Permissions.IsAdministrator(client.AgentId)) !m_scene.Permissions.IsAdministrator(client.AgentId))
return; return;

View File

@ -286,7 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// ParcelFlags.ForSaleObjects // ParcelFlags.ForSaleObjects
// ParcelFlags.LindenHome // ParcelFlags.LindenHome
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, false))
{ {
allowedDelta |= (uint)(ParcelFlags.AllowLandmark | allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
ParcelFlags.AllowTerraform | ParcelFlags.AllowTerraform |
@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelFlags.AllowFly); ParcelFlags.AllowFly);
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale, true))
{ {
if (args.AuthBuyerID != newData.AuthBuyerID || if (args.AuthBuyerID != newData.AuthBuyerID ||
args.SalePrice != newData.SalePrice) args.SalePrice != newData.SalePrice)
@ -324,7 +324,7 @@ namespace OpenSim.Region.CoreModules.World.Land
allowedDelta |= (uint)ParcelFlags.ForSale; allowedDelta |= (uint)ParcelFlags.ForSale;
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces, false))
{ {
newData.Category = args.Category; newData.Category = args.Category;
@ -333,21 +333,21 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelFlags.MaturePublish) | (uint)(1 << 23); ParcelFlags.MaturePublish) | (uint)(1 << 23);
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity, false))
{ {
newData.Description = args.Desc; newData.Description = args.Desc;
newData.Name = args.Name; newData.Name = args.Name;
newData.SnapshotID = args.SnapshotID; newData.SnapshotID = args.SnapshotID;
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint, false))
{ {
newData.LandingType = args.LandingType; newData.LandingType = args.LandingType;
newData.UserLocation = args.UserLocation; newData.UserLocation = args.UserLocation;
newData.UserLookAt = args.UserLookAt; newData.UserLookAt = args.UserLookAt;
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia, false))
{ {
newData.MediaAutoScale = args.MediaAutoScale; newData.MediaAutoScale = args.MediaAutoScale;
newData.MediaID = args.MediaID; newData.MediaID = args.MediaID;
@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelFlags.UseEstateVoiceChan); ParcelFlags.UseEstateVoiceChan);
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses, false))
{ {
newData.PassHours = args.PassHours; newData.PassHours = args.PassHours;
newData.PassPrice = args.PassPrice; newData.PassPrice = args.PassPrice;
@ -376,25 +376,27 @@ namespace OpenSim.Region.CoreModules.World.Land
allowedDelta |= (uint)ParcelFlags.UsePassList; allowedDelta |= (uint)ParcelFlags.UsePassList;
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed, false))
{ {
allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
ParcelFlags.UseAccessList); ParcelFlags.UseAccessList);
} }
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned, false))
{ {
allowedDelta |= (uint)(ParcelFlags.UseBanList | allowedDelta |= (uint)(ParcelFlags.UseBanList |
ParcelFlags.DenyAnonymous | ParcelFlags.DenyAnonymous |
ParcelFlags.DenyAgeUnverified); ParcelFlags.DenyAgeUnverified);
} }
uint preserve = LandData.Flags & ~allowedDelta; if (allowedDelta != (uint)ParcelFlags.None)
newData.Flags = preserve | (args.ParcelFlags & allowedDelta); {
uint preserve = LandData.Flags & ~allowedDelta;
newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
SendLandUpdateToAvatarsOverMe(snap_selection);
SendLandUpdateToAvatarsOverMe(snap_selection); }
} }
public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@ -950,7 +952,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
{ {
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
{ {
List<uint> resultLocalIDs = new List<uint>(); List<uint> resultLocalIDs = new List<uint>();
try try
@ -1000,7 +1002,7 @@ namespace OpenSim.Region.CoreModules.World.Land
/// </param> /// </param>
public void SendLandObjectOwners(IClientAPI remote_client) public void SendLandObjectOwners(IClientAPI remote_client)
{ {
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
{ {
Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
List<UUID> groups = new List<UUID>(); List<UUID> groups = new List<UUID>();

View File

@ -42,8 +42,8 @@ using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.CoreModules.World.Permissions namespace OpenSim.Region.CoreModules.World.Permissions
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultPermissionsModule")]
public class PermissionsModule : INonSharedRegionModule, IPermissionsModule public class DefaultPermissionsModule : INonSharedRegionModule, IPermissionsModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -348,7 +348,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
public string Name public string Name
{ {
get { return "PermissionsModule"; } get { return "DefaultPermissionsModule"; }
} }
public Type ReplaceableInterface public Type ReplaceableInterface
@ -1047,7 +1047,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericObjectPermission(editorID, objectID, false); return GenericObjectPermission(editorID, objectID, false);
} }
private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene) private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
{ {
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;

View File

@ -662,7 +662,7 @@ namespace OpenSim.Region.Framework.Scenes
// Do the frame processing // Do the frame processing
double steps = (double)m_currentFrame.TimeMS / tickDuration; double steps = (double)m_currentFrame.TimeMS / tickDuration;
if (steps <= 0.0) if (steps <= 0.0)
{ {
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;

View File

@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene);
public delegate bool IsAdministratorHandler(UUID user); public delegate bool IsAdministratorHandler(UUID user);
public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager);
public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
@ -763,7 +763,7 @@ namespace OpenSim.Region.Framework.Scenes
#region EDIT PARCEL #region EDIT PARCEL
public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p) public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, bool allowManager)
{ {
EditParcelPropertiesHandler handler = OnEditParcelProperties; EditParcelPropertiesHandler handler = OnEditParcelProperties;
if (handler != null) if (handler != null)
@ -771,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList(); Delegate[] list = handler.GetInvocationList();
foreach (EditParcelPropertiesHandler h in list) foreach (EditParcelPropertiesHandler h in list)
{ {
if (h(user, parcel, p, m_scene) == false) if (h(user, parcel, p, m_scene, allowManager) == false)
return false; return false;
} }
} }

View File

@ -2802,8 +2802,10 @@ namespace OpenSim.Region.Framework.Scenes
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts(); newObject.ResumeScripts();
if (newObject.RootPart.KeyframeMotion != null) // AddSceneObject already does this and doing it again messes
newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); // up region crossings, so don't.
//if (newObject.RootPart.KeyframeMotion != null)
// newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
} }
// Do this as late as possible so that listeners have full access to the incoming object // Do this as late as possible so that listeners have full access to the incoming object

View File

@ -591,6 +591,7 @@ namespace OpenSim.Region.Framework.Scenes
avinfo.ParentID = av.ParentID; avinfo.ParentID = av.ParentID;
avsToCross.Add(avinfo); avsToCross.Add(avinfo);
av.PrevSitOffset = av.OffsetPosition;
av.ParentID = 0; av.ParentID = 0;
} }
@ -1072,6 +1073,11 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];
if (part.KeyframeMotion != null)
{
part.KeyframeMotion.UpdateSceneObject(this);
}
if (Object.ReferenceEquals(part, m_rootPart)) if (Object.ReferenceEquals(part, m_rootPart))
continue; continue;
@ -1880,25 +1886,27 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];
Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) if (Scene != null)
{ {
if (avatar.ParentID == LocalId) Scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
avatar.StandUp();
if (!silent)
{ {
part.ClearUpdateSchedule(); if (avatar.ParentID == LocalId)
if (part == m_rootPart) avatar.StandUp();
{
if (!IsAttachment
|| AttachedAvatar == avatar.ControllingClient.AgentId
|| !HasPrivateAttachmentPoint)
avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId });
}
}
});
}
if (!silent)
{
part.ClearUpdateSchedule();
if (part == m_rootPart)
{
if (!IsAttachment
|| AttachedAvatar == avatar.ControllingClient.AgentId
|| !HasPrivateAttachmentPoint)
avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId });
}
}
});
}
}
} }
public void AddScriptLPS(int count) public void AddScriptLPS(int count)
@ -3483,8 +3491,8 @@ namespace OpenSim.Region.Framework.Scenes
part.ClonePermissions(RootPart); part.ClonePermissions(RootPart);
}); });
uint lockMask = ~(uint)PermissionMask.Move; uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
uint lockBit = RootPart.OwnerMask & (uint)PermissionMask.Move; uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
RootPart.ScheduleFullUpdate(); RootPart.ScheduleFullUpdate();
} }

View File

@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_movementAnimationUpdateCounter = 0; private int m_movementAnimationUpdateCounter = 0;
private Vector3 m_prevSitOffset; public Vector3 PrevSitOffset { get; set; }
protected AvatarAppearance m_appearance; protected AvatarAppearance m_appearance;
@ -957,7 +957,7 @@ namespace OpenSim.Region.Framework.Scenes
// ParentPosition = part.GetWorldPosition(); // ParentPosition = part.GetWorldPosition();
ParentID = part.LocalId; ParentID = part.LocalId;
ParentPart = part; ParentPart = part;
m_pos = m_prevSitOffset; m_pos = PrevSitOffset;
// pos = ParentPosition; // pos = ParentPosition;
pos = part.GetWorldPosition(); pos = part.GetWorldPosition();
} }
@ -2261,6 +2261,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentID != 0) if (ParentID != 0)
{ {
PrevSitOffset = m_pos; // Save sit offset
SceneObjectPart part = ParentPart; SceneObjectPart part = ParentPart;
UnRegisterSeatControls(part.ParentGroup.UUID); UnRegisterSeatControls(part.ParentGroup.UUID);
@ -3487,7 +3488,7 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.Appearance = new AvatarAppearance(Appearance); cAgent.Appearance = new AvatarAppearance(Appearance);
cAgent.ParentPart = ParentUUID; cAgent.ParentPart = ParentUUID;
cAgent.SitOffset = m_pos; cAgent.SitOffset = PrevSitOffset;
lock (scriptedcontrols) lock (scriptedcontrols)
{ {
@ -3530,7 +3531,7 @@ namespace OpenSim.Region.Framework.Scenes
CameraLeftAxis = cAgent.LeftAxis; CameraLeftAxis = cAgent.LeftAxis;
CameraUpAxis = cAgent.UpAxis; CameraUpAxis = cAgent.UpAxis;
ParentUUID = cAgent.ParentPart; ParentUUID = cAgent.ParentPart;
m_prevSitOffset = cAgent.SitOffset; PrevSitOffset = cAgent.SitOffset;
// When we get to the point of re-computing neighbors everytime this // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the // changes, then start using the agent's drawdistance rather than the

View File

@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
IConfigSource configSource = new IniConfigSource(); IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Startup"); IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true); config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test. // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
@ -112,7 +112,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
IConfigSource configSource = new IniConfigSource(); IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Startup"); IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true); config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test. // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
@ -195,4 +195,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Assert.That(retrievedPart, Is.Null); // Assert.That(retrievedPart, Is.Null);
} }
} }
} }

View File

@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneHelpers.SetupSceneModules( SceneHelpers.SetupSceneModules(
scene, configSource, new object[] scene, configSource, new object[]
{ new PermissionsModule(), { new DefaultPermissionsModule(),
new GroupsModule(), new GroupsModule(),
new MockGroupsServicesConnector() }); new MockGroupsServicesConnector() });
@ -82,4 +82,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true); groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
} }
} }
} }

View File

@ -216,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// We need to set up the permisions module on scene B so that our later use of agent limit to deny // We need to set up the permisions module on scene B so that our later use of agent limit to deny
// QueryAccess won't succeed anyway because administrators are always allowed in and the default // QueryAccess won't succeed anyway because administrators are always allowed in and the default
// IsAdministrator if no permissions module is present is true. // IsAdministrator if no permissions module is present is true.
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB });
// Shared scene modules // Shared scene modules
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
@ -381,7 +381,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// We need to set up the permisions module on scene B so that our later use of agent limit to deny // We need to set up the permisions module on scene B so that our later use of agent limit to deny
// QueryAccess won't succeed anyway because administrators are always allowed in and the default // QueryAccess won't succeed anyway because administrators are always allowed in and the default
// IsAdministrator if no permissions module is present is true. // IsAdministrator if no permissions module is present is true.
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB });
// Shared scene modules // Shared scene modules
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
@ -507,4 +507,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// TestHelpers.DisableLogging(); // TestHelpers.DisableLogging();
} }
} }
} }

View File

@ -635,15 +635,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
// TODO: EstateSettings don't seem to get propagated... // TODO: EstateSettings don't seem to get propagated...
if (!scene.RegionInfo.EstateSettings.AllowVoice) if (!scene.RegionInfo.EstateSettings.AllowVoice)
{ {
m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings", //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings",
scene.RegionInfo.RegionName); // scene.RegionInfo.RegionName);
channel_uri = String.Empty; channel_uri = String.Empty;
} }
if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0) if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0)
{ {
m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel", //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName); // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
channel_uri = String.Empty; channel_uri = String.Empty;
} }
else else

View File

@ -203,8 +203,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
{ {
} }
public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount, UUID txn) public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount, UUID txn, out string result)
{ {
result = String.Empty;
string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID));
bool give_result = doMoneyTransfer(fromID, toID, amount, 2, description); bool give_result = doMoneyTransfer(fromID, toID, amount, 2, description);

View File

@ -105,9 +105,9 @@ namespace OpenSim.Region.RegionCombinerModule
return m_rootScene.Permissions.CanEditObject(objectid, editorid); return m_rootScene.Permissions.CanEditObject(objectid, editorid);
} }
public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene) public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene, bool allowManager)
{ {
return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g); return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g, allowManager);
} }
public bool CanInstantMessage(UUID user, UUID target, Scene startscene) public bool CanInstantMessage(UUID user, UUID target, Scene startscene)

View File

@ -3109,8 +3109,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
string reason;
money.ObjectGiveMoney( money.ObjectGiveMoney(
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason);
}); });
return 0; return 0;
@ -7105,7 +7106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID key; UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
{ {
int expires = 0; int expires = 0;
if (hours != 0) if (hours != 0)
@ -10430,7 +10431,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// according to the docs, this command only works if script owner and land owner are the same // according to the docs, this command only works if script owner and land owner are the same
// lets add estate owners and gods, too, and use the generic permission check. // lets add estate owners and gods, too, and use the generic permission check.
ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition); ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia, false)) return;
bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
byte loop = 0; byte loop = 0;
@ -10873,7 +10874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID key; UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
{ {
int expires = 0; int expires = 0;
if (hours != 0) if (hours != 0)
@ -10914,7 +10915,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID key; UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed, false))
{ {
if (UUID.TryParse(avatar, out key)) if (UUID.TryParse(avatar, out key))
{ {
@ -10941,7 +10942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID key; UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
{ {
if (UUID.TryParse(avatar, out key)) if (UUID.TryParse(avatar, out key))
{ {
@ -12784,8 +12785,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
string reason;
bool result = money.ObjectGiveMoney( bool result = money.ObjectGiveMoney(
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn); m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);
if (result) if (result)
{ {
@ -12793,7 +12795,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
replydata = "LINDENDOLLAR_INSUFFICIENTFUNDS"; replydata = reason;
} }
finally finally
{ {

View File

@ -1434,7 +1434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions)) if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
{ {
OSSLShoutError("You do not have permission to modify the parcel"); OSSLShoutError("You do not have permission to modify the parcel");
return; return;

View File

@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ItemID = ScriptTask.ItemID; ItemID = ScriptTask.ItemID;
AssetID = ScriptTask.AssetID; AssetID = ScriptTask.AssetID;
} }
LocalID = part.LocalId;
PrimName = part.ParentGroup.Name; PrimName = part.ParentGroup.Name;
StartParam = startParam; StartParam = startParam;

View File

@ -1316,13 +1316,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
ScriptInstance instance = null; ScriptInstance instance = null;
// Create the object record // Create the object record
UUID appDomain = assetID;
lockScriptsForRead(true); lockScriptsForRead(true);
if ((!m_Scripts.ContainsKey(itemID)) || if ((!m_Scripts.ContainsKey(itemID)) ||
(m_Scripts[itemID].AssetID != assetID)) (m_Scripts[itemID].AssetID != assetID))
{ {
lockScriptsForRead(false); lockScriptsForRead(false);
instance = new ScriptInstance(this, part,
UUID appDomain = assetID; item,
startParam, postOnRez,
m_MaxScriptQueue);
if (part.ParentGroup.IsAttachment) if (part.ParentGroup.IsAttachment)
appDomain = part.ParentGroup.RootPart.UUID; appDomain = part.ParentGroup.RootPart.UUID;
@ -1345,9 +1353,39 @@ namespace OpenSim.Region.ScriptEngine.XEngine
sandbox = AppDomain.CreateDomain( sandbox = AppDomain.CreateDomain(
m_Scene.RegionInfo.RegionID.ToString(), m_Scene.RegionInfo.RegionID.ToString(),
evidence, appSetup); evidence, appSetup);
m_AppDomains[appDomain].AssemblyResolve += if (m_AppDomains.ContainsKey(appDomain))
new ResolveEventHandler( {
AssemblyResolver.OnAssemblyResolve); m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
if (m_DomainScripts.ContainsKey(appDomain))
{
m_DomainScripts[appDomain].Add(itemID);
}
else
{
m_DomainScripts.Add(appDomain, new List<UUID>());
m_DomainScripts[appDomain].Add(itemID);
}
}
else
{
m_AppDomains.Add(appDomain, sandbox);
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
if (m_DomainScripts.ContainsKey(appDomain))
{
m_DomainScripts[appDomain].Add(itemID);
}
else
{
m_DomainScripts.Add(appDomain, new List<UUID>());
m_DomainScripts[appDomain].Add(itemID);
}
}
} }
else else
{ {
@ -1373,12 +1411,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false; return false;
} }
} }
m_DomainScripts[appDomain].Add(itemID);
instance = new ScriptInstance(this, part,
item,
startParam, postOnRez,
m_MaxScriptQueue);
instance.Load(m_AppDomains[appDomain], assembly, stateSource); instance.Load(m_AppDomains[appDomain], assembly, stateSource);
// m_log.DebugFormat( // m_log.DebugFormat(
@ -1502,6 +1535,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (handlerObjectRemoved != null) if (handlerObjectRemoved != null)
{ {
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
if (part != null)
handlerObjectRemoved(part.UUID); handlerObjectRemoved(part.UUID);
} }

View File

@ -40,7 +40,7 @@ namespace OpenSim.Server.Base
{ {
public class HttpServerBase : ServicesServerBase public class HttpServerBase : ServicesServerBase
{ {
// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private uint m_consolePort; private uint m_consolePort;
@ -69,6 +69,7 @@ namespace OpenSim.Server.Base
bool ssl_main = networkConfig.GetBoolean("https_main",false); bool ssl_main = networkConfig.GetBoolean("https_main",false);
bool ssl_listener = networkConfig.GetBoolean("https_listener",false); bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
bool ssl_external = networkConfig.GetBoolean("https_external",false);
m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
@ -113,20 +114,29 @@ namespace OpenSim.Server.Base
uint https_port = (uint)networkConfig.GetInt("https_port", 0); uint https_port = (uint)networkConfig.GetInt("https_port", 0);
string cert_path = networkConfig.GetString("cert_path",String.Empty); m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
if ( cert_path == String.Empty ) if (!ssl_external)
{ {
System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); string cert_path = networkConfig.GetString("cert_path",String.Empty);
Thread.CurrentThread.Abort(); if ( cert_path == String.Empty )
} {
string cert_pass = networkConfig.GetString("cert_pass",String.Empty); System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
if ( cert_pass == String.Empty ) Thread.CurrentThread.Abort();
{ }
System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
Thread.CurrentThread.Abort(); if ( cert_pass == String.Empty )
} {
System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort();
}
MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
}
else
{
m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested.");
MainServer.AddHttpServer(new BaseHttpServer(https_port));
}
} }
} }

View File

@ -137,7 +137,13 @@ namespace OpenSim.Services.Connectors
string prefix = id.Substring(0, 2).ToLower(); string prefix = id.Substring(0, 2).ToLower();
string host = m_UriMap[prefix]; string host;
// HG URLs will not be valid UUIDS
if (m_UriMap.ContainsKey(prefix))
host = m_UriMap[prefix];
else
host = m_UriMap["00"];
serverUri.Host = host; serverUri.Host = host;

View File

@ -86,6 +86,66 @@ namespace OpenSim.Services.Connectors
m_ServerURI = serviceURI.TrimEnd('/'); m_ServerURI = serviceURI.TrimEnd('/');
} }
public bool RemoveMapTile(int x, int y, out string reason)
{
reason = string.Empty;
int tickstart = Util.EnvironmentTickCount();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["X"] = x.ToString();
sendData["Y"] = y.ToString();
string reqString = ServerUtils.BuildQueryString(sendData);
string uri = m_ServerURI + "/removemap";
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri,
reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
{
return true;
}
else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
{
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString());
reason = replyData["Message"].ToString();
return false;
}
else if (!replyData.ContainsKey("Result"))
{
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field");
}
else
{
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
reason = "Unexpected result " + replyData["Result"].ToString();
}
}
else
{
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
}
}
catch (Exception e)
{
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message);
}
finally
{
// This just dumps a warning for any operation that takes more than 100 ms
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff);
}
return false;
}
public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) public bool AddMapTile(int x, int y, byte[] jpgData, out string reason)
{ {
reason = string.Empty; reason = string.Empty;

View File

@ -283,7 +283,7 @@ namespace OpenSim.Services.GridService
int flags = Convert.ToInt32(region.Data["flags"]); int flags = Convert.ToInt32(region.Data["flags"]);
if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) if ((!m_DeleteOnUnregister) || ((flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0))
{ {
flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline;
region.Data["flags"] = flags.ToString(); region.Data["flags"] = flags.ToString();
@ -298,7 +298,6 @@ namespace OpenSim.Services.GridService
} }
return true; return true;
} }
return m_Database.Delete(regionID); return m_Database.Delete(regionID);

View File

@ -35,6 +35,7 @@ namespace OpenSim.Services.Interfaces
{ {
//List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY);
bool AddMapTile(int x, int y, byte[] imageData, out string reason); bool AddMapTile(int x, int y, byte[] imageData, out string reason);
bool RemoveMapTile(int x, int y, out string reason);
byte[] GetMapTile(string fileName, out string format); byte[] GetMapTile(string fileName, out string format);
} }
} }

View File

@ -112,9 +112,38 @@ namespace OpenSim.Services.MapImageService
reason = e.Message; reason = e.Message;
return false; return false;
} }
}
// Also save in png format? return UpdateMultiResolutionFiles(x, y, out reason);
}
public bool RemoveMapTile(int x, int y, out string reason)
{
reason = String.Empty;
string fileName = GetFileName(1, x, y);
lock (m_Sync)
{
try
{
File.Delete(fileName);
}
catch (Exception e)
{
m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e);
reason = e.Message;
return false;
}
}
return UpdateMultiResolutionFiles(x, y, out reason);
}
private bool UpdateMultiResolutionFiles(int x, int y, out string reason)
{
reason = String.Empty;
lock (m_Sync)
{
// Stitch seven more aggregate tiles together // Stitch seven more aggregate tiles together
for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++)
{ {
@ -126,7 +155,7 @@ namespace OpenSim.Services.MapImageService
if (!CreateTile(zoomLevel, x1, y1)) if (!CreateTile(zoomLevel, x1, y1))
{ {
m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0} at zoom level {1}", fileName, zoomLevel); m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel);
reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); reason = string.Format("Map tile at zoom level {0} failed", zoomLevel);
return false; return false;
} }