aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Addons/Groups/GroupsExtendedData.cs4
-rw-r--r--OpenSim/Addons/Groups/GroupsMessagingModule.cs34
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs404
-rw-r--r--OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs20
-rw-r--r--OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs11
-rw-r--r--OpenSim/Addons/Groups/IGroupsServicesConnector.cs8
-rw-r--r--OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs10
-rw-r--r--OpenSim/Addons/Groups/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs4
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs14
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs21
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs59
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsServiceBase.cs110
-rw-r--r--OpenSim/Addons/Groups/Service/HGGroupsService.cs2
-rw-r--r--OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs16
-rw-r--r--OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs4
-rw-r--r--OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs2
18 files changed, 363 insertions, 380 deletions
diff --git a/OpenSim/Addons/Groups/GroupsExtendedData.cs b/OpenSim/Addons/Groups/GroupsExtendedData.cs
index c783b9e..d92c442 100644
--- a/OpenSim/Addons/Groups/GroupsExtendedData.cs
+++ b/OpenSim/Addons/Groups/GroupsExtendedData.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Groups
46 public string AccessToken; 46 public string AccessToken;
47 } 47 }
48 48
49 public class ExtendedGroupMembersData 49 public class ExtendedGroupMembersData
50 { 50 {
51 // This is the only difference: this is a string 51 // This is the only difference: this is a string
52 public string AgentID; 52 public string AgentID;
@@ -65,7 +65,7 @@ namespace OpenSim.Groups
65 public UUID RoleID; 65 public UUID RoleID;
66 // This is the only difference: this is a string 66 // This is the only difference: this is a string
67 public string MemberID; 67 public string MemberID;
68 68
69 } 69 }
70 70
71 public struct ExtendedGroupNoticeData 71 public struct ExtendedGroupNoticeData
diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
index e95db41..f4d3490 100644
--- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs
+++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Groups
131 { 131 {
132 if (!m_groupMessagingEnabled) 132 if (!m_groupMessagingEnabled)
133 return; 133 return;
134 134
135 scene.RegisterModuleInterface<IGroupsMessagingModule>(this); 135 scene.RegisterModuleInterface<IGroupsMessagingModule>(this);
136 m_sceneList.Add(scene); 136 m_sceneList.Add(scene);
137 137
@@ -163,7 +163,7 @@ namespace OpenSim.Groups
163 if (m_groupData == null) 163 if (m_groupData == null)
164 { 164 {
165 m_log.Error("[Groups.Messaging]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled."); 165 m_log.Error("[Groups.Messaging]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
166 RemoveRegion(scene); 166 RemoveRegion(scene);
167 return; 167 return;
168 } 168 }
169 169
@@ -218,7 +218,7 @@ namespace OpenSim.Groups
218 m_msgTransferModule = null; 218 m_msgTransferModule = null;
219 } 219 }
220 220
221 public Type ReplaceableInterface 221 public Type ReplaceableInterface
222 { 222 {
223 get { return null; } 223 get { return null; }
224 } 224 }
@@ -262,7 +262,7 @@ namespace OpenSim.Groups
262 { 262 {
263 if (m_debugEnabled) 263 if (m_debugEnabled)
264 m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 264 m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
265 265
266 GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID.ToString(), groupID, null); 266 GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID.ToString(), groupID, null);
267 267
268 if (groupInfo != null) 268 if (groupInfo != null)
@@ -279,7 +279,7 @@ namespace OpenSim.Groups
279 { 279 {
280 SendMessageToGroup(im, groupID, UUID.Zero, null); 280 SendMessageToGroup(im, groupID, UUID.Zero, null);
281 } 281 }
282 282
283 public void SendMessageToGroup( 283 public void SendMessageToGroup(
284 GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) 284 GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
285 { 285 {
@@ -355,9 +355,9 @@ namespace OpenSim.Groups
355 { 355 {
356 if (!sendCondition(member)) 356 if (!sendCondition(member))
357 { 357 {
358 if (m_debugEnabled) 358 if (m_debugEnabled)
359 m_log.DebugFormat( 359 m_log.DebugFormat(
360 "[Groups.Messaging]: Not sending to {0} as they do not fulfill send condition", 360 "[Groups.Messaging]: Not sending to {0} as they do not fulfill send condition",
361 member.AgentID); 361 member.AgentID);
362 362
363 continue; 363 continue;
@@ -366,7 +366,7 @@ namespace OpenSim.Groups
366 else if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID)) 366 else if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID))
367 { 367 {
368 // Don't deliver messages to people who have dropped this session 368 // Don't deliver messages to people who have dropped this session
369 if (m_debugEnabled) 369 if (m_debugEnabled)
370 m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID); 370 m_log.DebugFormat("[Groups.Messaging]: {0} has dropped session, not delivering to them", member.AgentID);
371 371
372 continue; 372 continue;
@@ -414,7 +414,7 @@ namespace OpenSim.Groups
414 "[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", 414 "[Groups.Messaging]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms",
415 groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); 415 groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick);
416 } 416 }
417 417
418 #region SimGridEventHandlers 418 #region SimGridEventHandlers
419 419
420 void OnClientLogin(IClientAPI client) 420 void OnClientLogin(IClientAPI client)
@@ -445,13 +445,13 @@ namespace OpenSim.Groups
445 // The instant message module will only deliver messages of dialog types: 445 // The instant message module will only deliver messages of dialog types:
446 // MessageFromAgent, StartTyping, StopTyping, MessageFromObject 446 // MessageFromAgent, StartTyping, StopTyping, MessageFromObject
447 // 447 //
448 // Any other message type will not be delivered to a client by the 448 // Any other message type will not be delivered to a client by the
449 // Instant Message Module 449 // Instant Message Module
450 450
451 UUID regionID = new UUID(msg.RegionID); 451 UUID regionID = new UUID(msg.RegionID);
452 if (m_debugEnabled) 452 if (m_debugEnabled)
453 { 453 {
454 m_log.DebugFormat("[Groups.Messaging]: {0} called, IM from region {1}", 454 m_log.DebugFormat("[Groups.Messaging]: {0} called, IM from region {1}",
455 System.Reflection.MethodBase.GetCurrentMethod().Name, regionID); 455 System.Reflection.MethodBase.GetCurrentMethod().Name, regionID);
456 456
457 DebugGridInstantMessage(msg); 457 DebugGridInstantMessage(msg);
@@ -508,7 +508,7 @@ namespace OpenSim.Groups
508 m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he has an agent in region of origin", sp.UUID); 508 m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because he has an agent in region of origin", sp.UUID);
509 return; 509 return;
510 } 510 }
511 else 511 else
512 { 512 {
513 if (m_debugEnabled) 513 if (m_debugEnabled)
514 m_log.DebugFormat("[Groups.Messaging]: not skipping agent {0}", sp.UUID); 514 m_log.DebugFormat("[Groups.Messaging]: not skipping agent {0}", sp.UUID);
@@ -531,7 +531,7 @@ namespace OpenSim.Groups
531 } 531 }
532 } 532 }
533 }); 533 });
534 534
535 } 535 }
536 } 536 }
537 } 537 }
@@ -555,7 +555,7 @@ namespace OpenSim.Groups
555 break; 555 break;
556 556
557 case (byte)InstantMessageDialog.SessionSend: 557 case (byte)InstantMessageDialog.SessionSend:
558 // User hasn't dropped, so they're in the session, 558 // User hasn't dropped, so they're in the session,
559 // maybe we should deliver it. 559 // maybe we should deliver it.
560 IClientAPI client = GetActiveClient(new UUID(msg.toAgentID)); 560 IClientAPI client = GetActiveClient(new UUID(msg.toAgentID));
561 if (client != null) 561 if (client != null)
@@ -627,6 +627,7 @@ namespace OpenSim.Groups
627 , false //canVoiceChat 627 , false //canVoiceChat
628 , false //isModerator 628 , false //isModerator
629 , false //text mute 629 , false //text mute
630 , true // Enter
630 ); 631 );
631 } 632 }
632 } 633 }
@@ -654,7 +655,7 @@ namespace OpenSim.Groups
654 UUID AgentID = new UUID(im.fromAgentID); 655 UUID AgentID = new UUID(im.fromAgentID);
655 656
656 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null); 657 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null);
657 658
658 if (groupInfo != null) 659 if (groupInfo != null)
659 { 660 {
660 AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); 661 AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID);
@@ -669,6 +670,7 @@ namespace OpenSim.Groups
669 , false //canVoiceChat 670 , false //canVoiceChat
670 , false //isModerator 671 , false //isModerator
671 , false //text mute 672 , false //text mute
673 , true
672 ); 674 );
673 } 675 }
674 } 676 }
@@ -679,7 +681,7 @@ namespace OpenSim.Groups
679 UUID GroupID = new UUID(im.imSessionID); 681 UUID GroupID = new UUID(im.imSessionID);
680 UUID AgentID = new UUID(im.fromAgentID); 682 UUID AgentID = new UUID(im.fromAgentID);
681 683
682 if (m_debugEnabled) 684 if (m_debugEnabled)
683 m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); 685 m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
684 686
685 //If this agent is sending a message, then they want to be in the session 687 //If this agent is sending a message, then they want to be in the session
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index d121d1a..5b76e0a 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Groups
51 private List<Scene> m_sceneList = new List<Scene>(); 51 private List<Scene> m_sceneList = new List<Scene>();
52 52
53 private IMessageTransferModule m_msgTransferModule = null; 53 private IMessageTransferModule m_msgTransferModule = null;
54 54
55 private IGroupsServicesConnector m_groupData = null; 55 private IGroupsServicesConnector m_groupData = null;
56 private IUserManagement m_UserManagement; 56 private IUserManagement m_UserManagement;
57 57
@@ -137,13 +137,6 @@ namespace OpenSim.Groups
137 137
138 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 138 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
139 139
140 scene.EventManager.OnNewClient += OnNewClient;
141 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
142 scene.EventManager.OnMakeChildAgent += OnMakeChild;
143 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
144 // The InstantMessageModule itself doesn't do this,
145 // so lets see if things explode if we don't do it
146 // scene.EventManager.OnClientClosed += OnClientClosed;
147 140
148 if (m_groupData == null) 141 if (m_groupData == null)
149 { 142 {
@@ -182,6 +175,11 @@ namespace OpenSim.Groups
182 m_sceneList.Add(scene); 175 m_sceneList.Add(scene);
183 } 176 }
184 177
178 scene.EventManager.OnNewClient += OnNewClient;
179 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
180 scene.EventManager.OnMakeChildAgent += OnMakeChild;
181 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
182 scene.EventManager.OnClientClosed += OnClientClosed;
185 183
186 } 184 }
187 185
@@ -196,6 +194,7 @@ namespace OpenSim.Groups
196 scene.EventManager.OnMakeRootAgent -= OnMakeRoot; 194 scene.EventManager.OnMakeRootAgent -= OnMakeRoot;
197 scene.EventManager.OnMakeChildAgent -= OnMakeChild; 195 scene.EventManager.OnMakeChildAgent -= OnMakeChild;
198 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 196 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
197 scene.EventManager.OnClientClosed -= OnClientClosed;
199 198
200 lock (m_sceneList) 199 lock (m_sceneList)
201 { 200 {
@@ -211,7 +210,7 @@ namespace OpenSim.Groups
211 if (m_debugEnabled) m_log.Debug("[Groups]: Shutting down Groups module."); 210 if (m_debugEnabled) m_log.Debug("[Groups]: Shutting down Groups module.");
212 } 211 }
213 212
214 public Type ReplaceableInterface 213 public Type ReplaceableInterface
215 { 214 {
216 get { return null; } 215 get { return null; }
217 } 216 }
@@ -237,6 +236,7 @@ namespace OpenSim.Groups
237 client.OnRequestAvatarProperties += OnRequestAvatarProperties; 236 client.OnRequestAvatarProperties += OnRequestAvatarProperties;
238 } 237 }
239 238
239
240 private void OnMakeRoot(ScenePresence sp) 240 private void OnMakeRoot(ScenePresence sp)
241 { 241 {
242 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 242 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -245,8 +245,12 @@ namespace OpenSim.Groups
245 // Used for Notices and Group Invites/Accept/Reject 245 // Used for Notices and Group Invites/Accept/Reject
246 sp.ControllingClient.OnInstantMessage += OnInstantMessage; 246 sp.ControllingClient.OnInstantMessage += OnInstantMessage;
247 247
248 // Send client their groups information. 248 // Send out group data update for compatibility.
249 SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID); 249 // There might be some problem with the thread we're generating this on but not
250 // doing the update at this time causes problems (Mantis #7920 and #7915)
251 // TODO: move sending this update to a later time in the rootification of the client.
252 if(!sp.haveGroupInformation)
253 SendAgentGroupDataUpdate(sp.ControllingClient, false);
250 } 254 }
251 255
252 private void OnMakeChild(ScenePresence sp) 256 private void OnMakeChild(ScenePresence sp)
@@ -262,23 +266,28 @@ namespace OpenSim.Groups
262 { 266 {
263 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 267 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
264 268
265 //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray();
266 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); 269 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
267 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); 270 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
268 } 271 }
269 272
270 /* 273 private void OnClientClosed(UUID AgentId, Scene scene)
271 * This becomes very problematic in a shared module. In a shared module you may have more then one
272 * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
273 * The OnClientClosed event does not provide anything to indicate which one of those should be closed
274 * nor does it provide what scene it was from so that the specific reference can be looked up.
275 * The InstantMessageModule.cs does not currently worry about unregistering the handles,
276 * and it should be an issue, since it's the client that references us not the other way around
277 * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
278 private void OnClientClosed(UUID AgentId)
279 { 274 {
280 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 275 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
276 if (scene == null)
277 return;
278
279 ScenePresence sp = scene.GetScenePresence(AgentId);
280 IClientAPI client = sp.ControllingClient;
281 if (client != null)
282 {
283 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
284 client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
285 // make child possible not called?
286 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
287 client.OnInstantMessage -= OnInstantMessage;
288 }
281 289
290 /*
282 lock (m_ActiveClients) 291 lock (m_ActiveClients)
283 { 292 {
284 if (m_ActiveClients.ContainsKey(AgentId)) 293 if (m_ActiveClients.ContainsKey(AgentId))
@@ -296,31 +305,22 @@ namespace OpenSim.Groups
296 if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here."); 305 if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here.");
297 } 306 }
298 307
299
300 }
301 } 308 }
302 */ 309 */
303 310
311 }
312
304 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) 313 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
305 { 314 {
306 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 315 // this a private message for own agent only
307 316 if (dataForAgentID != GetRequestingAgentID(remoteClient))
308 UUID activeGroupID = UUID.Zero; 317 return;
309 string activeGroupTitle = string.Empty;
310 string activeGroupName = string.Empty;
311 ulong activeGroupPowers = (ulong)GroupPowers.None;
312
313 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentIDStr(remoteClient), dataForAgentID.ToString());
314 if (membership != null)
315 {
316 activeGroupID = membership.GroupID;
317 activeGroupTitle = membership.GroupTitle;
318 activeGroupPowers = membership.GroupPowers;
319 }
320 318
321 SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle); 319 SendAgentGroupDataUpdate(remoteClient, false);
322 320
323 SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); 321 // also current viewers do ignore it and ask later on a much nicer thread
322 // its a info request not a change, so nothing is sent to others
323 // they do get the group title with the avatar object update on arrivel to a region
324 } 324 }
325 325
326 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) 326 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
@@ -394,12 +394,14 @@ namespace OpenSim.Groups
394 msg.binaryBucket = new byte[0]; 394 msg.binaryBucket = new byte[0];
395 395
396 OutgoingInstantMessage(msg, invitee); 396 OutgoingInstantMessage(msg, invitee);
397 397 IClientAPI inviteeClient = GetActiveRootClient(invitee);
398 UpdateAllClientsWithGroupInfo(invitee); 398 if(inviteeClient !=null)
399 {
400 SendAgentGroupDataUpdate(inviteeClient,true);
401 }
399 } 402 }
400 403
401 m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID); 404 m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
402
403 } 405 }
404 406
405 // Reject 407 // Reject
@@ -444,17 +446,16 @@ namespace OpenSim.Groups
444 446
445 UUID itemID = binBucketMap["item_id"].AsUUID(); 447 UUID itemID = binBucketMap["item_id"].AsUUID();
446 UUID ownerID = binBucketMap["owner_id"].AsUUID(); 448 UUID ownerID = binBucketMap["owner_id"].AsUUID();
447 item = new InventoryItemBase(itemID, ownerID); 449 item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID);
448 item = m_sceneList[0].InventoryService.GetItem(item);
449 } 450 }
450 else 451 else
451 m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType()); 452 m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());
452 } 453 }
453 454
454 if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, 455 if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message,
455 hasAttachment, 456 hasAttachment,
456 (byte)(item == null ? 0 : item.AssetType), 457 (byte)(item == null ? 0 : item.AssetType),
457 item == null ? null : item.Name, 458 item == null ? null : item.Name,
458 item == null ? UUID.Zero : item.ID, 459 item == null ? UUID.Zero : item.ID,
459 item == null ? UUID.Zero.ToString() : item.Owner.ToString())) 460 item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
460 { 461 {
@@ -463,7 +464,6 @@ namespace OpenSim.Groups
463 OnNewGroupNotice(GroupID, NoticeID); 464 OnNewGroupNotice(GroupID, NoticeID);
464 } 465 }
465 466
466
467 // Send notice out to everyone that wants notices 467 // Send notice out to everyone that wants notices
468 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) 468 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
469 { 469 {
@@ -497,7 +497,7 @@ namespace OpenSim.Groups
497 497
498 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); 498 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
499 string message; 499 string message;
500 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, 500 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
501 giver, notice.noticeData.AttachmentItemID, out message); 501 giver, notice.noticeData.AttachmentItemID, out message);
502 502
503 if (itemCopy == null) 503 if (itemCopy == null)
@@ -508,12 +508,11 @@ namespace OpenSim.Groups
508 508
509 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); 509 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
510 } 510 }
511
512 } 511 }
513 512
514 // Interop, received special 210 code for ejecting a group member 513 // Interop, received special 210 code for ejecting a group member
515 // this only works within the comms servers domain, and won't work hypergrid 514 // this only works within the comms servers domain, and won't work hypergrid
516 // TODO:FIXME: Use a presense server of some kind to find out where the 515 // TODO:FIXME: Use a presense server of some kind to find out where the
517 // client actually is, and try contacting that region directly to notify them, 516 // client actually is, and try contacting that region directly to notify them,
518 // or provide the notification via xmlrpc update queue 517 // or provide the notification via xmlrpc update queue
519 if ((im.dialog == 210)) 518 if ((im.dialog == 210))
@@ -524,14 +523,16 @@ namespace OpenSim.Groups
524 523
525 UUID ejecteeID = new UUID(im.toAgentID); 524 UUID ejecteeID = new UUID(im.toAgentID);
526 525
526 im.imSessionID = UUID.Zero.Guid;
527 im.dialog = (byte)InstantMessageDialog.MessageFromAgent; 527 im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
528 OutgoingInstantMessage(im, ejecteeID); 528 OutgoingInstantMessage(im, ejecteeID);
529 529
530 IClientAPI ejectee = GetActiveClient(ejecteeID); 530 IClientAPI ejectee = GetActiveRootClient(ejecteeID);
531 if (ejectee != null) 531 if (ejectee != null)
532 { 532 {
533 UUID groupID = new UUID(im.imSessionID); 533 UUID groupID = new UUID(im.imSessionID);
534 ejectee.SendAgentDropGroup(groupID); 534 ejectee.SendAgentDropGroup(groupID);
535 SendAgentGroupDataUpdate(ejectee,true);
535 } 536 }
536 } 537 }
537 } 538 }
@@ -551,7 +552,7 @@ namespace OpenSim.Groups
551 case (byte)InstantMessageDialog.GroupInvitation: 552 case (byte)InstantMessageDialog.GroupInvitation:
552 case (byte)InstantMessageDialog.GroupNotice: 553 case (byte)InstantMessageDialog.GroupNotice:
553 UUID toAgentID = new UUID(msg.toAgentID); 554 UUID toAgentID = new UUID(msg.toAgentID);
554 IClientAPI localClient = GetActiveClient(toAgentID); 555 IClientAPI localClient = GetActiveRootClient(toAgentID);
555 if (localClient != null) 556 if (localClient != null)
556 { 557 {
557 localClient.SendInstantMessage(msg); 558 localClient.SendInstantMessage(msg);
@@ -576,7 +577,7 @@ namespace OpenSim.Groups
576 { 577 {
577 return m_groupData.GetGroupRecord(UUID.Zero.ToString(), UUID.Zero, name); 578 return m_groupData.GetGroupRecord(UUID.Zero.ToString(), UUID.Zero, name);
578 } 579 }
579 580
580 public void ActivateGroup(IClientAPI remoteClient, UUID groupID) 581 public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
581 { 582 {
582 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 583 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -584,10 +585,10 @@ namespace OpenSim.Groups
584 m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID); 585 m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID);
585 586
586 // Changing active group changes title, active powers, all kinds of things 587 // Changing active group changes title, active powers, all kinds of things
587 // anyone who is in any region that can see this client, should probably be 588 // anyone who is in any region that can see this client, should probably be
588 // updated with new group info. At a minimum, they should get ScenePresence 589 // updated with new group info. At a minimum, they should get ScenePresence
589 // updated with new title. 590 // updated with new title.
590 UpdateAllClientsWithGroupInfo(remoteClient.AgentId); 591 SendAgentGroupDataUpdate(remoteClient, true);
591 } 592 }
592 593
593 /// <summary> 594 /// <summary>
@@ -619,10 +620,10 @@ namespace OpenSim.Groups
619 620
620 public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) 621 public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
621 { 622 {
622 if (m_debugEnabled) 623 if (m_debugEnabled)
623 m_log.DebugFormat( 624 m_log.DebugFormat(
624 "[Groups]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); 625 "[Groups]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name);
625 626
626 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), groupID); 627 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), groupID);
627 628
628 if (m_debugEnabled) 629 if (m_debugEnabled)
@@ -634,7 +635,6 @@ namespace OpenSim.Groups
634 } 635 }
635 636
636 return data; 637 return data;
637
638 } 638 }
639 639
640 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) 640 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
@@ -706,7 +706,7 @@ namespace OpenSim.Groups
706 706
707 public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) 707 public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
708 { 708 {
709 if (m_debugEnabled) 709 if (m_debugEnabled)
710 m_log.DebugFormat( 710 m_log.DebugFormat(
711 "[Groups]: {0} called with groupID={1}, agentID={2}", 711 "[Groups]: {0} called with groupID={1}, agentID={2}",
712 System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); 712 System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID);
@@ -714,6 +714,12 @@ namespace OpenSim.Groups
714 return m_groupData.GetAgentGroupMembership(UUID.Zero.ToString(), agentID.ToString(), groupID); 714 return m_groupData.GetAgentGroupMembership(UUID.Zero.ToString(), agentID.ToString(), groupID);
715 } 715 }
716 716
717 public GroupMembershipData GetActiveMembershipData(UUID agentID)
718 {
719 string agentIDstr = agentID.ToString();
720 return m_groupData.GetAgentActiveMembership(agentIDstr, agentIDstr);
721 }
722
717 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) 723 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
718 { 724 {
719 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 725 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -750,7 +756,7 @@ namespace OpenSim.Groups
750 756
751 if (avatar != null) 757 if (avatar != null)
752 { 758 {
753 if (avatar.UserLevel < m_levelGroupCreate) 759 if (avatar.GodController.UserLevel < m_levelGroupCreate)
754 { 760 {
755 remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate)); 761 remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
756 return UUID.Zero; 762 return UUID.Zero;
@@ -758,7 +764,7 @@ namespace OpenSim.Groups
758 } 764 }
759 765
760 // check funds 766 // check funds
761 // is there is a money module present ? 767 // is there a money module present ?
762 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); 768 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
763 if (money != null) 769 if (money != null)
764 { 770 {
@@ -770,18 +776,18 @@ namespace OpenSim.Groups
770 } 776 }
771 777
772 string reason = string.Empty; 778 string reason = string.Empty;
773 UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, 779 UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment,
774 allowPublish, maturePublish, remoteClient.AgentId, out reason); 780 allowPublish, maturePublish, remoteClient.AgentId, out reason);
775 781
776 if (groupID != UUID.Zero) 782 if (groupID != UUID.Zero)
777 { 783 {
778 if (money != null) 784 if (money != null && money.GroupCreationCharge > 0)
779 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); 785 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
780 786
781 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 787 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
782 788
783 // Update the founder with new group information. 789 // Update the founder with new group information.
784 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 790 SendAgentGroupDataUpdate(remoteClient, true);
785 } 791 }
786 else 792 else
787 remoteClient.SendCreateGroupReply(groupID, false, reason); 793 remoteClient.SendCreateGroupReply(groupID, false, reason);
@@ -817,7 +823,7 @@ namespace OpenSim.Groups
817 if (membership != null) 823 if (membership != null)
818 { 824 {
819 return membership.GroupTitle; 825 return membership.GroupTitle;
820 } 826 }
821 return string.Empty; 827 return string.Empty;
822 } 828 }
823 829
@@ -833,8 +839,8 @@ namespace OpenSim.Groups
833 // TODO: Not sure what all is needed here, but if the active group role change is for the group 839 // TODO: Not sure what all is needed here, but if the active group role change is for the group
834 // the client currently has set active, then we need to do a scene presence update too 840 // the client currently has set active, then we need to do a scene presence update too
835 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) 841 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
836 842
837 UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); 843 SendDataUpdate(remoteClient, true);
838 } 844 }
839 845
840 846
@@ -875,7 +881,7 @@ namespace OpenSim.Groups
875 } 881 }
876 882
877 // TODO: This update really should send out updates for everyone in the role that just got changed. 883 // TODO: This update really should send out updates for everyone in the role that just got changed.
878 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 884 SendDataUpdate(remoteClient, true);
879 } 885 }
880 886
881 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) 887 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes)
@@ -893,7 +899,7 @@ namespace OpenSim.Groups
893 case 1: 899 case 1:
894 // Remove 900 // Remove
895 m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentIDStr(remoteClient), memberID.ToString(), groupID, roleID); 901 m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentIDStr(remoteClient), memberID.ToString(), groupID, roleID);
896 902
897 break; 903 break;
898 default: 904 default:
899 m_log.ErrorFormat("[Groups]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); 905 m_log.ErrorFormat("[Groups]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes);
@@ -901,7 +907,7 @@ namespace OpenSim.Groups
901 } 907 }
902 908
903 // TODO: This update really should send out updates for everyone in the role that just got changed. 909 // TODO: This update really should send out updates for everyone in the role that just got changed.
904 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 910 SendDataUpdate(remoteClient, true);
905 } 911 }
906 912
907 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) 913 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID)
@@ -969,27 +975,37 @@ namespace OpenSim.Groups
969 return msg; 975 return msg;
970 } 976 }
971 977
972 public void SendAgentGroupDataUpdate(IClientAPI remoteClient) 978 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID)
973 { 979 {
974 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 980 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
975 981
976 // Send agent information about his groups 982 GroupRecord groupRecord = GetGroupRecord(groupID);
977 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 983 IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
978 }
979 984
980 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) 985 // Should check to see if there's an outstanding invitation
981 { 986
982 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 987 if (money != null && groupRecord.MembershipFee > 0)
988 {
989 // Does the agent have the funds to cover the group join fee?
990 if (!money.AmountCovered(remoteClient.AgentId, groupRecord.MembershipFee))
991 {
992 remoteClient.SendAlertMessage("Insufficient funds to join the group.");
993 remoteClient.SendJoinGroupReply(groupID, false);
994 return;
995 }
996 }
983 997
984 string reason = string.Empty; 998 string reason = string.Empty;
985 // Should check to see if OpenEnrollment, or if there's an outstanding invitation 999
986 if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason)) 1000 if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason))
987 { 1001 {
1002 if (money != null && groupRecord.MembershipFee > 0)
1003 money.ApplyCharge(remoteClient.AgentId, groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName);
988 1004
989 remoteClient.SendJoinGroupReply(groupID, true); 1005 remoteClient.SendJoinGroupReply(groupID, true);
990 1006
991 // Should this send updates to everyone in the group? 1007 // Should this send updates to everyone in the group?
992 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 1008 SendAgentGroupDataUpdate(remoteClient, true);
993 1009
994 if (reason != string.Empty) 1010 if (reason != string.Empty)
995 // A warning 1011 // A warning
@@ -1011,7 +1027,7 @@ namespace OpenSim.Groups
1011 1027
1012 // SL sends out notifcations to the group messaging session that the person has left 1028 // SL sends out notifcations to the group messaging session that the person has left
1013 // Should this also update everyone who is in the group? 1029 // Should this also update everyone who is in the group?
1014 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 1030 SendAgentGroupDataUpdate(remoteClient, true);
1015 } 1031 }
1016 1032
1017 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) 1033 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
@@ -1070,10 +1086,31 @@ namespace OpenSim.Groups
1070 return; 1086 return;
1071 } 1087 }
1072 1088
1089 IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID);
1090
1073 // Send Message to Ejectee 1091 // Send Message to Ejectee
1074 GridInstantMessage msg = new GridInstantMessage(); 1092 GridInstantMessage msg = new GridInstantMessage();
1075 1093
1076 msg.imSessionID = UUID.Zero.Guid; 1094 // if local send a normal message
1095 if(ejecteeClient != null)
1096 {
1097 msg.imSessionID = UUID.Zero.Guid;
1098 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
1099 // also execute and send update
1100 ejecteeClient.SendAgentDropGroup(groupID);
1101 SendAgentGroupDataUpdate(ejecteeClient,true);
1102 }
1103 else // send
1104 {
1105 // Interop, received special 210 code for ejecting a group member
1106 // this only works within the comms servers domain, and won't work hypergrid
1107 // TODO:FIXME: Use a presence server of some kind to find out where the
1108 // client actually is, and try contacting that region directly to notify them,
1109 // or provide the notification via xmlrpc update queue
1110
1111 msg.imSessionID = groupInfo.GroupID.Guid;
1112 msg.dialog = (byte)210; //interop
1113 }
1077 msg.fromAgentID = agentID.Guid; 1114 msg.fromAgentID = agentID.Guid;
1078 // msg.fromAgentID = info.GroupID; 1115 // msg.fromAgentID = info.GroupID;
1079 msg.toAgentID = ejecteeID.Guid; 1116 msg.toAgentID = ejecteeID.Guid;
@@ -1081,7 +1118,7 @@ namespace OpenSim.Groups
1081 msg.timestamp = 0; 1118 msg.timestamp = 0;
1082 msg.fromAgentName = agentName; 1119 msg.fromAgentName = agentName;
1083 msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); 1120 msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName);
1084 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; 1121
1085 msg.fromGroup = false; 1122 msg.fromGroup = false;
1086 msg.offline = (byte)0; 1123 msg.offline = (byte)0;
1087 msg.ParentEstateID = 0; 1124 msg.ParentEstateID = 0;
@@ -1091,11 +1128,7 @@ namespace OpenSim.Groups
1091 OutgoingInstantMessage(msg, ejecteeID); 1128 OutgoingInstantMessage(msg, ejecteeID);
1092 1129
1093 // Message to ejector 1130 // Message to ejector
1094 // Interop, received special 210 code for ejecting a group member 1131
1095 // this only works within the comms servers domain, and won't work hypergrid
1096 // TODO:FIXME: Use a presense server of some kind to find out where the
1097 // client actually is, and try contacting that region directly to notify them,
1098 // or provide the notification via xmlrpc update queue
1099 1132
1100 msg = new GridInstantMessage(); 1133 msg = new GridInstantMessage();
1101 msg.imSessionID = UUID.Zero.Guid; 1134 msg.imSessionID = UUID.Zero.Guid;
@@ -1111,7 +1144,7 @@ namespace OpenSim.Groups
1111 { 1144 {
1112 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); 1145 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member");
1113 } 1146 }
1114 msg.dialog = (byte)210; //interop 1147 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
1115 msg.fromGroup = false; 1148 msg.fromGroup = false;
1116 msg.offline = (byte)0; 1149 msg.offline = (byte)0;
1117 msg.ParentEstateID = 0; 1150 msg.ParentEstateID = 0;
@@ -1119,11 +1152,6 @@ namespace OpenSim.Groups
1119 msg.RegionID = regionInfo.RegionID.Guid; 1152 msg.RegionID = regionInfo.RegionID.Guid;
1120 msg.binaryBucket = new byte[0]; 1153 msg.binaryBucket = new byte[0];
1121 OutgoingInstantMessage(msg, agentID); 1154 OutgoingInstantMessage(msg, agentID);
1122
1123
1124 // SL sends out messages to everyone in the group
1125 // Who all should receive updates and what should they be updated with?
1126 UpdateAllClientsWithGroupInfo(ejecteeID);
1127 } 1155 }
1128 1156
1129 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) 1157 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
@@ -1186,6 +1214,18 @@ namespace OpenSim.Groups
1186 #endregion 1214 #endregion
1187 1215
1188 #region Client/Update Tools 1216 #region Client/Update Tools
1217 private IClientAPI GetActiveRootClient(UUID agentID)
1218 {
1219 foreach (Scene scene in m_sceneList)
1220 {
1221 ScenePresence sp = scene.GetScenePresence(agentID);
1222 if (sp != null && !sp.IsChildAgent && !sp.IsDeleted)
1223 {
1224 return sp.ControllingClient;
1225 }
1226 }
1227 return null;
1228 }
1189 1229
1190 /// <summary> 1230 /// <summary>
1191 /// Try to find an active IClientAPI reference for agentID giving preference to root connections 1231 /// Try to find an active IClientAPI reference for agentID giving preference to root connections
@@ -1198,7 +1238,7 @@ namespace OpenSim.Groups
1198 foreach (Scene scene in m_sceneList) 1238 foreach (Scene scene in m_sceneList)
1199 { 1239 {
1200 ScenePresence sp = scene.GetScenePresence(agentID); 1240 ScenePresence sp = scene.GetScenePresence(agentID);
1201 if (sp != null) 1241 if (sp != null&& !sp.IsDeleted)
1202 { 1242 {
1203 if (!sp.IsChildAgent) 1243 if (!sp.IsChildAgent)
1204 { 1244 {
@@ -1215,71 +1255,6 @@ namespace OpenSim.Groups
1215 return child; 1255 return child;
1216 } 1256 }
1217 1257
1218 /// <summary>
1219 /// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
1220 /// </summary>
1221 private void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, UUID dataForAgentID, GroupMembershipData[] data)
1222 {
1223 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1224
1225 // NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
1226 // to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
1227 if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
1228 return;
1229
1230 OSDArray AgentData = new OSDArray(1);
1231 OSDMap AgentDataMap = new OSDMap(1);
1232 AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
1233 AgentData.Add(AgentDataMap);
1234
1235 OSDArray GroupData = new OSDArray(data.Length);
1236 OSDArray NewGroupData = new OSDArray(data.Length);
1237
1238 foreach (GroupMembershipData membership in data)
1239 {
1240 if (GetRequestingAgentID(remoteClient) != dataForAgentID)
1241 {
1242 if (!membership.ListInProfile)
1243 {
1244 // If we're sending group info to remoteclient about another agent,
1245 // filter out groups the other agent doesn't want to share.
1246 continue;
1247 }
1248 }
1249
1250 OSDMap GroupDataMap = new OSDMap(6);
1251 OSDMap NewGroupDataMap = new OSDMap(1);
1252
1253 GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
1254 GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
1255 GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
1256 GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
1257 GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
1258 GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
1259 NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
1260
1261 GroupData.Add(GroupDataMap);
1262 NewGroupData.Add(NewGroupDataMap);
1263 }
1264
1265 OSDMap llDataStruct = new OSDMap(3);
1266 llDataStruct.Add("AgentData", AgentData);
1267 llDataStruct.Add("GroupData", GroupData);
1268 llDataStruct.Add("NewGroupData", NewGroupData);
1269
1270 if (m_debugEnabled)
1271 {
1272 m_log.InfoFormat("[Groups]: {0}", OSDParser.SerializeJsonString(llDataStruct));
1273 }
1274
1275 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
1276
1277 if (queue != null)
1278 {
1279 queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
1280 }
1281 }
1282
1283 private void SendScenePresenceUpdate(UUID AgentID, string Title) 1258 private void SendScenePresenceUpdate(UUID AgentID, string Title)
1284 { 1259 {
1285 if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title); 1260 if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title);
@@ -1296,53 +1271,39 @@ namespace OpenSim.Groups
1296 presence.Grouptitle = Title; 1271 presence.Grouptitle = Title;
1297 1272
1298 if (! presence.IsChildAgent) 1273 if (! presence.IsChildAgent)
1299 presence.SendAvatarDataToAllClients(); 1274 presence.SendAvatarDataToAllAgents();
1300 } 1275 }
1301 } 1276 }
1302 } 1277 }
1303 } 1278 }
1304 1279
1305 /// <summary> 1280 public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
1306 /// Send updates to all clients who might be interested in groups data for dataForClientID
1307 /// </summary>
1308 private void UpdateAllClientsWithGroupInfo(UUID dataForClientID)
1309 { 1281 {
1310 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1282 SendAgentGroupDataUpdate(remoteClient, true);
1311
1312 // TODO: Probably isn't nessesary to update every client in every scene.
1313 // Need to examine client updates and do only what's nessesary.
1314 lock (m_sceneList)
1315 {
1316 foreach (Scene scene in m_sceneList)
1317 {
1318 scene.ForEachClient(delegate(IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); });
1319 }
1320 }
1321 } 1283 }
1322 1284
1323 /// <summary> 1285 /// <summary>
1324 /// Update remoteClient with group information about dataForAgentID 1286 /// Tell remoteClient about its agent groups, and optionally send title to others
1325 /// </summary> 1287 /// </summary>
1326 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID) 1288 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers)
1327 { 1289 {
1328 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); 1290 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
1329 1291
1292 // NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
1293 // to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
1294 if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
1295 return;
1296
1330 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1297 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
1331 1298
1332 OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); 1299 UUID agentID = GetRequestingAgentID(remoteClient);
1333 1300
1334 // Need to send a group membership update to the client 1301 SendDataUpdate(remoteClient, tellOthers);
1335 // UDP version doesn't seem to behave nicely. But we're going to send it out here
1336 // with an empty group membership to hopefully remove groups being displayed due
1337 // to the core Groups Stub
1338 //remoteClient.SendGroupMembership(new GroupMembershipData[0]);
1339 1302
1340 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); 1303 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID);
1341 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
1342 1304
1343 //remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); 1305 remoteClient.UpdateGroupMembership(membershipArray);
1344 if (remoteClient.AgentId == dataForAgentID) 1306 remoteClient.SendAgentGroupDataUpdate(agentID, membershipArray);
1345 remoteClient.RefreshGroupMembership();
1346 } 1307 }
1347 1308
1348 /// <summary> 1309 /// <summary>
@@ -1381,7 +1342,7 @@ namespace OpenSim.Groups
1381 membershipArray = membershipData.ToArray(); 1342 membershipArray = membershipData.ToArray();
1382 } 1343 }
1383 } 1344 }
1384 1345
1385 if (m_debugEnabled) 1346 if (m_debugEnabled)
1386 { 1347 {
1387 m_log.InfoFormat("[Groups]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); 1348 m_log.InfoFormat("[Groups]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId);
@@ -1394,27 +1355,49 @@ namespace OpenSim.Groups
1394 return membershipArray; 1355 return membershipArray;
1395 } 1356 }
1396 1357
1397 1358 //tell remoteClient about its agent group info, and optionally send title to others
1398 private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) 1359 private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers)
1399 { 1360 {
1400 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1361 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1401 1362
1402 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1363 UUID activeGroupID = UUID.Zero;
1403 string firstname = "Unknown", lastname = "Unknown"; 1364 string activeGroupTitle = string.Empty;
1404 string name = m_UserManagement.GetUserName(dataForAgentID); 1365 string activeGroupName = string.Empty;
1405 if (!string.IsNullOrEmpty(name)) 1366 ulong activeGroupPowers = (ulong)GroupPowers.None;
1367
1368 UUID agentID = GetRequestingAgentID(remoteClient);
1369 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID.ToString(), agentID.ToString());
1370 if (membership != null)
1406 { 1371 {
1407 string[] parts = name.Split(new char[] { ' ' }); 1372 activeGroupID = membership.GroupID;
1408 if (parts.Length >= 2) 1373 activeGroupTitle = membership.GroupTitle;
1409 { 1374 activeGroupPowers = membership.GroupPowers;
1410 firstname = parts[0]; 1375 activeGroupName = membership.GroupName;
1411 lastname = parts[1];
1412 }
1413 } 1376 }
1414 1377
1415 remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, 1378 UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID);
1379 string firstname, lastname;
1380 if (account != null)
1381 {
1382 firstname = account.FirstName;
1383 lastname = account.LastName;
1384 }
1385 else
1386 {
1387 firstname = "Unknown";
1388 lastname = "Unknown";
1389 }
1390
1391 remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname,
1416 lastname, activeGroupPowers, activeGroupName, 1392 lastname, activeGroupPowers, activeGroupName,
1417 activeGroupTitle); 1393 activeGroupTitle);
1394
1395 if (tellOthers)
1396 SendScenePresenceUpdate(agentID, activeGroupTitle);
1397
1398 ScenePresence sp = (ScenePresence)remoteClient.SceneAgent;
1399 if (sp != null)
1400 sp.Grouptitle = activeGroupTitle;
1418 } 1401 }
1419 1402
1420 #endregion 1403 #endregion
@@ -1425,7 +1408,7 @@ namespace OpenSim.Groups
1425 { 1408 {
1426 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1409 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1427 1410
1428 IClientAPI localClient = GetActiveClient(msgTo); 1411 IClientAPI localClient = GetActiveRootClient(msgTo);
1429 if (localClient != null) 1412 if (localClient != null)
1430 { 1413 {
1431 if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name); 1414 if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name);
@@ -1463,5 +1446,4 @@ namespace OpenSim.Groups
1463 } 1446 }
1464 1447
1465 } 1448 }
1466
1467} 1449}
diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
index 7d57de1..9852581 100644
--- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Groups
103 if (!m_Enabled) 103 if (!m_Enabled)
104 return; 104 return;
105 105
106 m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName); 106 m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
107 scene.RegisterModuleInterface<IGroupsServicesConnector>(this); 107 scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
108 m_Scenes.Add(scene); 108 m_Scenes.Add(scene);
109 109
@@ -135,7 +135,7 @@ namespace OpenSim.Groups
135 { 135 {
136 m_LocalGroupsConnector = new GroupsServiceLocalConnectorModule(m_Config, m_UserManagement); 136 m_LocalGroupsConnector = new GroupsServiceLocalConnectorModule(m_Config, m_UserManagement);
137 // Also, if local, create the endpoint for the HGGroupsService 137 // Also, if local, create the endpoint for the HGGroupsService
138 new HGGroupsServiceRobustConnector(m_Config, MainServer.Instance, string.Empty, 138 new HGGroupsServiceRobustConnector(m_Config, MainServer.Instance, string.Empty,
139 scene.RequestModuleInterface<IOfflineIMService>(), scene.RequestModuleInterface<IUserAccountService>()); 139 scene.RequestModuleInterface<IOfflineIMService>(), scene.RequestModuleInterface<IUserAccountService>());
140 140
141 } 141 }
@@ -170,7 +170,7 @@ namespace OpenSim.Groups
170 if (sp is ScenePresence && ((ScenePresence)sp).PresenceType != PresenceType.Npc) 170 if (sp is ScenePresence && ((ScenePresence)sp).PresenceType != PresenceType.Npc)
171 { 171 {
172 AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); 172 AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId);
173 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 && 173 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 &&
174 m_OfflineIM != null && m_Messaging != null) 174 m_OfflineIM != null && m_Messaging != null)
175 { 175 {
176 List<GridInstantMessage> ims = m_OfflineIM.GetMessages(aCircuit.AgentID); 176 List<GridInstantMessage> ims = m_OfflineIM.GetMessages(aCircuit.AgentID);
@@ -184,12 +184,12 @@ namespace OpenSim.Groups
184 184
185 #region IGroupsServicesConnector 185 #region IGroupsServicesConnector
186 186
187 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 187 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
188 bool allowPublish, bool maturePublish, UUID founderID, out string reason) 188 bool allowPublish, bool maturePublish, UUID founderID, out string reason)
189 { 189 {
190 reason = string.Empty; 190 reason = string.Empty;
191 if (m_UserManagement.IsLocalGridUser(RequestingAgentID)) 191 if (m_UserManagement.IsLocalGridUser(RequestingAgentID))
192 return m_LocalGroupsConnector.CreateGroup(RequestingAgentID, name, charter, showInList, insigniaID, 192 return m_LocalGroupsConnector.CreateGroup(RequestingAgentID, name, charter, showInList, insigniaID,
193 membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason); 193 membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason);
194 else 194 else
195 { 195 {
@@ -198,14 +198,14 @@ namespace OpenSim.Groups
198 } 198 }
199 } 199 }
200 200
201 public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, 201 public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
202 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason) 202 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
203 { 203 {
204 reason = string.Empty; 204 reason = string.Empty;
205 string url = string.Empty; 205 string url = string.Empty;
206 string name = string.Empty; 206 string name = string.Empty;
207 if (IsLocal(groupID, out url, out name)) 207 if (IsLocal(groupID, out url, out name))
208 return m_LocalGroupsConnector.UpdateGroup(AgentUUI(RequestingAgentID), groupID, charter, showInList, insigniaID, membershipFee, 208 return m_LocalGroupsConnector.UpdateGroup(AgentUUI(RequestingAgentID), groupID, charter, showInList, insigniaID, membershipFee,
209 openEnrollment, allowPublish, maturePublish, out reason); 209 openEnrollment, allowPublish, maturePublish, out reason);
210 else 210 else
211 { 211 {
@@ -374,7 +374,7 @@ namespace OpenSim.Groups
374 374
375 } 375 }
376 } 376 }
377 377
378 return new List<GroupRoleMembersData>(); 378 return new List<GroupRoleMembersData>();
379 } 379 }
380 380
@@ -626,7 +626,7 @@ namespace OpenSim.Groups
626 } 626 }
627 if (agent != null) 627 if (agent != null)
628 return Util.ProduceUserUniversalIdentifier(agent); 628 return Util.ProduceUserUniversalIdentifier(agent);
629 629
630 // we don't know anything about this foreign user 630 // we don't know anything about this foreign user
631 // try asking the user management module, which may know more 631 // try asking the user management module, which may know more
632 return m_UserManagement.GetUserUUI(AgentID); 632 return m_UserManagement.GetUserUUI(AgentID);
@@ -664,7 +664,7 @@ namespace OpenSim.Groups
664 string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty; 664 string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
665 if (Util.ParseUniversalUserIdentifier(uID, out userID, out url, out first, out last, out tmp)) 665 if (Util.ParseUniversalUserIdentifier(uID, out userID, out url, out first, out last, out tmp))
666 m_UserManagement.AddUser(userID, first, last, url); 666 m_UserManagement.AddUser(userID, first, last, url);
667 667
668 return userID; 668 return userID;
669 } 669 }
670 670
diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
index f60c1a5..51f3ec1 100644
--- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs
@@ -64,8 +64,8 @@ namespace OpenSim.Groups
64 64
65 m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName); 65 m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName);
66 66
67 string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", 67 string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
68 new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty); 68 new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty);
69 if (homeURI == string.Empty) 69 if (homeURI == string.Empty)
70 throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName)); 70 throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName));
71 71
@@ -115,9 +115,10 @@ namespace OpenSim.Groups
115 protected override byte[] ProcessRequest(string path, Stream requestData, 115 protected override byte[] ProcessRequest(string path, Stream requestData,
116 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 116 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
117 { 117 {
118 StreamReader sr = new StreamReader(requestData); 118 string body;
119 string body = sr.ReadToEnd(); 119 using(StreamReader sr = new StreamReader(requestData))
120 sr.Close(); 120 body = sr.ReadToEnd();
121
121 body = body.Trim(); 122 body = body.Trim();
122 123
123 //m_log.DebugFormat("[XXX]: query String: {0}", body); 124 //m_log.DebugFormat("[XXX]: query String: {0}", body);
diff --git a/OpenSim/Addons/Groups/IGroupsServicesConnector.cs b/OpenSim/Addons/Groups/IGroupsServicesConnector.cs
index a09b59e..8a6e88d 100644
--- a/OpenSim/Addons/Groups/IGroupsServicesConnector.cs
+++ b/OpenSim/Addons/Groups/IGroupsServicesConnector.cs
@@ -34,9 +34,9 @@ namespace OpenSim.Groups
34{ 34{
35 public interface IGroupsServicesConnector 35 public interface IGroupsServicesConnector
36 { 36 {
37 UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, 37 UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee,
38 bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID, out string reason); 38 bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID, out string reason);
39 bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, 39 bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
40 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason); 40 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason);
41 ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName); 41 ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName);
42 List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search); 42 List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search);
@@ -75,7 +75,7 @@ namespace OpenSim.Groups
75 /// If the user is a member of the group then the data structure is returned. If not, then null is returned. 75 /// If the user is a member of the group then the data structure is returned. If not, then null is returned.
76 /// </returns> 76 /// </returns>
77 ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID); 77 ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID);
78 78
79 /// <summary> 79 /// <summary>
80 /// Get information about the groups to which a user belongs. 80 /// Get information about the groups to which a user belongs.
81 /// </summary> 81 /// </summary>
@@ -87,7 +87,7 @@ namespace OpenSim.Groups
87 /// </returns> 87 /// </returns>
88 List<GroupMembershipData> GetAgentGroupMemberships(string RequestingAgentID, string AgentID); 88 List<GroupMembershipData> GetAgentGroupMemberships(string RequestingAgentID, string AgentID);
89 89
90 bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, 90 bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
91 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID); 91 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID);
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);
diff --git a/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs b/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs
index 8e30df5..c7877c6 100644
--- a/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs
@@ -108,7 +108,7 @@ namespace OpenSim.Groups
108 if (!m_Enabled) 108 if (!m_Enabled)
109 return; 109 return;
110 110
111 m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName); 111 m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
112 scene.RegisterModuleInterface<IGroupsServicesConnector>(this); 112 scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
113 m_Scenes.Add(scene); 113 m_Scenes.Add(scene);
114 } 114 }
@@ -146,16 +146,16 @@ namespace OpenSim.Groups
146 146
147 #region IGroupsServicesConnector 147 #region IGroupsServicesConnector
148 148
149 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 149 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
150 bool allowPublish, bool maturePublish, UUID founderID, out string reason) 150 bool allowPublish, bool maturePublish, UUID founderID, out string reason)
151 { 151 {
152 m_log.DebugFormat("[Groups]: Creating group {0}", name); 152 m_log.DebugFormat("[Groups]: Creating group {0}", name);
153 reason = string.Empty; 153 reason = string.Empty;
154 return m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID, 154 return m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID,
155 membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason); 155 membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason);
156 } 156 }
157 157
158 public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, 158 public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
159 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason) 159 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
160 { 160 {
161 reason = string.Empty; 161 reason = string.Empty;
@@ -296,7 +296,7 @@ namespace OpenSim.Groups
296 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, 296 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
297 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID) 297 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
298 { 298 {
299 return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message, 299 return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message,
300 hasAttachment, attType, attName, attItemID, attOwnerID); 300 hasAttachment, attType, attName, attItemID, attOwnerID);
301 } 301 }
302 302
diff --git a/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs b/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs
index cf0de1d..e9be9c4 100644
--- a/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs
+++ b/OpenSim/Addons/Groups/Properties/AssemblyInfo.cs
@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins; 4using Mono.Addins;
5 5
6// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
7// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
8// associated with an assembly. 8// associated with an assembly.
9[assembly: AssemblyTitle("OpenSim.Addons.Groups")] 9[assembly: AssemblyTitle("OpenSim.Addons.Groups")]
@@ -15,8 +15,8 @@ using Mono.Addins;
15[assembly: AssemblyTrademark("")] 15[assembly: AssemblyTrademark("")]
16[assembly: AssemblyCulture("")] 16[assembly: AssemblyCulture("")]
17 17
18// Setting ComVisible to false makes the types in this assembly not visible 18// Setting ComVisible to false makes the types in this assembly not visible
19// to COM components. If you need to access a type in this assembly from 19// to COM components. If you need to access a type in this assembly from
20// COM, set the ComVisible attribute to true on that type. 20// COM, set the ComVisible attribute to true on that type.
21[assembly: ComVisible(false)] 21[assembly: ComVisible(false)]
22 22
@@ -26,11 +26,11 @@ using Mono.Addins;
26// Version information for an assembly consists of the following four values: 26// Version information for an assembly consists of the following four values:
27// 27//
28// Major Version 28// Major Version
29// Minor Version 29// Minor Version
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
33[assembly: AssemblyVersion("0.8.3.*")] 33[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
34 34
35[assembly: Addin("OpenSim.Groups", OpenSim.VersionInfo.VersionNumber)] 35[assembly: Addin("OpenSim.Groups", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] 36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
index 7450c14..8f6be0d 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
@@ -41,7 +41,7 @@ using Nini.Config;
41 41
42namespace OpenSim.Groups 42namespace OpenSim.Groups
43{ 43{
44 public class GroupsServiceRemoteConnector 44 public class GroupsServiceRemoteConnector
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
@@ -71,7 +71,7 @@ namespace OpenSim.Groups
71 } 71 }
72 /// 72 ///
73 73
74 m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}", 74 m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}",
75 m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString())); 75 m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
76 } 76 }
77 77
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
index d4739c6..b6c75a8 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Groups
113 if (!m_Enabled) 113 if (!m_Enabled)
114 return; 114 return;
115 115
116 m_log.DebugFormat("[Groups.RemoteConnector]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName); 116 m_log.DebugFormat("[Groups.RemoteConnector]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
117 scene.RegisterModuleInterface<IGroupsServicesConnector>(this); 117 scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
118 m_Scenes.Add(scene); 118 m_Scenes.Add(scene);
119 } 119 }
@@ -151,7 +151,7 @@ namespace OpenSim.Groups
151 151
152 #region IGroupsServicesConnector 152 #region IGroupsServicesConnector
153 153
154 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 154 public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
155 bool allowPublish, bool maturePublish, UUID founderID, out string reason) 155 bool allowPublish, bool maturePublish, UUID founderID, out string reason)
156 { 156 {
157 m_log.DebugFormat("[Groups.RemoteConnector]: Creating group {0}", name); 157 m_log.DebugFormat("[Groups.RemoteConnector]: Creating group {0}", name);
@@ -167,7 +167,7 @@ namespace OpenSim.Groups
167 return groupID; 167 return groupID;
168 } 168 }
169 169
170 public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, 170 public bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
171 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason) 171 bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
172 { 172 {
173 string r = string.Empty; 173 string r = string.Empty;
@@ -186,9 +186,9 @@ namespace OpenSim.Groups
186 if (GroupID == UUID.Zero && (GroupName == null || GroupName != null && GroupName == string.Empty)) 186 if (GroupID == UUID.Zero && (GroupName == null || GroupName != null && GroupName == string.Empty))
187 return null; 187 return null;
188 188
189 return m_CacheWrapper.GetGroupRecord(RequestingAgentID,GroupID,GroupName, delegate 189 return m_CacheWrapper.GetGroupRecord(RequestingAgentID,GroupID,GroupName, delegate
190 { 190 {
191 return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName); 191 return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName);
192 }); 192 });
193 } 193 }
194 194
@@ -362,7 +362,7 @@ namespace OpenSim.Groups
362 m_GroupsService.RemoveAgentToGroupInvite(RequestingAgentID, inviteID); 362 m_GroupsService.RemoveAgentToGroupInvite(RequestingAgentID, inviteID);
363 } 363 }
364 364
365 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, 365 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
366 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID) 366 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
367 { 367 {
368 GroupNoticeInfo notice = new GroupNoticeInfo(); 368 GroupNoticeInfo notice = new GroupNoticeInfo();
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index 26e844e..8502bb5 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -91,9 +91,10 @@ namespace OpenSim.Groups
91 protected override byte[] ProcessRequest(string path, Stream requestData, 91 protected override byte[] ProcessRequest(string path, Stream requestData,
92 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 92 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
93 { 93 {
94 StreamReader sr = new StreamReader(requestData); 94 string body;
95 string body = sr.ReadToEnd(); 95 using(StreamReader sr = new StreamReader(requestData))
96 sr.Close(); 96 body = sr.ReadToEnd();
97
97 body = body.Trim(); 98 body = body.Trim();
98 99
99 //m_log.DebugFormat("[XXX]: query String: {0}", body); 100 //m_log.DebugFormat("[XXX]: query String: {0}", body);
@@ -286,7 +287,7 @@ namespace OpenSim.Groups
286 string requestingAgentID = request["RequestingAgentID"].ToString(); 287 string requestingAgentID = request["RequestingAgentID"].ToString();
287 288
288 if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID)) 289 if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
289 NullResult(result, string.Format("Insufficient permissions.", agentID)); 290 NullResult(result, string.Format("Insufficient permissions. {0}", agentID));
290 else 291 else
291 result["RESULT"] = "true"; 292 result["RESULT"] = "true";
292 } 293 }
@@ -393,7 +394,7 @@ namespace OpenSim.Groups
393 394
394 if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("RoleID") || 395 if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("RoleID") ||
395 !request.ContainsKey("Name") || !request.ContainsKey("Description") || !request.ContainsKey("Title") || 396 !request.ContainsKey("Name") || !request.ContainsKey("Description") || !request.ContainsKey("Title") ||
396 !request.ContainsKey("Powers") || !request.ContainsKey("OP")) 397 !request.ContainsKey("Powers") || !request.ContainsKey("OP"))
397 NullResult(result, "Bad network data"); 398 NullResult(result, "Bad network data");
398 399
399 else 400 else
@@ -519,11 +520,11 @@ namespace OpenSim.Groups
519 520
520 bool success = false; 521 bool success = false;
521 if (op == "ADD") 522 if (op == "ADD")
522 success = m_GroupsService.AddAgentToGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(), 523 success = m_GroupsService.AddAgentToGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(),
523 new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString())); 524 new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()));
524 525
525 else if (op == "DELETE") 526 else if (op == "DELETE")
526 success = m_GroupsService.RemoveAgentFromGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(), 527 success = m_GroupsService.RemoveAgentFromGroupRole(request["RequestingAgentID"].ToString(), request["AgentID"].ToString(),
527 new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString())); 528 new UUID(request["GroupID"].ToString()), new UUID(request["RoleID"].ToString()));
528 529
529 result["RESULT"] = success.ToString(); 530 result["RESULT"] = success.ToString();
@@ -647,8 +648,8 @@ namespace OpenSim.Groups
647 string op = request["OP"].ToString(); 648 string op = request["OP"].ToString();
648 649
649 if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID")) 650 if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID"))
650 { 651 {
651 bool success = m_GroupsService.AddAgentToGroupInvite(request["RequestingAgentID"].ToString(), 652 bool success = m_GroupsService.AddAgentToGroupInvite(request["RequestingAgentID"].ToString(),
652 new UUID(request["InviteID"].ToString()), new UUID(request["GroupID"].ToString()), 653 new UUID(request["InviteID"].ToString()), new UUID(request["GroupID"].ToString()),
653 new UUID(request["RoleID"].ToString()), request["AgentID"].ToString()); 654 new UUID(request["RoleID"].ToString()), request["AgentID"].ToString());
654 655
@@ -664,7 +665,7 @@ namespace OpenSim.Groups
664 } 665 }
665 else if (op == "GET") 666 else if (op == "GET")
666 { 667 {
667 GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request["RequestingAgentID"].ToString(), 668 GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request["RequestingAgentID"].ToString(),
668 new UUID(request["InviteID"].ToString())); 669 new UUID(request["InviteID"].ToString()));
669 670
670 if (invite != null) 671 if (invite != null)
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index 07641ef..ea0fedd 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Groups
126 126
127 #endregion 127 #endregion
128 128
129 public UUID CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 129 public UUID CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
130 bool allowPublish, bool maturePublish, UUID founderID, out string reason) 130 bool allowPublish, bool maturePublish, UUID founderID, out string reason)
131 { 131 {
132 reason = string.Empty; 132 reason = string.Empty;
@@ -264,7 +264,7 @@ namespace OpenSim.Groups
264 if (ownerRole != null) 264 if (ownerRole != null)
265 ownerRoleID = ownerRole.RoleID; 265 ownerRoleID = ownerRole.RoleID;
266 266
267 // Check visibility? 267 // Check visibility?
268 // When we don't want to check visibility, we pass it "all" as the requestingAgentID 268 // When we don't want to check visibility, we pass it "all" as the requestingAgentID
269 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString()); 269 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
270 270
@@ -307,20 +307,20 @@ namespace OpenSim.Groups
307 m.Contribution = Int32.Parse(d.Data["Contribution"]); 307 m.Contribution = Int32.Parse(d.Data["Contribution"]);
308 m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false; 308 m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
309 309
310 GridUserData gud = m_GridUserService.Get(d.PrincipalID); 310 GridUserData gud = m_GridUserService.Get(d.PrincipalID);
311 if (gud != null) 311 if (gud != null)
312 { 312 {
313 if (bool.Parse(gud.Data["Online"])) 313 if (bool.Parse(gud.Data["Online"]))
314 { 314 {
315 m.OnlineStatus = @"Online"; 315 m.OnlineStatus = @"Online";
316 } 316 }
317 else 317 else
318 { 318 {
319 int unixtime = int.Parse(gud.Data["Login"]); 319 int unixtime = int.Parse(gud.Data["Login"]);
320 // The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates! 320 // The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
321 m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy"); 321 m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
322 } 322 }
323 } 323 }
324 324
325 // Is this person an owner of the group? 325 // Is this person an owner of the group?
326 m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false; 326 m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
@@ -486,7 +486,7 @@ namespace OpenSim.Groups
486 // check permissions 486 // check permissions
487 bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited); 487 bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
488 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID); 488 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID);
489 if (!limited || !unlimited) 489 if (!limited && !unlimited)
490 { 490 {
491 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID); 491 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
492 return false; 492 return false;
@@ -496,7 +496,7 @@ namespace OpenSim.Groups
496 if (!unlimited && limited) 496 if (!unlimited && limited)
497 { 497 {
498 // check whether person's has this role 498 // check whether person's has this role
499 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 499 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
500 if (rolemembership == null) 500 if (rolemembership == null)
501 { 501 {
502 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID); 502 m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
@@ -516,13 +516,26 @@ namespace OpenSim.Groups
516 return false; 516 return false;
517 517
518 // check permissions 518 // check permissions
519 bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
519 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID); 520 bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
520 if (!unlimited) 521 if (!limited && !unlimited)
521 { 522 {
522 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID); 523 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
523 return false; 524 return false;
524 } 525 }
525 526
527 // AssignMemberLimited means that the person can assign another person to the same roles that she has in the group
528 if (!unlimited && limited)
529 {
530 // check whether person's has this role
531 RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
532 if (rolemembership == null)
533 {
534 m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
535 return false;
536 }
537 }
538
526 RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 539 RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
527 540
528 if (rolemember == null) 541 if (rolemember == null)
@@ -540,8 +553,8 @@ namespace OpenSim.Groups
540 { 553 {
541 newRoleID = r.RoleID; 554 newRoleID = r.RoleID;
542 break; 555 break;
543 } 556 }
544 } 557 }
545 558
546 MembershipData member = m_Database.RetrieveMember(GroupID, AgentID); 559 MembershipData member = m_Database.RetrieveMember(GroupID, AgentID);
547 if (member != null) 560 if (member != null)
@@ -699,7 +712,7 @@ namespace OpenSim.Groups
699 m_Database.StoreMember(membership); 712 m_Database.StoreMember(membership);
700 } 713 }
701 714
702 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, 715 public bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message,
703 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID) 716 bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
704 { 717 {
705 // Check perms 718 // Check perms
@@ -812,7 +825,7 @@ namespace OpenSim.Groups
812 if (RoleID != UUID.Zero) 825 if (RoleID != UUID.Zero)
813 _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); 826 _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
814 827
815 // Make thit this active group 828 // Make this the active group
816 PrincipalData pdata = new PrincipalData(); 829 PrincipalData pdata = new PrincipalData();
817 pdata.PrincipalID = AgentID; 830 pdata.PrincipalID = AgentID;
818 pdata.ActiveGroupID = GroupID; 831 pdata.ActiveGroupID = GroupID;
diff --git a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
index 8e237aa..98d0172 100644
--- a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
@@ -35,67 +35,67 @@ using OpenSim.Services.Base;
35 35
36namespace OpenSim.Groups 36namespace OpenSim.Groups
37{ 37{
38 public class GroupsServiceBase : ServiceBase 38 public class GroupsServiceBase : ServiceBase
39 { 39 {
40 protected IGroupsData m_Database = null; 40 protected IGroupsData m_Database = null;
41 protected IGridUserData m_GridUserService = null; 41 protected IGridUserData m_GridUserService = null;
42 42
43 public GroupsServiceBase(IConfigSource config, string cName) 43 public GroupsServiceBase(IConfigSource config, string cName)
44 : base(config) 44 : base(config)
45 { 45 {
46 string dllName = String.Empty; 46 string dllName = String.Empty;
47 string connString = String.Empty; 47 string connString = String.Empty;
48 string realm = "os_groups"; 48 string realm = "os_groups";
49 string usersRealm = "GridUser"; 49 string usersRealm = "GridUser";
50 string configName = (cName == string.Empty) ? "Groups" : cName; 50 string configName = (cName == string.Empty) ? "Groups" : cName;
51 51
52 // 52 //
53 // Try reading the [DatabaseService] section, if it exists 53 // Try reading the [DatabaseService] section, if it exists
54 // 54 //
55 IConfig dbConfig = config.Configs["DatabaseService"]; 55 IConfig dbConfig = config.Configs["DatabaseService"];
56 if (dbConfig != null) 56 if (dbConfig != null)
57 { 57 {
58 if (dllName == String.Empty) 58 if (dllName == String.Empty)
59 dllName = dbConfig.GetString("StorageProvider", String.Empty); 59 dllName = dbConfig.GetString("StorageProvider", String.Empty);
60 if (connString == String.Empty) 60 if (connString == String.Empty)
61 connString = dbConfig.GetString("ConnectionString", String.Empty); 61 connString = dbConfig.GetString("ConnectionString", String.Empty);
62 } 62 }
63 63
64 // 64 //
65 // [Groups] section overrides [DatabaseService], if it exists 65 // [Groups] section overrides [DatabaseService], if it exists
66 // 66 //
67 IConfig groupsConfig = config.Configs[configName]; 67 IConfig groupsConfig = config.Configs[configName];
68 if (groupsConfig != null) 68 if (groupsConfig != null)
69 { 69 {
70 dllName = groupsConfig.GetString("StorageProvider", dllName); 70 dllName = groupsConfig.GetString("StorageProvider", dllName);
71 connString = groupsConfig.GetString("ConnectionString", connString); 71 connString = groupsConfig.GetString("ConnectionString", connString);
72 realm = groupsConfig.GetString("Realm", realm); 72 realm = groupsConfig.GetString("Realm", realm);
73 } 73 }
74 74
75 // 75 //
76 // We tried, but this doesn't exist. We can't proceed. 76 // We tried, but this doesn't exist. We can't proceed.
77 // 77 //
78 if (dllName.Equals(String.Empty)) 78 if (dllName.Equals(String.Empty))
79 throw new Exception("No StorageProvider configured"); 79 throw new Exception("No StorageProvider configured");
80 80
81 m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm }); 81 m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm });
82 if (m_Database == null) 82 if (m_Database == null)
83 throw new Exception("Could not find a storage interface in the given module " + dllName); 83 throw new Exception("Could not find a storage interface in the given module " + dllName);
84 84
85 // 85 //
86 // [GridUserService] section overrides [DatabaseService], if it exists 86 // [GridUserService] section overrides [DatabaseService], if it exists
87 // 87 //
88 IConfig usersConfig = config.Configs["GridUserService"]; 88 IConfig usersConfig = config.Configs["GridUserService"];
89 if (usersConfig != null) 89 if (usersConfig != null)
90 { 90 {
91 dllName = usersConfig.GetString("StorageProvider", dllName); 91 dllName = usersConfig.GetString("StorageProvider", dllName);
92 connString = usersConfig.GetString("ConnectionString", connString); 92 connString = usersConfig.GetString("ConnectionString", connString);
93 usersRealm = usersConfig.GetString("Realm", usersRealm); 93 usersRealm = usersConfig.GetString("Realm", usersRealm);
94 } 94 }
95 95
96 m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm }); 96 m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm });
97 if (m_GridUserService == null) 97 if (m_GridUserService == null)
98 throw new Exception("Could not find a storage inferface for the given users module " + dllName); 98 throw new Exception("Could not find a storage inferface for the given users module " + dllName);
99 } 99 }
100 } 100 }
101} 101}
diff --git a/OpenSim/Addons/Groups/Service/HGGroupsService.cs b/OpenSim/Addons/Groups/Service/HGGroupsService.cs
index 56e999b..7d86f85 100644
--- a/OpenSim/Addons/Groups/Service/HGGroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/HGGroupsService.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Groups
76 76
77 // Check if it already exists 77 // Check if it already exists
78 GroupData grec = m_Database.RetrieveGroup(groupID); 78 GroupData grec = m_Database.RetrieveGroup(groupID);
79 if (grec == null || 79 if (grec == null ||
80 (grec != null && grec.Data["Location"] != string.Empty && grec.Data["Location"].ToLower() != serviceLocation.ToLower())) 80 (grec != null && grec.Data["Location"] != string.Empty && grec.Data["Location"].ToLower() != serviceLocation.ToLower()))
81 { 81 {
82 // Create the group 82 // Create the group
diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
index 5340bcd..d8164e7 100644
--- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
+++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
@@ -114,7 +114,6 @@ namespace OpenSim.OfflineIM
114 scene.ForEachClient(delegate(IClientAPI client) 114 scene.ForEachClient(delegate(IClientAPI client)
115 { 115 {
116 client.OnRetrieveInstantMessages -= RetrieveInstantMessages; 116 client.OnRetrieveInstantMessages -= RetrieveInstantMessages;
117 client.OnMuteListRequest -= OnMuteListRequest;
118 }); 117 });
119 } 118 }
120 119
@@ -162,7 +161,6 @@ namespace OpenSim.OfflineIM
162 private void OnNewClient(IClientAPI client) 161 private void OnNewClient(IClientAPI client)
163 { 162 {
164 client.OnRetrieveInstantMessages += RetrieveInstantMessages; 163 client.OnRetrieveInstantMessages += RetrieveInstantMessages;
165 client.OnMuteListRequest += OnMuteListRequest;
166 } 164 }
167 165
168 private void RetrieveInstantMessages(IClientAPI client) 166 private void RetrieveInstantMessages(IClientAPI client)
@@ -194,20 +192,6 @@ namespace OpenSim.OfflineIM
194 } 192 }
195 } 193 }
196 194
197 // Apparently this is needed in order for the viewer to request the IMs.
198 private void OnMuteListRequest(IClientAPI client, uint crc)
199 {
200 m_log.DebugFormat("[OfflineIM.V2] Got mute list request for crc {0}", crc);
201 string filename = "mutes" + client.AgentId.ToString();
202
203 IXfer xfer = client.Scene.RequestModuleInterface<IXfer>();
204 if (xfer != null)
205 {
206 xfer.AddNewFile(filename, new Byte[0]);
207 client.SendMuteListUpdate(filename);
208 }
209 }
210
211 private void UndeliveredMessage(GridInstantMessage im) 195 private void UndeliveredMessage(GridInstantMessage im)
212 { 196 {
213 if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && 197 if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
diff --git a/OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs b/OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs
index 0699660..fe828bc 100644
--- a/OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs
+++ b/OpenSim/Addons/OfflineIM/Properties/AssemblyInfo.cs
@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins; 4using Mono.Addins;
5 5
6// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
7// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
8// associated with an assembly. 8// associated with an assembly.
9[assembly: AssemblyTitle("OpenSim.Addons.OfflineIM")] 9[assembly: AssemblyTitle("OpenSim.Addons.OfflineIM")]
@@ -15,8 +15,8 @@ using Mono.Addins;
15[assembly: AssemblyTrademark("")] 15[assembly: AssemblyTrademark("")]
16[assembly: AssemblyCulture("")] 16[assembly: AssemblyCulture("")]
17 17
18// Setting ComVisible to false makes the types in this assembly not visible 18// Setting ComVisible to false makes the types in this assembly not visible
19// to COM components. If you need to access a type in this assembly from 19// to COM components. If you need to access a type in this assembly from
20// COM, set the ComVisible attribute to true on that type. 20// COM, set the ComVisible attribute to true on that type.
21[assembly: ComVisible(false)] 21[assembly: ComVisible(false)]
22 22
@@ -26,11 +26,11 @@ using Mono.Addins;
26// Version information for an assembly consists of the following four values: 26// Version information for an assembly consists of the following four values:
27// 27//
28// Major Version 28// Major Version
29// Minor Version 29// Minor Version
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
33[assembly: AssemblyVersion("0.8.3.*")] 33[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
34 34
35[assembly: Addin("OpenSim.OfflineIM", OpenSim.VersionInfo.VersionNumber)] 35[assembly: Addin("OpenSim.OfflineIM", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] 36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
index 047b8be..46d4979 100644
--- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
+++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
@@ -77,7 +77,7 @@ namespace OpenSim.OfflineIM
77 break; 77 break;
78 } 78 }
79 /// 79 ///
80 m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}", 80 m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}",
81 m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString())); 81 m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
82 } 82 }
83 83
@@ -140,7 +140,7 @@ namespace OpenSim.OfflineIM
140 { 140 {
141 Dictionary<string, object> sendData = new Dictionary<string, object>(); 141 Dictionary<string, object> sendData = new Dictionary<string, object>();
142 sendData["UserID"] = userID; 142 sendData["UserID"] = userID;
143 143
144 MakeRequest("DELETE", sendData); 144 MakeRequest("DELETE", sendData);
145 } 145 }
146 146
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
index 02084ff..d1ecdce 100644
--- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
+++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
@@ -90,7 +90,7 @@ namespace OpenSim.OfflineIM
90 public bool StoreMessage(GridInstantMessage im, out string reason) 90 public bool StoreMessage(GridInstantMessage im, out string reason)
91 { 91 {
92 reason = string.Empty; 92 reason = string.Empty;
93 93
94 // Check limits 94 // Check limits
95 UUID principalID = new UUID(im.toAgentID); 95 UUID principalID = new UUID(im.toAgentID);
96 long count = m_Database.GetCount("PrincipalID", principalID.ToString()); 96 long count = m_Database.GetCount("PrincipalID", principalID.ToString());