aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2014-07-16 16:22:32 +0100
committerUbitUmarov2014-07-16 16:22:32 +0100
commit19d33c571d8f48501ecb2409814d5b95b2b4be23 (patch)
tree8e08805a71ebea81de75b5805105f325e0defa0f
parentMerge branch 'avination-current' into ubitwork (diff)
parentMerge branch 'avination-current' of ssh://3dhosting.de/var/git/careminster in... (diff)
downloadopensim-SC-19d33c571d8f48501ecb2409814d5b95b2b4be23.zip
opensim-SC-19d33c571d8f48501ecb2409814d5b95b2b4be23.tar.gz
opensim-SC-19d33c571d8f48501ecb2409814d5b95b2b4be23.tar.bz2
opensim-SC-19d33c571d8f48501ecb2409814d5b95b2b4be23.tar.xz
Merge branch 'avination-current' into ubitwork
-rw-r--r--OpenSim/Addons/Groups/GroupsExtendedData.cs24
-rw-r--r--OpenSim/Addons/Groups/GroupsMessagingModule.cs430
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs109
-rw-r--r--OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs42
-rw-r--r--OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs2
-rw-r--r--OpenSim/Addons/Groups/IGroupsServicesConnector.cs6
-rw-r--r--OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs22
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs31
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs24
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs45
-rw-r--r--OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs13
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs40
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs3
-rw-r--r--OpenSim/Framework/GridInstantMessage.cs18
-rw-r--r--OpenSim/Framework/IMoneyModule.cs2
-rw-r--r--OpenSim/Framework/NetworkServersInfo.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs10
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs40
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs23
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs50
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs21
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs55
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs8
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs3
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs56
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs32
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs60
-rw-r--r--OpenSim/Services/GridService/GridService.cs3
-rw-r--r--OpenSim/Services/Interfaces/IMapImageService.cs1
-rw-r--r--OpenSim/Services/MapImageService/MapImageService.cs33
53 files changed, 954 insertions, 472 deletions
diff --git a/OpenSim/Addons/Groups/GroupsExtendedData.cs b/OpenSim/Addons/Groups/GroupsExtendedData.cs
index 6f4db28..1632aee 100644
--- a/OpenSim/Addons/Groups/GroupsExtendedData.cs
+++ b/OpenSim/Addons/Groups/GroupsExtendedData.cs
@@ -504,6 +504,30 @@ namespace OpenSim.Groups
504 504
505 return notice; 505 return notice;
506 } 506 }
507
508 public static Dictionary<string, object> DirGroupsReplyData(DirGroupsReplyData g)
509 {
510 Dictionary<string, object> dict = new Dictionary<string, object>();
511
512 dict["GroupID"] = g.groupID;
513 dict["Name"] = g.groupName;
514 dict["NMembers"] = g.members;
515 dict["SearchOrder"] = g.searchOrder;
516
517 return dict;
518 }
519
520 public static DirGroupsReplyData DirGroupsReplyData(Dictionary<string, object> dict)
521 {
522 DirGroupsReplyData g;
523
524 g.groupID = new UUID(dict["GroupID"].ToString());
525 g.groupName = dict["Name"].ToString();
526 Int32.TryParse(dict["NMembers"].ToString(), out g.members);
527 float.TryParse(dict["SearchOrder"].ToString(), out g.searchOrder);
528
529 return g;
530 }
507 } 531 }
508 532
509} 533}
diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
index d172d48..be59c62 100644
--- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs
+++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
@@ -39,6 +39,7 @@ using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; 41using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
42using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42 43
43namespace OpenSim.Groups 44namespace OpenSim.Groups
44{ 45{
@@ -51,7 +52,7 @@ namespace OpenSim.Groups
51 private IPresenceService m_presenceService; 52 private IPresenceService m_presenceService;
52 53
53 private IMessageTransferModule m_msgTransferModule = null; 54 private IMessageTransferModule m_msgTransferModule = null;
54 55 private IUserManagement m_UserManagement = null;
55 private IGroupsServicesConnector m_groupData = null; 56 private IGroupsServicesConnector m_groupData = null;
56 57
57 // Config Options 58 // Config Options
@@ -79,6 +80,10 @@ namespace OpenSim.Groups
79 80
80 private int m_usersOnlineCacheExpirySeconds = 20; 81 private int m_usersOnlineCacheExpirySeconds = 20;
81 82
83 private Dictionary<UUID, List<string>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<string>>();
84 private Dictionary<UUID, List<string>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<string>>();
85
86
82 #region Region Module interfaceBase Members 87 #region Region Module interfaceBase Members
83 88
84 public void Initialise(IConfigSource config) 89 public void Initialise(IConfigSource config)
@@ -124,10 +129,12 @@ namespace OpenSim.Groups
124 m_sceneList.Add(scene); 129 m_sceneList.Add(scene);
125 130
126 scene.EventManager.OnNewClient += OnNewClient; 131 scene.EventManager.OnNewClient += OnNewClient;
132 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
133 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
127 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 134 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
128 scene.EventManager.OnClientLogin += OnClientLogin; 135 scene.EventManager.OnClientLogin += OnClientLogin;
129 } 136 }
130 137
131 public void RegionLoaded(Scene scene) 138 public void RegionLoaded(Scene scene)
132 { 139 {
133 if (!m_groupMessagingEnabled) 140 if (!m_groupMessagingEnabled)
@@ -155,6 +162,17 @@ namespace OpenSim.Groups
155 return; 162 return;
156 } 163 }
157 164
165 m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
166
167 // No groups module, no groups messaging
168 if (m_UserManagement == null)
169 {
170 m_log.Error("[Groups.Messaging]: Could not get IUserManagement, GroupsMessagingModule is now disabled.");
171 RemoveRegion(scene);
172 return;
173 }
174
175
158 if (m_presenceService == null) 176 if (m_presenceService == null)
159 m_presenceService = scene.PresenceService; 177 m_presenceService = scene.PresenceService;
160 178
@@ -227,87 +245,107 @@ namespace OpenSim.Groups
227 245
228 public void SendMessageToGroup(GridInstantMessage im, UUID groupID) 246 public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
229 { 247 {
230 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(new UUID(im.fromAgentID).ToString(), groupID); 248 UUID fromAgentID = new UUID(im.fromAgentID);
249 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), groupID);
231 int groupMembersCount = groupMembers.Count; 250 int groupMembersCount = groupMembers.Count;
251 PresenceInfo[] onlineAgents = null;
232 252
233 if (m_messageOnlineAgentsOnly) 253 // In V2 we always only send to online members.
234 { 254 // Sending to offline members is not an option.
235 string[] t1 = groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()).ToArray(); 255 string[] t1 = groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()).ToArray();
236 256
237 // We cache in order not to overwhlem the presence service on large grids with many groups. This does 257 // We cache in order not to overwhlem the presence service on large grids with many groups. This does
238 // mean that members coming online will not see all group members until after m_usersOnlineCacheExpirySeconds has elapsed. 258 // mean that members coming online will not see all group members until after m_usersOnlineCacheExpirySeconds has elapsed.
239 // (assuming this is the same across all grid simulators). 259 // (assuming this is the same across all grid simulators).
240 PresenceInfo[] onlineAgents; 260 if (!m_usersOnlineCache.TryGetValue(groupID, out onlineAgents))
241 if (!m_usersOnlineCache.TryGetValue(groupID, out onlineAgents)) 261 {
242 { 262 onlineAgents = m_presenceService.GetAgents(t1);
243 onlineAgents = m_presenceService.GetAgents(t1); 263 m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds);
244 m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); 264 }
245 }
246 265
247 HashSet<string> onlineAgentsUuidSet = new HashSet<string>(); 266 HashSet<string> onlineAgentsUuidSet = new HashSet<string>();
248 Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID)); 267 Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID));
249 268
250 groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); 269 groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
251 270
252 // if (m_debugEnabled) 271// if (m_debugEnabled)
253// m_log.DebugFormat( 272// m_log.DebugFormat(
254// "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online", 273// "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online",
255// groupID, groupMembersCount, groupMembers.Count()); 274// groupID, groupMembersCount, groupMembers.Count());
256 } 275
257 else 276 int requestStartTick = Environment.TickCount;
277
278 im.imSessionID = groupID.Guid;
279 im.fromGroup = true;
280 IClientAPI thisClient = GetActiveClient(fromAgentID);
281 if (thisClient != null)
258 { 282 {
259 if (m_debugEnabled) 283 im.RegionID = thisClient.Scene.RegionInfo.RegionID.Guid;
260 m_log.DebugFormat(
261 "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members",
262 groupID, groupMembers.Count);
263 } 284 }
264 285
265 int requestStartTick = Environment.TickCount; 286 // Send to self first of all
287 im.toAgentID = im.fromAgentID;
288 im.fromGroup = true;
289 ProcessMessageFromGroupSession(im);
266 290
291 List<UUID> regions = new List<UUID>();
292 List<UUID> clientsAlreadySent = new List<UUID>();
293
294 // Then send to everybody else
267 foreach (GroupMembersData member in groupMembers) 295 foreach (GroupMembersData member in groupMembers)
268 { 296 {
269 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID)) 297 if (member.AgentID.Guid == im.fromAgentID)
298 continue;
299
300 if (clientsAlreadySent.Contains(member.AgentID))
301 continue;
302 clientsAlreadySent.Add(member.AgentID);
303
304 if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID))
270 { 305 {
271 // Don't deliver messages to people who have dropped this session 306 // Don't deliver messages to people who have dropped this session
272 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID); 307 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID);
273 continue; 308 continue;
274 } 309 }
275 310
276 // Copy Message 311 im.toAgentID = member.AgentID.Guid;
277 GridInstantMessage msg = new GridInstantMessage();
278 msg.imSessionID = groupID.Guid;
279 msg.fromAgentName = im.fromAgentName;
280 msg.message = im.message;
281 msg.dialog = im.dialog;
282 msg.offline = im.offline;
283 msg.ParentEstateID = im.ParentEstateID;
284 msg.Position = im.Position;
285 msg.RegionID = im.RegionID;
286 msg.binaryBucket = im.binaryBucket;
287 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
288
289 msg.fromAgentID = im.fromAgentID;
290 msg.fromGroup = true;
291
292 msg.toAgentID = member.AgentID.Guid;
293 312
294 IClientAPI client = GetActiveClient(member.AgentID); 313 IClientAPI client = GetActiveClient(member.AgentID);
295 if (client == null) 314 if (client == null)
296 { 315 {
297 // If they're not local, forward across the grid 316 // If they're not local, forward across the grid
317 // BUT do it only once per region, please! Sim would be even better!
298 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} via Grid", member.AgentID); 318 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} via Grid", member.AgentID);
299 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); 319
320 bool reallySend = true;
321 if (onlineAgents != null)
322 {
323 PresenceInfo presence = onlineAgents.First(p => p.UserID == member.AgentID.ToString());
324 if (regions.Contains(presence.RegionID))
325 reallySend = false;
326 else
327 regions.Add(presence.RegionID);
328 }
329
330 if (reallySend)
331 {
332 // We have to create a new IM structure because the transfer module
333 // uses async send
334 GridInstantMessage msg = new GridInstantMessage(im, true);
335 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
336 }
300 } 337 }
301 else 338 else
302 { 339 {
303 // Deliver locally, directly 340 // Deliver locally, directly
304 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); 341 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
305 ProcessMessageFromGroupSession(msg); 342
343 ProcessMessageFromGroupSession(im);
306 } 344 }
345
307 } 346 }
308 347
309 // Temporary for assessing how long it still takes to send messages to large online groups. 348 if (m_debugEnabled)
310 if (m_messageOnlineAgentsOnly)
311 m_log.DebugFormat( 349 m_log.DebugFormat(
312 "[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", 350 "[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms",
313 groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); 351 groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick);
@@ -324,9 +362,20 @@ namespace OpenSim.Groups
324 { 362 {
325 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: OnInstantMessage registered for {0}", client.Name); 363 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: OnInstantMessage registered for {0}", client.Name);
326 364
327 client.OnInstantMessage += OnInstantMessage; 365 ResetAgentGroupChatSessions(client.AgentId.ToString());
366 }
367
368 void OnMakeRootAgent(ScenePresence sp)
369 {
370 sp.ControllingClient.OnInstantMessage += OnInstantMessage;
371 }
372
373 void OnMakeChildAgent(ScenePresence sp)
374 {
375 sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
328 } 376 }
329 377
378
330 private void OnGridInstantMessage(GridInstantMessage msg) 379 private void OnGridInstantMessage(GridInstantMessage msg)
331 { 380 {
332 // The instant message module will only deliver messages of dialog types: 381 // The instant message module will only deliver messages of dialog types:
@@ -335,21 +384,91 @@ namespace OpenSim.Groups
335 // Any other message type will not be delivered to a client by the 384 // Any other message type will not be delivered to a client by the
336 // Instant Message Module 385 // Instant Message Module
337 386
338 387 UUID regionID = new UUID(msg.RegionID);
339 if (m_debugEnabled) 388 if (m_debugEnabled)
340 { 389 {
341 m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 390 m_log.DebugFormat("[Groups.Messaging]: {0} called, IM from region {1}",
391 System.Reflection.MethodBase.GetCurrentMethod().Name, regionID);
342 392
343 DebugGridInstantMessage(msg); 393 DebugGridInstantMessage(msg);
344 } 394 }
345 395
346 // Incoming message from a group 396 // Incoming message from a group
347 if ((msg.fromGroup == true) && 397 if ((msg.fromGroup == true) && (msg.dialog == (byte)InstantMessageDialog.SessionSend))
348 ((msg.dialog == (byte)InstantMessageDialog.SessionSend)
349 || (msg.dialog == (byte)InstantMessageDialog.SessionAdd)
350 || (msg.dialog == (byte)InstantMessageDialog.SessionDrop)))
351 { 398 {
352 ProcessMessageFromGroupSession(msg); 399 // We have to redistribute the message across all members of the group who are here
400 // on this sim
401
402 UUID GroupID = new UUID(msg.imSessionID);
403
404 Scene aScene = m_sceneList[0];
405 GridRegion regionOfOrigin = aScene.GridService.GetRegionByUUID(aScene.RegionInfo.ScopeID, regionID);
406
407 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), GroupID);
408
409 //if (m_debugEnabled)
410 // foreach (GroupMembersData m in groupMembers)
411 // m_log.DebugFormat("[Groups.Messaging]: member {0}", m.AgentID);
412
413 foreach (Scene s in m_sceneList)
414 {
415 s.ForEachScenePresence(sp =>
416 {
417 // If we got this via grid messaging, it's because the caller thinks
418 // that the root agent is here. We should only send the IM to root agents.
419 if (sp.IsChildAgent)
420 return;
421
422 GroupMembersData m = groupMembers.Find(gmd =>
423 {
424 return gmd.AgentID == sp.UUID;
425 });
426 if (m.AgentID == UUID.Zero)
427 {
428 if (m_debugEnabled)
429 m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he is not a member of the group", sp.UUID);
430 return;
431 }
432
433 // Check if the user has an agent in the region where
434 // the IM came from, and if so, skip it, because the IM
435 // was already sent via that agent
436 if (regionOfOrigin != null)
437 {
438 AgentCircuitData aCircuit = s.AuthenticateHandler.GetAgentCircuitData(sp.UUID);
439 if (aCircuit != null)
440 {
441 if (aCircuit.ChildrenCapSeeds.Keys.Contains(regionOfOrigin.RegionHandle))
442 {
443 if (m_debugEnabled)
444 m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he has an agent in region of origin", sp.UUID);
445 return;
446 }
447 else
448 {
449 if (m_debugEnabled)
450 m_log.DebugFormat("[Groups.Messaging]: not skipping agent {0}", sp.UUID);
451 }
452 }
453 }
454
455 UUID AgentID = sp.UUID;
456 msg.toAgentID = AgentID.Guid;
457
458 if (!hasAgentDroppedGroupChatSession(AgentID.ToString(), GroupID))
459 {
460 if (!hasAgentBeenInvitedToGroupChatSession(AgentID.ToString(), GroupID))
461 AddAgentToSession(AgentID, GroupID, msg);
462 else
463 {
464 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", sp.Name);
465
466 ProcessMessageFromGroupSession(msg);
467 }
468 }
469 });
470
471 }
353 } 472 }
354 } 473 }
355 474
@@ -359,82 +478,40 @@ namespace OpenSim.Groups
359 478
360 UUID AgentID = new UUID(msg.fromAgentID); 479 UUID AgentID = new UUID(msg.fromAgentID);
361 UUID GroupID = new UUID(msg.imSessionID); 480 UUID GroupID = new UUID(msg.imSessionID);
481 UUID toAgentID = new UUID(msg.toAgentID);
362 482
363 switch (msg.dialog) 483 switch (msg.dialog)
364 { 484 {
365 case (byte)InstantMessageDialog.SessionAdd: 485 case (byte)InstantMessageDialog.SessionAdd:
366 m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); 486 AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
367 break; 487 break;
368 488
369 case (byte)InstantMessageDialog.SessionDrop: 489 case (byte)InstantMessageDialog.SessionDrop:
370 m_groupData.AgentDroppedFromGroupChatSession(AgentID.ToString(), GroupID); 490 AgentDroppedFromGroupChatSession(AgentID.ToString(), GroupID);
371 break; 491 break;
372 492
373 case (byte)InstantMessageDialog.SessionSend: 493 case (byte)InstantMessageDialog.SessionSend:
374 if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID.ToString(), GroupID) 494 // User hasn't dropped, so they're in the session,
375 && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID.ToString(), GroupID) 495 // maybe we should deliver it.
376 ) 496 IClientAPI client = GetActiveClient(new UUID(msg.toAgentID));
497 if (client != null)
377 { 498 {
378 // Agent not in session and hasn't dropped from session 499 // Deliver locally, directly
379 // Add them to the session for now, and Invite them 500 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} locally", client.Name);
380 m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
381 501
382 UUID toAgentID = new UUID(msg.toAgentID); 502 if (!hasAgentDroppedGroupChatSession(toAgentID.ToString(), GroupID))
383 IClientAPI activeClient = GetActiveClient(toAgentID);
384 if (activeClient != null)
385 { 503 {
386 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null); 504 if (!hasAgentBeenInvitedToGroupChatSession(toAgentID.ToString(), GroupID))
387 if (groupInfo != null) 505 // This actually sends the message too, so no need to resend it
388 { 506 // with client.SendInstantMessage
389 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message"); 507 AddAgentToSession(toAgentID, GroupID, msg);
390 508 else
391 // Force? open the group session dialog??? 509 client.SendInstantMessage(msg);
392 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
393 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
394 eq.ChatterboxInvitation(
395 GroupID
396 , groupInfo.GroupName
397 , new UUID(msg.fromAgentID)
398 , msg.message
399 , new UUID(msg.toAgentID)
400 , msg.fromAgentName
401 , msg.dialog
402 , msg.timestamp
403 , msg.offline == 1
404 , (int)msg.ParentEstateID
405 , msg.Position
406 , 1
407 , new UUID(msg.imSessionID)
408 , msg.fromGroup
409 , OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
410 );
411
412 eq.ChatterBoxSessionAgentListUpdates(
413 new UUID(GroupID)
414 , new UUID(msg.fromAgentID)
415 , new UUID(msg.toAgentID)
416 , false //canVoiceChat
417 , false //isModerator
418 , false //text mute
419 );
420 }
421 } 510 }
422 } 511 }
423 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID.ToString(), GroupID)) 512 else
424 { 513 {
425 // User hasn't dropped, so they're in the session, 514 m_log.WarnFormat("[Groups.Messaging]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
426 // maybe we should deliver it.
427 IClientAPI client = GetActiveClient(new UUID(msg.toAgentID));
428 if (client != null)
429 {
430 // Deliver locally, directly
431 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Delivering to {0} locally", client.Name);
432 client.SendInstantMessage(msg);
433 }
434 else
435 {
436 m_log.WarnFormat("[Groups.Messaging]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
437 }
438 } 515 }
439 break; 516 break;
440 517
@@ -444,6 +521,53 @@ namespace OpenSim.Groups
444 } 521 }
445 } 522 }
446 523
524 private void AddAgentToSession(UUID AgentID, UUID GroupID, GridInstantMessage msg)
525 {
526 // Agent not in session and hasn't dropped from session
527 // Add them to the session for now, and Invite them
528 AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
529
530 IClientAPI activeClient = GetActiveClient(AgentID);
531 if (activeClient != null)
532 {
533 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null);
534 if (groupInfo != null)
535 {
536 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message");
537
538 // Force? open the group session dialog???
539 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
540 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
541 eq.ChatterboxInvitation(
542 GroupID
543 , groupInfo.GroupName
544 , new UUID(msg.fromAgentID)
545 , msg.message
546 , AgentID
547 , msg.fromAgentName
548 , msg.dialog
549 , msg.timestamp
550 , msg.offline == 1
551 , (int)msg.ParentEstateID
552 , msg.Position
553 , 1
554 , new UUID(msg.imSessionID)
555 , msg.fromGroup
556 , OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
557 );
558
559 eq.ChatterBoxSessionAgentListUpdates(
560 new UUID(GroupID)
561 , AgentID
562 , new UUID(msg.toAgentID)
563 , false //canVoiceChat
564 , false //isModerator
565 , false //text mute
566 );
567 }
568 }
569 }
570
447 #endregion 571 #endregion
448 572
449 573
@@ -469,7 +593,7 @@ namespace OpenSim.Groups
469 593
470 if (groupInfo != null) 594 if (groupInfo != null)
471 { 595 {
472 m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); 596 AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
473 597
474 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); 598 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
475 599
@@ -495,7 +619,7 @@ namespace OpenSim.Groups
495 m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); 619 m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
496 620
497 //If this agent is sending a message, then they want to be in the session 621 //If this agent is sending a message, then they want to be in the session
498 m_groupData.AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); 622 AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
499 623
500 SendMessageToGroup(im, GroupID); 624 SendMessageToGroup(im, GroupID);
501 } 625 }
@@ -566,12 +690,12 @@ namespace OpenSim.Groups
566 { 690 {
567 if (!sp.IsChildAgent) 691 if (!sp.IsChildAgent)
568 { 692 {
569 if (m_debugEnabled) m_log.WarnFormat("[Groups.Messaging]: Found root agent for client : {0}", sp.ControllingClient.Name); 693 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Found root agent for client : {0}", sp.ControllingClient.Name);
570 return sp.ControllingClient; 694 return sp.ControllingClient;
571 } 695 }
572 else 696 else
573 { 697 {
574 if (m_debugEnabled) m_log.WarnFormat("[Groups.Messaging]: Found child agent for client : {0}", sp.ControllingClient.Name); 698 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Found child agent for client : {0}", sp.ControllingClient.Name);
575 child = sp.ControllingClient; 699 child = sp.ControllingClient;
576 } 700 }
577 } 701 }
@@ -590,5 +714,71 @@ namespace OpenSim.Groups
590 } 714 }
591 715
592 #endregion 716 #endregion
717
718 #region GroupSessionTracking
719
720 public void ResetAgentGroupChatSessions(string agentID)
721 {
722 foreach (List<string> agentList in m_groupsAgentsDroppedFromChatSession.Values)
723 agentList.Remove(agentID);
724
725 foreach (List<string> agentList in m_groupsAgentsInvitedToChatSession.Values)
726 agentList.Remove(agentID);
727 }
728
729 public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
730 {
731 // If we're tracking this group, and we can find them in the tracking, then they've been invited
732 return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID)
733 && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID);
734 }
735
736 public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
737 {
738 // If we're tracking drops for this group,
739 // and we find them, well... then they've dropped
740 return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)
741 && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID);
742 }
743
744 public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
745 {
746 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
747 {
748 // If not in dropped list, add
749 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
750 {
751 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
752 }
753 }
754 }
755
756 public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
757 {
758 // Add Session Status if it doesn't exist for this session
759 CreateGroupChatSessionTracking(groupID);
760
761 // If nessesary, remove from dropped list
762 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
763 {
764 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
765 }
766
767 // Add to invited
768 if (!m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
769 m_groupsAgentsInvitedToChatSession[groupID].Add(agentID);
770 }
771
772 private void CreateGroupChatSessionTracking(UUID groupID)
773 {
774 if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
775 {
776 m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<string>());
777 m_groupsAgentsInvitedToChatSession.Add(groupID, new List<string>());
778 }
779
780 }
781 #endregion
782
593 } 783 }
594} 784}
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index f805d69..b0493fa 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -141,6 +141,8 @@ namespace OpenSim.Groups
141 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 141 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
142 142
143 scene.EventManager.OnNewClient += OnNewClient; 143 scene.EventManager.OnNewClient += OnNewClient;
144 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
145 scene.EventManager.OnMakeChildAgent += OnMakeChild;
144 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 146 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
145 // The InstantMessageModule itself doesn't do this, 147 // The InstantMessageModule itself doesn't do this,
146 // so lets see if things explode if we don't do it 148 // so lets see if things explode if we don't do it
@@ -194,6 +196,8 @@ namespace OpenSim.Groups
194 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 196 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
195 197
196 scene.EventManager.OnNewClient -= OnNewClient; 198 scene.EventManager.OnNewClient -= OnNewClient;
199 scene.EventManager.OnMakeRootAgent -= OnMakeRoot;
200 scene.EventManager.OnMakeChildAgent -= OnMakeChild;
197 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 201 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
198 202
199 lock (m_sceneList) 203 lock (m_sceneList)
@@ -232,16 +236,29 @@ namespace OpenSim.Groups
232 { 236 {
233 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 237 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
234 238
235 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
236 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; 239 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
237 client.OnDirFindQuery += OnDirFindQuery;
238 client.OnRequestAvatarProperties += OnRequestAvatarProperties; 240 client.OnRequestAvatarProperties += OnRequestAvatarProperties;
241 }
239 242
243 private void OnMakeRoot(ScenePresence sp)
244 {
245 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
246
247 sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
240 // Used for Notices and Group Invites/Accept/Reject 248 // Used for Notices and Group Invites/Accept/Reject
241 client.OnInstantMessage += OnInstantMessage; 249 sp.ControllingClient.OnInstantMessage += OnInstantMessage;
242 250
243 // Send client their groups information. 251 // Send client their groups information.
244 SendAgentGroupDataUpdate(client, client.AgentId); 252 SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID);
253 }
254
255 private void OnMakeChild(ScenePresence sp)
256 {
257 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
258
259 sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
260 // Used for Notices and Group Invites/Accept/Reject
261 sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
245 } 262 }
246 263
247 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 264 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
@@ -287,21 +304,6 @@ namespace OpenSim.Groups
287 } 304 }
288 */ 305 */
289 306
290 void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
291 {
292 if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups)
293 {
294 if (m_debugEnabled)
295 m_log.DebugFormat(
296 "[Groups]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})",
297 System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);
298
299 // TODO: This currently ignores pretty much all the query flags including Mature and sort order
300 remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), queryText).ToArray());
301 }
302
303 }
304
305 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) 307 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
306 { 308 {
307 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 309 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -347,7 +349,7 @@ namespace OpenSim.Groups
347 { 349 {
348 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 350 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
349 351
350 m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog); 352 //m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
351 // Group invitations 353 // Group invitations
352 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) 354 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
353 { 355 {
@@ -465,12 +467,12 @@ namespace OpenSim.Groups
465 } 467 }
466 468
467 // Send notice out to everyone that wants notices 469 // Send notice out to everyone that wants notices
468 // Build notice IIM
469 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
470 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) 470 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
471 { 471 {
472 if (member.AcceptNotices) 472 if (member.AcceptNotices)
473 { 473 {
474 // Build notice IIM, one of reach, because the sending may be async
475 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
474 msg.toAgentID = member.AgentID.Guid; 476 msg.toAgentID = member.AgentID.Guid;
475 OutgoingInstantMessage(msg, member.AgentID); 477 OutgoingInstantMessage(msg, member.AgentID);
476 } 478 }
@@ -485,7 +487,7 @@ namespace OpenSim.Groups
485 return; 487 return;
486 488
487 //// 16 bytes are the UUID. Maybe. 489 //// 16 bytes are the UUID. Maybe.
488 UUID folderID = new UUID(im.binaryBucket, 0); 490// UUID folderID = new UUID(im.binaryBucket, 0);
489 UUID noticeID = new UUID(im.imSessionID); 491 UUID noticeID = new UUID(im.imSessionID);
490 492
491 GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID); 493 GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID);
@@ -766,14 +768,17 @@ namespace OpenSim.Groups
766 remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group."); 768 remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group.");
767 return UUID.Zero; 769 return UUID.Zero;
768 } 770 }
769 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
770 } 771 }
772
771 string reason = string.Empty; 773 string reason = string.Empty;
772 UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, 774 UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment,
773 allowPublish, maturePublish, remoteClient.AgentId, out reason); 775 allowPublish, maturePublish, remoteClient.AgentId, out reason);
774 776
775 if (groupID != UUID.Zero) 777 if (groupID != UUID.Zero)
776 { 778 {
779 if (money != null)
780 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
781
777 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 782 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
778 783
779 // Update the founder with new group information. 784 // Update the founder with new group information.
@@ -904,23 +909,7 @@ namespace OpenSim.Groups
904 { 909 {
905 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called for notice {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, groupNoticeID); 910 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called for notice {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, groupNoticeID);
906 911
907 //GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), data.GroupID, null);
908
909 GridInstantMessage msg = CreateGroupNoticeIM(remoteClient.AgentId, groupNoticeID, (byte)InstantMessageDialog.GroupNoticeRequested); 912 GridInstantMessage msg = CreateGroupNoticeIM(remoteClient.AgentId, groupNoticeID, (byte)InstantMessageDialog.GroupNoticeRequested);
910 //GridInstantMessage msg = new GridInstantMessage();
911 //msg.imSessionID = UUID.Zero.Guid;
912 //msg.fromAgentID = data.GroupID.Guid;
913 //msg.toAgentID = GetRequestingAgentID(remoteClient).Guid;
914 //msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
915 //msg.fromAgentName = "Group Notice : " + groupInfo == null ? "Unknown" : groupInfo.GroupName;
916 //msg.message = data.noticeData.Subject + "|" + data.Message;
917 //msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNoticeRequested;
918 //msg.fromGroup = true;
919 //msg.offline = (byte)0;
920 //msg.ParentEstateID = 0;
921 //msg.Position = Vector3.Zero;
922 //msg.RegionID = UUID.Zero.Guid;
923 //msg.binaryBucket = data.BinaryBucket;
924 913
925 OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); 914 OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient));
926 } 915 }
@@ -1002,6 +991,10 @@ namespace OpenSim.Groups
1002 991
1003 // Should this send updates to everyone in the group? 992 // Should this send updates to everyone in the group?
1004 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 993 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
994
995 if (reason != string.Empty)
996 // A warning
997 remoteClient.SendAlertMessage("Warning: " + reason);
1005 } 998 }
1006 else 999 else
1007 remoteClient.SendJoinGroupReply(groupID, false); 1000 remoteClient.SendJoinGroupReply(groupID, false);
@@ -1186,6 +1179,11 @@ namespace OpenSim.Groups
1186 } 1179 }
1187 } 1180 }
1188 1181
1182 public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query)
1183 {
1184 return m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), query);
1185 }
1186
1189 #endregion 1187 #endregion
1190 1188
1191 #region Client/Update Tools 1189 #region Client/Update Tools
@@ -1225,12 +1223,16 @@ namespace OpenSim.Groups
1225 { 1223 {
1226 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1224 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1227 1225
1226 // NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
1227 // to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
1228 if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
1229 return;
1230
1228 OSDArray AgentData = new OSDArray(1); 1231 OSDArray AgentData = new OSDArray(1);
1229 OSDMap AgentDataMap = new OSDMap(1); 1232 OSDMap AgentDataMap = new OSDMap(1);
1230 AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID)); 1233 AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
1231 AgentData.Add(AgentDataMap); 1234 AgentData.Add(AgentDataMap);
1232 1235
1233
1234 OSDArray GroupData = new OSDArray(data.Length); 1236 OSDArray GroupData = new OSDArray(data.Length);
1235 OSDArray NewGroupData = new OSDArray(data.Length); 1237 OSDArray NewGroupData = new OSDArray(data.Length);
1236 1238
@@ -1276,8 +1278,7 @@ namespace OpenSim.Groups
1276 if (queue != null) 1278 if (queue != null)
1277 { 1279 {
1278 queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); 1280 queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
1279 } 1281 }
1280
1281 } 1282 }
1282 1283
1283 private void SendScenePresenceUpdate(UUID AgentID, string Title) 1284 private void SendScenePresenceUpdate(UUID AgentID, string Title)
@@ -1339,6 +1340,7 @@ namespace OpenSim.Groups
1339 1340
1340 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); 1341 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID);
1341 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); 1342 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
1343
1342 //remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); 1344 //remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
1343 if (remoteClient.AgentId == dataForAgentID) 1345 if (remoteClient.AgentId == dataForAgentID)
1344 remoteClient.RefreshGroupMembership(); 1346 remoteClient.RefreshGroupMembership();
@@ -1399,19 +1401,18 @@ namespace OpenSim.Groups
1399 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1401 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1400 1402
1401 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1403 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
1402 UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID); 1404 string firstname = "Unknown", lastname = "Unknown";
1403 string firstname, lastname; 1405 string name = m_UserManagement.GetUserName(dataForAgentID);
1404 if (account != null) 1406 if (!string.IsNullOrEmpty(name))
1405 {
1406 firstname = account.FirstName;
1407 lastname = account.LastName;
1408 }
1409 else
1410 { 1407 {
1411 firstname = "Unknown"; 1408 string[] parts = name.Split(new char[] { ' ' });
1412 lastname = "Unknown"; 1409 if (parts.Length >= 2)
1410 {
1411 firstname = parts[0];
1412 lastname = parts[1];
1413 }
1413 } 1414 }
1414 1415
1415 remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, 1416 remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname,
1416 lastname, activeGroupPowers, activeGroupName, 1417 lastname, activeGroupPowers, activeGroupName,
1417 activeGroupTitle); 1418 activeGroupTitle);
diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
index f670272..4642b2a 100644
--- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
@@ -186,7 +186,6 @@ namespace OpenSim.Groups
186 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 186 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
187 bool allowPublish, bool maturePublish, UUID founderID, out string reason) 187 bool allowPublish, bool maturePublish, UUID founderID, out string reason)
188 { 188 {
189 m_log.DebugFormat("[Groups]: Creating group {0}", name);
190 reason = string.Empty; 189 reason = string.Empty;
191 if (m_UserManagement.IsLocalGridUser(RequestingAgentID)) 190 if (m_UserManagement.IsLocalGridUser(RequestingAgentID))
192 return m_LocalGroupsConnector.CreateGroup(RequestingAgentID, name, charter, showInList, insigniaID, 191 return m_LocalGroupsConnector.CreateGroup(RequestingAgentID, name, charter, showInList, insigniaID,
@@ -255,7 +254,10 @@ namespace OpenSim.Groups
255 { 254 {
256 string url = string.Empty, gname = string.Empty; 255 string url = string.Empty, gname = string.Empty;
257 if (IsLocal(GroupID, out url, out gname)) 256 if (IsLocal(GroupID, out url, out gname))
258 return m_LocalGroupsConnector.GetGroupMembers(AgentUUI(RequestingAgentID), GroupID); 257 {
258 string agentID = AgentUUI(RequestingAgentID);
259 return m_LocalGroupsConnector.GetGroupMembers(agentID, GroupID);
260 }
259 else if (!string.IsNullOrEmpty(url)) 261 else if (!string.IsNullOrEmpty(url))
260 { 262 {
261 ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID); 263 ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID);
@@ -397,17 +399,21 @@ namespace OpenSim.Groups
397 399
398 if (success) 400 if (success)
399 { 401 {
402 // Here we always return true. The user has been added to the local group,
403 // independent of whether the remote operation succeeds or not
400 url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI"); 404 url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI");
401 if (url == string.Empty) 405 if (url == string.Empty)
402 { 406 {
403 reason = "User doesn't have a groups server"; 407 reason = "You don't have an accessible groups server in your home world. You membership to this group in only within this grid.";
404 return false; 408 return true;
405 } 409 }
406 410
407 GroupsServiceHGConnector c = GetConnector(url); 411 GroupsServiceHGConnector c = GetConnector(url);
408 if (c != null) 412 if (c != null)
409 return c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason); 413 c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason);
414 return true;
410 } 415 }
416 return false;
411 } 417 }
412 } 418 }
413 else if (m_UserManagement.IsLocalGridUser(uid)) // local user 419 else if (m_UserManagement.IsLocalGridUser(uid)) // local user
@@ -544,7 +550,6 @@ namespace OpenSim.Groups
544 List<string> urls = new List<string>(); 550 List<string> urls = new List<string>();
545 foreach (GroupMembersData m in members) 551 foreach (GroupMembersData m in members)
546 { 552 {
547 UUID userID = UUID.Zero;
548 if (!m_UserManagement.IsLocalGridUser(m.AgentID)) 553 if (!m_UserManagement.IsLocalGridUser(m.AgentID))
549 { 554 {
550 string gURL = m_UserManagement.GetUserServerURL(m.AgentID, "GroupsServerURI"); 555 string gURL = m_UserManagement.GetUserServerURL(m.AgentID, "GroupsServerURI");
@@ -592,28 +597,6 @@ namespace OpenSim.Groups
592 return m_LocalGroupsConnector.GetGroupNotices(AgentUUI(RequestingAgentID), GroupID); 597 return m_LocalGroupsConnector.GetGroupNotices(AgentUUI(RequestingAgentID), GroupID);
593 } 598 }
594 599
595 public void ResetAgentGroupChatSessions(string agentID)
596 {
597 }
598
599 public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
600 {
601 return false;
602 }
603
604 public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
605 {
606 return false;
607 }
608
609 public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
610 {
611 }
612
613 public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
614 {
615 }
616
617 #endregion 600 #endregion
618 601
619 #region hypergrid groups 602 #region hypergrid groups
@@ -685,6 +668,9 @@ namespace OpenSim.Groups
685 { 668 {
686 serviceLocation = string.Empty; 669 serviceLocation = string.Empty;
687 name = string.Empty; 670 name = string.Empty;
671 if (groupID.Equals(UUID.Zero))
672 return true;
673
688 ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty); 674 ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty);
689 if (group == null) 675 if (group == null)
690 { 676 {
diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
index 3584f78..6f58922 100644
--- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
@@ -47,7 +47,6 @@ namespace OpenSim.Groups
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private HGGroupsService m_GroupsService; 49 private HGGroupsService m_GroupsService;
50 private string m_HomeURI = string.Empty;
51 private string m_ConfigName = "Groups"; 50 private string m_ConfigName = "Groups";
52 51
53 // Called by Robust shell 52 // Called by Robust shell
@@ -209,7 +208,6 @@ namespace OpenSim.Groups
209 UUID groupID = new UUID(request["GroupID"].ToString()); 208 UUID groupID = new UUID(request["GroupID"].ToString());
210 string agentID = request["AgentID"].ToString(); 209 string agentID = request["AgentID"].ToString();
211 string token = request["AccessToken"].ToString(); 210 string token = request["AccessToken"].ToString();
212 string reason = string.Empty;
213 211
214 m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token); 212 m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token);
215 } 213 }
diff --git a/OpenSim/Addons/Groups/IGroupsServicesConnector.cs b/OpenSim/Addons/Groups/IGroupsServicesConnector.cs
index 73deb7a..a09b59e 100644
--- a/OpenSim/Addons/Groups/IGroupsServicesConnector.cs
+++ b/OpenSim/Addons/Groups/IGroupsServicesConnector.cs
@@ -92,12 +92,6 @@ namespace OpenSim.Groups
92 GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID); 92 GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID);
93 List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID); 93 List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID);
94 94
95 void ResetAgentGroupChatSessions(string agentID);
96 bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID);
97 bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID);
98 void AgentDroppedFromGroupChatSession(string agentID, UUID groupID);
99 void AgentInvitedToGroupChatSession(string agentID, UUID groupID);
100
101 } 95 }
102 96
103 public class GroupInviteInfo 97 public class GroupInviteInfo
diff --git a/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs b/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs
index 905bc91..564dec4 100644
--- a/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs
@@ -320,28 +320,6 @@ namespace OpenSim.Groups
320 return m_GroupsService.GetGroupNotices(RequestingAgentID, GroupID); 320 return m_GroupsService.GetGroupNotices(RequestingAgentID, GroupID);
321 } 321 }
322 322
323 public void ResetAgentGroupChatSessions(string agentID)
324 {
325 }
326
327 public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
328 {
329 return false;
330 }
331
332 public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
333 {
334 return false;
335 }
336
337 public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
338 {
339 }
340
341 public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
342 {
343 }
344
345 #endregion 323 #endregion
346 } 324 }
347} 325}
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
index 04328c9..161ca0c 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
@@ -133,6 +133,36 @@ namespace OpenSim.Groups
133 return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]); 133 return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
134 } 134 }
135 135
136 public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
137 {
138 List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
139 if (string.IsNullOrEmpty(query))
140 return hits;
141
142 Dictionary<string, object> sendData = new Dictionary<string, object>();
143 sendData["Query"] = query;
144 sendData["RequestingAgentID"] = RequestingAgentID;
145
146 Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);
147
148 if (ret == null)
149 return hits;
150
151 if (!ret.ContainsKey("RESULT"))
152 return hits;
153
154 if (ret["RESULT"].ToString() == "NULL")
155 return hits;
156
157 foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
158 {
159 DirGroupsReplyData m = GroupsDataUtils.DirGroupsReplyData((Dictionary<string, object>)v);
160 hits.Add(m);
161 }
162
163 return hits;
164 }
165
136 public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) 166 public GroupMembershipData AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
137 { 167 {
138 reason = string.Empty; 168 reason = string.Empty;
@@ -226,6 +256,7 @@ namespace OpenSim.Groups
226 Dictionary<string, object> sendData = new Dictionary<string, object>(); 256 Dictionary<string, object> sendData = new Dictionary<string, object>();
227 sendData["GroupID"] = GroupID.ToString(); 257 sendData["GroupID"] = GroupID.ToString();
228 sendData["RequestingAgentID"] = RequestingAgentID; 258 sendData["RequestingAgentID"] = RequestingAgentID;
259
229 Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData); 260 Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData);
230 261
231 if (ret == null) 262 if (ret == null)
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
index f1cf66c..d3de0e8 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
@@ -199,7 +199,7 @@ namespace OpenSim.Groups
199 public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search) 199 public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
200 { 200 {
201 // TODO! 201 // TODO!
202 return new List<DirGroupsReplyData>(); 202 return m_GroupsService.FindGroups(RequestingAgentID, search);
203 } 203 }
204 204
205 public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) 205 public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
@@ -406,28 +406,6 @@ namespace OpenSim.Groups
406 }); 406 });
407 } 407 }
408 408
409 public void ResetAgentGroupChatSessions(string agentID)
410 {
411 }
412
413 public bool hasAgentBeenInvitedToGroupChatSession(string agentID, UUID groupID)
414 {
415 return false;
416 }
417
418 public bool hasAgentDroppedGroupChatSession(string agentID, UUID groupID)
419 {
420 return false;
421 }
422
423 public void AgentDroppedFromGroupChatSession(string agentID, UUID groupID)
424 {
425 }
426
427 public void AgentInvitedToGroupChatSession(string agentID, UUID groupID)
428 {
429 }
430
431 #endregion 409 #endregion
432 } 410 }
433 411
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index f991d01..7e55d3c 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -133,6 +133,8 @@ namespace OpenSim.Groups
133 return HandleAddNotice(request); 133 return HandleAddNotice(request);
134 case "GETNOTICES": 134 case "GETNOTICES":
135 return HandleGetNotices(request); 135 return HandleGetNotices(request);
136 case "FINDGROUPS":
137 return HandleFindGroups(request);
136 } 138 }
137 m_log.DebugFormat("[GROUPS HANDLER]: unknown method request: {0}", method); 139 m_log.DebugFormat("[GROUPS HANDLER]: unknown method request: {0}", method);
138 } 140 }
@@ -170,11 +172,16 @@ namespace OpenSim.Groups
170 172
171 } 173 }
172 174
173 grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID); 175 if (grec.GroupID != UUID.Zero)
174 if (grec == null) 176 {
175 NullResult(result, "Internal Error"); 177 grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID);
178 if (grec == null)
179 NullResult(result, "Internal Error");
180 else
181 result["RESULT"] = GroupsDataUtils.GroupRecord(grec);
182 }
176 else 183 else
177 result["RESULT"] = GroupsDataUtils.GroupRecord(grec); 184 NullResult(result, reason);
178 } 185 }
179 186
180 string xmlString = ServerUtils.BuildXmlResponse(result); 187 string xmlString = ServerUtils.BuildXmlResponse(result);
@@ -264,7 +271,6 @@ namespace OpenSim.Groups
264 UUID groupID = new UUID(request["GroupID"].ToString()); 271 UUID groupID = new UUID(request["GroupID"].ToString());
265 string agentID = request["AgentID"].ToString(); 272 string agentID = request["AgentID"].ToString();
266 string requestingAgentID = request["RequestingAgentID"].ToString(); 273 string requestingAgentID = request["RequestingAgentID"].ToString();
267 string reason = string.Empty;
268 274
269 m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID); 275 m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID);
270 } 276 }
@@ -495,7 +501,6 @@ namespace OpenSim.Groups
495 else 501 else
496 { 502 {
497 string op = request["OP"].ToString(); 503 string op = request["OP"].ToString();
498 string reason = string.Empty;
499 504
500 bool success = false; 505 bool success = false;
501 if (op == "ADD") 506 if (op == "ADD")
@@ -563,7 +568,6 @@ namespace OpenSim.Groups
563 else 568 else
564 { 569 {
565 string op = request["OP"].ToString(); 570 string op = request["OP"].ToString();
566 string reason = string.Empty;
567 571
568 if (op == "GROUP") 572 if (op == "GROUP")
569 { 573 {
@@ -626,7 +630,6 @@ namespace OpenSim.Groups
626 else 630 else
627 { 631 {
628 string op = request["OP"].ToString(); 632 string op = request["OP"].ToString();
629 string reason = string.Empty;
630 633
631 if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID")) 634 if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID"))
632 { 635 {
@@ -739,6 +742,32 @@ namespace OpenSim.Groups
739 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 742 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
740 } 743 }
741 744
745 byte[] HandleFindGroups(Dictionary<string, object> request)
746 {
747 Dictionary<string, object> result = new Dictionary<string, object>();
748
749 if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("Query"))
750 NullResult(result, "Bad network data");
751
752 List<DirGroupsReplyData> hits = m_GroupsService.FindGroups(request["RequestingAgentID"].ToString(), request["Query"].ToString());
753
754 if (hits == null || (hits != null && hits.Count == 0))
755 NullResult(result, "No hits");
756 else
757 {
758 Dictionary<string, object> dict = new Dictionary<string, object>();
759 int i = 0;
760 foreach (DirGroupsReplyData n in hits)
761 dict["n-" + i++] = GroupsDataUtils.DirGroupsReplyData(n);
762
763 result["RESULT"] = dict;
764 }
765
766
767 string xmlString = ServerUtils.BuildXmlResponse(result);
768 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
769 }
770
742 771
743 #region Helpers 772 #region Helpers
744 773
diff --git a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs
index e7d38c2..3ac74fc 100644
--- a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs
+++ b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Groups
53 private ForeignImporter m_ForeignImporter; 53 private ForeignImporter m_ForeignImporter;
54 54
55 private Dictionary<string, bool> m_ActiveRequests = new Dictionary<string, bool>(); 55 private Dictionary<string, bool> m_ActiveRequests = new Dictionary<string, bool>();
56 private const int GROUPS_CACHE_TIMEOUT = 5 * 60; // 5 minutes 56 private const int GROUPS_CACHE_TIMEOUT = 1 * 60; // 1 minutes
57 57
58 // This all important cache cahces objects of different types: 58 // This all important cache cahces objects of different types:
59 // group-<GroupID> or group-<Name> => ExtendedGroupRecord 59 // group-<GroupID> or group-<Name> => ExtendedGroupRecord
@@ -209,13 +209,10 @@ namespace OpenSim.Groups
209 public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d) 209 public void SetAgentActiveGroup(string AgentID, GroupMembershipDelegate d)
210 { 210 {
211 GroupMembershipData activeGroup = d(); 211 GroupMembershipData activeGroup = d();
212 if (activeGroup != null) 212 string cacheKey = "active-" + AgentID.ToString();
213 { 213 lock (m_Cache)
214 string cacheKey = "active-" + AgentID.ToString(); 214 if (m_Cache.Contains(cacheKey))
215 lock (m_Cache) 215 m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT);
216 if (m_Cache.Contains(cacheKey))
217 m_Cache.AddOrUpdate(cacheKey, activeGroup, GROUPS_CACHE_TIMEOUT);
218 }
219 } 216 }
220 217
221 public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d) 218 public ExtendedGroupMembershipData GetAgentActiveMembership(string AgentID, GroupMembershipDelegate d)
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index 0668870..037ef59 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -130,6 +130,13 @@ namespace OpenSim.Groups
130 { 130 {
131 reason = string.Empty; 131 reason = string.Empty;
132 132
133 // Check if the group already exists
134 if (m_Database.RetrieveGroup(name) != null)
135 {
136 reason = "A group with that name already exists";
137 return UUID.Zero;
138 }
139
133 // Create the group 140 // Create the group
134 GroupData data = new GroupData(); 141 GroupData data = new GroupData();
135 data.GroupID = UUID.Random(); 142 data.GroupID = UUID.Random();
@@ -248,13 +255,20 @@ namespace OpenSim.Groups
248 return members; 255 return members;
249 List<RoleData> rolesList = new List<RoleData>(roles); 256 List<RoleData> rolesList = new List<RoleData>(roles);
250 257
251 // Is the requester a member of the group? 258 // Check visibility?
252 bool isInGroup = false; 259 // When we don't want to check visibility, we pass it "all" as the requestingAgentID
253 if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null) 260 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
254 isInGroup = true;
255 261
256 if (!isInGroup) // reduce the roles to the visible ones 262 if (checkVisibility)
257 rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0); 263 {
264 // Is the requester a member of the group?
265 bool isInGroup = false;
266 if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null)
267 isInGroup = true;
268
269 if (!isInGroup) // reduce the roles to the visible ones
270 rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0);
271 }
258 272
259 MembershipData[] datas = m_Database.RetrieveMembers(GroupID); 273 MembershipData[] datas = m_Database.RetrieveMembers(GroupID);
260 if (datas == null || (datas != null && datas.Length == 0)) 274 if (datas == null || (datas != null && datas.Length == 0))
@@ -723,12 +737,12 @@ namespace OpenSim.Groups
723 737
724 #region Actions without permission checks 738 #region Actions without permission checks
725 739
726 private void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) 740 protected void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
727 { 741 {
728 _AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, string.Empty); 742 _AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, string.Empty);
729 } 743 }
730 744
731 public void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID) 745 protected void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
732 { 746 {
733 // 1. Delete membership 747 // 1. Delete membership
734 m_Database.DeleteMember(GroupID, AgentID); 748 m_Database.DeleteMember(GroupID, AgentID);
@@ -780,7 +794,7 @@ namespace OpenSim.Groups
780 794
781 } 795 }
782 796
783 private bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add) 797 protected bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add)
784 { 798 {
785 RoleData data = m_Database.RetrieveRole(groupID, roleID); 799 RoleData data = m_Database.RetrieveRole(groupID, roleID);
786 800
@@ -810,12 +824,12 @@ namespace OpenSim.Groups
810 return m_Database.StoreRole(data); 824 return m_Database.StoreRole(data);
811 } 825 }
812 826
813 private void _RemoveGroupRole(UUID groupID, UUID roleID) 827 protected void _RemoveGroupRole(UUID groupID, UUID roleID)
814 { 828 {
815 m_Database.DeleteRole(groupID, roleID); 829 m_Database.DeleteRole(groupID, roleID);
816 } 830 }
817 831
818 private void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) 832 protected void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
819 { 833 {
820 RoleMembershipData data = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 834 RoleMembershipData data = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
821 if (data != null) 835 if (data != null)
@@ -840,7 +854,7 @@ namespace OpenSim.Groups
840 854
841 } 855 }
842 856
843 private List<GroupRolesData> _GetGroupRoles(UUID groupID) 857 protected List<GroupRolesData> _GetGroupRoles(UUID groupID)
844 { 858 {
845 List<GroupRolesData> roles = new List<GroupRolesData>(); 859 List<GroupRolesData> roles = new List<GroupRolesData>();
846 860
@@ -865,7 +879,7 @@ namespace OpenSim.Groups
865 return roles; 879 return roles;
866 } 880 }
867 881
868 private List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup) 882 protected List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup)
869 { 883 {
870 List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>(); 884 List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>();
871 885
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 5320543..537ec85 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -458,8 +458,6 @@ namespace OpenSim.Data.MySQL
458 if (prim.ParentUUID == UUID.Zero) 458 if (prim.ParentUUID == UUID.Zero)
459 { 459 {
460 objects[prim.UUID] = new SceneObjectGroup(prim); 460 objects[prim.UUID] = new SceneObjectGroup(prim);
461 if (prim.KeyframeMotion != null)
462 prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
463 } 461 }
464 } 462 }
465 463
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 99a6598..76f717d 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -732,9 +732,12 @@ namespace OpenSim.Data.SQLite
732 } 732 }
733 733
734 SceneObjectGroup group = new SceneObjectGroup(prim); 734 SceneObjectGroup group = new SceneObjectGroup(prim);
735
735 createdObjects.Add(group.UUID, group); 736 createdObjects.Add(group.UUID, group);
736 retvals.Add(group); 737 retvals.Add(group);
737 LoadItems(prim); 738 LoadItems(prim);
739
740
738 } 741 }
739 } 742 }
740 catch (Exception e) 743 catch (Exception e)
diff --git a/OpenSim/Framework/GridInstantMessage.cs b/OpenSim/Framework/GridInstantMessage.cs
index 6ae0488..da3690c 100644
--- a/OpenSim/Framework/GridInstantMessage.cs
+++ b/OpenSim/Framework/GridInstantMessage.cs
@@ -53,6 +53,24 @@ namespace OpenSim.Framework
53 binaryBucket = new byte[0]; 53 binaryBucket = new byte[0];
54 } 54 }
55 55
56 public GridInstantMessage(GridInstantMessage im, bool addTimestamp)
57 {
58 fromAgentID = im.fromAgentID;
59 fromAgentName = im.fromAgentName;
60 toAgentID = im.toAgentID;
61 dialog = im.dialog;
62 fromGroup = im.fromGroup;
63 message = im.message;
64 imSessionID = im.imSessionID;
65 offline = im.offline;
66 Position = im.Position;
67 binaryBucket = im.binaryBucket;
68 RegionID = im.RegionID;
69
70 if (addTimestamp)
71 timestamp = (uint)Util.UnixTimeSinceEpoch();
72 }
73
56 public GridInstantMessage(IScene scene, UUID _fromAgentID, 74 public GridInstantMessage(IScene scene, UUID _fromAgentID,
57 string _fromAgentName, UUID _toAgentID, 75 string _fromAgentName, UUID _toAgentID,
58 byte _dialog, bool _fromGroup, string _message, 76 byte _dialog, bool _fromGroup, string _message,
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs
index 415b7df..55c9613 100644
--- a/OpenSim/Framework/IMoneyModule.cs
+++ b/OpenSim/Framework/IMoneyModule.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework
33 public interface IMoneyModule 33 public interface IMoneyModule
34 { 34 {
35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, 35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
36 int amount, UUID txn); 36 int amount, UUID txn, out string reason);
37 37
38 int GetBalance(UUID agentID); 38 int GetBalance(UUID agentID);
39 bool UploadCovered(UUID agentID, int amount); 39 bool UploadCovered(UUID agentID, int amount);
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs
index 4b7d4c7..dfe9695 100644
--- a/OpenSim/Framework/NetworkServersInfo.cs
+++ b/OpenSim/Framework/NetworkServersInfo.cs
@@ -41,6 +41,7 @@ namespace OpenSim.Framework
41 41
42 // "Out of band" managemnt https 42 // "Out of band" managemnt https
43 public bool ssl_listener = false; 43 public bool ssl_listener = false;
44 public bool ssl_external = false;
44 public uint https_port = 0; 45 public uint https_port = 0;
45 public string cert_path = String.Empty; 46 public string cert_path = String.Empty;
46 public string cert_pass = String.Empty; 47 public string cert_pass = String.Empty;
@@ -64,6 +65,7 @@ namespace OpenSim.Framework
64 65
65 // "Out of band management https" 66 // "Out of band management https"
66 ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); 67 ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false);
68 ssl_external = config.Configs["Network"].GetBoolean("https_external",false);
67 if( ssl_listener) 69 if( ssl_listener)
68 { 70 {
69 cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); 71 cert_path = config.Configs["Network"].GetString("cert_path",String.Empty);
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 6dde62f..24ec181 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -224,10 +224,12 @@ namespace OpenSim.Framework
224 // 224 //
225 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) 225 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
226 { 226 {
227 // m_configSource = configSource; 227 XmlElement elem = (XmlElement)xmlNode;
228 configMember = 228 string name = elem.GetAttribute("Name");
229 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 229 string xmlstr = "<Nini>" + xmlNode.OuterXml + "</Nini>";
230 configMember.performConfigurationRetrieve(); 230 XmlConfigSource source = new XmlConfigSource(XmlReader.Create(new StringReader(xmlstr)));
231 ReadNiniConfig(source, name);
232
231 m_serverURI = string.Empty; 233 m_serverURI = string.Empty;
232 } 234 }
233 235
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index c7caf6f..65de563 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -93,8 +93,8 @@ namespace OpenSim.Framework.RegionLoader.Web
93 xmlSource.Length); 93 xmlSource.Length);
94 XmlDocument xmlDoc = new XmlDocument(); 94 XmlDocument xmlDoc = new XmlDocument();
95 xmlDoc.LoadXml(xmlSource); 95 xmlDoc.LoadXml(xmlSource);
96 if (xmlDoc.FirstChild.Name == "Regions") 96 if (xmlDoc.FirstChild.Name == "Nini")
97 { 97 {
98 regionCount = xmlDoc.FirstChild.ChildNodes.Count; 98 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
99 99
100 if (regionCount > 0) 100 if (regionCount > 0)
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 7361f50..88bd869 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -195,7 +195,9 @@ namespace OpenSim
195 195
196 m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true); 196 m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true);
197 197
198 string permissionModules = startupConfig.GetString("permissionmodules", "DefaultPermissionsModule"); 198 string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules",
199 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
200
199 m_permsModules = new List<string>(permissionModules.Split(',')); 201 m_permsModules = new List<string>(permissionModules.Split(','));
200 } 202 }
201 203
@@ -392,29 +394,19 @@ namespace OpenSim
392 } 394 }
393 else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing..."); 395 else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
394 396
395 // XPTO: Fix this 397 if (m_securePermissionsLoading)
396// if (m_securePermissionsLoading) 398 {
397// { 399 foreach (string s in m_permsModules)
398// foreach (string s in m_permsModules) 400 {
399// { 401 if (!scene.RegionModules.ContainsKey(s))
400// if (!scene.RegionModules.ContainsKey(s)) 402 {
401// { 403 m_log.Fatal("[MODULES]: Required module " + s + " not found.");
402// bool found = false; 404 Environment.Exit(0);
403// foreach (IRegionModule m in modules) 405 }
404// { 406 }
405// if (m.Name == s) 407
406// { 408 m_log.InfoFormat("[SCENE]: Secure permissions loading enabled, modules loaded: {0}", String.Join(" ", m_permsModules.ToArray()));
407// found = true; 409 }
408// }
409// }
410// if (!found)
411// {
412// m_log.Fatal("[MODULES]: Required module " + s + " not found.");
413// Environment.Exit(0);
414// }
415// }
416// }
417// }
418 410
419 scene.SetModuleInterfaces(); 411 scene.SetModuleInterfaces();
420// First Step of bootreport sequence 412// First Step of bootreport sequence
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 59b9585..8241e07 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -990,13 +990,20 @@ namespace OpenSim.Region.ClientStack.Linden
990 else 990 else
991 prim.Name = assetName + "#" + i.ToString(); 991 prim.Name = assetName + "#" + i.ToString();
992 992
993 prim.EveryoneMask = 0;
994 prim.GroupMask = 0;
995
993 if (restrictPerms) 996 if (restrictPerms)
994 { 997 {
995 prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); 998 prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
996 prim.EveryoneMask = 0;
997 prim.GroupMask = 0;
998 prim.NextOwnerMask = 0;
999 prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); 999 prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
1000 prim.NextOwnerMask = 0;
1001 }
1002 else
1003 {
1004 prim.BaseMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1005 prim.OwnerMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1006 prim.NextOwnerMask = (uint)PermissionMask.Transfer;
1000 } 1007 }
1001 1008
1002 if(istest) 1009 if(istest)
@@ -1099,21 +1106,17 @@ namespace OpenSim.Region.ClientStack.Linden
1099 1106
1100 if (restrictPerms) 1107 if (restrictPerms)
1101 { 1108 {
1102 item.CurrentPermissions
1103 = (uint)(PermissionMask.Move | PermissionMask.Modify);
1104
1105 item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); 1109 item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
1110 item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
1106 item.EveryOnePermissions = 0; 1111 item.EveryOnePermissions = 0;
1107 item.NextPermissions = 0; 1112 item.NextPermissions = 0;
1108 } 1113 }
1109 else 1114 else
1110 { 1115 {
1111 item.CurrentPermissions
1112 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
1113
1114 item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; 1116 item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1117 item.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1115 item.EveryOnePermissions = 0; 1118 item.EveryOnePermissions = 0;
1116 item.NextPermissions = (uint)PermissionMask.All; 1119 item.NextPermissions = (uint)PermissionMask.Transfer;
1117 } 1120 }
1118 1121
1119 item.CreationDate = Util.UnixTimeSinceEpoch(); 1122 item.CreationDate = Util.UnixTimeSinceEpoch();
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index a42c96c..0570144 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -77,6 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden
77 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 77 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
78 private static Thread[] m_workerThreads = null; 78 private static Thread[] m_workerThreads = null;
79 79
80 private string m_Url = "localhost";
81
80 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 82 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
81 new OpenMetaverse.BlockingQueue<aPollRequest>(); 83 new OpenMetaverse.BlockingQueue<aPollRequest>();
82 84
@@ -86,6 +88,9 @@ namespace OpenSim.Region.ClientStack.Linden
86 88
87 public void Initialise(IConfigSource source) 89 public void Initialise(IConfigSource source)
88 { 90 {
91 IConfig config = source.Configs["ClientStack.LindenCaps"];
92 if (config != null)
93 m_Url = config.GetString("Cap_GetTexture", "localhost");
89 } 94 }
90 95
91 public void AddRegion(Scene s) 96 public void AddRegion(Scene s)
@@ -343,27 +348,34 @@ namespace OpenSim.Region.ClientStack.Linden
343 348
344 private void RegisterCaps(UUID agentID, Caps caps) 349 private void RegisterCaps(UUID agentID, Caps caps)
345 { 350 {
346 string capUrl = "/CAPS/" + UUID.Random() + "/"; 351 if (m_Url == "localhost")
347 352 {
348 // Register this as a poll service 353 string capUrl = "/CAPS/" + UUID.Random() + "/";
349 PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); 354
350 355 // Register this as a poll service
351 args.Type = PollServiceEventArgs.EventType.Texture; 356 PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
352 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); 357
353 358 args.Type = PollServiceEventArgs.EventType.Texture;
354 string hostName = m_scene.RegionInfo.ExternalHostName; 359 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
355 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; 360
356 string protocol = "http"; 361 string hostName = m_scene.RegionInfo.ExternalHostName;
357 362 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
358 if (MainServer.Instance.UseSSL) 363 string protocol = "http";
364
365 if (MainServer.Instance.UseSSL)
366 {
367 hostName = MainServer.Instance.SSLCommonName;
368 port = MainServer.Instance.SSLPort;
369 protocol = "https";
370 }
371 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
372 m_pollservices[agentID] = args;
373 m_capsDict[agentID] = capUrl;
374 }
375 else
359 { 376 {
360 hostName = MainServer.Instance.SSLCommonName; 377 caps.RegisterHandler("GetTexture", m_Url);
361 port = MainServer.Instance.SSLPort;
362 protocol = "https";
363 } 378 }
364 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
365 m_pollservices[agentID] = args;
366 m_capsDict[agentID] = capUrl;
367 } 379 }
368 380
369 private void DeregisterCaps(UUID agentID, Caps caps) 381 private void DeregisterCaps(UUID agentID, Caps caps)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index eebb8ae..7c62f90 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2233,9 +2233,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2233 2233
2234 public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) 2234 public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
2235 { 2235 {
2236 m_activeGroupID = activegroupid; 2236 if (agentid == AgentId)
2237 m_activeGroupName = groupname; 2237 {
2238 m_activeGroupPowers = grouppowers; 2238 m_activeGroupID = activegroupid;
2239 m_activeGroupName = groupname;
2240 m_activeGroupPowers = grouppowers;
2241 }
2239 2242
2240 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); 2243 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
2241 sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; 2244 sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid;
@@ -3933,6 +3936,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3933 part.Shape.ProfileHollow = 27500; 3936 part.Shape.ProfileHollow = 27500;
3934 } 3937 }
3935 } 3938 }
3939 else if (update.Entity is ScenePresence)
3940 {
3941 ScenePresence presence = (ScenePresence)update.Entity;
3942
3943 // If ParentUUID is not UUID.Zero and ParentID is 0, this
3944 // avatar is in the process of crossing regions while
3945 // sat on an object. In this state, we don't want any
3946 // updates because they will visually orbit the avatar.
3947 // Update will be forced once crossing is completed anyway.
3948 if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0)
3949 continue;
3950 }
3936 3951
3937 ++updatesThisCall; 3952 ++updatesThisCall;
3938 3953
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 853b72d..287c278 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -100,13 +100,25 @@ namespace OpenSim.Region.ClientStack
100 // "OOB" Server 100 // "OOB" Server
101 if (m_networkServersInfo.ssl_listener) 101 if (m_networkServersInfo.ssl_listener)
102 { 102 {
103 BaseHttpServer server = new BaseHttpServer( 103 if (!m_networkServersInfo.ssl_external)
104 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, 104 {
105 m_networkServersInfo.cert_pass); 105 BaseHttpServer server = new BaseHttpServer(
106 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
107 m_networkServersInfo.cert_pass);
106 108
107 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); 109 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
108 MainServer.AddHttpServer(server); 110 MainServer.AddHttpServer(server);
109 server.Start(); 111 server.Start();
112 }
113 else
114 {
115 BaseHttpServer server = new BaseHttpServer(
116 m_networkServersInfo.https_port);
117
118 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port);
119 MainServer.AddHttpServer(server);
120 server.Start();
121 }
110 } 122 }
111 123
112 base.StartupSpecific(); 124 base.StartupSpecific();
@@ -132,4 +144,4 @@ namespace OpenSim.Region.ClientStack
132 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); 144 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
133 } 145 }
134 } 146 }
135} \ No newline at end of file 147}
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f2f789b..6495f3f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -302,7 +302,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
302 // If we're an NPC then skip all the item checks and manipulations since we don't have an 302 // If we're an NPC then skip all the item checks and manipulations since we don't have an
303 // inventory right now. 303 // inventory right now.
304 RezSingleAttachmentFromInventoryInternal( 304 RezSingleAttachmentFromInventoryInternal(
305 sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p, true, null); 305 sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p, true, d);
306 } 306 }
307 catch (Exception e) 307 catch (Exception e)
308 { 308 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 343cdb5..c52d586 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -182,6 +182,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
182 try 182 try
183 { 183 {
184 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 184 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
185 if (obj == null)
186 return;
185 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 187 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
186 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage) 188 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
187 { 189 {
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 2d46276..41958b3 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -40,6 +40,13 @@ using OpenSim.Region.Framework.Scenes;
40 40
41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
42{ 42{
43 public struct SendReply
44 {
45 public bool Success;
46 public string Message;
47 public int Disposition;
48 }
49
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")]
44 public class OfflineMessageModule : ISharedRegionModule 51 public class OfflineMessageModule : ISharedRegionModule
45 { 52 {
@@ -50,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
50 private string m_RestURL = String.Empty; 57 private string m_RestURL = String.Empty;
51 IMessageTransferModule m_TransferModule = null; 58 IMessageTransferModule m_TransferModule = null;
52 private bool m_ForwardOfflineGroupMessages = true; 59 private bool m_ForwardOfflineGroupMessages = true;
60 private Dictionary<IClientAPI, List<UUID>> m_repliesSent= new Dictionary<IClientAPI, List<UUID>>();
53 61
54 public void Initialise(IConfigSource config) 62 public void Initialise(IConfigSource config)
55 { 63 {
@@ -169,6 +177,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
169 private void OnNewClient(IClientAPI client) 177 private void OnNewClient(IClientAPI client)
170 { 178 {
171 client.OnRetrieveInstantMessages += RetrieveInstantMessages; 179 client.OnRetrieveInstantMessages += RetrieveInstantMessages;
180 client.OnLogout += OnClientLoggedOut;
181 }
182
183 public void OnClientLoggedOut(IClientAPI client)
184 {
185 m_repliesSent.Remove(client);
172 } 186 }
173 187
174 private void RetrieveInstantMessages(IClientAPI client) 188 private void RetrieveInstantMessages(IClientAPI client)
@@ -228,7 +242,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
228 if (scene == null) 242 if (scene == null)
229 scene = m_SceneList[0]; 243 scene = m_SceneList[0];
230 244
231 bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( 245 SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
232 "POST", m_RestURL+"/SaveMessage/?scope=" + 246 "POST", m_RestURL+"/SaveMessage/?scope=" +
233 scene.RegionInfo.ScopeID.ToString(), im); 247 scene.RegionInfo.ScopeID.ToString(), im);
234 248
@@ -238,13 +252,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
238 if (client == null) 252 if (client == null)
239 return; 253 return;
240 254
241 client.SendInstantMessage(new GridInstantMessage( 255 if (reply.Message == String.Empty)
242 null, new UUID(im.toAgentID), 256 reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
243 "System", new UUID(im.fromAgentID), 257
244 (byte)InstantMessageDialog.MessageFromAgent, 258 bool sendReply = true;
245 "User is not logged in. "+ 259
246 (success ? "Message saved." : "Message not saved"), 260 switch (reply.Disposition)
247 false, new Vector3())); 261 {
262 case 0: // Normal
263 break;
264 case 1: // Only once per user
265 if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
266 {
267 sendReply = false;
268 }
269 else
270 {
271 if (!m_repliesSent.ContainsKey(client))
272 m_repliesSent[client] = new List<UUID>();
273 m_repliesSent[client].Add(new UUID(im.toAgentID));
274 }
275 break;
276 }
277
278 if (sendReply)
279 {
280 client.SendInstantMessage(new GridInstantMessage(
281 null, new UUID(im.toAgentID),
282 "System", new UUID(im.fromAgentID),
283 (byte)InstantMessageDialog.MessageFromAgent,
284 reply.Message,
285 false, new Vector3()));
286 }
248 } 287 }
249 } 288 }
250 } 289 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index a606d76..193a27b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -265,7 +265,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
265 return UUID.Zero; 265 return UUID.Zero;
266 } 266 }
267 267
268 remoteClient.SendAgentAlertMessage("Notecard saved", false); 268 remoteClient.SendAlertMessage("Notecard saved");
269 } 269 }
270 else if ((InventoryType)item.InvType == InventoryType.LSL) 270 else if ((InventoryType)item.InvType == InventoryType.LSL)
271 { 271 {
@@ -275,7 +275,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
275 return UUID.Zero; 275 return UUID.Zero;
276 } 276 }
277 277
278 remoteClient.SendAgentAlertMessage("Script saved", false); 278 remoteClient.SendAlertMessage("Script saved");
279 } 279 }
280 280
281 AssetBase asset = 281 AssetBase asset =
@@ -799,6 +799,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
799 XmlDocument doc = new XmlDocument(); 799 XmlDocument doc = new XmlDocument();
800 doc.LoadXml(xmlData); 800 doc.LoadXml(xmlData);
801 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); 801 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
802 Vector3 rez_pos;
802 if (e == null || attachment) // Single 803 if (e == null || attachment) // Single
803 { 804 {
804 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); 805 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
@@ -820,6 +821,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
820 RayStart, RayEnd, RayTargetID, Quaternion.Identity, 821 RayStart, RayEnd, RayTargetID, Quaternion.Identity,
821 BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); 822 BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false);
822 pos.Z += offsetHeight; 823 pos.Z += offsetHeight;
824 rez_pos = pos;
823 } 825 }
824 else 826 else
825 { 827 {
@@ -834,6 +836,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
834 BypassRayCast, bRayEndIsIntersection, true, 836 BypassRayCast, bRayEndIsIntersection, true,
835 bbox, false); 837 bbox, false);
836 838
839 rez_pos = pos;
840
837 pos -= bbox / 2; 841 pos -= bbox / 2;
838 842
839 XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); 843 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
@@ -870,7 +874,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
870 primcount += g.PrimCount; 874 primcount += g.PrimCount;
871 875
872 if (!m_Scene.Permissions.CanRezObject( 876 if (!m_Scene.Permissions.CanRezObject(
873 primcount, remoteClient.AgentId, pos) 877 primcount, remoteClient.AgentId, rez_pos)
874 && !attachment) 878 && !attachment)
875 { 879 {
876 // The client operates in no fail mode. It will 880 // The client operates in no fail mode. It will
@@ -887,7 +891,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
887 return null; 891 return null;
888 } 892 }
889 893
890 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) 894 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, rez_pos, attachment))
891 return null; 895 return null;
892 896
893 for (int i = 0; i < objlist.Count; i++) 897 for (int i = 0; i < objlist.Count; i++)
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index a5f5749..834fd77 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -96,6 +96,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
96 96
97 m_commands = new EstateManagementCommands(this); 97 m_commands = new EstateManagementCommands(this);
98 m_commands.Initialise(); 98 m_commands.Initialise();
99
100 m_regionChangeTimer.Interval = 10000;
101 m_regionChangeTimer.Elapsed += RaiseRegionInfoChange;
102 m_regionChangeTimer.AutoReset = false;
99 } 103 }
100 104
101 public void RemoveRegion(Scene scene) {} 105 public void RemoveRegion(Scene scene) {}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index c307998..4e21724 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -565,7 +565,7 @@ namespace OpenSim.Region.CoreModules.World.Land
565 requiredPowers = GroupPowers.LandManageBanned; 565 requiredPowers = GroupPowers.LandManageBanned;
566 566
567 if (m_scene.Permissions.CanEditParcelProperties(agentID, 567 if (m_scene.Permissions.CanEditParcelProperties(agentID,
568 land, requiredPowers)) 568 land, requiredPowers, false))
569 { 569 {
570 land.UpdateAccessList(flags, transactionID, sequenceID, 570 land.UpdateAccessList(flags, transactionID, sequenceID,
571 sections, entries, remote_client); 571 sections, entries, remote_client);
@@ -927,7 +927,7 @@ namespace OpenSim.Region.CoreModules.World.Land
927 927
928 //If we are still here, then they are subdividing within one piece of land 928 //If we are still here, then they are subdividing within one piece of land
929 //Check owner 929 //Check owner
930 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin)) 930 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin, true))
931 { 931 {
932 return; 932 return;
933 } 933 }
@@ -996,7 +996,7 @@ namespace OpenSim.Region.CoreModules.World.Land
996 { 996 {
997 return; 997 return;
998 } 998 }
999 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin)) 999 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin, true))
1000 { 1000 {
1001 return; 1001 return;
1002 } 1002 }
@@ -1727,7 +1727,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1727 1727
1728 if (land == null) return; 1728 if (land == null) return;
1729 1729
1730 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions)) 1730 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions, false))
1731 return; 1731 return;
1732 1732
1733 land.LandData.OtherCleanTime = otherCleanTime; 1733 land.LandData.OtherCleanTime = otherCleanTime;
@@ -1827,7 +1827,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1827 if (targetAvatar.UserLevel == 0) 1827 if (targetAvatar.UserLevel == 0)
1828 { 1828 {
1829 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); 1829 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1830 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) 1830 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true))
1831 return; 1831 return;
1832 if (flags == 0) 1832 if (flags == 0)
1833 { 1833 {
@@ -1876,7 +1876,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1876 1876
1877 // Check if you even have permission to do this 1877 // Check if you even have permission to do this
1878 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); 1878 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1879 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) && 1879 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true) &&
1880 !m_scene.Permissions.IsAdministrator(client.AgentId)) 1880 !m_scene.Permissions.IsAdministrator(client.AgentId))
1881 return; 1881 return;
1882 1882
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 07d00c0..2eafd44 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Land
286 // ParcelFlags.ForSaleObjects 286 // ParcelFlags.ForSaleObjects
287 // ParcelFlags.LindenHome 287 // ParcelFlags.LindenHome
288 288
289 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 289 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, false))
290 { 290 {
291 allowedDelta |= (uint)(ParcelFlags.AllowLandmark | 291 allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
292 ParcelFlags.AllowTerraform | 292 ParcelFlags.AllowTerraform |
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.World.Land
301 ParcelFlags.AllowFly); 301 ParcelFlags.AllowFly);
302 } 302 }
303 303
304 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) 304 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale, true))
305 { 305 {
306 if (args.AuthBuyerID != newData.AuthBuyerID || 306 if (args.AuthBuyerID != newData.AuthBuyerID ||
307 args.SalePrice != newData.SalePrice) 307 args.SalePrice != newData.SalePrice)
@@ -324,7 +324,7 @@ namespace OpenSim.Region.CoreModules.World.Land
324 allowedDelta |= (uint)ParcelFlags.ForSale; 324 allowedDelta |= (uint)ParcelFlags.ForSale;
325 } 325 }
326 326
327 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces)) 327 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces, false))
328 { 328 {
329 newData.Category = args.Category; 329 newData.Category = args.Category;
330 330
@@ -333,21 +333,21 @@ namespace OpenSim.Region.CoreModules.World.Land
333 ParcelFlags.MaturePublish) | (uint)(1 << 23); 333 ParcelFlags.MaturePublish) | (uint)(1 << 23);
334 } 334 }
335 335
336 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) 336 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity, false))
337 { 337 {
338 newData.Description = args.Desc; 338 newData.Description = args.Desc;
339 newData.Name = args.Name; 339 newData.Name = args.Name;
340 newData.SnapshotID = args.SnapshotID; 340 newData.SnapshotID = args.SnapshotID;
341 } 341 }
342 342
343 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint)) 343 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint, false))
344 { 344 {
345 newData.LandingType = args.LandingType; 345 newData.LandingType = args.LandingType;
346 newData.UserLocation = args.UserLocation; 346 newData.UserLocation = args.UserLocation;
347 newData.UserLookAt = args.UserLookAt; 347 newData.UserLookAt = args.UserLookAt;
348 } 348 }
349 349
350 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia)) 350 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia, false))
351 { 351 {
352 newData.MediaAutoScale = args.MediaAutoScale; 352 newData.MediaAutoScale = args.MediaAutoScale;
353 newData.MediaID = args.MediaID; 353 newData.MediaID = args.MediaID;
@@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.World.Land
368 ParcelFlags.UseEstateVoiceChan); 368 ParcelFlags.UseEstateVoiceChan);
369 } 369 }
370 370
371 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses)) 371 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses, false))
372 { 372 {
373 newData.PassHours = args.PassHours; 373 newData.PassHours = args.PassHours;
374 newData.PassPrice = args.PassPrice; 374 newData.PassPrice = args.PassPrice;
@@ -376,25 +376,27 @@ namespace OpenSim.Region.CoreModules.World.Land
376 allowedDelta |= (uint)ParcelFlags.UsePassList; 376 allowedDelta |= (uint)ParcelFlags.UsePassList;
377 } 377 }
378 378
379 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed)) 379 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed, false))
380 { 380 {
381 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | 381 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
382 ParcelFlags.UseAccessList); 382 ParcelFlags.UseAccessList);
383 } 383 }
384 384
385 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned)) 385 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned, false))
386 { 386 {
387 allowedDelta |= (uint)(ParcelFlags.UseBanList | 387 allowedDelta |= (uint)(ParcelFlags.UseBanList |
388 ParcelFlags.DenyAnonymous | 388 ParcelFlags.DenyAnonymous |
389 ParcelFlags.DenyAgeUnverified); 389 ParcelFlags.DenyAgeUnverified);
390 } 390 }
391 391
392 uint preserve = LandData.Flags & ~allowedDelta; 392 if (allowedDelta != (uint)ParcelFlags.None)
393 newData.Flags = preserve | (args.ParcelFlags & allowedDelta); 393 {
394 394 uint preserve = LandData.Flags & ~allowedDelta;
395 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 395 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
396 396
397 SendLandUpdateToAvatarsOverMe(snap_selection); 397 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
398 SendLandUpdateToAvatarsOverMe(snap_selection);
399 }
398 } 400 }
399 401
400 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 402 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
950 952
951 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 953 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
952 { 954 {
953 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 955 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
954 { 956 {
955 List<uint> resultLocalIDs = new List<uint>(); 957 List<uint> resultLocalIDs = new List<uint>();
956 try 958 try
@@ -1000,7 +1002,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1000 /// </param> 1002 /// </param>
1001 public void SendLandObjectOwners(IClientAPI remote_client) 1003 public void SendLandObjectOwners(IClientAPI remote_client)
1002 { 1004 {
1003 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 1005 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
1004 { 1006 {
1005 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 1007 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
1006 List<UUID> groups = new List<UUID>(); 1008 List<UUID> groups = new List<UUID>();
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 79dd4a0..4f5b9b7 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -42,8 +42,8 @@ using PermissionMask = OpenSim.Framework.PermissionMask;
42 42
43namespace OpenSim.Region.CoreModules.World.Permissions 43namespace OpenSim.Region.CoreModules.World.Permissions
44{ 44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")] 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultPermissionsModule")]
46 public class PermissionsModule : INonSharedRegionModule, IPermissionsModule 46 public class DefaultPermissionsModule : INonSharedRegionModule, IPermissionsModule
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
@@ -348,7 +348,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
348 348
349 public string Name 349 public string Name
350 { 350 {
351 get { return "PermissionsModule"; } 351 get { return "DefaultPermissionsModule"; }
352 } 352 }
353 353
354 public Type ReplaceableInterface 354 public Type ReplaceableInterface
@@ -1047,7 +1047,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1047 return GenericObjectPermission(editorID, objectID, false); 1047 return GenericObjectPermission(editorID, objectID, false);
1048 } 1048 }
1049 1049
1050 private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene) 1050 private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
1051 { 1051 {
1052 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1052 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1053 if (m_bypassPermissions) return m_bypassPermissionsValue; 1053 if (m_bypassPermissions) return m_bypassPermissionsValue;
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index 09481a7..f0e639d 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -662,7 +662,7 @@ namespace OpenSim.Region.Framework.Scenes
662 662
663 // Do the frame processing 663 // Do the frame processing
664 double steps = (double)m_currentFrame.TimeMS / tickDuration; 664 double steps = (double)m_currentFrame.TimeMS / tickDuration;
665 665
666 if (steps <= 0.0) 666 if (steps <= 0.0)
667 { 667 {
668 m_group.RootPart.Velocity = Vector3.Zero; 668 m_group.RootPart.Velocity = Vector3.Zero;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 535d87a..4d90726 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes
70 public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); 70 public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene);
71 public delegate bool IsAdministratorHandler(UUID user); 71 public delegate bool IsAdministratorHandler(UUID user);
72 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); 72 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
73 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); 73 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager);
74 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); 74 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
75 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); 75 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
76 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); 76 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
@@ -763,7 +763,7 @@ namespace OpenSim.Region.Framework.Scenes
763 763
764 #region EDIT PARCEL 764 #region EDIT PARCEL
765 765
766 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p) 766 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, bool allowManager)
767 { 767 {
768 EditParcelPropertiesHandler handler = OnEditParcelProperties; 768 EditParcelPropertiesHandler handler = OnEditParcelProperties;
769 if (handler != null) 769 if (handler != null)
@@ -771,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes
771 Delegate[] list = handler.GetInvocationList(); 771 Delegate[] list = handler.GetInvocationList();
772 foreach (EditParcelPropertiesHandler h in list) 772 foreach (EditParcelPropertiesHandler h in list)
773 { 773 {
774 if (h(user, parcel, p, m_scene) == false) 774 if (h(user, parcel, p, m_scene, allowManager) == false)
775 return false; 775 return false;
776 } 776 }
777 } 777 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2b58795..b189599 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2802,8 +2802,10 @@ namespace OpenSim.Region.Framework.Scenes
2802 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); 2802 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
2803 newObject.ResumeScripts(); 2803 newObject.ResumeScripts();
2804 2804
2805 if (newObject.RootPart.KeyframeMotion != null) 2805 // AddSceneObject already does this and doing it again messes
2806 newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); 2806 // up region crossings, so don't.
2807 //if (newObject.RootPart.KeyframeMotion != null)
2808 // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
2807 } 2809 }
2808 2810
2809 // Do this as late as possible so that listeners have full access to the incoming object 2811 // Do this as late as possible so that listeners have full access to the incoming object
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0ea4e09..86f60bb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -591,6 +591,7 @@ namespace OpenSim.Region.Framework.Scenes
591 avinfo.ParentID = av.ParentID; 591 avinfo.ParentID = av.ParentID;
592 avsToCross.Add(avinfo); 592 avsToCross.Add(avinfo);
593 593
594 av.PrevSitOffset = av.OffsetPosition;
594 av.ParentID = 0; 595 av.ParentID = 0;
595 } 596 }
596 597
@@ -1072,6 +1073,11 @@ namespace OpenSim.Region.Framework.Scenes
1072 for (int i = 0; i < parts.Length; i++) 1073 for (int i = 0; i < parts.Length; i++)
1073 { 1074 {
1074 SceneObjectPart part = parts[i]; 1075 SceneObjectPart part = parts[i];
1076 if (part.KeyframeMotion != null)
1077 {
1078 part.KeyframeMotion.UpdateSceneObject(this);
1079 }
1080
1075 if (Object.ReferenceEquals(part, m_rootPart)) 1081 if (Object.ReferenceEquals(part, m_rootPart))
1076 continue; 1082 continue;
1077 1083
@@ -1880,25 +1886,27 @@ namespace OpenSim.Region.Framework.Scenes
1880 { 1886 {
1881 SceneObjectPart part = parts[i]; 1887 SceneObjectPart part = parts[i];
1882 1888
1883 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) 1889 if (Scene != null)
1884 { 1890 {
1885 if (avatar.ParentID == LocalId) 1891 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
1886 avatar.StandUp();
1887
1888 if (!silent)
1889 { 1892 {
1890 part.ClearUpdateSchedule(); 1893 if (avatar.ParentID == LocalId)
1891 if (part == m_rootPart) 1894 avatar.StandUp();
1895
1896 if (!silent)
1892 { 1897 {
1893 if (!IsAttachment 1898 part.ClearUpdateSchedule();
1894 || AttachedAvatar == avatar.ControllingClient.AgentId 1899 if (part == m_rootPart)
1895 || !HasPrivateAttachmentPoint) 1900 {
1896 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); 1901 if (!IsAttachment
1902 || AttachedAvatar == avatar.ControllingClient.AgentId
1903 || !HasPrivateAttachmentPoint)
1904 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId });
1905 }
1897 } 1906 }
1898 } 1907 });
1899 }); 1908 }
1900 } 1909 }
1901
1902 } 1910 }
1903 1911
1904 public void AddScriptLPS(int count) 1912 public void AddScriptLPS(int count)
@@ -3483,8 +3491,8 @@ namespace OpenSim.Region.Framework.Scenes
3483 part.ClonePermissions(RootPart); 3491 part.ClonePermissions(RootPart);
3484 }); 3492 });
3485 3493
3486 uint lockMask = ~(uint)PermissionMask.Move; 3494 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
3487 uint lockBit = RootPart.OwnerMask & (uint)PermissionMask.Move; 3495 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
3488 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); 3496 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
3489 RootPart.ScheduleFullUpdate(); 3497 RootPart.ScheduleFullUpdate();
3490 } 3498 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0ab267a..7004d23 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
242 242
243 private int m_movementAnimationUpdateCounter = 0; 243 private int m_movementAnimationUpdateCounter = 0;
244 244
245 private Vector3 m_prevSitOffset; 245 public Vector3 PrevSitOffset { get; set; }
246 246
247 protected AvatarAppearance m_appearance; 247 protected AvatarAppearance m_appearance;
248 248
@@ -957,7 +957,7 @@ namespace OpenSim.Region.Framework.Scenes
957// ParentPosition = part.GetWorldPosition(); 957// ParentPosition = part.GetWorldPosition();
958 ParentID = part.LocalId; 958 ParentID = part.LocalId;
959 ParentPart = part; 959 ParentPart = part;
960 m_pos = m_prevSitOffset; 960 m_pos = PrevSitOffset;
961// pos = ParentPosition; 961// pos = ParentPosition;
962 pos = part.GetWorldPosition(); 962 pos = part.GetWorldPosition();
963 } 963 }
@@ -2261,6 +2261,7 @@ namespace OpenSim.Region.Framework.Scenes
2261 2261
2262 if (ParentID != 0) 2262 if (ParentID != 0)
2263 { 2263 {
2264 PrevSitOffset = m_pos; // Save sit offset
2264 SceneObjectPart part = ParentPart; 2265 SceneObjectPart part = ParentPart;
2265 UnRegisterSeatControls(part.ParentGroup.UUID); 2266 UnRegisterSeatControls(part.ParentGroup.UUID);
2266 2267
@@ -3487,7 +3488,7 @@ namespace OpenSim.Region.Framework.Scenes
3487 cAgent.Appearance = new AvatarAppearance(Appearance); 3488 cAgent.Appearance = new AvatarAppearance(Appearance);
3488 3489
3489 cAgent.ParentPart = ParentUUID; 3490 cAgent.ParentPart = ParentUUID;
3490 cAgent.SitOffset = m_pos; 3491 cAgent.SitOffset = PrevSitOffset;
3491 3492
3492 lock (scriptedcontrols) 3493 lock (scriptedcontrols)
3493 { 3494 {
@@ -3530,7 +3531,7 @@ namespace OpenSim.Region.Framework.Scenes
3530 CameraLeftAxis = cAgent.LeftAxis; 3531 CameraLeftAxis = cAgent.LeftAxis;
3531 CameraUpAxis = cAgent.UpAxis; 3532 CameraUpAxis = cAgent.UpAxis;
3532 ParentUUID = cAgent.ParentPart; 3533 ParentUUID = cAgent.ParentPart;
3533 m_prevSitOffset = cAgent.SitOffset; 3534 PrevSitOffset = cAgent.SitOffset;
3534 3535
3535 // When we get to the point of re-computing neighbors everytime this 3536 // When we get to the point of re-computing neighbors everytime this
3536 // changes, then start using the agent's drawdistance rather than the 3537 // changes, then start using the agent's drawdistance rather than the
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 52ad538..9557cd0 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
67 IConfigSource configSource = new IniConfigSource(); 67 IConfigSource configSource = new IniConfigSource();
68 IConfig config = configSource.AddConfig("Startup"); 68 IConfig config = configSource.AddConfig("Startup");
69 config.Set("serverside_object_permissions", true); 69 config.Set("serverside_object_permissions", true);
70 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 70 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
71 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; 71 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
72 72
73 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 73 // 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
112 IConfigSource configSource = new IniConfigSource(); 112 IConfigSource configSource = new IniConfigSource();
113 IConfig config = configSource.AddConfig("Startup"); 113 IConfig config = configSource.AddConfig("Startup");
114 config.Set("serverside_object_permissions", true); 114 config.Set("serverside_object_permissions", true);
115 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); 115 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
116 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; 116 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
117 117
118 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 118 // 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
195// Assert.That(retrievedPart, Is.Null); 195// Assert.That(retrievedPart, Is.Null);
196 } 196 }
197 } 197 }
198} \ No newline at end of file 198}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index c7eaff9..e7a1fe0 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
71 71
72 SceneHelpers.SetupSceneModules( 72 SceneHelpers.SetupSceneModules(
73 scene, configSource, new object[] 73 scene, configSource, new object[]
74 { new PermissionsModule(), 74 { new DefaultPermissionsModule(),
75 new GroupsModule(), 75 new GroupsModule(),
76 new MockGroupsServicesConnector() }); 76 new MockGroupsServicesConnector() });
77 77
@@ -82,4 +82,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
82 groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true); 82 groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true);
83 } 83 }
84 } 84 }
85} \ No newline at end of file 85}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index de4458d..8d94d29 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
216 // We need to set up the permisions module on scene B so that our later use of agent limit to deny 216 // We need to set up the permisions module on scene B so that our later use of agent limit to deny
217 // QueryAccess won't succeed anyway because administrators are always allowed in and the default 217 // QueryAccess won't succeed anyway because administrators are always allowed in and the default
218 // IsAdministrator if no permissions module is present is true. 218 // IsAdministrator if no permissions module is present is true.
219 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); 219 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB });
220 220
221 // Shared scene modules 221 // Shared scene modules
222 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); 222 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
@@ -381,7 +381,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
381 // We need to set up the permisions module on scene B so that our later use of agent limit to deny 381 // We need to set up the permisions module on scene B so that our later use of agent limit to deny
382 // QueryAccess won't succeed anyway because administrators are always allowed in and the default 382 // QueryAccess won't succeed anyway because administrators are always allowed in and the default
383 // IsAdministrator if no permissions module is present is true. 383 // IsAdministrator if no permissions module is present is true.
384 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); 384 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB });
385 385
386 // Shared scene modules 386 // Shared scene modules
387 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); 387 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
@@ -507,4 +507,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
507// TestHelpers.DisableLogging(); 507// TestHelpers.DisableLogging();
508 } 508 }
509 } 509 }
510} \ No newline at end of file 510}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index e756c70..9e6cc1a 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -635,15 +635,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
635 // TODO: EstateSettings don't seem to get propagated... 635 // TODO: EstateSettings don't seem to get propagated...
636 if (!scene.RegionInfo.EstateSettings.AllowVoice) 636 if (!scene.RegionInfo.EstateSettings.AllowVoice)
637 { 637 {
638 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings", 638 //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings",
639 scene.RegionInfo.RegionName); 639 // scene.RegionInfo.RegionName);
640 channel_uri = String.Empty; 640 channel_uri = String.Empty;
641 } 641 }
642 642
643 if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0) 643 if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0)
644 { 644 {
645 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel", 645 //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
646 scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName); 646 // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
647 channel_uri = String.Empty; 647 channel_uri = String.Empty;
648 } 648 }
649 else 649 else
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index 0c9fdb9..5d10e93 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -203,8 +203,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
203 { 203 {
204 } 204 }
205 205
206 public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount, UUID txn) 206 public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount, UUID txn, out string result)
207 { 207 {
208 result = String.Empty;
208 string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); 209 string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID));
209 210
210 bool give_result = doMoneyTransfer(fromID, toID, amount, 2, description); 211 bool give_result = doMoneyTransfer(fromID, toID, amount, 2, description);
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
index 7c662c9..40ed3fd 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
@@ -105,9 +105,9 @@ namespace OpenSim.Region.RegionCombinerModule
105 return m_rootScene.Permissions.CanEditObject(objectid, editorid); 105 return m_rootScene.Permissions.CanEditObject(objectid, editorid);
106 } 106 }
107 107
108 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene) 108 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene, bool allowManager)
109 { 109 {
110 return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g); 110 return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g, allowManager);
111 } 111 }
112 112
113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene) 113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5ea14c7..3f0af6d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3109,8 +3109,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3109 return; 3109 return;
3110 } 3110 }
3111 3111
3112 string reason;
3112 money.ObjectGiveMoney( 3113 money.ObjectGiveMoney(
3113 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); 3114 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason);
3114 }); 3115 });
3115 3116
3116 return 0; 3117 return 0;
@@ -7105,7 +7106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7105 UUID key; 7106 UUID key;
7106 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 7107 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
7107 7108
7108 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 7109 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
7109 { 7110 {
7110 int expires = 0; 7111 int expires = 0;
7111 if (hours != 0) 7112 if (hours != 0)
@@ -10430,7 +10431,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10430 // according to the docs, this command only works if script owner and land owner are the same 10431 // according to the docs, this command only works if script owner and land owner are the same
10431 // lets add estate owners and gods, too, and use the generic permission check. 10432 // lets add estate owners and gods, too, and use the generic permission check.
10432 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 10433 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10433 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; 10434 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia, false)) return;
10434 10435
10435 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 10436 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
10436 byte loop = 0; 10437 byte loop = 0;
@@ -10873,7 +10874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10873 m_host.AddScriptLPS(1); 10874 m_host.AddScriptLPS(1);
10874 UUID key; 10875 UUID key;
10875 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 10876 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10876 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10877 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
10877 { 10878 {
10878 int expires = 0; 10879 int expires = 0;
10879 if (hours != 0) 10880 if (hours != 0)
@@ -10914,7 +10915,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10914 m_host.AddScriptLPS(1); 10915 m_host.AddScriptLPS(1);
10915 UUID key; 10916 UUID key;
10916 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 10917 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10917 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) 10918 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed, false))
10918 { 10919 {
10919 if (UUID.TryParse(avatar, out key)) 10920 if (UUID.TryParse(avatar, out key))
10920 { 10921 {
@@ -10941,7 +10942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10941 m_host.AddScriptLPS(1); 10942 m_host.AddScriptLPS(1);
10942 UUID key; 10943 UUID key;
10943 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 10944 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10944 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10945 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
10945 { 10946 {
10946 if (UUID.TryParse(avatar, out key)) 10947 if (UUID.TryParse(avatar, out key))
10947 { 10948 {
@@ -12784,8 +12785,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12784 return; 12785 return;
12785 } 12786 }
12786 12787
12788 string reason;
12787 bool result = money.ObjectGiveMoney( 12789 bool result = money.ObjectGiveMoney(
12788 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn); 12790 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);
12789 12791
12790 if (result) 12792 if (result)
12791 { 12793 {
@@ -12793,7 +12795,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12793 return; 12795 return;
12794 } 12796 }
12795 12797
12796 replydata = "LINDENDOLLAR_INSUFFICIENTFUNDS"; 12798 replydata = reason;
12797 } 12799 }
12798 finally 12800 finally
12799 { 12801 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f4e4f44..9c148d1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1434,7 +1434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1434 return; 1434 return;
1435 } 1435 }
1436 1436
1437 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions)) 1437 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
1438 { 1438 {
1439 OSSLShoutError("You do not have permission to modify the parcel"); 1439 OSSLShoutError("You do not have permission to modify the parcel");
1440 return; 1440 return;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 26850c4..a2ac9c5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
231 ItemID = ScriptTask.ItemID; 231 ItemID = ScriptTask.ItemID;
232 AssetID = ScriptTask.AssetID; 232 AssetID = ScriptTask.AssetID;
233 } 233 }
234 LocalID = part.LocalId;
234 235
235 PrimName = part.ParentGroup.Name; 236 PrimName = part.ParentGroup.Name;
236 StartParam = startParam; 237 StartParam = startParam;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 17243ab..04a4e53 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1316,13 +1316,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1316 1316
1317 ScriptInstance instance = null; 1317 ScriptInstance instance = null;
1318 // Create the object record 1318 // Create the object record
1319 UUID appDomain = assetID;
1320
1321
1322
1319 lockScriptsForRead(true); 1323 lockScriptsForRead(true);
1320 if ((!m_Scripts.ContainsKey(itemID)) || 1324 if ((!m_Scripts.ContainsKey(itemID)) ||
1321 (m_Scripts[itemID].AssetID != assetID)) 1325 (m_Scripts[itemID].AssetID != assetID))
1322 { 1326 {
1323 lockScriptsForRead(false); 1327 lockScriptsForRead(false);
1324 1328 instance = new ScriptInstance(this, part,
1325 UUID appDomain = assetID; 1329 item,
1330 startParam, postOnRez,
1331 m_MaxScriptQueue);
1332
1333
1326 1334
1327 if (part.ParentGroup.IsAttachment) 1335 if (part.ParentGroup.IsAttachment)
1328 appDomain = part.ParentGroup.RootPart.UUID; 1336 appDomain = part.ParentGroup.RootPart.UUID;
@@ -1345,9 +1353,39 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1345 sandbox = AppDomain.CreateDomain( 1353 sandbox = AppDomain.CreateDomain(
1346 m_Scene.RegionInfo.RegionID.ToString(), 1354 m_Scene.RegionInfo.RegionID.ToString(),
1347 evidence, appSetup); 1355 evidence, appSetup);
1348 m_AppDomains[appDomain].AssemblyResolve += 1356 if (m_AppDomains.ContainsKey(appDomain))
1349 new ResolveEventHandler( 1357 {
1350 AssemblyResolver.OnAssemblyResolve); 1358 m_AppDomains[appDomain].AssemblyResolve +=
1359 new ResolveEventHandler(
1360 AssemblyResolver.OnAssemblyResolve);
1361 if (m_DomainScripts.ContainsKey(appDomain))
1362 {
1363 m_DomainScripts[appDomain].Add(itemID);
1364 }
1365 else
1366 {
1367 m_DomainScripts.Add(appDomain, new List<UUID>());
1368 m_DomainScripts[appDomain].Add(itemID);
1369 }
1370 }
1371 else
1372 {
1373 m_AppDomains.Add(appDomain, sandbox);
1374 m_AppDomains[appDomain].AssemblyResolve +=
1375 new ResolveEventHandler(
1376 AssemblyResolver.OnAssemblyResolve);
1377 if (m_DomainScripts.ContainsKey(appDomain))
1378 {
1379 m_DomainScripts[appDomain].Add(itemID);
1380 }
1381 else
1382 {
1383 m_DomainScripts.Add(appDomain, new List<UUID>());
1384 m_DomainScripts[appDomain].Add(itemID);
1385 }
1386
1387 }
1388
1351 } 1389 }
1352 else 1390 else
1353 { 1391 {
@@ -1373,12 +1411,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1373 return false; 1411 return false;
1374 } 1412 }
1375 } 1413 }
1376 m_DomainScripts[appDomain].Add(itemID); 1414
1377
1378 instance = new ScriptInstance(this, part,
1379 item,
1380 startParam, postOnRez,
1381 m_MaxScriptQueue);
1382 1415
1383 instance.Load(m_AppDomains[appDomain], assembly, stateSource); 1416 instance.Load(m_AppDomains[appDomain], assembly, stateSource);
1384// m_log.DebugFormat( 1417// m_log.DebugFormat(
@@ -1502,6 +1535,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1502 if (handlerObjectRemoved != null) 1535 if (handlerObjectRemoved != null)
1503 { 1536 {
1504 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); 1537 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
1538 if (part != null)
1505 handlerObjectRemoved(part.UUID); 1539 handlerObjectRemoved(part.UUID);
1506 } 1540 }
1507 1541
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index 954783c..eed2645 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Server.Base
40{ 40{
41 public class HttpServerBase : ServicesServerBase 41 public class HttpServerBase : ServicesServerBase
42 { 42 {
43// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private uint m_consolePort; 45 private uint m_consolePort;
46 46
@@ -69,6 +69,7 @@ namespace OpenSim.Server.Base
69 69
70 bool ssl_main = networkConfig.GetBoolean("https_main",false); 70 bool ssl_main = networkConfig.GetBoolean("https_main",false);
71 bool ssl_listener = networkConfig.GetBoolean("https_listener",false); 71 bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
72 bool ssl_external = networkConfig.GetBoolean("https_external",false);
72 73
73 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); 74 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
74 75
@@ -113,20 +114,29 @@ namespace OpenSim.Server.Base
113 114
114 uint https_port = (uint)networkConfig.GetInt("https_port", 0); 115 uint https_port = (uint)networkConfig.GetInt("https_port", 0);
115 116
116 string cert_path = networkConfig.GetString("cert_path",String.Empty); 117 m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
117 if ( cert_path == String.Empty ) 118 if (!ssl_external)
118 { 119 {
119 System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); 120 string cert_path = networkConfig.GetString("cert_path",String.Empty);
120 Thread.CurrentThread.Abort(); 121 if ( cert_path == String.Empty )
122 {
123 System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
124 Thread.CurrentThread.Abort();
125 }
126 string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
127 if ( cert_pass == String.Empty )
128 {
129 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
130 Thread.CurrentThread.Abort();
131 }
132
133 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
121 } 134 }
122 string cert_pass = networkConfig.GetString("cert_pass",String.Empty); 135 else
123 if ( cert_pass == String.Empty )
124 { 136 {
125 System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); 137 m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested.");
126 Thread.CurrentThread.Abort(); 138 MainServer.AddHttpServer(new BaseHttpServer(https_port));
127 } 139 }
128
129 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
130 } 140 }
131 } 141 }
132 142
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 4b502b7..8b702e0 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -137,7 +137,13 @@ namespace OpenSim.Services.Connectors
137 137
138 string prefix = id.Substring(0, 2).ToLower(); 138 string prefix = id.Substring(0, 2).ToLower();
139 139
140 string host = m_UriMap[prefix]; 140 string host;
141
142 // HG URLs will not be valid UUIDS
143 if (m_UriMap.ContainsKey(prefix))
144 host = m_UriMap[prefix];
145 else
146 host = m_UriMap["00"];
141 147
142 serverUri.Host = host; 148 serverUri.Host = host;
143 149
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
index 30bfb70..267dd71 100644
--- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
+++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
@@ -86,6 +86,66 @@ namespace OpenSim.Services.Connectors
86 m_ServerURI = serviceURI.TrimEnd('/'); 86 m_ServerURI = serviceURI.TrimEnd('/');
87 } 87 }
88 88
89 public bool RemoveMapTile(int x, int y, out string reason)
90 {
91 reason = string.Empty;
92 int tickstart = Util.EnvironmentTickCount();
93 Dictionary<string, object> sendData = new Dictionary<string, object>();
94 sendData["X"] = x.ToString();
95 sendData["Y"] = y.ToString();
96
97 string reqString = ServerUtils.BuildQueryString(sendData);
98 string uri = m_ServerURI + "/removemap";
99
100 try
101 {
102 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
103 uri,
104 reqString);
105 if (reply != string.Empty)
106 {
107 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
108
109 if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
110 {
111 return true;
112 }
113 else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
114 {
115 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString());
116 reason = replyData["Message"].ToString();
117 return false;
118 }
119 else if (!replyData.ContainsKey("Result"))
120 {
121 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field");
122 }
123 else
124 {
125 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
126 reason = "Unexpected result " + replyData["Result"].ToString();
127 }
128
129 }
130 else
131 {
132 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
133 }
134 }
135 catch (Exception e)
136 {
137 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message);
138 }
139 finally
140 {
141 // This just dumps a warning for any operation that takes more than 100 ms
142 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
143 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff);
144 }
145
146 return false;
147 }
148
89 public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) 149 public bool AddMapTile(int x, int y, byte[] jpgData, out string reason)
90 { 150 {
91 reason = string.Empty; 151 reason = string.Empty;
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index daebf8b..7f71835 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -283,7 +283,7 @@ namespace OpenSim.Services.GridService
283 283
284 int flags = Convert.ToInt32(region.Data["flags"]); 284 int flags = Convert.ToInt32(region.Data["flags"]);
285 285
286 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) 286 if ((!m_DeleteOnUnregister) || ((flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0))
287 { 287 {
288 flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; 288 flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline;
289 region.Data["flags"] = flags.ToString(); 289 region.Data["flags"] = flags.ToString();
@@ -298,7 +298,6 @@ namespace OpenSim.Services.GridService
298 } 298 }
299 299
300 return true; 300 return true;
301
302 } 301 }
303 302
304 return m_Database.Delete(regionID); 303 return m_Database.Delete(regionID);
diff --git a/OpenSim/Services/Interfaces/IMapImageService.cs b/OpenSim/Services/Interfaces/IMapImageService.cs
index a7b2cf1..78daa5f 100644
--- a/OpenSim/Services/Interfaces/IMapImageService.cs
+++ b/OpenSim/Services/Interfaces/IMapImageService.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Services.Interfaces
35 { 35 {
36 //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); 36 //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY);
37 bool AddMapTile(int x, int y, byte[] imageData, out string reason); 37 bool AddMapTile(int x, int y, byte[] imageData, out string reason);
38 bool RemoveMapTile(int x, int y, out string reason);
38 byte[] GetMapTile(string fileName, out string format); 39 byte[] GetMapTile(string fileName, out string format);
39 } 40 }
40} 41}
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs
index a85ee70..e2f256f 100644
--- a/OpenSim/Services/MapImageService/MapImageService.cs
+++ b/OpenSim/Services/MapImageService/MapImageService.cs
@@ -112,9 +112,38 @@ namespace OpenSim.Services.MapImageService
112 reason = e.Message; 112 reason = e.Message;
113 return false; 113 return false;
114 } 114 }
115 }
116
117 return UpdateMultiResolutionFiles(x, y, out reason);
118 }
119
120 public bool RemoveMapTile(int x, int y, out string reason)
121 {
122 reason = String.Empty;
123 string fileName = GetFileName(1, x, y);
124
125 lock (m_Sync)
126 {
127 try
128 {
129 File.Delete(fileName);
130 }
131 catch (Exception e)
132 {
133 m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e);
134 reason = e.Message;
135 return false;
136 }
137 }
115 138
116 // Also save in png format? 139 return UpdateMultiResolutionFiles(x, y, out reason);
140 }
117 141
142 private bool UpdateMultiResolutionFiles(int x, int y, out string reason)
143 {
144 reason = String.Empty;
145 lock (m_Sync)
146 {
118 // Stitch seven more aggregate tiles together 147 // Stitch seven more aggregate tiles together
119 for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) 148 for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++)
120 { 149 {
@@ -126,7 +155,7 @@ namespace OpenSim.Services.MapImageService
126 155
127 if (!CreateTile(zoomLevel, x1, y1)) 156 if (!CreateTile(zoomLevel, x1, y1))
128 { 157 {
129 m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0} at zoom level {1}", fileName, zoomLevel); 158 m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel);
130 reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); 159 reason = string.Format("Map tile at zoom level {0} failed", zoomLevel);
131 return false; 160 return false;
132 } 161 }