diff options
Diffstat (limited to 'OpenSim/Addons/Groups/GroupsModule.cs')
-rw-r--r-- | OpenSim/Addons/Groups/GroupsModule.cs | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index f805d69..da8030c 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs | |||
@@ -141,6 +141,8 @@ namespace OpenSim.Groups | |||
141 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 141 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
142 | 142 | ||
143 | scene.EventManager.OnNewClient += OnNewClient; | 143 | scene.EventManager.OnNewClient += OnNewClient; |
144 | scene.EventManager.OnMakeRootAgent += OnMakeRoot; | ||
145 | scene.EventManager.OnMakeChildAgent += OnMakeChild; | ||
144 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 146 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
145 | // The InstantMessageModule itself doesn't do this, | 147 | // The InstantMessageModule itself doesn't do this, |
146 | // so lets see if things explode if we don't do it | 148 | // so lets see if things explode if we don't do it |
@@ -194,6 +196,8 @@ namespace OpenSim.Groups | |||
194 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 196 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
195 | 197 | ||
196 | scene.EventManager.OnNewClient -= OnNewClient; | 198 | scene.EventManager.OnNewClient -= OnNewClient; |
199 | scene.EventManager.OnMakeRootAgent -= OnMakeRoot; | ||
200 | scene.EventManager.OnMakeChildAgent -= OnMakeChild; | ||
197 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 201 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
198 | 202 | ||
199 | lock (m_sceneList) | 203 | lock (m_sceneList) |
@@ -232,16 +236,29 @@ namespace OpenSim.Groups | |||
232 | { | 236 | { |
233 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 237 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
234 | 238 | ||
235 | client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; | ||
236 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; | 239 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; |
237 | client.OnDirFindQuery += OnDirFindQuery; | ||
238 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; | 240 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; |
241 | } | ||
239 | 242 | ||
243 | private void OnMakeRoot(ScenePresence sp) | ||
244 | { | ||
245 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
246 | |||
247 | sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; | ||
240 | // Used for Notices and Group Invites/Accept/Reject | 248 | // Used for Notices and Group Invites/Accept/Reject |
241 | client.OnInstantMessage += OnInstantMessage; | 249 | sp.ControllingClient.OnInstantMessage += OnInstantMessage; |
242 | 250 | ||
243 | // Send client their groups information. | 251 | // Send client their groups information. |
244 | SendAgentGroupDataUpdate(client, client.AgentId); | 252 | SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID); |
253 | } | ||
254 | |||
255 | private void OnMakeChild(ScenePresence sp) | ||
256 | { | ||
257 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
258 | |||
259 | sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; | ||
260 | // Used for Notices and Group Invites/Accept/Reject | ||
261 | sp.ControllingClient.OnInstantMessage -= OnInstantMessage; | ||
245 | } | 262 | } |
246 | 263 | ||
247 | private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) | 264 | private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) |
@@ -287,21 +304,6 @@ namespace OpenSim.Groups | |||
287 | } | 304 | } |
288 | */ | 305 | */ |
289 | 306 | ||
290 | void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) | ||
291 | { | ||
292 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) | ||
293 | { | ||
294 | if (m_debugEnabled) | ||
295 | m_log.DebugFormat( | ||
296 | "[Groups]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", | ||
297 | System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); | ||
298 | |||
299 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order | ||
300 | remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), queryText).ToArray()); | ||
301 | } | ||
302 | |||
303 | } | ||
304 | |||
305 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) | 307 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) |
306 | { | 308 | { |
307 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 309 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -347,7 +349,7 @@ namespace OpenSim.Groups | |||
347 | { | 349 | { |
348 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 350 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
349 | 351 | ||
350 | m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog); | 352 | //m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog); |
351 | // Group invitations | 353 | // Group invitations |
352 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) | 354 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) |
353 | { | 355 | { |
@@ -485,7 +487,7 @@ namespace OpenSim.Groups | |||
485 | return; | 487 | return; |
486 | 488 | ||
487 | //// 16 bytes are the UUID. Maybe. | 489 | //// 16 bytes are the UUID. Maybe. |
488 | UUID folderID = new UUID(im.binaryBucket, 0); | 490 | // UUID folderID = new UUID(im.binaryBucket, 0); |
489 | UUID noticeID = new UUID(im.imSessionID); | 491 | UUID noticeID = new UUID(im.imSessionID); |
490 | 492 | ||
491 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID); | 493 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID); |
@@ -766,14 +768,17 @@ namespace OpenSim.Groups | |||
766 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group."); | 768 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a group."); |
767 | return UUID.Zero; | 769 | return UUID.Zero; |
768 | } | 770 | } |
769 | money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); | ||
770 | } | 771 | } |
772 | |||
771 | string reason = string.Empty; | 773 | string reason = string.Empty; |
772 | UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, | 774 | UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, |
773 | allowPublish, maturePublish, remoteClient.AgentId, out reason); | 775 | allowPublish, maturePublish, remoteClient.AgentId, out reason); |
774 | 776 | ||
775 | if (groupID != UUID.Zero) | 777 | if (groupID != UUID.Zero) |
776 | { | 778 | { |
779 | if (money != null) | ||
780 | money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); | ||
781 | |||
777 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); | 782 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); |
778 | 783 | ||
779 | // Update the founder with new group information. | 784 | // Update the founder with new group information. |
@@ -904,23 +909,7 @@ namespace OpenSim.Groups | |||
904 | { | 909 | { |
905 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called for notice {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, groupNoticeID); | 910 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called for notice {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, groupNoticeID); |
906 | 911 | ||
907 | //GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), data.GroupID, null); | ||
908 | |||
909 | GridInstantMessage msg = CreateGroupNoticeIM(remoteClient.AgentId, groupNoticeID, (byte)InstantMessageDialog.GroupNoticeRequested); | 912 | GridInstantMessage msg = CreateGroupNoticeIM(remoteClient.AgentId, groupNoticeID, (byte)InstantMessageDialog.GroupNoticeRequested); |
910 | //GridInstantMessage msg = new GridInstantMessage(); | ||
911 | //msg.imSessionID = UUID.Zero.Guid; | ||
912 | //msg.fromAgentID = data.GroupID.Guid; | ||
913 | //msg.toAgentID = GetRequestingAgentID(remoteClient).Guid; | ||
914 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
915 | //msg.fromAgentName = "Group Notice : " + groupInfo == null ? "Unknown" : groupInfo.GroupName; | ||
916 | //msg.message = data.noticeData.Subject + "|" + data.Message; | ||
917 | //msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNoticeRequested; | ||
918 | //msg.fromGroup = true; | ||
919 | //msg.offline = (byte)0; | ||
920 | //msg.ParentEstateID = 0; | ||
921 | //msg.Position = Vector3.Zero; | ||
922 | //msg.RegionID = UUID.Zero.Guid; | ||
923 | //msg.binaryBucket = data.BinaryBucket; | ||
924 | 913 | ||
925 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); | 914 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); |
926 | } | 915 | } |
@@ -1002,6 +991,10 @@ namespace OpenSim.Groups | |||
1002 | 991 | ||
1003 | // Should this send updates to everyone in the group? | 992 | // Should this send updates to everyone in the group? |
1004 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 993 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); |
994 | |||
995 | if (reason != string.Empty) | ||
996 | // A warning | ||
997 | remoteClient.SendAlertMessage("Warning: " + reason); | ||
1005 | } | 998 | } |
1006 | else | 999 | else |
1007 | remoteClient.SendJoinGroupReply(groupID, false); | 1000 | remoteClient.SendJoinGroupReply(groupID, false); |
@@ -1186,6 +1179,11 @@ namespace OpenSim.Groups | |||
1186 | } | 1179 | } |
1187 | } | 1180 | } |
1188 | 1181 | ||
1182 | public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query) | ||
1183 | { | ||
1184 | return m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), query); | ||
1185 | } | ||
1186 | |||
1189 | #endregion | 1187 | #endregion |
1190 | 1188 | ||
1191 | #region Client/Update Tools | 1189 | #region Client/Update Tools |
@@ -1399,19 +1397,18 @@ namespace OpenSim.Groups | |||
1399 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1397 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1400 | 1398 | ||
1401 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff | 1399 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff |
1402 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID); | 1400 | string firstname = "Unknown", lastname = "Unknown"; |
1403 | string firstname, lastname; | 1401 | string name = m_UserManagement.GetUserName(dataForAgentID); |
1404 | if (account != null) | 1402 | if (!string.IsNullOrEmpty(name)) |
1405 | { | ||
1406 | firstname = account.FirstName; | ||
1407 | lastname = account.LastName; | ||
1408 | } | ||
1409 | else | ||
1410 | { | 1403 | { |
1411 | firstname = "Unknown"; | 1404 | string[] parts = name.Split(new char[] { ' ' }); |
1412 | lastname = "Unknown"; | 1405 | if (parts.Length >= 2) |
1406 | { | ||
1407 | firstname = parts[0]; | ||
1408 | lastname = parts[1]; | ||
1409 | } | ||
1413 | } | 1410 | } |
1414 | 1411 | ||
1415 | remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, | 1412 | remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, |
1416 | lastname, activeGroupPowers, activeGroupName, | 1413 | lastname, activeGroupPowers, activeGroupName, |
1417 | activeGroupTitle); | 1414 | activeGroupTitle); |