diff options
author | Jeff Ames | 2009-04-21 15:30:03 +0000 |
---|---|---|
committer | Jeff Ames | 2009-04-21 15:30:03 +0000 |
commit | 13f5dd5f353c5ea5e86944af3dbaa739c8be1a8a (patch) | |
tree | db2753c11ade99bfad52a28c96fc16520df865b1 /OpenSim/Region/OptionalModules/Avatar | |
parent | * Add the ability to update profiles via the cache, so that cached profiles d... (diff) | |
download | opensim-SC_OLD-13f5dd5f353c5ea5e86944af3dbaa739c8be1a8a.zip opensim-SC_OLD-13f5dd5f353c5ea5e86944af3dbaa739c8be1a8a.tar.gz opensim-SC_OLD-13f5dd5f353c5ea5e86944af3dbaa739c8be1a8a.tar.bz2 opensim-SC_OLD-13f5dd5f353c5ea5e86944af3dbaa739c8be1a8a.tar.xz |
Update svn properties.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar')
4 files changed, 2583 insertions, 2583 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs index 6e9105d..3fd6116 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupDataProvider.cs | |||
@@ -1,85 +1,85 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | 30 | ||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | 32 | ||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | 34 | ||
35 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 35 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
36 | { | 36 | { |
37 | interface IGroupDataProvider | 37 | interface IGroupDataProvider |
38 | { | 38 | { |
39 | UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); | 39 | UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); |
40 | void UpdateGroup(UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); | 40 | void UpdateGroup(UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); |
41 | GroupRecord GetGroupRecord(UUID GroupID, string GroupName); | 41 | GroupRecord GetGroupRecord(UUID GroupID, string GroupName); |
42 | List<DirGroupsReplyData> FindGroups(string search); | 42 | List<DirGroupsReplyData> FindGroups(string search); |
43 | List<GroupMembersData> GetGroupMembers(UUID GroupID); | 43 | List<GroupMembersData> GetGroupMembers(UUID GroupID); |
44 | 44 | ||
45 | void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers); | 45 | void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers); |
46 | void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers); | 46 | void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers); |
47 | void RemoveGroupRole(UUID groupID, UUID roleID); | 47 | void RemoveGroupRole(UUID groupID, UUID roleID); |
48 | List<GroupRolesData> GetGroupRoles(UUID GroupID); | 48 | List<GroupRolesData> GetGroupRoles(UUID GroupID); |
49 | List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID); | 49 | List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID); |
50 | 50 | ||
51 | void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID); | 51 | void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID); |
52 | void RemoveAgentFromGroup(UUID AgentID, UUID GroupID); | 52 | void RemoveAgentFromGroup(UUID AgentID, UUID GroupID); |
53 | 53 | ||
54 | void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID); | 54 | void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID); |
55 | GroupInviteInfo GetAgentToGroupInvite(UUID inviteID); | 55 | GroupInviteInfo GetAgentToGroupInvite(UUID inviteID); |
56 | void RemoveAgentToGroupInvite(UUID inviteID); | 56 | void RemoveAgentToGroupInvite(UUID inviteID); |
57 | 57 | ||
58 | 58 | ||
59 | void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID); | 59 | void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID); |
60 | void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID); | 60 | void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID); |
61 | List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID); | 61 | List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID); |
62 | 62 | ||
63 | void SetAgentActiveGroup(UUID AgentID, UUID GroupID); | 63 | void SetAgentActiveGroup(UUID AgentID, UUID GroupID); |
64 | GroupMembershipData GetAgentActiveMembership(UUID AgentID); | 64 | GroupMembershipData GetAgentActiveMembership(UUID AgentID); |
65 | 65 | ||
66 | void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID); | 66 | void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID); |
67 | void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); | 67 | void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); |
68 | 68 | ||
69 | GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID); | 69 | GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID); |
70 | List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID); | 70 | List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID); |
71 | 71 | ||
72 | void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); | 72 | void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); |
73 | GroupNoticeInfo GetGroupNotice(UUID noticeID); | 73 | GroupNoticeInfo GetGroupNotice(UUID noticeID); |
74 | List<GroupNoticeData> GetGroupNotices(UUID GroupID); | 74 | List<GroupNoticeData> GetGroupNotices(UUID GroupID); |
75 | } | 75 | } |
76 | 76 | ||
77 | public class GroupInviteInfo | 77 | public class GroupInviteInfo |
78 | { | 78 | { |
79 | public UUID GroupID = UUID.Zero; | 79 | public UUID GroupID = UUID.Zero; |
80 | public UUID RoleID = UUID.Zero; | 80 | public UUID RoleID = UUID.Zero; |
81 | public UUID AgentID = UUID.Zero; | 81 | public UUID AgentID = UUID.Zero; |
82 | public UUID InviteID = UUID.Zero; | 82 | public UUID InviteID = UUID.Zero; |
83 | } | 83 | } |
84 | 84 | ||
85 | } | 85 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs index 343bd6d..eff76cf 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupData.cs | |||
@@ -1,1017 +1,1017 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | //using System.Text; | 32 | //using System.Text; |
33 | 33 | ||
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | 35 | ||
36 | using log4net; | 36 | using log4net; |
37 | // using Nini.Config; | 37 | // using Nini.Config; |
38 | 38 | ||
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
41 | 41 | ||
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | //using OpenSim.Region.Framework.Interfaces; | 43 | //using OpenSim.Region.Framework.Interfaces; |
44 | 44 | ||
45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
46 | { | 46 | { |
47 | 47 | ||
48 | public class XmlRpcGroupDataProvider : IGroupDataProvider | 48 | public class XmlRpcGroupDataProvider : IGroupDataProvider |
49 | { | 49 | { |
50 | private static readonly ILog m_log = | 50 | private static readonly ILog m_log = |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private string m_serviceURL = "http://osflotsam.org/xmlrpc.php"; | 53 | private string m_serviceURL = "http://osflotsam.org/xmlrpc.php"; |
54 | 54 | ||
55 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | GroupPowers.JoinChat | GroupPowers.AllowVoiceChat | GroupPowers.ReceiveNotices | GroupPowers.StartProposal | GroupPowers.VoteOnProposal; | 55 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | GroupPowers.JoinChat | GroupPowers.AllowVoiceChat | GroupPowers.ReceiveNotices | GroupPowers.StartProposal | GroupPowers.VoteOnProposal; |
56 | 56 | ||
57 | public XmlRpcGroupDataProvider(string serviceURL) | 57 | public XmlRpcGroupDataProvider(string serviceURL) |
58 | { | 58 | { |
59 | m_serviceURL = serviceURL; | 59 | m_serviceURL = serviceURL; |
60 | } | 60 | } |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. | 63 | /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. |
64 | /// </summary> | 64 | /// </summary> |
65 | public UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID) | 65 | public UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID) |
66 | { | 66 | { |
67 | UUID GroupID = UUID.Random(); | 67 | UUID GroupID = UUID.Random(); |
68 | UUID OwnerRoleID = UUID.Random(); | 68 | UUID OwnerRoleID = UUID.Random(); |
69 | 69 | ||
70 | Hashtable param = new Hashtable(); | 70 | Hashtable param = new Hashtable(); |
71 | param["GroupID"] = GroupID.ToString(); | 71 | param["GroupID"] = GroupID.ToString(); |
72 | param["Name"] = name; | 72 | param["Name"] = name; |
73 | param["Charter"] = charter; | 73 | param["Charter"] = charter; |
74 | param["ShowInList"] = showInList == true ? 1 : 0; | 74 | param["ShowInList"] = showInList == true ? 1 : 0; |
75 | param["InsigniaID"] = insigniaID.ToString(); | 75 | param["InsigniaID"] = insigniaID.ToString(); |
76 | param["MembershipFee"] = 0; | 76 | param["MembershipFee"] = 0; |
77 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; | 77 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; |
78 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 78 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
79 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 79 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
80 | param["FounderID"] = founderID.ToString(); | 80 | param["FounderID"] = founderID.ToString(); |
81 | param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString(); | 81 | param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString(); |
82 | param["OwnerRoleID"] = OwnerRoleID.ToString(); | 82 | param["OwnerRoleID"] = OwnerRoleID.ToString(); |
83 | 83 | ||
84 | // Would this be cleaner as (GroupPowers)ulong.MaxValue; | 84 | // Would this be cleaner as (GroupPowers)ulong.MaxValue; |
85 | GroupPowers OwnerPowers = GroupPowers.Accountable | 85 | GroupPowers OwnerPowers = GroupPowers.Accountable |
86 | | GroupPowers.AllowEditLand | 86 | | GroupPowers.AllowEditLand |
87 | | GroupPowers.AllowFly | 87 | | GroupPowers.AllowFly |
88 | | GroupPowers.AllowLandmark | 88 | | GroupPowers.AllowLandmark |
89 | | GroupPowers.AllowRez | 89 | | GroupPowers.AllowRez |
90 | | GroupPowers.AllowSetHome | 90 | | GroupPowers.AllowSetHome |
91 | | GroupPowers.AllowVoiceChat | 91 | | GroupPowers.AllowVoiceChat |
92 | | GroupPowers.AssignMember | 92 | | GroupPowers.AssignMember |
93 | | GroupPowers.AssignMemberLimited | 93 | | GroupPowers.AssignMemberLimited |
94 | | GroupPowers.ChangeActions | 94 | | GroupPowers.ChangeActions |
95 | | GroupPowers.ChangeIdentity | 95 | | GroupPowers.ChangeIdentity |
96 | | GroupPowers.ChangeMedia | 96 | | GroupPowers.ChangeMedia |
97 | | GroupPowers.ChangeOptions | 97 | | GroupPowers.ChangeOptions |
98 | | GroupPowers.CreateRole | 98 | | GroupPowers.CreateRole |
99 | | GroupPowers.DeedObject | 99 | | GroupPowers.DeedObject |
100 | | GroupPowers.DeleteRole | 100 | | GroupPowers.DeleteRole |
101 | | GroupPowers.Eject | 101 | | GroupPowers.Eject |
102 | | GroupPowers.FindPlaces | 102 | | GroupPowers.FindPlaces |
103 | | GroupPowers.Invite | 103 | | GroupPowers.Invite |
104 | | GroupPowers.JoinChat | 104 | | GroupPowers.JoinChat |
105 | | GroupPowers.LandChangeIdentity | 105 | | GroupPowers.LandChangeIdentity |
106 | | GroupPowers.LandDeed | 106 | | GroupPowers.LandDeed |
107 | | GroupPowers.LandDivideJoin | 107 | | GroupPowers.LandDivideJoin |
108 | | GroupPowers.LandEdit | 108 | | GroupPowers.LandEdit |
109 | | GroupPowers.LandEjectAndFreeze | 109 | | GroupPowers.LandEjectAndFreeze |
110 | | GroupPowers.LandGardening | 110 | | GroupPowers.LandGardening |
111 | | GroupPowers.LandManageAllowed | 111 | | GroupPowers.LandManageAllowed |
112 | | GroupPowers.LandManageBanned | 112 | | GroupPowers.LandManageBanned |
113 | | GroupPowers.LandManagePasses | 113 | | GroupPowers.LandManagePasses |
114 | | GroupPowers.LandOptions | 114 | | GroupPowers.LandOptions |
115 | | GroupPowers.LandRelease | 115 | | GroupPowers.LandRelease |
116 | | GroupPowers.LandSetSale | 116 | | GroupPowers.LandSetSale |
117 | | GroupPowers.ModerateChat | 117 | | GroupPowers.ModerateChat |
118 | | GroupPowers.ObjectManipulate | 118 | | GroupPowers.ObjectManipulate |
119 | | GroupPowers.ObjectSetForSale | 119 | | GroupPowers.ObjectSetForSale |
120 | | GroupPowers.ReceiveNotices | 120 | | GroupPowers.ReceiveNotices |
121 | | GroupPowers.RemoveMember | 121 | | GroupPowers.RemoveMember |
122 | | GroupPowers.ReturnGroupOwned | 122 | | GroupPowers.ReturnGroupOwned |
123 | | GroupPowers.ReturnGroupSet | 123 | | GroupPowers.ReturnGroupSet |
124 | | GroupPowers.ReturnNonGroup | 124 | | GroupPowers.ReturnNonGroup |
125 | | GroupPowers.RoleProperties | 125 | | GroupPowers.RoleProperties |
126 | | GroupPowers.SendNotices | 126 | | GroupPowers.SendNotices |
127 | | GroupPowers.SetLandingPoint | 127 | | GroupPowers.SetLandingPoint |
128 | | GroupPowers.StartProposal | 128 | | GroupPowers.StartProposal |
129 | | GroupPowers.VoteOnProposal; | 129 | | GroupPowers.VoteOnProposal; |
130 | param["OwnersPowers"] = ((ulong)OwnerPowers).ToString(); | 130 | param["OwnersPowers"] = ((ulong)OwnerPowers).ToString(); |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | IList parameters = new ArrayList(); | 134 | IList parameters = new ArrayList(); |
135 | parameters.Add(param); | 135 | parameters.Add(param); |
136 | XmlRpcRequest req = new XmlRpcRequest("groups.createGroup", parameters); | 136 | XmlRpcRequest req = new XmlRpcRequest("groups.createGroup", parameters); |
137 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 137 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
138 | Hashtable respData = (Hashtable)resp.Value; | 138 | Hashtable respData = (Hashtable)resp.Value; |
139 | 139 | ||
140 | if (respData.Contains("error")) | 140 | if (respData.Contains("error")) |
141 | { | 141 | { |
142 | LogRespDataToConsoleError(respData); | 142 | LogRespDataToConsoleError(respData); |
143 | } | 143 | } |
144 | 144 | ||
145 | return UUID.Parse((string)respData["GroupID"]); | 145 | return UUID.Parse((string)respData["GroupID"]); |
146 | } | 146 | } |
147 | 147 | ||
148 | public void UpdateGroup(UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) | 148 | public void UpdateGroup(UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) |
149 | { | 149 | { |
150 | Hashtable param = new Hashtable(); | 150 | Hashtable param = new Hashtable(); |
151 | param["GroupID"] = groupID.ToString(); | 151 | param["GroupID"] = groupID.ToString(); |
152 | param["Charter"] = charter; | 152 | param["Charter"] = charter; |
153 | param["ShowInList"] = showInList == true ? 1 : 0; | 153 | param["ShowInList"] = showInList == true ? 1 : 0; |
154 | param["InsigniaID"] = insigniaID.ToString(); | 154 | param["InsigniaID"] = insigniaID.ToString(); |
155 | param["MembershipFee"] = membershipFee; | 155 | param["MembershipFee"] = membershipFee; |
156 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; | 156 | param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; |
157 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 157 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
158 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 158 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
159 | 159 | ||
160 | IList parameters = new ArrayList(); | 160 | IList parameters = new ArrayList(); |
161 | parameters.Add(param); | 161 | parameters.Add(param); |
162 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroup", parameters); | 162 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroup", parameters); |
163 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 163 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
164 | Hashtable respData = (Hashtable)resp.Value; | 164 | Hashtable respData = (Hashtable)resp.Value; |
165 | 165 | ||
166 | if (respData.Contains("error")) | 166 | if (respData.Contains("error")) |
167 | { | 167 | { |
168 | LogRespDataToConsoleError(respData); | 168 | LogRespDataToConsoleError(respData); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | public void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) | 172 | public void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) |
173 | { | 173 | { |
174 | Hashtable param = new Hashtable(); | 174 | Hashtable param = new Hashtable(); |
175 | param["GroupID"] = groupID.ToString(); | 175 | param["GroupID"] = groupID.ToString(); |
176 | param["RoleID"] = roleID.ToString(); | 176 | param["RoleID"] = roleID.ToString(); |
177 | param["Name"] = name; | 177 | param["Name"] = name; |
178 | param["Description"] = description; | 178 | param["Description"] = description; |
179 | param["Title"] = title; | 179 | param["Title"] = title; |
180 | param["Powers"] = powers.ToString(); | 180 | param["Powers"] = powers.ToString(); |
181 | 181 | ||
182 | IList parameters = new ArrayList(); | 182 | IList parameters = new ArrayList(); |
183 | parameters.Add(param); | 183 | parameters.Add(param); |
184 | XmlRpcRequest req = new XmlRpcRequest("groups.addRoleToGroup", parameters); | 184 | XmlRpcRequest req = new XmlRpcRequest("groups.addRoleToGroup", parameters); |
185 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 185 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
186 | Hashtable respData = (Hashtable)resp.Value; | 186 | Hashtable respData = (Hashtable)resp.Value; |
187 | 187 | ||
188 | if (respData.Contains("error")) | 188 | if (respData.Contains("error")) |
189 | { | 189 | { |
190 | LogRespDataToConsoleError(respData); | 190 | LogRespDataToConsoleError(respData); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | public void RemoveGroupRole(UUID groupID, UUID roleID) | 194 | public void RemoveGroupRole(UUID groupID, UUID roleID) |
195 | { | 195 | { |
196 | Hashtable param = new Hashtable(); | 196 | Hashtable param = new Hashtable(); |
197 | param["GroupID"] = groupID.ToString(); | 197 | param["GroupID"] = groupID.ToString(); |
198 | param["RoleID"] = roleID.ToString(); | 198 | param["RoleID"] = roleID.ToString(); |
199 | 199 | ||
200 | IList parameters = new ArrayList(); | 200 | IList parameters = new ArrayList(); |
201 | parameters.Add(param); | 201 | parameters.Add(param); |
202 | XmlRpcRequest req = new XmlRpcRequest("groups.removeRoleFromGroup", parameters); | 202 | XmlRpcRequest req = new XmlRpcRequest("groups.removeRoleFromGroup", parameters); |
203 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 203 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
204 | Hashtable respData = (Hashtable)resp.Value; | 204 | Hashtable respData = (Hashtable)resp.Value; |
205 | 205 | ||
206 | if (respData.Contains("error")) | 206 | if (respData.Contains("error")) |
207 | { | 207 | { |
208 | LogRespDataToConsoleError(respData); | 208 | LogRespDataToConsoleError(respData); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | public void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) | 212 | public void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers) |
213 | { | 213 | { |
214 | Hashtable param = new Hashtable(); | 214 | Hashtable param = new Hashtable(); |
215 | param["GroupID"] = groupID.ToString(); | 215 | param["GroupID"] = groupID.ToString(); |
216 | param["RoleID"] = roleID.ToString(); | 216 | param["RoleID"] = roleID.ToString(); |
217 | if (name != null) | 217 | if (name != null) |
218 | { | 218 | { |
219 | param["Name"] = name; | 219 | param["Name"] = name; |
220 | } | 220 | } |
221 | if (description != null) | 221 | if (description != null) |
222 | { | 222 | { |
223 | param["Description"] = description; | 223 | param["Description"] = description; |
224 | } | 224 | } |
225 | if (title != null) | 225 | if (title != null) |
226 | { | 226 | { |
227 | param["Title"] = title; | 227 | param["Title"] = title; |
228 | } | 228 | } |
229 | param["Powers"] = powers.ToString(); | 229 | param["Powers"] = powers.ToString(); |
230 | 230 | ||
231 | IList parameters = new ArrayList(); | 231 | IList parameters = new ArrayList(); |
232 | parameters.Add(param); | 232 | parameters.Add(param); |
233 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroupRole", parameters); | 233 | XmlRpcRequest req = new XmlRpcRequest("groups.updateGroupRole", parameters); |
234 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 234 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
235 | Hashtable respData = (Hashtable)resp.Value; | 235 | Hashtable respData = (Hashtable)resp.Value; |
236 | 236 | ||
237 | if (respData.Contains("error")) | 237 | if (respData.Contains("error")) |
238 | { | 238 | { |
239 | LogRespDataToConsoleError(respData); | 239 | LogRespDataToConsoleError(respData); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | public GroupRecord GetGroupRecord(UUID GroupID, string GroupName) | 243 | public GroupRecord GetGroupRecord(UUID GroupID, string GroupName) |
244 | { | 244 | { |
245 | Hashtable param = new Hashtable(); | 245 | Hashtable param = new Hashtable(); |
246 | if ((GroupID != null) && (GroupID != UUID.Zero)) | 246 | if ((GroupID != null) && (GroupID != UUID.Zero)) |
247 | { | 247 | { |
248 | param["GroupID"] = GroupID.ToString(); | 248 | param["GroupID"] = GroupID.ToString(); |
249 | } | 249 | } |
250 | if ((GroupName != null) && (GroupName != string.Empty)) | 250 | if ((GroupName != null) && (GroupName != string.Empty)) |
251 | { | 251 | { |
252 | param["Name"] = GroupName.ToString(); | 252 | param["Name"] = GroupName.ToString(); |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | IList parameters = new ArrayList(); | 256 | IList parameters = new ArrayList(); |
257 | parameters.Add(param); | 257 | parameters.Add(param); |
258 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); | 258 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); |
259 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 259 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
260 | Hashtable respData = (Hashtable)resp.Value; | 260 | Hashtable respData = (Hashtable)resp.Value; |
261 | 261 | ||
262 | if (respData.Contains("error")) | 262 | if (respData.Contains("error")) |
263 | { | 263 | { |
264 | if ((string)respData["error"] != "Group Not Found") | 264 | if ((string)respData["error"] != "Group Not Found") |
265 | { | 265 | { |
266 | LogRespDataToConsoleError(respData); | 266 | LogRespDataToConsoleError(respData); |
267 | } | 267 | } |
268 | return null; | 268 | return null; |
269 | } | 269 | } |
270 | 270 | ||
271 | return GroupProfileHashtableToGroupRecord(respData); | 271 | return GroupProfileHashtableToGroupRecord(respData); |
272 | 272 | ||
273 | } | 273 | } |
274 | 274 | ||
275 | public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID) | 275 | public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID) |
276 | { | 276 | { |
277 | Hashtable param = new Hashtable(); | 277 | Hashtable param = new Hashtable(); |
278 | param["GroupID"] = GroupID.ToString(); | 278 | param["GroupID"] = GroupID.ToString(); |
279 | 279 | ||
280 | 280 | ||
281 | IList parameters = new ArrayList(); | 281 | IList parameters = new ArrayList(); |
282 | parameters.Add(param); | 282 | parameters.Add(param); |
283 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); | 283 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroup", parameters); |
284 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 284 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
285 | Hashtable respData = (Hashtable)resp.Value; | 285 | Hashtable respData = (Hashtable)resp.Value; |
286 | 286 | ||
287 | if (respData.Contains("error")) | 287 | if (respData.Contains("error")) |
288 | { | 288 | { |
289 | if ((string)respData["error"] != "Group Not Found") | 289 | if ((string)respData["error"] != "Group Not Found") |
290 | { | 290 | { |
291 | LogRespDataToConsoleError(respData); | 291 | LogRespDataToConsoleError(respData); |
292 | } | 292 | } |
293 | return new GroupProfileData(); | 293 | return new GroupProfileData(); |
294 | } | 294 | } |
295 | 295 | ||
296 | GroupMembershipData MemberInfo = GetAgentGroupMembership(AgentID, GroupID); | 296 | GroupMembershipData MemberInfo = GetAgentGroupMembership(AgentID, GroupID); |
297 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 297 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
298 | 298 | ||
299 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 299 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
300 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 300 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; |
301 | 301 | ||
302 | return MemberGroupProfile; | 302 | return MemberGroupProfile; |
303 | 303 | ||
304 | } | 304 | } |
305 | 305 | ||
306 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) | 306 | private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile) |
307 | { | 307 | { |
308 | GroupProfileData group = new GroupProfileData(); | 308 | GroupProfileData group = new GroupProfileData(); |
309 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 309 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
310 | group.Name = (string)groupProfile["Name"]; | 310 | group.Name = (string)groupProfile["Name"]; |
311 | 311 | ||
312 | if (groupProfile["Charter"] != null) | 312 | if (groupProfile["Charter"] != null) |
313 | { | 313 | { |
314 | group.Charter = (string)groupProfile["Charter"]; | 314 | group.Charter = (string)groupProfile["Charter"]; |
315 | } | 315 | } |
316 | 316 | ||
317 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | 317 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; |
318 | group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); | 318 | group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]); |
319 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | 319 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); |
320 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | 320 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; |
321 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | 321 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; |
322 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | 322 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; |
323 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | 323 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); |
324 | group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); | 324 | group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]); |
325 | 325 | ||
326 | group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); | 326 | group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]); |
327 | group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); | 327 | group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]); |
328 | 328 | ||
329 | return group; | 329 | return group; |
330 | } | 330 | } |
331 | 331 | ||
332 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | 332 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) |
333 | { | 333 | { |
334 | 334 | ||
335 | GroupRecord group = new GroupRecord(); | 335 | GroupRecord group = new GroupRecord(); |
336 | m_log.Debug("GroupID"); | 336 | m_log.Debug("GroupID"); |
337 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 337 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
338 | 338 | ||
339 | m_log.Debug("Name"); | 339 | m_log.Debug("Name"); |
340 | group.GroupName = groupProfile["Name"].ToString(); | 340 | group.GroupName = groupProfile["Name"].ToString(); |
341 | 341 | ||
342 | m_log.Debug("Charter"); | 342 | m_log.Debug("Charter"); |
343 | if (groupProfile["Charter"] != null) | 343 | if (groupProfile["Charter"] != null) |
344 | { | 344 | { |
345 | group.Charter = (string)groupProfile["Charter"]; | 345 | group.Charter = (string)groupProfile["Charter"]; |
346 | } | 346 | } |
347 | 347 | ||
348 | m_log.Debug("ShowInList"); | 348 | m_log.Debug("ShowInList"); |
349 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; | 349 | group.ShowInList = ((string)groupProfile["ShowInList"]) == "1"; |
350 | 350 | ||
351 | m_log.Debug("InsigniaID"); | 351 | m_log.Debug("InsigniaID"); |
352 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); | 352 | group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]); |
353 | 353 | ||
354 | m_log.Debug("MembershipFee"); | 354 | m_log.Debug("MembershipFee"); |
355 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); | 355 | group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]); |
356 | 356 | ||
357 | m_log.Debug("OpenEnrollment"); | 357 | m_log.Debug("OpenEnrollment"); |
358 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; | 358 | group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1"; |
359 | 359 | ||
360 | m_log.Debug("AllowPublish"); | 360 | m_log.Debug("AllowPublish"); |
361 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; | 361 | group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1"; |
362 | 362 | ||
363 | m_log.Debug("MaturePublish"); | 363 | m_log.Debug("MaturePublish"); |
364 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; | 364 | group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1"; |
365 | 365 | ||
366 | m_log.Debug("FounderID"); | 366 | m_log.Debug("FounderID"); |
367 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); | 367 | group.FounderID = UUID.Parse((string)groupProfile["FounderID"]); |
368 | 368 | ||
369 | m_log.Debug("OwnerRoleID"); | 369 | m_log.Debug("OwnerRoleID"); |
370 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); | 370 | group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]); |
371 | 371 | ||
372 | return group; | 372 | return group; |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
376 | public void SetAgentActiveGroup(UUID AgentID, UUID GroupID) | 376 | public void SetAgentActiveGroup(UUID AgentID, UUID GroupID) |
377 | { | 377 | { |
378 | Hashtable param = new Hashtable(); | 378 | Hashtable param = new Hashtable(); |
379 | param["AgentID"] = AgentID.ToString(); | 379 | param["AgentID"] = AgentID.ToString(); |
380 | param["GroupID"] = GroupID.ToString(); | 380 | param["GroupID"] = GroupID.ToString(); |
381 | 381 | ||
382 | IList parameters = new ArrayList(); | 382 | IList parameters = new ArrayList(); |
383 | parameters.Add(param); | 383 | parameters.Add(param); |
384 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentActiveGroup", parameters); | 384 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentActiveGroup", parameters); |
385 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 385 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
386 | Hashtable respData = (Hashtable)resp.Value; | 386 | Hashtable respData = (Hashtable)resp.Value; |
387 | 387 | ||
388 | if (respData.Contains("error")) | 388 | if (respData.Contains("error")) |
389 | { | 389 | { |
390 | LogRespDataToConsoleError(respData); | 390 | LogRespDataToConsoleError(respData); |
391 | } | 391 | } |
392 | 392 | ||
393 | } | 393 | } |
394 | 394 | ||
395 | public void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 395 | public void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
396 | { | 396 | { |
397 | Hashtable param = new Hashtable(); | 397 | Hashtable param = new Hashtable(); |
398 | param["AgentID"] = AgentID.ToString(); | 398 | param["AgentID"] = AgentID.ToString(); |
399 | param["GroupID"] = GroupID.ToString(); | 399 | param["GroupID"] = GroupID.ToString(); |
400 | param["SelectedRoleID"] = RoleID.ToString(); | 400 | param["SelectedRoleID"] = RoleID.ToString(); |
401 | 401 | ||
402 | IList parameters = new ArrayList(); | 402 | IList parameters = new ArrayList(); |
403 | parameters.Add(param); | 403 | parameters.Add(param); |
404 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); | 404 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); |
405 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 405 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
406 | Hashtable respData = (Hashtable)resp.Value; | 406 | Hashtable respData = (Hashtable)resp.Value; |
407 | 407 | ||
408 | if (respData.Contains("error")) | 408 | if (respData.Contains("error")) |
409 | { | 409 | { |
410 | LogRespDataToConsoleError(respData); | 410 | LogRespDataToConsoleError(respData); |
411 | } | 411 | } |
412 | 412 | ||
413 | } | 413 | } |
414 | 414 | ||
415 | public void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 415 | public void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
416 | { | 416 | { |
417 | Hashtable param = new Hashtable(); | 417 | Hashtable param = new Hashtable(); |
418 | param["AgentID"] = AgentID.ToString(); | 418 | param["AgentID"] = AgentID.ToString(); |
419 | param["GroupID"] = GroupID.ToString(); | 419 | param["GroupID"] = GroupID.ToString(); |
420 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 420 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
421 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 421 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
422 | 422 | ||
423 | IList parameters = new ArrayList(); | 423 | IList parameters = new ArrayList(); |
424 | parameters.Add(param); | 424 | parameters.Add(param); |
425 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); | 425 | XmlRpcRequest req = new XmlRpcRequest("groups.setAgentGroupInfo", parameters); |
426 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 426 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
427 | Hashtable respData = (Hashtable)resp.Value; | 427 | Hashtable respData = (Hashtable)resp.Value; |
428 | 428 | ||
429 | if (respData.Contains("error")) | 429 | if (respData.Contains("error")) |
430 | { | 430 | { |
431 | LogRespDataToConsoleError(respData); | 431 | LogRespDataToConsoleError(respData); |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 435 | public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
436 | { | 436 | { |
437 | Hashtable param = new Hashtable(); | 437 | Hashtable param = new Hashtable(); |
438 | param["InviteID"] = inviteID.ToString(); | 438 | param["InviteID"] = inviteID.ToString(); |
439 | param["AgentID"] = agentID.ToString(); | 439 | param["AgentID"] = agentID.ToString(); |
440 | param["RoleID"] = roleID.ToString(); | 440 | param["RoleID"] = roleID.ToString(); |
441 | param["GroupID"] = groupID.ToString(); | 441 | param["GroupID"] = groupID.ToString(); |
442 | 442 | ||
443 | IList parameters = new ArrayList(); | 443 | IList parameters = new ArrayList(); |
444 | parameters.Add(param); | 444 | parameters.Add(param); |
445 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupInvite", parameters); | 445 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupInvite", parameters); |
446 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 446 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
447 | Hashtable respData = (Hashtable)resp.Value; | 447 | Hashtable respData = (Hashtable)resp.Value; |
448 | 448 | ||
449 | if (respData.Contains("error")) | 449 | if (respData.Contains("error")) |
450 | { | 450 | { |
451 | if (respData["error"] != "Duplicate group invite requested") | 451 | if (respData["error"] != "Duplicate group invite requested") |
452 | { | 452 | { |
453 | LogRespDataToConsoleError(respData); | 453 | LogRespDataToConsoleError(respData); |
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | } | 458 | } |
459 | 459 | ||
460 | public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID) | 460 | public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID) |
461 | { | 461 | { |
462 | Hashtable param = new Hashtable(); | 462 | Hashtable param = new Hashtable(); |
463 | param["InviteID"] = inviteID.ToString(); | 463 | param["InviteID"] = inviteID.ToString(); |
464 | 464 | ||
465 | IList parameters = new ArrayList(); | 465 | IList parameters = new ArrayList(); |
466 | parameters.Add(param); | 466 | parameters.Add(param); |
467 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentToGroupInvite", parameters); | 467 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentToGroupInvite", parameters); |
468 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 468 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
469 | Hashtable respData = (Hashtable)resp.Value; | 469 | Hashtable respData = (Hashtable)resp.Value; |
470 | 470 | ||
471 | 471 | ||
472 | if (respData.Contains("error")) | 472 | if (respData.Contains("error")) |
473 | { | 473 | { |
474 | LogRespDataToConsoleError(respData); | 474 | LogRespDataToConsoleError(respData); |
475 | 475 | ||
476 | return null; | 476 | return null; |
477 | } | 477 | } |
478 | 478 | ||
479 | GroupInviteInfo inviteInfo = new GroupInviteInfo(); | 479 | GroupInviteInfo inviteInfo = new GroupInviteInfo(); |
480 | inviteInfo.InviteID = inviteID; | 480 | inviteInfo.InviteID = inviteID; |
481 | inviteInfo.GroupID = UUID.Parse((string)respData["GroupID"]); | 481 | inviteInfo.GroupID = UUID.Parse((string)respData["GroupID"]); |
482 | inviteInfo.RoleID = UUID.Parse((string)respData["RoleID"]); | 482 | inviteInfo.RoleID = UUID.Parse((string)respData["RoleID"]); |
483 | inviteInfo.AgentID = UUID.Parse((string)respData["AgentID"]); | 483 | inviteInfo.AgentID = UUID.Parse((string)respData["AgentID"]); |
484 | 484 | ||
485 | return inviteInfo; | 485 | return inviteInfo; |
486 | } | 486 | } |
487 | 487 | ||
488 | public void RemoveAgentToGroupInvite(UUID inviteID) | 488 | public void RemoveAgentToGroupInvite(UUID inviteID) |
489 | { | 489 | { |
490 | Hashtable param = new Hashtable(); | 490 | Hashtable param = new Hashtable(); |
491 | param["InviteID"] = inviteID.ToString(); | 491 | param["InviteID"] = inviteID.ToString(); |
492 | 492 | ||
493 | IList parameters = new ArrayList(); | 493 | IList parameters = new ArrayList(); |
494 | parameters.Add(param); | 494 | parameters.Add(param); |
495 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentToGroupInvite", parameters); | 495 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentToGroupInvite", parameters); |
496 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 496 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
497 | Hashtable respData = (Hashtable)resp.Value; | 497 | Hashtable respData = (Hashtable)resp.Value; |
498 | 498 | ||
499 | if (respData.Contains("error")) | 499 | if (respData.Contains("error")) |
500 | { | 500 | { |
501 | LogRespDataToConsoleError(respData); | 501 | LogRespDataToConsoleError(respData); |
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
505 | public void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID) | 505 | public void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID) |
506 | { | 506 | { |
507 | Hashtable param = new Hashtable(); | 507 | Hashtable param = new Hashtable(); |
508 | param["AgentID"] = AgentID.ToString(); | 508 | param["AgentID"] = AgentID.ToString(); |
509 | param["GroupID"] = GroupID.ToString(); | 509 | param["GroupID"] = GroupID.ToString(); |
510 | param["RoleID"] = RoleID.ToString(); | 510 | param["RoleID"] = RoleID.ToString(); |
511 | 511 | ||
512 | IList parameters = new ArrayList(); | 512 | IList parameters = new ArrayList(); |
513 | parameters.Add(param); | 513 | parameters.Add(param); |
514 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroup", parameters); | 514 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroup", parameters); |
515 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 515 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
516 | Hashtable respData = (Hashtable)resp.Value; | 516 | Hashtable respData = (Hashtable)resp.Value; |
517 | 517 | ||
518 | if (respData.Contains("error")) | 518 | if (respData.Contains("error")) |
519 | { | 519 | { |
520 | LogRespDataToConsoleError(respData); | 520 | LogRespDataToConsoleError(respData); |
521 | } | 521 | } |
522 | } | 522 | } |
523 | 523 | ||
524 | public void RemoveAgentFromGroup(UUID AgentID, UUID GroupID) | 524 | public void RemoveAgentFromGroup(UUID AgentID, UUID GroupID) |
525 | { | 525 | { |
526 | Hashtable param = new Hashtable(); | 526 | Hashtable param = new Hashtable(); |
527 | param["AgentID"] = AgentID.ToString(); | 527 | param["AgentID"] = AgentID.ToString(); |
528 | param["GroupID"] = GroupID.ToString(); | 528 | param["GroupID"] = GroupID.ToString(); |
529 | 529 | ||
530 | IList parameters = new ArrayList(); | 530 | IList parameters = new ArrayList(); |
531 | parameters.Add(param); | 531 | parameters.Add(param); |
532 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroup", parameters); | 532 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroup", parameters); |
533 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 533 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
534 | Hashtable respData = (Hashtable)resp.Value; | 534 | Hashtable respData = (Hashtable)resp.Value; |
535 | 535 | ||
536 | if (respData.Contains("error")) | 536 | if (respData.Contains("error")) |
537 | { | 537 | { |
538 | LogRespDataToConsoleError(respData); | 538 | LogRespDataToConsoleError(respData); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | 541 | ||
542 | public void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 542 | public void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
543 | { | 543 | { |
544 | Hashtable param = new Hashtable(); | 544 | Hashtable param = new Hashtable(); |
545 | param["AgentID"] = AgentID.ToString(); | 545 | param["AgentID"] = AgentID.ToString(); |
546 | param["GroupID"] = GroupID.ToString(); | 546 | param["GroupID"] = GroupID.ToString(); |
547 | param["RoleID"] = RoleID.ToString(); | 547 | param["RoleID"] = RoleID.ToString(); |
548 | 548 | ||
549 | IList parameters = new ArrayList(); | 549 | IList parameters = new ArrayList(); |
550 | parameters.Add(param); | 550 | parameters.Add(param); |
551 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupRole", parameters); | 551 | XmlRpcRequest req = new XmlRpcRequest("groups.addAgentToGroupRole", parameters); |
552 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 552 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
553 | Hashtable respData = (Hashtable)resp.Value; | 553 | Hashtable respData = (Hashtable)resp.Value; |
554 | 554 | ||
555 | if (respData.Contains("error")) | 555 | if (respData.Contains("error")) |
556 | { | 556 | { |
557 | LogRespDataToConsoleError(respData); | 557 | LogRespDataToConsoleError(respData); |
558 | } | 558 | } |
559 | } | 559 | } |
560 | 560 | ||
561 | public void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) | 561 | public void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID) |
562 | { | 562 | { |
563 | Hashtable param = new Hashtable(); | 563 | Hashtable param = new Hashtable(); |
564 | param["AgentID"] = AgentID.ToString(); | 564 | param["AgentID"] = AgentID.ToString(); |
565 | param["GroupID"] = GroupID.ToString(); | 565 | param["GroupID"] = GroupID.ToString(); |
566 | param["RoleID"] = RoleID.ToString(); | 566 | param["RoleID"] = RoleID.ToString(); |
567 | 567 | ||
568 | IList parameters = new ArrayList(); | 568 | IList parameters = new ArrayList(); |
569 | parameters.Add(param); | 569 | parameters.Add(param); |
570 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroupRole", parameters); | 570 | XmlRpcRequest req = new XmlRpcRequest("groups.removeAgentFromGroupRole", parameters); |
571 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); | 571 | XmlRpcResponse resp = req.Send(m_serviceURL, 3000); |
572 | Hashtable respData = (Hashtable)resp.Value; | 572 | Hashtable respData = (Hashtable)resp.Value; |
573 | 573 | ||
574 | if (respData.Contains("error")) | 574 | if (respData.Contains("error")) |
575 | { | 575 | { |
576 | LogRespDataToConsoleError(respData); | 576 | LogRespDataToConsoleError(respData); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | 580 | ||
581 | public List<DirGroupsReplyData> FindGroups(string search) | 581 | public List<DirGroupsReplyData> FindGroups(string search) |
582 | { | 582 | { |
583 | Hashtable param = new Hashtable(); | 583 | Hashtable param = new Hashtable(); |
584 | param["Search"] = search; | 584 | param["Search"] = search; |
585 | 585 | ||
586 | IList parameters = new ArrayList(); | 586 | IList parameters = new ArrayList(); |
587 | parameters.Add(param); | 587 | parameters.Add(param); |
588 | XmlRpcRequest req = new XmlRpcRequest("groups.findGroups", parameters); | 588 | XmlRpcRequest req = new XmlRpcRequest("groups.findGroups", parameters); |
589 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 589 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
590 | Hashtable respData = (Hashtable)resp.Value; | 590 | Hashtable respData = (Hashtable)resp.Value; |
591 | 591 | ||
592 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 592 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
593 | 593 | ||
594 | if (respData.Contains("error")) | 594 | if (respData.Contains("error")) |
595 | { | 595 | { |
596 | if (respData["error"].ToString() != "No groups found.") | 596 | if (respData["error"].ToString() != "No groups found.") |
597 | { | 597 | { |
598 | LogRespDataToConsoleError(respData); | 598 | LogRespDataToConsoleError(respData); |
599 | } | 599 | } |
600 | } | 600 | } |
601 | else | 601 | else |
602 | { | 602 | { |
603 | Hashtable results = (Hashtable)respData["results"]; | 603 | Hashtable results = (Hashtable)respData["results"]; |
604 | foreach (Hashtable groupFind in results.Values) | 604 | foreach (Hashtable groupFind in results.Values) |
605 | { | 605 | { |
606 | DirGroupsReplyData data = new DirGroupsReplyData(); | 606 | DirGroupsReplyData data = new DirGroupsReplyData(); |
607 | data.groupID = new UUID((string)groupFind["GroupID"]); ; | 607 | data.groupID = new UUID((string)groupFind["GroupID"]); ; |
608 | data.groupName = (string)groupFind["Name"]; | 608 | data.groupName = (string)groupFind["Name"]; |
609 | data.members = int.Parse((string)groupFind["Members"]); | 609 | data.members = int.Parse((string)groupFind["Members"]); |
610 | // data.searchOrder = order; | 610 | // data.searchOrder = order; |
611 | 611 | ||
612 | findings.Add(data); | 612 | findings.Add(data); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | return findings; | 616 | return findings; |
617 | } | 617 | } |
618 | 618 | ||
619 | public GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID) | 619 | public GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID) |
620 | { | 620 | { |
621 | Hashtable param = new Hashtable(); | 621 | Hashtable param = new Hashtable(); |
622 | param["AgentID"] = AgentID.ToString(); | 622 | param["AgentID"] = AgentID.ToString(); |
623 | param["GroupID"] = GroupID.ToString(); | 623 | param["GroupID"] = GroupID.ToString(); |
624 | 624 | ||
625 | IList parameters = new ArrayList(); | 625 | IList parameters = new ArrayList(); |
626 | parameters.Add(param); | 626 | parameters.Add(param); |
627 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMembership", parameters); | 627 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMembership", parameters); |
628 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 628 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
629 | Hashtable respData = (Hashtable)resp.Value; | 629 | Hashtable respData = (Hashtable)resp.Value; |
630 | 630 | ||
631 | if (respData.Contains("error")) | 631 | if (respData.Contains("error")) |
632 | { | 632 | { |
633 | if ((string)respData["error"] != "None Found") | 633 | if ((string)respData["error"] != "None Found") |
634 | { | 634 | { |
635 | LogRespDataToConsoleError(respData); | 635 | LogRespDataToConsoleError(respData); |
636 | } | 636 | } |
637 | return null; | 637 | return null; |
638 | } | 638 | } |
639 | 639 | ||
640 | GroupMembershipData data = HashTableToGroupMembershipData(respData); | 640 | GroupMembershipData data = HashTableToGroupMembershipData(respData); |
641 | 641 | ||
642 | return data; | 642 | return data; |
643 | } | 643 | } |
644 | 644 | ||
645 | public GroupMembershipData GetAgentActiveMembership(UUID AgentID) | 645 | public GroupMembershipData GetAgentActiveMembership(UUID AgentID) |
646 | { | 646 | { |
647 | Hashtable param = new Hashtable(); | 647 | Hashtable param = new Hashtable(); |
648 | param["AgentID"] = AgentID.ToString(); | 648 | param["AgentID"] = AgentID.ToString(); |
649 | 649 | ||
650 | IList parameters = new ArrayList(); | 650 | IList parameters = new ArrayList(); |
651 | parameters.Add(param); | 651 | parameters.Add(param); |
652 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentActiveMembership", parameters); | 652 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentActiveMembership", parameters); |
653 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 653 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
654 | Hashtable respData = (Hashtable)resp.Value; | 654 | Hashtable respData = (Hashtable)resp.Value; |
655 | 655 | ||
656 | if (respData.Contains("error")) | 656 | if (respData.Contains("error")) |
657 | { | 657 | { |
658 | if (respData["error"].ToString() == "No Active Group Specified") | 658 | if (respData["error"].ToString() == "No Active Group Specified") |
659 | { | 659 | { |
660 | return null; | 660 | return null; |
661 | } | 661 | } |
662 | LogRespDataToConsoleError(respData); | 662 | LogRespDataToConsoleError(respData); |
663 | return null; | 663 | return null; |
664 | } | 664 | } |
665 | 665 | ||
666 | try | 666 | try |
667 | { | 667 | { |
668 | GroupMembershipData data = HashTableToGroupMembershipData(respData); | 668 | GroupMembershipData data = HashTableToGroupMembershipData(respData); |
669 | return data; | 669 | return data; |
670 | } | 670 | } |
671 | catch (System.Exception e) | 671 | catch (System.Exception e) |
672 | { | 672 | { |
673 | LogRespDataToConsoleError(respData); | 673 | LogRespDataToConsoleError(respData); |
674 | throw e; | 674 | throw e; |
675 | } | 675 | } |
676 | } | 676 | } |
677 | 677 | ||
678 | private void LogRespDataToConsoleError(Hashtable respData) | 678 | private void LogRespDataToConsoleError(Hashtable respData) |
679 | { | 679 | { |
680 | m_log.Error("[GROUPDATA] Error:"); | 680 | m_log.Error("[GROUPDATA] Error:"); |
681 | 681 | ||
682 | foreach (string key in respData.Keys) | 682 | foreach (string key in respData.Keys) |
683 | { | 683 | { |
684 | m_log.ErrorFormat("[GROUPDATA] Key: {0}", key); | 684 | m_log.ErrorFormat("[GROUPDATA] Key: {0}", key); |
685 | 685 | ||
686 | object o = respData[key]; | 686 | object o = respData[key]; |
687 | 687 | ||
688 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); | 688 | string[] lines = respData[key].ToString().Split(new char[] { '\n' }); |
689 | foreach (string line in lines) | 689 | foreach (string line in lines) |
690 | { | 690 | { |
691 | m_log.ErrorFormat("[GROUPDATA] {0}", line); | 691 | m_log.ErrorFormat("[GROUPDATA] {0}", line); |
692 | } | 692 | } |
693 | 693 | ||
694 | } | 694 | } |
695 | } | 695 | } |
696 | 696 | ||
697 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID) | 697 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID) |
698 | { | 698 | { |
699 | Hashtable param = new Hashtable(); | 699 | Hashtable param = new Hashtable(); |
700 | param["AgentID"] = AgentID.ToString(); | 700 | param["AgentID"] = AgentID.ToString(); |
701 | 701 | ||
702 | IList parameters = new ArrayList(); | 702 | IList parameters = new ArrayList(); |
703 | parameters.Add(param); | 703 | parameters.Add(param); |
704 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMemberships", parameters); | 704 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentGroupMemberships", parameters); |
705 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 705 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
706 | Hashtable respData = (Hashtable)resp.Value; | 706 | Hashtable respData = (Hashtable)resp.Value; |
707 | 707 | ||
708 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 708 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
709 | 709 | ||
710 | if (respData.Contains("error")) | 710 | if (respData.Contains("error")) |
711 | { | 711 | { |
712 | if (respData["error"].ToString() != "No Memberships") | 712 | if (respData["error"].ToString() != "No Memberships") |
713 | { | 713 | { |
714 | LogRespDataToConsoleError(respData); | 714 | LogRespDataToConsoleError(respData); |
715 | } | 715 | } |
716 | } | 716 | } |
717 | else | 717 | else |
718 | { | 718 | { |
719 | foreach (object membership in respData.Values) | 719 | foreach (object membership in respData.Values) |
720 | { | 720 | { |
721 | memberships.Add(HashTableToGroupMembershipData((Hashtable)membership)); | 721 | memberships.Add(HashTableToGroupMembershipData((Hashtable)membership)); |
722 | } | 722 | } |
723 | } | 723 | } |
724 | return memberships; | 724 | return memberships; |
725 | } | 725 | } |
726 | 726 | ||
727 | public List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID) | 727 | public List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID) |
728 | { | 728 | { |
729 | Hashtable param = new Hashtable(); | 729 | Hashtable param = new Hashtable(); |
730 | param["AgentID"] = AgentID.ToString(); | 730 | param["AgentID"] = AgentID.ToString(); |
731 | param["GroupID"] = GroupID.ToString(); | 731 | param["GroupID"] = GroupID.ToString(); |
732 | 732 | ||
733 | IList parameters = new ArrayList(); | 733 | IList parameters = new ArrayList(); |
734 | parameters.Add(param); | 734 | parameters.Add(param); |
735 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentRoles", parameters); | 735 | XmlRpcRequest req = new XmlRpcRequest("groups.getAgentRoles", parameters); |
736 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 736 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
737 | Hashtable respData = (Hashtable)resp.Value; | 737 | Hashtable respData = (Hashtable)resp.Value; |
738 | 738 | ||
739 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 739 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
740 | 740 | ||
741 | if (respData.Contains("error")) | 741 | if (respData.Contains("error")) |
742 | { | 742 | { |
743 | if ((string)respData["error"] != "None found") | 743 | if ((string)respData["error"] != "None found") |
744 | { | 744 | { |
745 | LogRespDataToConsoleError(respData); | 745 | LogRespDataToConsoleError(respData); |
746 | } | 746 | } |
747 | return Roles; | 747 | return Roles; |
748 | } | 748 | } |
749 | 749 | ||
750 | foreach (Hashtable role in respData.Values) | 750 | foreach (Hashtable role in respData.Values) |
751 | { | 751 | { |
752 | GroupRolesData data = new GroupRolesData(); | 752 | GroupRolesData data = new GroupRolesData(); |
753 | data.RoleID = new UUID((string)role["RoleID"]); | 753 | data.RoleID = new UUID((string)role["RoleID"]); |
754 | data.Name = (string)role["Name"]; | 754 | data.Name = (string)role["Name"]; |
755 | data.Description = (string)role["Description"]; | 755 | data.Description = (string)role["Description"]; |
756 | data.Powers = ulong.Parse((string)role["Powers"]); | 756 | data.Powers = ulong.Parse((string)role["Powers"]); |
757 | data.Title = (string)role["Title"]; | 757 | data.Title = (string)role["Title"]; |
758 | 758 | ||
759 | Roles.Add(data); | 759 | Roles.Add(data); |
760 | } | 760 | } |
761 | 761 | ||
762 | return Roles; | 762 | return Roles; |
763 | 763 | ||
764 | 764 | ||
765 | } | 765 | } |
766 | 766 | ||
767 | public List<GroupRolesData> GetGroupRoles(UUID GroupID) | 767 | public List<GroupRolesData> GetGroupRoles(UUID GroupID) |
768 | { | 768 | { |
769 | Hashtable param = new Hashtable(); | 769 | Hashtable param = new Hashtable(); |
770 | param["GroupID"] = GroupID.ToString(); | 770 | param["GroupID"] = GroupID.ToString(); |
771 | 771 | ||
772 | IList parameters = new ArrayList(); | 772 | IList parameters = new ArrayList(); |
773 | parameters.Add(param); | 773 | parameters.Add(param); |
774 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoles", parameters); | 774 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoles", parameters); |
775 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 775 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
776 | Hashtable respData = (Hashtable)resp.Value; | 776 | Hashtable respData = (Hashtable)resp.Value; |
777 | 777 | ||
778 | if (respData.Contains("error")) | 778 | if (respData.Contains("error")) |
779 | { | 779 | { |
780 | LogRespDataToConsoleError(respData); | 780 | LogRespDataToConsoleError(respData); |
781 | return null; | 781 | return null; |
782 | } | 782 | } |
783 | 783 | ||
784 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 784 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
785 | foreach (Hashtable role in respData.Values) | 785 | foreach (Hashtable role in respData.Values) |
786 | { | 786 | { |
787 | GroupRolesData data = new GroupRolesData(); | 787 | GroupRolesData data = new GroupRolesData(); |
788 | data.Description = (string)role["Description"]; | 788 | data.Description = (string)role["Description"]; |
789 | data.Members = int.Parse((string)role["Members"]); | 789 | data.Members = int.Parse((string)role["Members"]); |
790 | data.Name = (string)role["Name"]; | 790 | data.Name = (string)role["Name"]; |
791 | data.Powers = ulong.Parse((string)role["Powers"]); | 791 | data.Powers = ulong.Parse((string)role["Powers"]); |
792 | data.RoleID = new UUID((string)role["RoleID"]); | 792 | data.RoleID = new UUID((string)role["RoleID"]); |
793 | data.Title = (string)role["Title"]; | 793 | data.Title = (string)role["Title"]; |
794 | 794 | ||
795 | Roles.Add(data); | 795 | Roles.Add(data); |
796 | } | 796 | } |
797 | 797 | ||
798 | return Roles; | 798 | return Roles; |
799 | 799 | ||
800 | } | 800 | } |
801 | 801 | ||
802 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | 802 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) |
803 | { | 803 | { |
804 | GroupMembershipData data = new GroupMembershipData(); | 804 | GroupMembershipData data = new GroupMembershipData(); |
805 | data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); | 805 | data.AcceptNotices = ((string)respData["AcceptNotices"] == "1"); |
806 | data.Contribution = int.Parse((string)respData["Contribution"]); | 806 | data.Contribution = int.Parse((string)respData["Contribution"]); |
807 | data.ListInProfile = ((string)respData["ListInProfile"] == "1"); | 807 | data.ListInProfile = ((string)respData["ListInProfile"] == "1"); |
808 | 808 | ||
809 | data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); | 809 | data.ActiveRole = new UUID((string)respData["SelectedRoleID"]); |
810 | data.GroupTitle = (string)respData["Title"]; | 810 | data.GroupTitle = (string)respData["Title"]; |
811 | 811 | ||
812 | data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); | 812 | data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]); |
813 | 813 | ||
814 | // Is this group the agent's active group | 814 | // Is this group the agent's active group |
815 | 815 | ||
816 | data.GroupID = new UUID((string)respData["GroupID"]); | 816 | data.GroupID = new UUID((string)respData["GroupID"]); |
817 | 817 | ||
818 | UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); | 818 | UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]); |
819 | data.Active = data.GroupID.Equals(ActiveGroup); | 819 | data.Active = data.GroupID.Equals(ActiveGroup); |
820 | 820 | ||
821 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); | 821 | data.AllowPublish = ((string)respData["AllowPublish"] == "1"); |
822 | data.Charter = (string)respData["Charter"]; | 822 | data.Charter = (string)respData["Charter"]; |
823 | data.FounderID = new UUID((string)respData["FounderID"]); | 823 | data.FounderID = new UUID((string)respData["FounderID"]); |
824 | data.GroupID = new UUID((string)respData["GroupID"]); | 824 | data.GroupID = new UUID((string)respData["GroupID"]); |
825 | data.GroupName = (string)respData["GroupName"]; | 825 | data.GroupName = (string)respData["GroupName"]; |
826 | data.GroupPicture = new UUID((string)respData["InsigniaID"]); | 826 | data.GroupPicture = new UUID((string)respData["InsigniaID"]); |
827 | data.MaturePublish = ((string)respData["MaturePublish"] == "1"); | 827 | data.MaturePublish = ((string)respData["MaturePublish"] == "1"); |
828 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | 828 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); |
829 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | 829 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); |
830 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | 830 | data.ShowInList = ((string)respData["ShowInList"] == "1"); |
831 | return data; | 831 | return data; |
832 | } | 832 | } |
833 | 833 | ||
834 | public List<GroupMembersData> GetGroupMembers(UUID GroupID) | 834 | public List<GroupMembersData> GetGroupMembers(UUID GroupID) |
835 | { | 835 | { |
836 | Hashtable param = new Hashtable(); | 836 | Hashtable param = new Hashtable(); |
837 | param["GroupID"] = GroupID.ToString(); | 837 | param["GroupID"] = GroupID.ToString(); |
838 | 838 | ||
839 | IList parameters = new ArrayList(); | 839 | IList parameters = new ArrayList(); |
840 | parameters.Add(param); | 840 | parameters.Add(param); |
841 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupMembers", parameters); | 841 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupMembers", parameters); |
842 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 842 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
843 | Hashtable respData = (Hashtable)resp.Value; | 843 | Hashtable respData = (Hashtable)resp.Value; |
844 | 844 | ||
845 | if (respData.Contains("error")) | 845 | if (respData.Contains("error")) |
846 | { | 846 | { |
847 | LogRespDataToConsoleError(respData); | 847 | LogRespDataToConsoleError(respData); |
848 | return null; | 848 | return null; |
849 | } | 849 | } |
850 | 850 | ||
851 | List<GroupMembersData> members = new List<GroupMembersData>(); | 851 | List<GroupMembersData> members = new List<GroupMembersData>(); |
852 | foreach (Hashtable membership in respData.Values) | 852 | foreach (Hashtable membership in respData.Values) |
853 | { | 853 | { |
854 | GroupMembersData data = new GroupMembersData(); | 854 | GroupMembersData data = new GroupMembersData(); |
855 | 855 | ||
856 | data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1"; | 856 | data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1"; |
857 | data.AgentID = new UUID((string)membership["AgentID"]); | 857 | data.AgentID = new UUID((string)membership["AgentID"]); |
858 | data.Contribution = int.Parse((string)membership["Contribution"]); | 858 | data.Contribution = int.Parse((string)membership["Contribution"]); |
859 | data.IsOwner = ((string)membership["IsOwner"]) == "1"; | 859 | data.IsOwner = ((string)membership["IsOwner"]) == "1"; |
860 | data.ListInProfile = ((string)membership["ListInProfile"]) == "1"; | 860 | data.ListInProfile = ((string)membership["ListInProfile"]) == "1"; |
861 | data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]); | 861 | data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]); |
862 | data.Title = (string)membership["Title"]; | 862 | data.Title = (string)membership["Title"]; |
863 | 863 | ||
864 | members.Add(data); | 864 | members.Add(data); |
865 | } | 865 | } |
866 | 866 | ||
867 | return members; | 867 | return members; |
868 | 868 | ||
869 | } | 869 | } |
870 | 870 | ||
871 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID) | 871 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID) |
872 | { | 872 | { |
873 | Hashtable param = new Hashtable(); | 873 | Hashtable param = new Hashtable(); |
874 | param["GroupID"] = GroupID.ToString(); | 874 | param["GroupID"] = GroupID.ToString(); |
875 | 875 | ||
876 | IList parameters = new ArrayList(); | 876 | IList parameters = new ArrayList(); |
877 | parameters.Add(param); | 877 | parameters.Add(param); |
878 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoleMembers", parameters); | 878 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupRoleMembers", parameters); |
879 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 879 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
880 | Hashtable respData = (Hashtable)resp.Value; | 880 | Hashtable respData = (Hashtable)resp.Value; |
881 | 881 | ||
882 | if (respData.Contains("error")) | 882 | if (respData.Contains("error")) |
883 | { | 883 | { |
884 | LogRespDataToConsoleError(respData); | 884 | LogRespDataToConsoleError(respData); |
885 | return null; | 885 | return null; |
886 | } | 886 | } |
887 | 887 | ||
888 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 888 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
889 | foreach (Hashtable membership in respData.Values) | 889 | foreach (Hashtable membership in respData.Values) |
890 | { | 890 | { |
891 | GroupRoleMembersData data = new GroupRoleMembersData(); | 891 | GroupRoleMembersData data = new GroupRoleMembersData(); |
892 | 892 | ||
893 | data.MemberID = new UUID((string)membership["AgentID"]); | 893 | data.MemberID = new UUID((string)membership["AgentID"]); |
894 | data.RoleID = new UUID((string)membership["RoleID"]); | 894 | data.RoleID = new UUID((string)membership["RoleID"]); |
895 | 895 | ||
896 | members.Add(data); | 896 | members.Add(data); |
897 | } | 897 | } |
898 | 898 | ||
899 | return members; | 899 | return members; |
900 | } | 900 | } |
901 | 901 | ||
902 | public List<GroupNoticeData> GetGroupNotices(UUID GroupID) | 902 | public List<GroupNoticeData> GetGroupNotices(UUID GroupID) |
903 | { | 903 | { |
904 | Hashtable param = new Hashtable(); | 904 | Hashtable param = new Hashtable(); |
905 | param["GroupID"] = GroupID.ToString(); | 905 | param["GroupID"] = GroupID.ToString(); |
906 | 906 | ||
907 | IList parameters = new ArrayList(); | 907 | IList parameters = new ArrayList(); |
908 | parameters.Add(param); | 908 | parameters.Add(param); |
909 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotices", parameters); | 909 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotices", parameters); |
910 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 910 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
911 | Hashtable respData = (Hashtable)resp.Value; | 911 | Hashtable respData = (Hashtable)resp.Value; |
912 | 912 | ||
913 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 913 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
914 | 914 | ||
915 | if (respData.Contains("error")) | 915 | if (respData.Contains("error")) |
916 | { | 916 | { |
917 | if ((string)respData["error"] != "No Notices") | 917 | if ((string)respData["error"] != "No Notices") |
918 | { | 918 | { |
919 | LogRespDataToConsoleError(respData); | 919 | LogRespDataToConsoleError(respData); |
920 | } | 920 | } |
921 | } | 921 | } |
922 | else | 922 | else |
923 | { | 923 | { |
924 | foreach (Hashtable value in respData.Values) | 924 | foreach (Hashtable value in respData.Values) |
925 | { | 925 | { |
926 | GroupNoticeData data = new GroupNoticeData(); | 926 | GroupNoticeData data = new GroupNoticeData(); |
927 | data.NoticeID = UUID.Parse((string)value["NoticeID"]); | 927 | data.NoticeID = UUID.Parse((string)value["NoticeID"]); |
928 | data.Timestamp = uint.Parse((string)value["Timestamp"]); | 928 | data.Timestamp = uint.Parse((string)value["Timestamp"]); |
929 | data.FromName = (string)value["FromName"]; | 929 | data.FromName = (string)value["FromName"]; |
930 | data.Subject = (string)value["Subject"]; | 930 | data.Subject = (string)value["Subject"]; |
931 | data.HasAttachment = false; | 931 | data.HasAttachment = false; |
932 | data.AssetType = 0; | 932 | data.AssetType = 0; |
933 | 933 | ||
934 | values.Add(data); | 934 | values.Add(data); |
935 | } | 935 | } |
936 | } | 936 | } |
937 | return values; | 937 | return values; |
938 | 938 | ||
939 | } | 939 | } |
940 | public GroupNoticeInfo GetGroupNotice(UUID noticeID) | 940 | public GroupNoticeInfo GetGroupNotice(UUID noticeID) |
941 | { | 941 | { |
942 | Hashtable param = new Hashtable(); | 942 | Hashtable param = new Hashtable(); |
943 | param["NoticeID"] = noticeID.ToString(); | 943 | param["NoticeID"] = noticeID.ToString(); |
944 | 944 | ||
945 | IList parameters = new ArrayList(); | 945 | IList parameters = new ArrayList(); |
946 | parameters.Add(param); | 946 | parameters.Add(param); |
947 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotice", parameters); | 947 | XmlRpcRequest req = new XmlRpcRequest("groups.getGroupNotice", parameters); |
948 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 948 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
949 | Hashtable respData = (Hashtable)resp.Value; | 949 | Hashtable respData = (Hashtable)resp.Value; |
950 | 950 | ||
951 | 951 | ||
952 | 952 | ||
953 | if (respData.Contains("error")) | 953 | if (respData.Contains("error")) |
954 | { | 954 | { |
955 | if ((string)respData["error"] != "Group Notice Not Found") | 955 | if ((string)respData["error"] != "Group Notice Not Found") |
956 | { | 956 | { |
957 | LogRespDataToConsoleError(respData); | 957 | LogRespDataToConsoleError(respData); |
958 | return null; | 958 | return null; |
959 | } | 959 | } |
960 | } | 960 | } |
961 | 961 | ||
962 | GroupNoticeInfo data = new GroupNoticeInfo(); | 962 | GroupNoticeInfo data = new GroupNoticeInfo(); |
963 | data.GroupID = UUID.Parse((string)respData["GroupID"]); | 963 | data.GroupID = UUID.Parse((string)respData["GroupID"]); |
964 | data.Message = (string)respData["Message"]; | 964 | data.Message = (string)respData["Message"]; |
965 | data.BinaryBucket = Utils.HexStringToBytes((string)respData["BinaryBucket"], true); | 965 | data.BinaryBucket = Utils.HexStringToBytes((string)respData["BinaryBucket"], true); |
966 | data.noticeData.NoticeID = UUID.Parse((string)respData["NoticeID"]); | 966 | data.noticeData.NoticeID = UUID.Parse((string)respData["NoticeID"]); |
967 | data.noticeData.Timestamp = uint.Parse((string)respData["Timestamp"]); | 967 | data.noticeData.Timestamp = uint.Parse((string)respData["Timestamp"]); |
968 | data.noticeData.FromName = (string)respData["FromName"]; | 968 | data.noticeData.FromName = (string)respData["FromName"]; |
969 | data.noticeData.Subject = (string)respData["Subject"]; | 969 | data.noticeData.Subject = (string)respData["Subject"]; |
970 | data.noticeData.HasAttachment = false; | 970 | data.noticeData.HasAttachment = false; |
971 | data.noticeData.AssetType = 0; | 971 | data.noticeData.AssetType = 0; |
972 | 972 | ||
973 | if (data.Message == null) | 973 | if (data.Message == null) |
974 | { | 974 | { |
975 | data.Message = string.Empty; | 975 | data.Message = string.Empty; |
976 | } | 976 | } |
977 | 977 | ||
978 | return data; | 978 | return data; |
979 | } | 979 | } |
980 | public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 980 | public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
981 | { | 981 | { |
982 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 982 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
983 | 983 | ||
984 | Hashtable param = new Hashtable(); | 984 | Hashtable param = new Hashtable(); |
985 | param["GroupID"] = groupID.ToString(); | 985 | param["GroupID"] = groupID.ToString(); |
986 | param["NoticeID"] = noticeID.ToString(); | 986 | param["NoticeID"] = noticeID.ToString(); |
987 | param["FromName"] = fromName; | 987 | param["FromName"] = fromName; |
988 | param["Subject"] = subject; | 988 | param["Subject"] = subject; |
989 | param["Message"] = message; | 989 | param["Message"] = message; |
990 | param["BinaryBucket"] = binBucket; | 990 | param["BinaryBucket"] = binBucket; |
991 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 991 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
992 | 992 | ||
993 | IList parameters = new ArrayList(); | 993 | IList parameters = new ArrayList(); |
994 | parameters.Add(param); | 994 | parameters.Add(param); |
995 | XmlRpcRequest req = new XmlRpcRequest("groups.addGroupNotice", parameters); | 995 | XmlRpcRequest req = new XmlRpcRequest("groups.addGroupNotice", parameters); |
996 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); | 996 | XmlRpcResponse resp = req.Send(m_serviceURL, 10000); |
997 | Hashtable respData = (Hashtable)resp.Value; | 997 | Hashtable respData = (Hashtable)resp.Value; |
998 | 998 | ||
999 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 999 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
1000 | 1000 | ||
1001 | if (respData.Contains("error")) | 1001 | if (respData.Contains("error")) |
1002 | { | 1002 | { |
1003 | LogRespDataToConsoleError(respData); | 1003 | LogRespDataToConsoleError(respData); |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | 1007 | ||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | public class GroupNoticeInfo | 1010 | public class GroupNoticeInfo |
1011 | { | 1011 | { |
1012 | public GroupNoticeData noticeData = new GroupNoticeData(); | 1012 | public GroupNoticeData noticeData = new GroupNoticeData(); |
1013 | public UUID GroupID = UUID.Zero; | 1013 | public UUID GroupID = UUID.Zero; |
1014 | public string Message = string.Empty; | 1014 | public string Message = string.Empty; |
1015 | public byte[] BinaryBucket = new byte[0]; | 1015 | public byte[] BinaryBucket = new byte[0]; |
1016 | } | 1016 | } |
1017 | } | 1017 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs index 5990fa6..10561a6 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsMessaging.cs | |||
@@ -1,430 +1,430 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | //using System.Collections; | 29 | //using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | 32 | ||
33 | 33 | ||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | 36 | ||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
39 | 39 | ||
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Region.CoreModules.Framework.EventQueue; | 41 | using OpenSim.Region.CoreModules.Framework.EventQueue; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | 44 | ||
45 | 45 | ||
46 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | 46 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; |
47 | 47 | ||
48 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 48 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
49 | { | 49 | { |
50 | public class XmlRpcGroupsMessaging : INonSharedRegionModule | 50 | public class XmlRpcGroupsMessaging : INonSharedRegionModule |
51 | { | 51 | { |
52 | 52 | ||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | private List<Scene> m_SceneList = new List<Scene>(); | 55 | private List<Scene> m_SceneList = new List<Scene>(); |
56 | 56 | ||
57 | // must be NonShared for this to work, otherewise we may actually get multiple active clients | 57 | // must be NonShared for this to work, otherewise we may actually get multiple active clients |
58 | private Dictionary<Guid, IClientAPI> m_ActiveClients = new Dictionary<Guid, IClientAPI>(); | 58 | private Dictionary<Guid, IClientAPI> m_ActiveClients = new Dictionary<Guid, IClientAPI>(); |
59 | 59 | ||
60 | private IMessageTransferModule m_MsgTransferModule = null; | 60 | private IMessageTransferModule m_MsgTransferModule = null; |
61 | 61 | ||
62 | private IGroupsModule m_GroupsModule = null; | 62 | private IGroupsModule m_GroupsModule = null; |
63 | 63 | ||
64 | // Config Options | 64 | // Config Options |
65 | private bool m_GroupMessagingEnabled = true; | 65 | private bool m_GroupMessagingEnabled = true; |
66 | private bool m_debugEnabled = true; | 66 | private bool m_debugEnabled = true; |
67 | 67 | ||
68 | #region IRegionModule Members | 68 | #region IRegionModule Members |
69 | 69 | ||
70 | public void Initialise(IConfigSource config) | 70 | public void Initialise(IConfigSource config) |
71 | { | 71 | { |
72 | IConfig groupsConfig = config.Configs["Groups"]; | 72 | IConfig groupsConfig = config.Configs["Groups"]; |
73 | 73 | ||
74 | m_log.Info("[GROUPS-MESSAGING]: Initializing XmlRpcGroupsMessaging"); | 74 | m_log.Info("[GROUPS-MESSAGING]: Initializing XmlRpcGroupsMessaging"); |
75 | 75 | ||
76 | if (groupsConfig == null) | 76 | if (groupsConfig == null) |
77 | { | 77 | { |
78 | // Do not run this module by default. | 78 | // Do not run this module by default. |
79 | m_log.Info("[GROUPS-MESSAGING]: No config found in OpenSim.ini -- not enabling XmlRpcGroupsMessaging"); | 79 | m_log.Info("[GROUPS-MESSAGING]: No config found in OpenSim.ini -- not enabling XmlRpcGroupsMessaging"); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | else | 82 | else |
83 | { | 83 | { |
84 | if (!groupsConfig.GetBoolean("Enabled", false)) | 84 | if (!groupsConfig.GetBoolean("Enabled", false)) |
85 | { | 85 | { |
86 | m_log.Info("[GROUPS-MESSAGING]: Groups disabled in configuration"); | 86 | m_log.Info("[GROUPS-MESSAGING]: Groups disabled in configuration"); |
87 | return; | 87 | return; |
88 | } | 88 | } |
89 | 89 | ||
90 | if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") | 90 | if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") |
91 | { | 91 | { |
92 | m_log.Info("[GROUPS-MESSAGING]: Config Groups Module not set to XmlRpcGroups"); | 92 | m_log.Info("[GROUPS-MESSAGING]: Config Groups Module not set to XmlRpcGroups"); |
93 | m_GroupMessagingEnabled = false; | 93 | m_GroupMessagingEnabled = false; |
94 | 94 | ||
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | 97 | ||
98 | m_GroupMessagingEnabled = groupsConfig.GetBoolean("XmlRpcMessagingEnabled", true); | 98 | m_GroupMessagingEnabled = groupsConfig.GetBoolean("XmlRpcMessagingEnabled", true); |
99 | 99 | ||
100 | if (!m_GroupMessagingEnabled) | 100 | if (!m_GroupMessagingEnabled) |
101 | { | 101 | { |
102 | m_log.Info("[GROUPS-MESSAGING]: XmlRpcGroups Messaging disabled."); | 102 | m_log.Info("[GROUPS-MESSAGING]: XmlRpcGroups Messaging disabled."); |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | 105 | ||
106 | m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); | 106 | m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); |
107 | 107 | ||
108 | } | 108 | } |
109 | 109 | ||
110 | m_log.Info("[GROUPS-MESSAGING]: XmlRpcGroupsMessaging starting up"); | 110 | m_log.Info("[GROUPS-MESSAGING]: XmlRpcGroupsMessaging starting up"); |
111 | 111 | ||
112 | } | 112 | } |
113 | 113 | ||
114 | public void AddRegion(Scene scene) | 114 | public void AddRegion(Scene scene) |
115 | { | 115 | { |
116 | } | 116 | } |
117 | public void RegionLoaded(Scene scene) | 117 | public void RegionLoaded(Scene scene) |
118 | { | 118 | { |
119 | if (!m_GroupMessagingEnabled) | 119 | if (!m_GroupMessagingEnabled) |
120 | return; | 120 | return; |
121 | 121 | ||
122 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 122 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
123 | 123 | ||
124 | 124 | ||
125 | m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); | 125 | m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); |
126 | 126 | ||
127 | // No groups module, no groups messaging | 127 | // No groups module, no groups messaging |
128 | if (m_GroupsModule == null) | 128 | if (m_GroupsModule == null) |
129 | { | 129 | { |
130 | m_GroupMessagingEnabled = false; | 130 | m_GroupMessagingEnabled = false; |
131 | m_log.Info("[GROUPS-MESSAGING]: Could not get IGroupsModule, XmlRpcGroupsMessaging is now disabled."); | 131 | m_log.Info("[GROUPS-MESSAGING]: Could not get IGroupsModule, XmlRpcGroupsMessaging is now disabled."); |
132 | Close(); | 132 | Close(); |
133 | return; | 133 | return; |
134 | } | 134 | } |
135 | 135 | ||
136 | m_MsgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); | 136 | m_MsgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); |
137 | 137 | ||
138 | // No message transfer module, no groups messaging | 138 | // No message transfer module, no groups messaging |
139 | if (m_MsgTransferModule == null) | 139 | if (m_MsgTransferModule == null) |
140 | { | 140 | { |
141 | m_GroupMessagingEnabled = false; | 141 | m_GroupMessagingEnabled = false; |
142 | m_log.Info("[GROUPS-MESSAGING]: Could not get MessageTransferModule"); | 142 | m_log.Info("[GROUPS-MESSAGING]: Could not get MessageTransferModule"); |
143 | Close(); | 143 | Close(); |
144 | return; | 144 | return; |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | m_SceneList.Add(scene); | 148 | m_SceneList.Add(scene); |
149 | 149 | ||
150 | scene.EventManager.OnNewClient += OnNewClient; | 150 | scene.EventManager.OnNewClient += OnNewClient; |
151 | scene.EventManager.OnClientClosed += OnClientClosed; | 151 | scene.EventManager.OnClientClosed += OnClientClosed; |
152 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 152 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | public void RemoveRegion(Scene scene) | 156 | public void RemoveRegion(Scene scene) |
157 | { | 157 | { |
158 | if (!m_GroupMessagingEnabled) | 158 | if (!m_GroupMessagingEnabled) |
159 | return; | 159 | return; |
160 | 160 | ||
161 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 161 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
162 | 162 | ||
163 | m_SceneList.Remove(scene); | 163 | m_SceneList.Remove(scene); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | public void Close() | 167 | public void Close() |
168 | { | 168 | { |
169 | if (!m_GroupMessagingEnabled) | 169 | if (!m_GroupMessagingEnabled) |
170 | return; | 170 | return; |
171 | 171 | ||
172 | m_log.Debug("[GROUPS-MESSAGING]: Shutting down XmlRpcGroupsMessaging module."); | 172 | m_log.Debug("[GROUPS-MESSAGING]: Shutting down XmlRpcGroupsMessaging module."); |
173 | 173 | ||
174 | 174 | ||
175 | foreach (Scene scene in m_SceneList) | 175 | foreach (Scene scene in m_SceneList) |
176 | { | 176 | { |
177 | scene.EventManager.OnNewClient -= OnNewClient; | 177 | scene.EventManager.OnNewClient -= OnNewClient; |
178 | scene.EventManager.OnClientClosed -= OnClientClosed; | 178 | scene.EventManager.OnClientClosed -= OnClientClosed; |
179 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 179 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
180 | } | 180 | } |
181 | 181 | ||
182 | m_SceneList.Clear(); | 182 | m_SceneList.Clear(); |
183 | 183 | ||
184 | m_GroupsModule = null; | 184 | m_GroupsModule = null; |
185 | m_MsgTransferModule = null; | 185 | m_MsgTransferModule = null; |
186 | } | 186 | } |
187 | 187 | ||
188 | public string Name | 188 | public string Name |
189 | { | 189 | { |
190 | get { return "XmlRpcGroupsMessaging"; } | 190 | get { return "XmlRpcGroupsMessaging"; } |
191 | } | 191 | } |
192 | 192 | ||
193 | #endregion | 193 | #endregion |
194 | 194 | ||
195 | #region SimGridEventHandlers | 195 | #region SimGridEventHandlers |
196 | 196 | ||
197 | private void OnNewClient(IClientAPI client) | 197 | private void OnNewClient(IClientAPI client) |
198 | { | 198 | { |
199 | RegisterClientAgent(client); | 199 | RegisterClientAgent(client); |
200 | } | 200 | } |
201 | private void OnClientClosed(UUID AgentId) | 201 | private void OnClientClosed(UUID AgentId) |
202 | { | 202 | { |
203 | UnregisterClientAgent(AgentId); | 203 | UnregisterClientAgent(AgentId); |
204 | } | 204 | } |
205 | 205 | ||
206 | private void OnGridInstantMessage(GridInstantMessage msg) | 206 | private void OnGridInstantMessage(GridInstantMessage msg) |
207 | { | 207 | { |
208 | m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 208 | m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
209 | 209 | ||
210 | DebugGridInstantMessage(msg); | 210 | DebugGridInstantMessage(msg); |
211 | 211 | ||
212 | // Incoming message from a group | 212 | // Incoming message from a group |
213 | if ((msg.dialog == (byte)InstantMessageDialog.SessionSend) && (msg.fromGroup == true)) | 213 | if ((msg.dialog == (byte)InstantMessageDialog.SessionSend) && (msg.fromGroup == true)) |
214 | { | 214 | { |
215 | if (m_ActiveClients.ContainsKey(msg.toAgentID)) | 215 | if (m_ActiveClients.ContainsKey(msg.toAgentID)) |
216 | { | 216 | { |
217 | UUID GroupID = new UUID(msg.fromAgentID); | 217 | UUID GroupID = new UUID(msg.fromAgentID); |
218 | // SendMessageToGroup(im); | 218 | // SendMessageToGroup(im); |
219 | 219 | ||
220 | GroupRecord GroupInfo = m_GroupsModule.GetGroupRecord(GroupID); | 220 | GroupRecord GroupInfo = m_GroupsModule.GetGroupRecord(GroupID); |
221 | if (GroupInfo != null) | 221 | if (GroupInfo != null) |
222 | { | 222 | { |
223 | 223 | ||
224 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Sending chatterbox invite instant message"); | 224 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Sending chatterbox invite instant message"); |
225 | 225 | ||
226 | // Force? open the group session dialog??? | 226 | // Force? open the group session dialog??? |
227 | IEventQueue eq = m_ActiveClients[msg.toAgentID].Scene.RequestModuleInterface<IEventQueue>(); | 227 | IEventQueue eq = m_ActiveClients[msg.toAgentID].Scene.RequestModuleInterface<IEventQueue>(); |
228 | eq.ChatterboxInvitation( | 228 | eq.ChatterboxInvitation( |
229 | GroupID | 229 | GroupID |
230 | , GroupInfo.GroupName | 230 | , GroupInfo.GroupName |
231 | , new UUID(msg.fromAgentID) | 231 | , new UUID(msg.fromAgentID) |
232 | , msg.message, new UUID(msg.toAgentID) | 232 | , msg.message, new UUID(msg.toAgentID) |
233 | , msg.fromAgentName | 233 | , msg.fromAgentName |
234 | , msg.dialog | 234 | , msg.dialog |
235 | , msg.timestamp | 235 | , msg.timestamp |
236 | , msg.offline==1 | 236 | , msg.offline==1 |
237 | , (int)msg.ParentEstateID | 237 | , (int)msg.ParentEstateID |
238 | , msg.Position | 238 | , msg.Position |
239 | , 1 | 239 | , 1 |
240 | , new UUID(msg.imSessionID) | 240 | , new UUID(msg.imSessionID) |
241 | , msg.fromGroup | 241 | , msg.fromGroup |
242 | , Utils.StringToBytes(GroupInfo.GroupName) | 242 | , Utils.StringToBytes(GroupInfo.GroupName) |
243 | ); | 243 | ); |
244 | 244 | ||
245 | eq.ChatterBoxSessionAgentListUpdates( | 245 | eq.ChatterBoxSessionAgentListUpdates( |
246 | new UUID(GroupID) | 246 | new UUID(GroupID) |
247 | , new UUID(msg.fromAgentID) | 247 | , new UUID(msg.fromAgentID) |
248 | , new UUID(msg.toAgentID) | 248 | , new UUID(msg.toAgentID) |
249 | , false //canVoiceChat | 249 | , false //canVoiceChat |
250 | , false //isModerator | 250 | , false //isModerator |
251 | , false //text mute | 251 | , false //text mute |
252 | ); | 252 | ); |
253 | 253 | ||
254 | } | 254 | } |
255 | } | 255 | } |
256 | } | 256 | } |
257 | 257 | ||
258 | } | 258 | } |
259 | 259 | ||
260 | #endregion | 260 | #endregion |
261 | 261 | ||
262 | #region ClientEvents | 262 | #region ClientEvents |
263 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) | 263 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) |
264 | { | 264 | { |
265 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 265 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
266 | 266 | ||
267 | DebugGridInstantMessage(im); | 267 | DebugGridInstantMessage(im); |
268 | 268 | ||
269 | // Start group IM session | 269 | // Start group IM session |
270 | if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) | 270 | if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) |
271 | { | 271 | { |
272 | UUID GroupID = new UUID(im.toAgentID); | 272 | UUID GroupID = new UUID(im.toAgentID); |
273 | 273 | ||
274 | GroupRecord GroupInfo = m_GroupsModule.GetGroupRecord(GroupID); | 274 | GroupRecord GroupInfo = m_GroupsModule.GetGroupRecord(GroupID); |
275 | if (GroupInfo != null) | 275 | if (GroupInfo != null) |
276 | { | 276 | { |
277 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Start Group Session for {0}", GroupInfo.GroupName); | 277 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Start Group Session for {0}", GroupInfo.GroupName); |
278 | 278 | ||
279 | // remoteClient.SendInstantMessage(new GridInstantMessage(remoteClient.Scene, GroupID, GroupProfile.Name, remoteClient.AgentId, (byte)OpenMetaverse.InstantMessageDialog.SessionSend, true, "Welcome", GroupID, false, new Vector3(), new byte[0])); | 279 | // remoteClient.SendInstantMessage(new GridInstantMessage(remoteClient.Scene, GroupID, GroupProfile.Name, remoteClient.AgentId, (byte)OpenMetaverse.InstantMessageDialog.SessionSend, true, "Welcome", GroupID, false, new Vector3(), new byte[0])); |
280 | 280 | ||
281 | ChatterBoxSessionStartReplyViaCaps(remoteClient, GroupInfo.GroupName, GroupID); | 281 | ChatterBoxSessionStartReplyViaCaps(remoteClient, GroupInfo.GroupName, GroupID); |
282 | 282 | ||
283 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 283 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); |
284 | queue.ChatterBoxSessionAgentListUpdates( | 284 | queue.ChatterBoxSessionAgentListUpdates( |
285 | new UUID(GroupID) | 285 | new UUID(GroupID) |
286 | , new UUID(im.fromAgentID) | 286 | , new UUID(im.fromAgentID) |
287 | , new UUID(im.toAgentID) | 287 | , new UUID(im.toAgentID) |
288 | , false //canVoiceChat | 288 | , false //canVoiceChat |
289 | , false //isModerator | 289 | , false //isModerator |
290 | , false //text mute | 290 | , false //text mute |
291 | ); | 291 | ); |
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | // Send a message to a group | 295 | // Send a message to a group |
296 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) | 296 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) |
297 | { | 297 | { |
298 | UUID GroupID = new UUID(im.toAgentID); | 298 | UUID GroupID = new UUID(im.toAgentID); |
299 | 299 | ||
300 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Send message to session for group {0}", GroupID); | 300 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Send message to session for group {0}", GroupID); |
301 | 301 | ||
302 | SendMessageToGroup(im, GroupID); | 302 | SendMessageToGroup(im, GroupID); |
303 | } | 303 | } |
304 | 304 | ||
305 | // Incoming message from a group | 305 | // Incoming message from a group |
306 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend) && (im.fromGroup == true)) | 306 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend) && (im.fromGroup == true)) |
307 | { | 307 | { |
308 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Message from group session {0} going to agent {1}", im.fromAgentID, im.toAgentID); | 308 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] Message from group session {0} going to agent {1}", im.fromAgentID, im.toAgentID); |
309 | } | 309 | } |
310 | } | 310 | } |
311 | #endregion | 311 | #endregion |
312 | 312 | ||
313 | private void RegisterClientAgent(IClientAPI client) | 313 | private void RegisterClientAgent(IClientAPI client) |
314 | { | 314 | { |
315 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 315 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
316 | 316 | ||
317 | lock (m_ActiveClients) | 317 | lock (m_ActiveClients) |
318 | { | 318 | { |
319 | if (!m_ActiveClients.ContainsKey(client.AgentId.Guid)) | 319 | if (!m_ActiveClients.ContainsKey(client.AgentId.Guid)) |
320 | { | 320 | { |
321 | client.OnInstantMessage += OnInstantMessage; | 321 | client.OnInstantMessage += OnInstantMessage; |
322 | 322 | ||
323 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] OnInstantMessage registered for {0}", client.Name); | 323 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] OnInstantMessage registered for {0}", client.Name); |
324 | 324 | ||
325 | m_ActiveClients.Add(client.AgentId.Guid, client); | 325 | m_ActiveClients.Add(client.AgentId.Guid, client); |
326 | } | 326 | } |
327 | else | 327 | else |
328 | { | 328 | { |
329 | // Remove old client connection for this agent | 329 | // Remove old client connection for this agent |
330 | UnregisterClientAgent(client.AgentId); | 330 | UnregisterClientAgent(client.AgentId); |
331 | 331 | ||
332 | // Add new client connection | 332 | // Add new client connection |
333 | RegisterClientAgent(client); | 333 | RegisterClientAgent(client); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | } | 336 | } |
337 | private void UnregisterClientAgent(UUID agentID) | 337 | private void UnregisterClientAgent(UUID agentID) |
338 | { | 338 | { |
339 | lock (m_ActiveClients) | 339 | lock (m_ActiveClients) |
340 | { | 340 | { |
341 | if (m_ActiveClients.ContainsKey(agentID.Guid)) | 341 | if (m_ActiveClients.ContainsKey(agentID.Guid)) |
342 | { | 342 | { |
343 | IClientAPI client = m_ActiveClients[agentID.Guid]; | 343 | IClientAPI client = m_ActiveClients[agentID.Guid]; |
344 | client.OnInstantMessage -= OnInstantMessage; | 344 | client.OnInstantMessage -= OnInstantMessage; |
345 | 345 | ||
346 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] OnInstantMessage unregistered for {0}", client.Name); | 346 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] OnInstantMessage unregistered for {0}", client.Name); |
347 | 347 | ||
348 | m_ActiveClients.Remove(agentID.Guid); | 348 | m_ActiveClients.Remove(agentID.Guid); |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | m_log.InfoFormat("[GROUPS-MESSAGING] Client closed that wasn't registered here."); | 352 | m_log.InfoFormat("[GROUPS-MESSAGING] Client closed that wasn't registered here."); |
353 | } | 353 | } |
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | private void SendMessageToGroup(GridInstantMessage im, UUID groupID) | 357 | private void SendMessageToGroup(GridInstantMessage im, UUID groupID) |
358 | { | 358 | { |
359 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 359 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
360 | 360 | ||
361 | GridInstantMessage msg = new GridInstantMessage(); | 361 | GridInstantMessage msg = new GridInstantMessage(); |
362 | msg.imSessionID = im.imSessionID; | 362 | msg.imSessionID = im.imSessionID; |
363 | msg.fromAgentID = im.imSessionID; // GroupID | 363 | msg.fromAgentID = im.imSessionID; // GroupID |
364 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 364 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
365 | msg.fromAgentName = im.fromAgentName; | 365 | msg.fromAgentName = im.fromAgentName; |
366 | msg.message = im.message; | 366 | msg.message = im.message; |
367 | msg.dialog = im.dialog; | 367 | msg.dialog = im.dialog; |
368 | msg.fromGroup = true; | 368 | msg.fromGroup = true; |
369 | msg.offline = (byte)0; | 369 | msg.offline = (byte)0; |
370 | msg.ParentEstateID = im.ParentEstateID; | 370 | msg.ParentEstateID = im.ParentEstateID; |
371 | msg.Position = im.Position; | 371 | msg.Position = im.Position; |
372 | msg.RegionID = im.RegionID; | 372 | msg.RegionID = im.RegionID; |
373 | msg.binaryBucket = new byte[1] { 0 }; | 373 | msg.binaryBucket = new byte[1] { 0 }; |
374 | 374 | ||
375 | foreach (GroupMembersData member in m_GroupsModule.GroupMembersRequest(null, groupID)) | 375 | foreach (GroupMembersData member in m_GroupsModule.GroupMembersRequest(null, groupID)) |
376 | { | 376 | { |
377 | msg.toAgentID = member.AgentID.Guid; | 377 | msg.toAgentID = member.AgentID.Guid; |
378 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | 378 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); |
379 | } | 379 | } |
380 | } | 380 | } |
381 | 381 | ||
382 | void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) | 382 | void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) |
383 | { | 383 | { |
384 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 384 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
385 | 385 | ||
386 | OSDMap moderatedMap = new OSDMap(4); | 386 | OSDMap moderatedMap = new OSDMap(4); |
387 | moderatedMap.Add("voice", OSD.FromBoolean(false)); | 387 | moderatedMap.Add("voice", OSD.FromBoolean(false)); |
388 | 388 | ||
389 | OSDMap sessionMap = new OSDMap(4); | 389 | OSDMap sessionMap = new OSDMap(4); |
390 | sessionMap.Add("moderated_mode", moderatedMap); | 390 | sessionMap.Add("moderated_mode", moderatedMap); |
391 | sessionMap.Add("session_name", OSD.FromString(groupName)); | 391 | sessionMap.Add("session_name", OSD.FromString(groupName)); |
392 | sessionMap.Add("type", OSD.FromInteger(0)); | 392 | sessionMap.Add("type", OSD.FromInteger(0)); |
393 | sessionMap.Add("voice_enabled", OSD.FromBoolean(false)); | 393 | sessionMap.Add("voice_enabled", OSD.FromBoolean(false)); |
394 | 394 | ||
395 | 395 | ||
396 | OSDMap bodyMap = new OSDMap(4); | 396 | OSDMap bodyMap = new OSDMap(4); |
397 | bodyMap.Add("session_id", OSD.FromUUID(groupID)); | 397 | bodyMap.Add("session_id", OSD.FromUUID(groupID)); |
398 | bodyMap.Add("temp_session_id", OSD.FromUUID(groupID)); | 398 | bodyMap.Add("temp_session_id", OSD.FromUUID(groupID)); |
399 | bodyMap.Add("success", OSD.FromBoolean(true)); | 399 | bodyMap.Add("success", OSD.FromBoolean(true)); |
400 | bodyMap.Add("session_info", sessionMap); | 400 | bodyMap.Add("session_info", sessionMap); |
401 | 401 | ||
402 | 402 | ||
403 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 403 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); |
404 | 404 | ||
405 | if (queue != null) | 405 | if (queue != null) |
406 | { | 406 | { |
407 | queue.Enqueue(EventQueueHelper.buildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId); | 407 | queue.Enqueue(EventQueueHelper.buildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId); |
408 | } | 408 | } |
409 | 409 | ||
410 | } | 410 | } |
411 | 411 | ||
412 | 412 | ||
413 | private void DebugGridInstantMessage(GridInstantMessage im) | 413 | private void DebugGridInstantMessage(GridInstantMessage im) |
414 | { | 414 | { |
415 | if (m_debugEnabled) | 415 | if (m_debugEnabled) |
416 | { | 416 | { |
417 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: fromGroup({0})", im.fromGroup ? "True" : "False"); | 417 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: fromGroup({0})", im.fromGroup ? "True" : "False"); |
418 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: Dialog({0})", ((InstantMessageDialog)im.dialog).ToString()); | 418 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: Dialog({0})", ((InstantMessageDialog)im.dialog).ToString()); |
419 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: fromAgentID({0})", im.fromAgentID.ToString()); | 419 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: fromAgentID({0})", im.fromAgentID.ToString()); |
420 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: fromAgentName({0})", im.fromAgentName.ToString()); | 420 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: fromAgentName({0})", im.fromAgentName.ToString()); |
421 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: imSessionID({0})", im.imSessionID.ToString()); | 421 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: imSessionID({0})", im.imSessionID.ToString()); |
422 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: message({0})", im.message.ToString()); | 422 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: message({0})", im.message.ToString()); |
423 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: offline({0})", im.offline.ToString()); | 423 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: offline({0})", im.offline.ToString()); |
424 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: toAgentID({0})", im.toAgentID.ToString()); | 424 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: toAgentID({0})", im.toAgentID.ToString()); |
425 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket")); | 425 | m_log.WarnFormat("[GROUPS-MESSAGING] IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket")); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | } | 429 | } |
430 | } | 430 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs index 6a3aa06..a6f9ea1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsModule.cs | |||
@@ -1,1051 +1,1051 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | 31 | ||
32 | using System.Collections; | 32 | using System.Collections; |
33 | //using Nwc.XmlRpc; | 33 | //using Nwc.XmlRpc; |
34 | 34 | ||
35 | using log4net; | 35 | using log4net; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | 37 | ||
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using OpenMetaverse.StructuredData; | 39 | using OpenMetaverse.StructuredData; |
40 | 40 | ||
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Region.CoreModules.Framework.EventQueue; | 42 | using OpenSim.Region.CoreModules.Framework.EventQueue; |
43 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
44 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
45 | 45 | ||
46 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | 46 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; |
47 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; | 47 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 51 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
52 | { | 52 | { |
53 | public class XmlRpcGroupsModule : INonSharedRegionModule, IGroupsModule | 53 | public class XmlRpcGroupsModule : INonSharedRegionModule, IGroupsModule |
54 | { | 54 | { |
55 | /// <summary> | 55 | /// <summary> |
56 | /// To use this module, you must specify the following in your OpenSim.ini | 56 | /// To use this module, you must specify the following in your OpenSim.ini |
57 | /// [GROUPS] | 57 | /// [GROUPS] |
58 | /// Enabled = true | 58 | /// Enabled = true |
59 | /// Module = XmlRpcGroups | 59 | /// Module = XmlRpcGroups |
60 | /// XmlRpcMessagingEnabled = true | 60 | /// XmlRpcMessagingEnabled = true |
61 | /// XmlRpcNoticesEnabled = true | 61 | /// XmlRpcNoticesEnabled = true |
62 | /// XmlRpcDebugEnabled = true | 62 | /// XmlRpcDebugEnabled = true |
63 | /// | 63 | /// |
64 | /// </summary> | 64 | /// </summary> |
65 | 65 | ||
66 | private static readonly ILog m_log = | 66 | private static readonly ILog m_log = |
67 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 67 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
68 | 68 | ||
69 | private List<Scene> m_SceneList = new List<Scene>(); | 69 | private List<Scene> m_SceneList = new List<Scene>(); |
70 | 70 | ||
71 | // This only works when running as non-Shared, in shared, there may be multiple IClientAPIs for a single client | 71 | // This only works when running as non-Shared, in shared, there may be multiple IClientAPIs for a single client |
72 | private Dictionary<UUID, IClientAPI> m_ActiveClients = new Dictionary<UUID, IClientAPI>(); | 72 | private Dictionary<UUID, IClientAPI> m_ActiveClients = new Dictionary<UUID, IClientAPI>(); |
73 | 73 | ||
74 | private IMessageTransferModule m_MsgTransferModule = null; | 74 | private IMessageTransferModule m_MsgTransferModule = null; |
75 | 75 | ||
76 | private IGroupDataProvider m_groupData = null; | 76 | private IGroupDataProvider m_groupData = null; |
77 | 77 | ||
78 | // Configuration settings | 78 | // Configuration settings |
79 | private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php"; | 79 | private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php"; |
80 | private bool m_GroupsEnabled = false; | 80 | private bool m_GroupsEnabled = false; |
81 | private bool m_GroupNoticesEnabled = true; | 81 | private bool m_GroupNoticesEnabled = true; |
82 | private bool m_debugEnabled = true; | 82 | private bool m_debugEnabled = true; |
83 | 83 | ||
84 | #region IRegionModule Members | 84 | #region IRegionModule Members |
85 | 85 | ||
86 | public void Initialise(IConfigSource config) | 86 | public void Initialise(IConfigSource config) |
87 | { | 87 | { |
88 | IConfig groupsConfig = config.Configs["Groups"]; | 88 | IConfig groupsConfig = config.Configs["Groups"]; |
89 | 89 | ||
90 | m_log.Info("[GROUPS]: Initializing XmlRpcGroups"); | 90 | m_log.Info("[GROUPS]: Initializing XmlRpcGroups"); |
91 | 91 | ||
92 | if (groupsConfig == null) | 92 | if (groupsConfig == null) |
93 | { | 93 | { |
94 | // Do not run this module by default. | 94 | // Do not run this module by default. |
95 | m_log.Info("[GROUPS]: No config found in OpenSim.ini -- not enabling XmlRpcGroups"); | 95 | m_log.Info("[GROUPS]: No config found in OpenSim.ini -- not enabling XmlRpcGroups"); |
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | else | 98 | else |
99 | { | 99 | { |
100 | m_GroupsEnabled = groupsConfig.GetBoolean("Enabled", false); | 100 | m_GroupsEnabled = groupsConfig.GetBoolean("Enabled", false); |
101 | if (!m_GroupsEnabled) | 101 | if (!m_GroupsEnabled) |
102 | { | 102 | { |
103 | m_log.Info("[GROUPS]: Groups disabled in configuration"); | 103 | m_log.Info("[GROUPS]: Groups disabled in configuration"); |
104 | return; | 104 | return; |
105 | } | 105 | } |
106 | 106 | ||
107 | if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") | 107 | if (groupsConfig.GetString("Module", "Default") != "XmlRpcGroups") |
108 | { | 108 | { |
109 | m_log.Info("[GROUPS]: Config Groups Module not set to XmlRpcGroups"); | 109 | m_log.Info("[GROUPS]: Config Groups Module not set to XmlRpcGroups"); |
110 | m_GroupsEnabled = false; | 110 | m_GroupsEnabled = false; |
111 | 111 | ||
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | 114 | ||
115 | string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); | 115 | string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); |
116 | m_groupData = new XmlRpcGroupDataProvider(ServiceURL); | 116 | m_groupData = new XmlRpcGroupDataProvider(ServiceURL); |
117 | m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL); | 117 | m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL); |
118 | 118 | ||
119 | m_GroupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); | 119 | m_GroupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); |
120 | m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); | 120 | m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); |
121 | 121 | ||
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | public void AddRegion(Scene scene) | 125 | public void AddRegion(Scene scene) |
126 | { | 126 | { |
127 | if (m_GroupsEnabled) | 127 | if (m_GroupsEnabled) |
128 | scene.RegisterModuleInterface<IGroupsModule>(this); | 128 | scene.RegisterModuleInterface<IGroupsModule>(this); |
129 | } | 129 | } |
130 | 130 | ||
131 | public void RegionLoaded(Scene scene) | 131 | public void RegionLoaded(Scene scene) |
132 | { | 132 | { |
133 | if (!m_GroupsEnabled) | 133 | if (!m_GroupsEnabled) |
134 | return; | 134 | return; |
135 | 135 | ||
136 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 136 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
137 | 137 | ||
138 | m_MsgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); | 138 | m_MsgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); |
139 | 139 | ||
140 | // No message transfer module, no notices, group invites, rejects, ejects, etc | 140 | // No message transfer module, no notices, group invites, rejects, ejects, etc |
141 | if (m_MsgTransferModule == null) | 141 | if (m_MsgTransferModule == null) |
142 | { | 142 | { |
143 | m_GroupsEnabled = false; | 143 | m_GroupsEnabled = false; |
144 | m_log.Info("[GROUPS]: Could not get MessageTransferModule"); | 144 | m_log.Info("[GROUPS]: Could not get MessageTransferModule"); |
145 | Close(); | 145 | Close(); |
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | m_SceneList.Add(scene); | 150 | m_SceneList.Add(scene); |
151 | 151 | ||
152 | scene.EventManager.OnNewClient += OnNewClient; | 152 | scene.EventManager.OnNewClient += OnNewClient; |
153 | scene.EventManager.OnClientClosed += OnClientClosed; | 153 | scene.EventManager.OnClientClosed += OnClientClosed; |
154 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 154 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
155 | 155 | ||
156 | } | 156 | } |
157 | 157 | ||
158 | public void RemoveRegion(Scene scene) | 158 | public void RemoveRegion(Scene scene) |
159 | { | 159 | { |
160 | if (!m_GroupsEnabled) | 160 | if (!m_GroupsEnabled) |
161 | return; | 161 | return; |
162 | 162 | ||
163 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 163 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
164 | 164 | ||
165 | m_SceneList.Remove(scene); | 165 | m_SceneList.Remove(scene); |
166 | } | 166 | } |
167 | 167 | ||
168 | public void Close() | 168 | public void Close() |
169 | { | 169 | { |
170 | if (!m_GroupsEnabled) | 170 | if (!m_GroupsEnabled) |
171 | return; | 171 | return; |
172 | m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module."); | 172 | m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module."); |
173 | } | 173 | } |
174 | 174 | ||
175 | public string Name | 175 | public string Name |
176 | { | 176 | { |
177 | get { return "XmlRpcGroupsModule"; } | 177 | get { return "XmlRpcGroupsModule"; } |
178 | } | 178 | } |
179 | 179 | ||
180 | #endregion | 180 | #endregion |
181 | 181 | ||
182 | private void UpdateAllClientsWithGroupInfo() | 182 | private void UpdateAllClientsWithGroupInfo() |
183 | { | 183 | { |
184 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 184 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
185 | foreach (IClientAPI client in m_ActiveClients.Values) | 185 | foreach (IClientAPI client in m_ActiveClients.Values) |
186 | { | 186 | { |
187 | UpdateClientWithGroupInfo(client); | 187 | UpdateClientWithGroupInfo(client); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | private void UpdateClientWithGroupInfo(IClientAPI client) | 191 | private void UpdateClientWithGroupInfo(IClientAPI client) |
192 | { | 192 | { |
193 | m_log.InfoFormat("[GROUPS] {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, client.Name); | 193 | m_log.InfoFormat("[GROUPS] {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, client.Name); |
194 | OnAgentDataUpdateRequest(client, client.AgentId, UUID.Zero); | 194 | OnAgentDataUpdateRequest(client, client.AgentId, UUID.Zero); |
195 | 195 | ||
196 | 196 | ||
197 | // Need to send a group membership update to the client | 197 | // Need to send a group membership update to the client |
198 | // UDP version doesn't seem to behave nicely | 198 | // UDP version doesn't seem to behave nicely |
199 | // client.SendGroupMembership(GetMembershipData(client.AgentId)); | 199 | // client.SendGroupMembership(GetMembershipData(client.AgentId)); |
200 | 200 | ||
201 | GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(client.AgentId).ToArray(); | 201 | GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(client.AgentId).ToArray(); |
202 | 202 | ||
203 | SendGroupMembershipInfoViaCaps(client, membershipData); | 203 | SendGroupMembershipInfoViaCaps(client, membershipData); |
204 | client.SendAvatarGroupsReply(client.AgentId, membershipData); | 204 | client.SendAvatarGroupsReply(client.AgentId, membershipData); |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | #region EventHandlers | 208 | #region EventHandlers |
209 | private void OnNewClient(IClientAPI client) | 209 | private void OnNewClient(IClientAPI client) |
210 | { | 210 | { |
211 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 211 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
212 | 212 | ||
213 | 213 | ||
214 | lock (m_ActiveClients) | 214 | lock (m_ActiveClients) |
215 | { | 215 | { |
216 | if (!m_ActiveClients.ContainsKey(client.AgentId)) | 216 | if (!m_ActiveClients.ContainsKey(client.AgentId)) |
217 | { | 217 | { |
218 | client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; | 218 | client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; |
219 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; | 219 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; |
220 | client.OnDirFindQuery += OnDirFindQuery; | 220 | client.OnDirFindQuery += OnDirFindQuery; |
221 | client.OnInstantMessage += OnInstantMessage; | 221 | client.OnInstantMessage += OnInstantMessage; |
222 | 222 | ||
223 | m_ActiveClients.Add(client.AgentId, client); | 223 | m_ActiveClients.Add(client.AgentId, client); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | UpdateClientWithGroupInfo(client); | 227 | UpdateClientWithGroupInfo(client); |
228 | } | 228 | } |
229 | private void OnClientClosed(UUID AgentId) | 229 | private void OnClientClosed(UUID AgentId) |
230 | { | 230 | { |
231 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 231 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
232 | 232 | ||
233 | lock (m_ActiveClients) | 233 | lock (m_ActiveClients) |
234 | { | 234 | { |
235 | if (m_ActiveClients.ContainsKey(AgentId)) | 235 | if (m_ActiveClients.ContainsKey(AgentId)) |
236 | { | 236 | { |
237 | IClientAPI client = m_ActiveClients[AgentId]; | 237 | IClientAPI client = m_ActiveClients[AgentId]; |
238 | client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; | 238 | client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; |
239 | client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; | 239 | client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; |
240 | client.OnDirFindQuery -= OnDirFindQuery; | 240 | client.OnDirFindQuery -= OnDirFindQuery; |
241 | client.OnInstantMessage -= OnInstantMessage; | 241 | client.OnInstantMessage -= OnInstantMessage; |
242 | 242 | ||
243 | m_ActiveClients.Remove(AgentId); | 243 | m_ActiveClients.Remove(AgentId); |
244 | } | 244 | } |
245 | else | 245 | else |
246 | { | 246 | { |
247 | m_log.InfoFormat("[GROUPS] Client closed that wasn't registered here."); | 247 | m_log.InfoFormat("[GROUPS] Client closed that wasn't registered here."); |
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
251 | } | 251 | } |
252 | 252 | ||
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) | 256 | void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) |
257 | { | 257 | { |
258 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) | 258 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) |
259 | { | 259 | { |
260 | m_log.InfoFormat("[GROUPS] {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); | 260 | m_log.InfoFormat("[GROUPS] {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); |
261 | 261 | ||
262 | remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(queryText).ToArray()); | 262 | remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(queryText).ToArray()); |
263 | } | 263 | } |
264 | 264 | ||
265 | } | 265 | } |
266 | 266 | ||
267 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, | 267 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, |
268 | UUID AgentID, UUID SessionID) | 268 | UUID AgentID, UUID SessionID) |
269 | { | 269 | { |
270 | m_log.InfoFormat("[GROUPS] {0} called with SessionID :: {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, SessionID); | 270 | m_log.InfoFormat("[GROUPS] {0} called with SessionID :: {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, SessionID); |
271 | 271 | ||
272 | 272 | ||
273 | UUID ActiveGroupID = UUID.Zero; | 273 | UUID ActiveGroupID = UUID.Zero; |
274 | string ActiveGroupTitle = string.Empty; | 274 | string ActiveGroupTitle = string.Empty; |
275 | string ActiveGroupName = string.Empty; | 275 | string ActiveGroupName = string.Empty; |
276 | ulong ActiveGroupPowers = (ulong)GroupPowers.None; | 276 | ulong ActiveGroupPowers = (ulong)GroupPowers.None; |
277 | 277 | ||
278 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(AgentID); | 278 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(AgentID); |
279 | if (membership != null) | 279 | if (membership != null) |
280 | { | 280 | { |
281 | ActiveGroupID = membership.GroupID; | 281 | ActiveGroupID = membership.GroupID; |
282 | ActiveGroupTitle = membership.GroupTitle; | 282 | ActiveGroupTitle = membership.GroupTitle; |
283 | ActiveGroupPowers = membership.GroupPowers; | 283 | ActiveGroupPowers = membership.GroupPowers; |
284 | } | 284 | } |
285 | 285 | ||
286 | string firstname, lastname; | 286 | string firstname, lastname; |
287 | IClientAPI agent; | 287 | IClientAPI agent; |
288 | if( m_ActiveClients.TryGetValue(AgentID, out agent) ) | 288 | if( m_ActiveClients.TryGetValue(AgentID, out agent) ) |
289 | { | 289 | { |
290 | firstname = agent.FirstName; | 290 | firstname = agent.FirstName; |
291 | lastname = agent.LastName; | 291 | lastname = agent.LastName; |
292 | } else { | 292 | } else { |
293 | firstname = "Unknown"; | 293 | firstname = "Unknown"; |
294 | lastname = "Unknown"; | 294 | lastname = "Unknown"; |
295 | } | 295 | } |
296 | 296 | ||
297 | UpdateScenePresenceWithTitle(AgentID, ActiveGroupTitle); | 297 | UpdateScenePresenceWithTitle(AgentID, ActiveGroupTitle); |
298 | 298 | ||
299 | remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, | 299 | remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, |
300 | lastname, ActiveGroupPowers, ActiveGroupName, | 300 | lastname, ActiveGroupPowers, ActiveGroupName, |
301 | ActiveGroupTitle); | 301 | ActiveGroupTitle); |
302 | } | 302 | } |
303 | 303 | ||
304 | private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remote_client) | 304 | private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remote_client) |
305 | { | 305 | { |
306 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 306 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
307 | 307 | ||
308 | string GroupName; | 308 | string GroupName; |
309 | 309 | ||
310 | GroupRecord group = m_groupData.GetGroupRecord(GroupID, null); | 310 | GroupRecord group = m_groupData.GetGroupRecord(GroupID, null); |
311 | if (group != null) | 311 | if (group != null) |
312 | { | 312 | { |
313 | GroupName = group.GroupName; | 313 | GroupName = group.GroupName; |
314 | } | 314 | } |
315 | else | 315 | else |
316 | { | 316 | { |
317 | GroupName = "Unknown"; | 317 | GroupName = "Unknown"; |
318 | } | 318 | } |
319 | 319 | ||
320 | 320 | ||
321 | remote_client.SendGroupNameReply(GroupID, GroupName); | 321 | remote_client.SendGroupNameReply(GroupID, GroupName); |
322 | } | 322 | } |
323 | 323 | ||
324 | 324 | ||
325 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) | 325 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) |
326 | { | 326 | { |
327 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 327 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
328 | 328 | ||
329 | 329 | ||
330 | // Group invitations | 330 | // Group invitations |
331 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) | 331 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) |
332 | { | 332 | { |
333 | m_log.WarnFormat("[GROUPS] Received an IIM for {0}.", ((InstantMessageDialog)im.dialog).ToString()); | 333 | m_log.WarnFormat("[GROUPS] Received an IIM for {0}.", ((InstantMessageDialog)im.dialog).ToString()); |
334 | 334 | ||
335 | 335 | ||
336 | UUID inviteID = new UUID(im.imSessionID); | 336 | UUID inviteID = new UUID(im.imSessionID); |
337 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(inviteID); | 337 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(inviteID); |
338 | 338 | ||
339 | m_log.WarnFormat("[GROUPS] Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID); | 339 | m_log.WarnFormat("[GROUPS] Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID); |
340 | 340 | ||
341 | UUID fromAgentID = new UUID(im.fromAgentID); | 341 | UUID fromAgentID = new UUID(im.fromAgentID); |
342 | if ((inviteInfo != null) && (fromAgentID == inviteInfo.AgentID)) | 342 | if ((inviteInfo != null) && (fromAgentID == inviteInfo.AgentID)) |
343 | { | 343 | { |
344 | 344 | ||
345 | // Accept | 345 | // Accept |
346 | if (im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) | 346 | if (im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) |
347 | { | 347 | { |
348 | m_log.WarnFormat("[GROUPS] Received an accept invite notice."); | 348 | m_log.WarnFormat("[GROUPS] Received an accept invite notice."); |
349 | 349 | ||
350 | // and the sessionid is the role | 350 | // and the sessionid is the role |
351 | m_groupData.AddAgentToGroup(inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID); | 351 | m_groupData.AddAgentToGroup(inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID); |
352 | 352 | ||
353 | if (m_MsgTransferModule != null) | 353 | if (m_MsgTransferModule != null) |
354 | { | 354 | { |
355 | GridInstantMessage msg = new GridInstantMessage(); | 355 | GridInstantMessage msg = new GridInstantMessage(); |
356 | msg.imSessionID = UUID.Zero.Guid; | 356 | msg.imSessionID = UUID.Zero.Guid; |
357 | msg.fromAgentID = UUID.Zero.Guid; | 357 | msg.fromAgentID = UUID.Zero.Guid; |
358 | msg.toAgentID = inviteInfo.AgentID.Guid; | 358 | msg.toAgentID = inviteInfo.AgentID.Guid; |
359 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 359 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
360 | msg.fromAgentName = "Groups"; | 360 | msg.fromAgentName = "Groups"; |
361 | msg.message = string.Format("You have been added to the group."); | 361 | msg.message = string.Format("You have been added to the group."); |
362 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageBox; | 362 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageBox; |
363 | msg.fromGroup = false; | 363 | msg.fromGroup = false; |
364 | msg.offline = (byte)0; | 364 | msg.offline = (byte)0; |
365 | msg.ParentEstateID = 0; | 365 | msg.ParentEstateID = 0; |
366 | msg.Position = Vector3.Zero; | 366 | msg.Position = Vector3.Zero; |
367 | msg.RegionID = UUID.Zero.Guid; | 367 | msg.RegionID = UUID.Zero.Guid; |
368 | msg.binaryBucket = new byte[0]; | 368 | msg.binaryBucket = new byte[0]; |
369 | 369 | ||
370 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | 370 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); |
371 | } | 371 | } |
372 | 372 | ||
373 | UpdateAllClientsWithGroupInfo(); | 373 | UpdateAllClientsWithGroupInfo(); |
374 | 374 | ||
375 | m_groupData.RemoveAgentToGroupInvite(inviteID); | 375 | m_groupData.RemoveAgentToGroupInvite(inviteID); |
376 | } | 376 | } |
377 | 377 | ||
378 | // Reject | 378 | // Reject |
379 | if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline) | 379 | if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline) |
380 | { | 380 | { |
381 | m_log.WarnFormat("[GROUPS] Received a reject invite notice."); | 381 | m_log.WarnFormat("[GROUPS] Received a reject invite notice."); |
382 | m_groupData.RemoveAgentToGroupInvite(inviteID); | 382 | m_groupData.RemoveAgentToGroupInvite(inviteID); |
383 | 383 | ||
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | // Group notices | 390 | // Group notices |
391 | if ((im.dialog == (byte)InstantMessageDialog.GroupNotice)) | 391 | if ((im.dialog == (byte)InstantMessageDialog.GroupNotice)) |
392 | { | 392 | { |
393 | if (!m_GroupNoticesEnabled) | 393 | if (!m_GroupNoticesEnabled) |
394 | { | 394 | { |
395 | return; | 395 | return; |
396 | } | 396 | } |
397 | 397 | ||
398 | UUID GroupID = new UUID(im.toAgentID); | 398 | UUID GroupID = new UUID(im.toAgentID); |
399 | if( m_groupData.GetGroupRecord(GroupID, null) != null) | 399 | if( m_groupData.GetGroupRecord(GroupID, null) != null) |
400 | { | 400 | { |
401 | UUID NoticeID = UUID.Random(); | 401 | UUID NoticeID = UUID.Random(); |
402 | string Subject = im.message.Substring(0, im.message.IndexOf('|')); | 402 | string Subject = im.message.Substring(0, im.message.IndexOf('|')); |
403 | string Message = im.message.Substring(Subject.Length + 1); | 403 | string Message = im.message.Substring(Subject.Length + 1); |
404 | 404 | ||
405 | byte[] bucket; | 405 | byte[] bucket; |
406 | 406 | ||
407 | if ((im.binaryBucket.Length == 1) && (im.binaryBucket[0] == 0)) | 407 | if ((im.binaryBucket.Length == 1) && (im.binaryBucket[0] == 0)) |
408 | { | 408 | { |
409 | bucket = new byte[19]; | 409 | bucket = new byte[19]; |
410 | bucket[0] = 0; //dunno | 410 | bucket[0] = 0; //dunno |
411 | bucket[1] = 0; //dunno | 411 | bucket[1] = 0; //dunno |
412 | GroupID.ToBytes(bucket, 2); | 412 | GroupID.ToBytes(bucket, 2); |
413 | bucket[18] = 0; //dunno | 413 | bucket[18] = 0; //dunno |
414 | } | 414 | } |
415 | else | 415 | else |
416 | { | 416 | { |
417 | string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket); | 417 | string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket); |
418 | binBucket = binBucket.Remove(0, 14).Trim(); | 418 | binBucket = binBucket.Remove(0, 14).Trim(); |
419 | m_log.WarnFormat("I don't understand a group notice binary bucket of: {0}", binBucket); | 419 | m_log.WarnFormat("I don't understand a group notice binary bucket of: {0}", binBucket); |
420 | 420 | ||
421 | OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket); | 421 | OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket); |
422 | 422 | ||
423 | foreach (string key in binBucketOSD.Keys) | 423 | foreach (string key in binBucketOSD.Keys) |
424 | { | 424 | { |
425 | m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); | 425 | m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); |
426 | } | 426 | } |
427 | 427 | ||
428 | // treat as if no attachment | 428 | // treat as if no attachment |
429 | bucket = new byte[19]; | 429 | bucket = new byte[19]; |
430 | bucket[0] = 0; //dunno | 430 | bucket[0] = 0; //dunno |
431 | bucket[1] = 0; //dunno | 431 | bucket[1] = 0; //dunno |
432 | GroupID.ToBytes(bucket, 2); | 432 | GroupID.ToBytes(bucket, 2); |
433 | bucket[18] = 0; //dunno | 433 | bucket[18] = 0; //dunno |
434 | } | 434 | } |
435 | 435 | ||
436 | 436 | ||
437 | m_groupData.AddGroupNotice(GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); | 437 | m_groupData.AddGroupNotice(GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); |
438 | if (OnNewGroupNotice != null) | 438 | if (OnNewGroupNotice != null) |
439 | { | 439 | { |
440 | OnNewGroupNotice(GroupID, NoticeID); | 440 | OnNewGroupNotice(GroupID, NoticeID); |
441 | } | 441 | } |
442 | 442 | ||
443 | // Build notice IIM | 443 | // Build notice IIM |
444 | GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); | 444 | GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); |
445 | 445 | ||
446 | // Send notice out to everyone that wants notices | 446 | // Send notice out to everyone that wants notices |
447 | foreach( GroupMembersData member in m_groupData.GetGroupMembers(GroupID) ) | 447 | foreach( GroupMembersData member in m_groupData.GetGroupMembers(GroupID) ) |
448 | { | 448 | { |
449 | if( member.AcceptNotices ) | 449 | if( member.AcceptNotices ) |
450 | { | 450 | { |
451 | msg.toAgentID = member.AgentID.Guid; | 451 | msg.toAgentID = member.AgentID.Guid; |
452 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | 452 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); |
453 | 453 | ||
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | 458 | ||
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
462 | // Interop, received special 210 code for ejecting a group member | 462 | // Interop, received special 210 code for ejecting a group member |
463 | // this only works within the comms servers domain, and won't work hypergrid | 463 | // this only works within the comms servers domain, and won't work hypergrid |
464 | // TODO:FIXME: Use a presense server of some kind to find out where the | 464 | // TODO:FIXME: Use a presense server of some kind to find out where the |
465 | // client actually is, and try contacting that region directly to notify them, | 465 | // client actually is, and try contacting that region directly to notify them, |
466 | // or provide the notification via xmlrpc update queue | 466 | // or provide the notification via xmlrpc update queue |
467 | if ((im.dialog == 210)) | 467 | if ((im.dialog == 210)) |
468 | { | 468 | { |
469 | // This is sent from the region that the ejectee was ejected from | 469 | // This is sent from the region that the ejectee was ejected from |
470 | // if it's being delivered here, then the ejectee is here | 470 | // if it's being delivered here, then the ejectee is here |
471 | // so we need to send local updates to the agent. | 471 | // so we need to send local updates to the agent. |
472 | 472 | ||
473 | 473 | ||
474 | if (m_MsgTransferModule != null) | 474 | if (m_MsgTransferModule != null) |
475 | { | 475 | { |
476 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; | 476 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; |
477 | m_MsgTransferModule.SendInstantMessage(im, delegate(bool success) { }); | 477 | m_MsgTransferModule.SendInstantMessage(im, delegate(bool success) { }); |
478 | } | 478 | } |
479 | 479 | ||
480 | UUID ejecteeID = new UUID(im.toAgentID); | 480 | UUID ejecteeID = new UUID(im.toAgentID); |
481 | UUID groupID = new UUID(im.toAgentID); | 481 | UUID groupID = new UUID(im.toAgentID); |
482 | if (m_ActiveClients.ContainsKey(ejecteeID)) | 482 | if (m_ActiveClients.ContainsKey(ejecteeID)) |
483 | { | 483 | { |
484 | m_ActiveClients[ejecteeID].SendAgentDropGroup(groupID); | 484 | m_ActiveClients[ejecteeID].SendAgentDropGroup(groupID); |
485 | } | 485 | } |
486 | 486 | ||
487 | } | 487 | } |
488 | 488 | ||
489 | 489 | ||
490 | 490 | ||
491 | } | 491 | } |
492 | 492 | ||
493 | private void OnGridInstantMessage(GridInstantMessage msg) | 493 | private void OnGridInstantMessage(GridInstantMessage msg) |
494 | { | 494 | { |
495 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 495 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
496 | 496 | ||
497 | // Trigger the above event handler | 497 | // Trigger the above event handler |
498 | OnInstantMessage(null, msg); | 498 | OnInstantMessage(null, msg); |
499 | } | 499 | } |
500 | 500 | ||
501 | 501 | ||
502 | #endregion | 502 | #endregion |
503 | 503 | ||
504 | 504 | ||
505 | private void UpdateScenePresenceWithTitle(UUID AgentID, string Title) | 505 | private void UpdateScenePresenceWithTitle(UUID AgentID, string Title) |
506 | { | 506 | { |
507 | m_log.DebugFormat("[GROUPS] Updating scene title for {0} with title: {1}", AgentID, Title); | 507 | m_log.DebugFormat("[GROUPS] Updating scene title for {0} with title: {1}", AgentID, Title); |
508 | ScenePresence presence = null; | 508 | ScenePresence presence = null; |
509 | lock (m_SceneList) | 509 | lock (m_SceneList) |
510 | { | 510 | { |
511 | foreach (Scene scene in m_SceneList) | 511 | foreach (Scene scene in m_SceneList) |
512 | { | 512 | { |
513 | presence = scene.GetScenePresence(AgentID); | 513 | presence = scene.GetScenePresence(AgentID); |
514 | if (presence != null) | 514 | if (presence != null) |
515 | { | 515 | { |
516 | presence.Grouptitle = Title; | 516 | presence.Grouptitle = Title; |
517 | 517 | ||
518 | // FixMe: Ter suggests a "Schedule" method that I can't find. | 518 | // FixMe: Ter suggests a "Schedule" method that I can't find. |
519 | presence.SendFullUpdateToAllClients(); | 519 | presence.SendFullUpdateToAllClients(); |
520 | } | 520 | } |
521 | } | 521 | } |
522 | } | 522 | } |
523 | } | 523 | } |
524 | 524 | ||
525 | 525 | ||
526 | #region IGroupsModule Members | 526 | #region IGroupsModule Members |
527 | 527 | ||
528 | public event NewGroupNotice OnNewGroupNotice; | 528 | public event NewGroupNotice OnNewGroupNotice; |
529 | 529 | ||
530 | public GroupRecord GetGroupRecord(UUID GroupID) | 530 | public GroupRecord GetGroupRecord(UUID GroupID) |
531 | { | 531 | { |
532 | return m_groupData.GetGroupRecord(GroupID, null); | 532 | return m_groupData.GetGroupRecord(GroupID, null); |
533 | } | 533 | } |
534 | 534 | ||
535 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) | 535 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) |
536 | { | 536 | { |
537 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 537 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
538 | 538 | ||
539 | m_groupData.SetAgentActiveGroup(remoteClient.AgentId, groupID); | 539 | m_groupData.SetAgentActiveGroup(remoteClient.AgentId, groupID); |
540 | 540 | ||
541 | // UpdateClientWithGroupInfo(remoteClient); | 541 | // UpdateClientWithGroupInfo(remoteClient); |
542 | UpdateAllClientsWithGroupInfo(); | 542 | UpdateAllClientsWithGroupInfo(); |
543 | } | 543 | } |
544 | 544 | ||
545 | /// <summary> | 545 | /// <summary> |
546 | /// Get the Role Titles for an Agent, for a specific group | 546 | /// Get the Role Titles for an Agent, for a specific group |
547 | /// </summary> | 547 | /// </summary> |
548 | public List<GroupTitlesData> GroupTitlesRequest(IClientAPI remoteClient, UUID groupID) | 548 | public List<GroupTitlesData> GroupTitlesRequest(IClientAPI remoteClient, UUID groupID) |
549 | { | 549 | { |
550 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 550 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
551 | 551 | ||
552 | List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(remoteClient.AgentId, groupID); | 552 | List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(remoteClient.AgentId, groupID); |
553 | GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(remoteClient.AgentId, groupID); | 553 | GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(remoteClient.AgentId, groupID); |
554 | 554 | ||
555 | List<GroupTitlesData> titles = new List<GroupTitlesData>(); | 555 | List<GroupTitlesData> titles = new List<GroupTitlesData>(); |
556 | foreach (GroupRolesData role in agentRoles) | 556 | foreach (GroupRolesData role in agentRoles) |
557 | { | 557 | { |
558 | GroupTitlesData title = new GroupTitlesData(); | 558 | GroupTitlesData title = new GroupTitlesData(); |
559 | title.Name = role.Name; | 559 | title.Name = role.Name; |
560 | if (agentMembership != null) | 560 | if (agentMembership != null) |
561 | { | 561 | { |
562 | title.Selected = agentMembership.ActiveRole == role.RoleID; | 562 | title.Selected = agentMembership.ActiveRole == role.RoleID; |
563 | } | 563 | } |
564 | title.UUID = role.RoleID; | 564 | title.UUID = role.RoleID; |
565 | 565 | ||
566 | titles.Add(title); | 566 | titles.Add(title); |
567 | } | 567 | } |
568 | 568 | ||
569 | return titles; | 569 | return titles; |
570 | } | 570 | } |
571 | 571 | ||
572 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) | 572 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) |
573 | { | 573 | { |
574 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 574 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
575 | 575 | ||
576 | List<GroupMembersData> data = m_groupData.GetGroupMembers(groupID); | 576 | List<GroupMembersData> data = m_groupData.GetGroupMembers(groupID); |
577 | 577 | ||
578 | foreach (GroupMembersData member in data) | 578 | foreach (GroupMembersData member in data) |
579 | { | 579 | { |
580 | m_log.InfoFormat("[GROUPS] {0} {1}", member.AgentID, member.Title); | 580 | m_log.InfoFormat("[GROUPS] {0} {1}", member.AgentID, member.Title); |
581 | } | 581 | } |
582 | 582 | ||
583 | return data; | 583 | return data; |
584 | 584 | ||
585 | } | 585 | } |
586 | 586 | ||
587 | public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) | 587 | public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) |
588 | { | 588 | { |
589 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 589 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
590 | 590 | ||
591 | List<GroupRolesData> data = m_groupData.GetGroupRoles(groupID); | 591 | List<GroupRolesData> data = m_groupData.GetGroupRoles(groupID); |
592 | 592 | ||
593 | foreach (GroupRolesData member in data) | 593 | foreach (GroupRolesData member in data) |
594 | { | 594 | { |
595 | m_log.InfoFormat("[GROUPS] {0} {1}", member.Title, member.Members); | 595 | m_log.InfoFormat("[GROUPS] {0} {1}", member.Title, member.Members); |
596 | } | 596 | } |
597 | 597 | ||
598 | return data; | 598 | return data; |
599 | 599 | ||
600 | } | 600 | } |
601 | 601 | ||
602 | public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) | 602 | public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) |
603 | { | 603 | { |
604 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 604 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
605 | 605 | ||
606 | List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(groupID); | 606 | List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(groupID); |
607 | 607 | ||
608 | foreach (GroupRoleMembersData member in data) | 608 | foreach (GroupRoleMembersData member in data) |
609 | { | 609 | { |
610 | m_log.InfoFormat("[GROUPS] Av: {0} Role: {1}", member.MemberID, member.RoleID); | 610 | m_log.InfoFormat("[GROUPS] Av: {0} Role: {1}", member.MemberID, member.RoleID); |
611 | } | 611 | } |
612 | 612 | ||
613 | return data; | 613 | return data; |
614 | 614 | ||
615 | 615 | ||
616 | } | 616 | } |
617 | 617 | ||
618 | public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) | 618 | public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) |
619 | { | 619 | { |
620 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 620 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
621 | 621 | ||
622 | GroupProfileData profile = new GroupProfileData(); | 622 | GroupProfileData profile = new GroupProfileData(); |
623 | 623 | ||
624 | GroupRecord groupInfo = m_groupData.GetGroupRecord(groupID, null); | 624 | GroupRecord groupInfo = m_groupData.GetGroupRecord(groupID, null); |
625 | if (groupInfo != null) | 625 | if (groupInfo != null) |
626 | { | 626 | { |
627 | profile.AllowPublish = groupInfo.AllowPublish; | 627 | profile.AllowPublish = groupInfo.AllowPublish; |
628 | profile.Charter = groupInfo.Charter; | 628 | profile.Charter = groupInfo.Charter; |
629 | profile.FounderID = groupInfo.FounderID; | 629 | profile.FounderID = groupInfo.FounderID; |
630 | profile.GroupID = groupID; | 630 | profile.GroupID = groupID; |
631 | profile.GroupMembershipCount = m_groupData.GetGroupMembers(groupID).Count; | 631 | profile.GroupMembershipCount = m_groupData.GetGroupMembers(groupID).Count; |
632 | profile.GroupRolesCount = m_groupData.GetGroupRoles(groupID).Count; | 632 | profile.GroupRolesCount = m_groupData.GetGroupRoles(groupID).Count; |
633 | profile.InsigniaID = groupInfo.GroupPicture; | 633 | profile.InsigniaID = groupInfo.GroupPicture; |
634 | profile.MaturePublish = groupInfo.MaturePublish; | 634 | profile.MaturePublish = groupInfo.MaturePublish; |
635 | profile.MembershipFee = groupInfo.MembershipFee; | 635 | profile.MembershipFee = groupInfo.MembershipFee; |
636 | profile.Money = 0; // TODO: Get this from the currency server? | 636 | profile.Money = 0; // TODO: Get this from the currency server? |
637 | profile.Name = groupInfo.GroupName; | 637 | profile.Name = groupInfo.GroupName; |
638 | profile.OpenEnrollment = groupInfo.OpenEnrollment; | 638 | profile.OpenEnrollment = groupInfo.OpenEnrollment; |
639 | profile.OwnerRole = groupInfo.OwnerRoleID; | 639 | profile.OwnerRole = groupInfo.OwnerRoleID; |
640 | profile.ShowInList = groupInfo.ShowInList; | 640 | profile.ShowInList = groupInfo.ShowInList; |
641 | } | 641 | } |
642 | 642 | ||
643 | GroupMembershipData memberInfo = m_groupData.GetAgentGroupMembership(remoteClient.AgentId, groupID); | 643 | GroupMembershipData memberInfo = m_groupData.GetAgentGroupMembership(remoteClient.AgentId, groupID); |
644 | if (memberInfo != null) | 644 | if (memberInfo != null) |
645 | { | 645 | { |
646 | profile.MemberTitle = memberInfo.GroupTitle; | 646 | profile.MemberTitle = memberInfo.GroupTitle; |
647 | profile.PowersMask = memberInfo.GroupPowers; | 647 | profile.PowersMask = memberInfo.GroupPowers; |
648 | } | 648 | } |
649 | 649 | ||
650 | return profile; | 650 | return profile; |
651 | } | 651 | } |
652 | 652 | ||
653 | public GroupMembershipData[] GetMembershipData(UUID UserID) | 653 | public GroupMembershipData[] GetMembershipData(UUID UserID) |
654 | { | 654 | { |
655 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 655 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
656 | 656 | ||
657 | return m_groupData.GetAgentGroupMemberships(UserID).ToArray(); | 657 | return m_groupData.GetAgentGroupMemberships(UserID).ToArray(); |
658 | } | 658 | } |
659 | 659 | ||
660 | public GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID) | 660 | public GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID) |
661 | { | 661 | { |
662 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 662 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
663 | 663 | ||
664 | return m_groupData.GetAgentGroupMembership(UserID, GroupID); | 664 | return m_groupData.GetAgentGroupMembership(UserID, GroupID); |
665 | } | 665 | } |
666 | 666 | ||
667 | public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) | 667 | public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) |
668 | { | 668 | { |
669 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 669 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
670 | 670 | ||
671 | // TODO: Security Check? | 671 | // TODO: Security Check? |
672 | 672 | ||
673 | m_groupData.UpdateGroup(groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish); | 673 | m_groupData.UpdateGroup(groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish); |
674 | } | 674 | } |
675 | 675 | ||
676 | public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile) | 676 | public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile) |
677 | { | 677 | { |
678 | // TODO: Security Check? | 678 | // TODO: Security Check? |
679 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 679 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
680 | 680 | ||
681 | m_groupData.SetAgentGroupInfo(remoteClient.AgentId, groupID, acceptNotices, listInProfile); | 681 | m_groupData.SetAgentGroupInfo(remoteClient.AgentId, groupID, acceptNotices, listInProfile); |
682 | } | 682 | } |
683 | 683 | ||
684 | public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) | 684 | public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) |
685 | { | 685 | { |
686 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 686 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
687 | 687 | ||
688 | if( m_groupData.GetGroupRecord(UUID.Zero, name) != null ) | 688 | if( m_groupData.GetGroupRecord(UUID.Zero, name) != null ) |
689 | { | 689 | { |
690 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); | 690 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); |
691 | return UUID.Zero; | 691 | return UUID.Zero; |
692 | } | 692 | } |
693 | 693 | ||
694 | UUID GroupID = m_groupData.CreateGroup(name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId); | 694 | UUID GroupID = m_groupData.CreateGroup(name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId); |
695 | 695 | ||
696 | remoteClient.SendCreateGroupReply(GroupID, true, "Group created successfullly"); | 696 | remoteClient.SendCreateGroupReply(GroupID, true, "Group created successfullly"); |
697 | 697 | ||
698 | UpdateClientWithGroupInfo(remoteClient); | 698 | UpdateClientWithGroupInfo(remoteClient); |
699 | 699 | ||
700 | return GroupID; | 700 | return GroupID; |
701 | } | 701 | } |
702 | 702 | ||
703 | public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID) | 703 | public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID) |
704 | { | 704 | { |
705 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 705 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
706 | 706 | ||
707 | // ToDo: check if agent is a member of group and is allowed to see notices? | 707 | // ToDo: check if agent is a member of group and is allowed to see notices? |
708 | 708 | ||
709 | return m_groupData.GetGroupNotices(GroupID).ToArray(); | 709 | return m_groupData.GetGroupNotices(GroupID).ToArray(); |
710 | } | 710 | } |
711 | 711 | ||
712 | /// <summary> | 712 | /// <summary> |
713 | /// Get the title of the agent's current role. | 713 | /// Get the title of the agent's current role. |
714 | /// </summary> | 714 | /// </summary> |
715 | public string GetGroupTitle(UUID avatarID) | 715 | public string GetGroupTitle(UUID avatarID) |
716 | { | 716 | { |
717 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 717 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
718 | 718 | ||
719 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(avatarID); | 719 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(avatarID); |
720 | if (membership != null) | 720 | if (membership != null) |
721 | { | 721 | { |
722 | return membership.GroupTitle; | 722 | return membership.GroupTitle; |
723 | } | 723 | } |
724 | return string.Empty; | 724 | return string.Empty; |
725 | } | 725 | } |
726 | 726 | ||
727 | /// <summary> | 727 | /// <summary> |
728 | /// Change the current Active Group Role for Agent | 728 | /// Change the current Active Group Role for Agent |
729 | /// </summary> | 729 | /// </summary> |
730 | public void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID) | 730 | public void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID) |
731 | { | 731 | { |
732 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 732 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
733 | 733 | ||
734 | m_groupData.SetAgentActiveGroupRole(remoteClient.AgentId, GroupID, TitleRoleID); | 734 | m_groupData.SetAgentActiveGroupRole(remoteClient.AgentId, GroupID, TitleRoleID); |
735 | 735 | ||
736 | UpdateAllClientsWithGroupInfo(); | 736 | UpdateAllClientsWithGroupInfo(); |
737 | } | 737 | } |
738 | 738 | ||
739 | 739 | ||
740 | public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType) | 740 | public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType) |
741 | { | 741 | { |
742 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 742 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
743 | 743 | ||
744 | // TODO: Security Checks? | 744 | // TODO: Security Checks? |
745 | 745 | ||
746 | switch ((OpenMetaverse.GroupRoleUpdate)updateType) | 746 | switch ((OpenMetaverse.GroupRoleUpdate)updateType) |
747 | { | 747 | { |
748 | case OpenMetaverse.GroupRoleUpdate.Create: | 748 | case OpenMetaverse.GroupRoleUpdate.Create: |
749 | m_groupData.AddGroupRole(groupID, UUID.Random(), name, description, title, powers); | 749 | m_groupData.AddGroupRole(groupID, UUID.Random(), name, description, title, powers); |
750 | break; | 750 | break; |
751 | 751 | ||
752 | case OpenMetaverse.GroupRoleUpdate.Delete: | 752 | case OpenMetaverse.GroupRoleUpdate.Delete: |
753 | m_groupData.RemoveGroupRole(groupID, roleID); | 753 | m_groupData.RemoveGroupRole(groupID, roleID); |
754 | break; | 754 | break; |
755 | 755 | ||
756 | case OpenMetaverse.GroupRoleUpdate.UpdateAll: | 756 | case OpenMetaverse.GroupRoleUpdate.UpdateAll: |
757 | case OpenMetaverse.GroupRoleUpdate.UpdateData: | 757 | case OpenMetaverse.GroupRoleUpdate.UpdateData: |
758 | case OpenMetaverse.GroupRoleUpdate.UpdatePowers: | 758 | case OpenMetaverse.GroupRoleUpdate.UpdatePowers: |
759 | m_groupData.UpdateGroupRole(groupID, roleID, name, description, title, powers); | 759 | m_groupData.UpdateGroupRole(groupID, roleID, name, description, title, powers); |
760 | break; | 760 | break; |
761 | 761 | ||
762 | case OpenMetaverse.GroupRoleUpdate.NoUpdate: | 762 | case OpenMetaverse.GroupRoleUpdate.NoUpdate: |
763 | default: | 763 | default: |
764 | // No Op | 764 | // No Op |
765 | break; | 765 | break; |
766 | 766 | ||
767 | } | 767 | } |
768 | 768 | ||
769 | UpdateClientWithGroupInfo(remoteClient); | 769 | UpdateClientWithGroupInfo(remoteClient); |
770 | } | 770 | } |
771 | 771 | ||
772 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) | 772 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) |
773 | { | 773 | { |
774 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 774 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
775 | // Todo: Security check | 775 | // Todo: Security check |
776 | 776 | ||
777 | switch (changes) | 777 | switch (changes) |
778 | { | 778 | { |
779 | case 0: | 779 | case 0: |
780 | // Add | 780 | // Add |
781 | m_groupData.AddAgentToGroupRole(memberID, groupID, roleID); | 781 | m_groupData.AddAgentToGroupRole(memberID, groupID, roleID); |
782 | 782 | ||
783 | break; | 783 | break; |
784 | case 1: | 784 | case 1: |
785 | // Remove | 785 | // Remove |
786 | m_groupData.RemoveAgentFromGroupRole(memberID, groupID, roleID); | 786 | m_groupData.RemoveAgentFromGroupRole(memberID, groupID, roleID); |
787 | 787 | ||
788 | break; | 788 | break; |
789 | default: | 789 | default: |
790 | m_log.ErrorFormat("[GROUPS] {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); | 790 | m_log.ErrorFormat("[GROUPS] {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); |
791 | break; | 791 | break; |
792 | } | 792 | } |
793 | UpdateClientWithGroupInfo(remoteClient); | 793 | UpdateClientWithGroupInfo(remoteClient); |
794 | } | 794 | } |
795 | 795 | ||
796 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) | 796 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) |
797 | { | 797 | { |
798 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 798 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
799 | 799 | ||
800 | 800 | ||
801 | GroupNoticeInfo data = m_groupData.GetGroupNotice(groupNoticeID); | 801 | GroupNoticeInfo data = m_groupData.GetGroupNotice(groupNoticeID); |
802 | 802 | ||
803 | if (data != null) | 803 | if (data != null) |
804 | { | 804 | { |
805 | if (m_MsgTransferModule != null) | 805 | if (m_MsgTransferModule != null) |
806 | { | 806 | { |
807 | GridInstantMessage msg = new GridInstantMessage(); | 807 | GridInstantMessage msg = new GridInstantMessage(); |
808 | msg.imSessionID = UUID.Zero.Guid; | 808 | msg.imSessionID = UUID.Zero.Guid; |
809 | msg.fromAgentID = data.GroupID.Guid; | 809 | msg.fromAgentID = data.GroupID.Guid; |
810 | msg.toAgentID = remoteClient.AgentId.Guid; | 810 | msg.toAgentID = remoteClient.AgentId.Guid; |
811 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 811 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
812 | msg.fromAgentName = "Group Notice From"; | 812 | msg.fromAgentName = "Group Notice From"; |
813 | msg.message = data.noticeData.Subject + "|" + data.Message; | 813 | msg.message = data.noticeData.Subject + "|" + data.Message; |
814 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNoticeRequested; | 814 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNoticeRequested; |
815 | msg.fromGroup = true; | 815 | msg.fromGroup = true; |
816 | msg.offline = (byte)0; | 816 | msg.offline = (byte)0; |
817 | msg.ParentEstateID = 0; | 817 | msg.ParentEstateID = 0; |
818 | msg.Position = Vector3.Zero; | 818 | msg.Position = Vector3.Zero; |
819 | msg.RegionID = UUID.Zero.Guid; | 819 | msg.RegionID = UUID.Zero.Guid; |
820 | msg.binaryBucket = data.BinaryBucket; | 820 | msg.binaryBucket = data.BinaryBucket; |
821 | 821 | ||
822 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | 822 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); |
823 | } | 823 | } |
824 | } | 824 | } |
825 | 825 | ||
826 | } | 826 | } |
827 | 827 | ||
828 | public GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog) | 828 | public GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog) |
829 | { | 829 | { |
830 | m_log.WarnFormat("[GROUPS] {0} is probably not properly implemented", System.Reflection.MethodBase.GetCurrentMethod().Name); | 830 | m_log.WarnFormat("[GROUPS] {0} is probably not properly implemented", System.Reflection.MethodBase.GetCurrentMethod().Name); |
831 | 831 | ||
832 | GridInstantMessage msg = new GridInstantMessage(); | 832 | GridInstantMessage msg = new GridInstantMessage(); |
833 | msg.imSessionID = UUID.Zero.Guid; | 833 | msg.imSessionID = UUID.Zero.Guid; |
834 | msg.toAgentID = agentID.Guid; | 834 | msg.toAgentID = agentID.Guid; |
835 | msg.dialog = dialog; | 835 | msg.dialog = dialog; |
836 | // msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice; | 836 | // msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice; |
837 | msg.fromGroup = true; | 837 | msg.fromGroup = true; |
838 | msg.offline = (byte)0; | 838 | msg.offline = (byte)0; |
839 | msg.ParentEstateID = 0; | 839 | msg.ParentEstateID = 0; |
840 | msg.Position = Vector3.Zero; | 840 | msg.Position = Vector3.Zero; |
841 | msg.RegionID = UUID.Zero.Guid; | 841 | msg.RegionID = UUID.Zero.Guid; |
842 | 842 | ||
843 | GroupNoticeInfo info = m_groupData.GetGroupNotice(groupNoticeID); | 843 | GroupNoticeInfo info = m_groupData.GetGroupNotice(groupNoticeID); |
844 | if (info != null) | 844 | if (info != null) |
845 | { | 845 | { |
846 | msg.fromAgentID = info.GroupID.Guid; | 846 | msg.fromAgentID = info.GroupID.Guid; |
847 | msg.timestamp = info.noticeData.Timestamp; | 847 | msg.timestamp = info.noticeData.Timestamp; |
848 | msg.fromAgentName = info.noticeData.FromName; | 848 | msg.fromAgentName = info.noticeData.FromName; |
849 | msg.message = info.noticeData.Subject + "|" + info.Message; | 849 | msg.message = info.noticeData.Subject + "|" + info.Message; |
850 | msg.binaryBucket = info.BinaryBucket; | 850 | msg.binaryBucket = info.BinaryBucket; |
851 | } | 851 | } |
852 | 852 | ||
853 | return msg; | 853 | return msg; |
854 | } | 854 | } |
855 | 855 | ||
856 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) | 856 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) |
857 | { | 857 | { |
858 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 858 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
859 | 859 | ||
860 | UpdateClientWithGroupInfo(remoteClient); | 860 | UpdateClientWithGroupInfo(remoteClient); |
861 | } | 861 | } |
862 | 862 | ||
863 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) | 863 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) |
864 | { | 864 | { |
865 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 865 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
866 | 866 | ||
867 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation | 867 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation |
868 | m_groupData.AddAgentToGroup(remoteClient.AgentId, groupID, UUID.Zero); | 868 | m_groupData.AddAgentToGroup(remoteClient.AgentId, groupID, UUID.Zero); |
869 | 869 | ||
870 | remoteClient.SendJoinGroupReply(groupID, true); | 870 | remoteClient.SendJoinGroupReply(groupID, true); |
871 | 871 | ||
872 | UpdateClientWithGroupInfo(remoteClient); | 872 | UpdateClientWithGroupInfo(remoteClient); |
873 | } | 873 | } |
874 | 874 | ||
875 | public void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID) | 875 | public void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID) |
876 | { | 876 | { |
877 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 877 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
878 | 878 | ||
879 | m_groupData.RemoveAgentFromGroup(remoteClient.AgentId, GroupID); | 879 | m_groupData.RemoveAgentFromGroup(remoteClient.AgentId, GroupID); |
880 | 880 | ||
881 | remoteClient.SendLeaveGroupReply(GroupID, true); | 881 | remoteClient.SendLeaveGroupReply(GroupID, true); |
882 | 882 | ||
883 | remoteClient.SendAgentDropGroup(GroupID); | 883 | remoteClient.SendAgentDropGroup(GroupID); |
884 | 884 | ||
885 | UpdateClientWithGroupInfo(remoteClient); | 885 | UpdateClientWithGroupInfo(remoteClient); |
886 | } | 886 | } |
887 | 887 | ||
888 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID) | 888 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID) |
889 | { | 889 | { |
890 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 890 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
891 | 891 | ||
892 | // Todo: Security check? | 892 | // Todo: Security check? |
893 | m_groupData.RemoveAgentFromGroup(EjecteeID, GroupID); | 893 | m_groupData.RemoveAgentFromGroup(EjecteeID, GroupID); |
894 | 894 | ||
895 | remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, GroupID, true); | 895 | remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, GroupID, true); |
896 | 896 | ||
897 | if (m_MsgTransferModule != null) | 897 | if (m_MsgTransferModule != null) |
898 | { | 898 | { |
899 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GroupID, null); | 899 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GroupID, null); |
900 | UserProfileData userProfile = m_SceneList[0].CommsManager.UserService.GetUserProfile(EjecteeID); | 900 | UserProfileData userProfile = m_SceneList[0].CommsManager.UserService.GetUserProfile(EjecteeID); |
901 | 901 | ||
902 | if ((groupInfo == null) || (userProfile == null)) | 902 | if ((groupInfo == null) || (userProfile == null)) |
903 | { | 903 | { |
904 | return; | 904 | return; |
905 | } | 905 | } |
906 | 906 | ||
907 | 907 | ||
908 | // Send Message to Ejectee | 908 | // Send Message to Ejectee |
909 | GridInstantMessage msg = new GridInstantMessage(); | 909 | GridInstantMessage msg = new GridInstantMessage(); |
910 | 910 | ||
911 | msg.imSessionID = UUID.Zero.Guid; | 911 | msg.imSessionID = UUID.Zero.Guid; |
912 | msg.fromAgentID = remoteClient.AgentId.Guid; | 912 | msg.fromAgentID = remoteClient.AgentId.Guid; |
913 | // msg.fromAgentID = info.GroupID; | 913 | // msg.fromAgentID = info.GroupID; |
914 | msg.toAgentID = EjecteeID.Guid; | 914 | msg.toAgentID = EjecteeID.Guid; |
915 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 915 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
916 | msg.timestamp = 0; | 916 | msg.timestamp = 0; |
917 | msg.fromAgentName = remoteClient.Name; | 917 | msg.fromAgentName = remoteClient.Name; |
918 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName); | 918 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName); |
919 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | 919 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; |
920 | msg.fromGroup = false; | 920 | msg.fromGroup = false; |
921 | msg.offline = (byte)0; | 921 | msg.offline = (byte)0; |
922 | msg.ParentEstateID = 0; | 922 | msg.ParentEstateID = 0; |
923 | msg.Position = Vector3.Zero; | 923 | msg.Position = Vector3.Zero; |
924 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 924 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; |
925 | msg.binaryBucket = new byte[0]; | 925 | msg.binaryBucket = new byte[0]; |
926 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success,ToString()); }); | 926 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success,ToString()); }); |
927 | 927 | ||
928 | 928 | ||
929 | // Message to ejector | 929 | // Message to ejector |
930 | // Interop, received special 210 code for ejecting a group member | 930 | // Interop, received special 210 code for ejecting a group member |
931 | // this only works within the comms servers domain, and won't work hypergrid | 931 | // this only works within the comms servers domain, and won't work hypergrid |
932 | // TODO:FIXME: Use a presense server of some kind to find out where the | 932 | // TODO:FIXME: Use a presense server of some kind to find out where the |
933 | // client actually is, and try contacting that region directly to notify them, | 933 | // client actually is, and try contacting that region directly to notify them, |
934 | // or provide the notification via xmlrpc update queue | 934 | // or provide the notification via xmlrpc update queue |
935 | 935 | ||
936 | msg = new GridInstantMessage(); | 936 | msg = new GridInstantMessage(); |
937 | msg.imSessionID = UUID.Zero.Guid; | 937 | msg.imSessionID = UUID.Zero.Guid; |
938 | msg.fromAgentID = remoteClient.AgentId.Guid; | 938 | msg.fromAgentID = remoteClient.AgentId.Guid; |
939 | msg.toAgentID = remoteClient.AgentId.Guid; | 939 | msg.toAgentID = remoteClient.AgentId.Guid; |
940 | msg.timestamp = 0; | 940 | msg.timestamp = 0; |
941 | msg.fromAgentName = remoteClient.Name; | 941 | msg.fromAgentName = remoteClient.Name; |
942 | if (userProfile != null) | 942 | if (userProfile != null) |
943 | { | 943 | { |
944 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, userProfile.Name); | 944 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, userProfile.Name); |
945 | } | 945 | } |
946 | else | 946 | else |
947 | { | 947 | { |
948 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, "Unknown member"); | 948 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, "Unknown member"); |
949 | } | 949 | } |
950 | msg.dialog = (byte)210; //interop | 950 | msg.dialog = (byte)210; //interop |
951 | msg.fromGroup = false; | 951 | msg.fromGroup = false; |
952 | msg.offline = (byte)0; | 952 | msg.offline = (byte)0; |
953 | msg.ParentEstateID = 0; | 953 | msg.ParentEstateID = 0; |
954 | msg.Position = Vector3.Zero; | 954 | msg.Position = Vector3.Zero; |
955 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 955 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; |
956 | msg.binaryBucket = new byte[0]; | 956 | msg.binaryBucket = new byte[0]; |
957 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success, ToString()); }); | 957 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success, ToString()); }); |
958 | 958 | ||
959 | 959 | ||
960 | 960 | ||
961 | } | 961 | } |
962 | 962 | ||
963 | 963 | ||
964 | UpdateAllClientsWithGroupInfo(); | 964 | UpdateAllClientsWithGroupInfo(); |
965 | } | 965 | } |
966 | 966 | ||
967 | public void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InvitedAgentID, UUID RoleID) | 967 | public void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InvitedAgentID, UUID RoleID) |
968 | { | 968 | { |
969 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 969 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
970 | m_log.WarnFormat("[GROUPS] GID {0}, AID {1}, RID {2} ", GroupID, InvitedAgentID, RoleID); | 970 | m_log.WarnFormat("[GROUPS] GID {0}, AID {1}, RID {2} ", GroupID, InvitedAgentID, RoleID); |
971 | 971 | ||
972 | // Todo: Security check, probably also want to send some kind of notification | 972 | // Todo: Security check, probably also want to send some kind of notification |
973 | UUID InviteID = UUID.Random(); | 973 | UUID InviteID = UUID.Random(); |
974 | m_log.WarnFormat("[GROUPS] Invite ID: {0}", InviteID); | 974 | m_log.WarnFormat("[GROUPS] Invite ID: {0}", InviteID); |
975 | m_groupData.AddAgentToGroupInvite(InviteID, GroupID, RoleID, InvitedAgentID); | 975 | m_groupData.AddAgentToGroupInvite(InviteID, GroupID, RoleID, InvitedAgentID); |
976 | 976 | ||
977 | if (m_MsgTransferModule != null) | 977 | if (m_MsgTransferModule != null) |
978 | { | 978 | { |
979 | Guid inviteUUID = InviteID.Guid; | 979 | Guid inviteUUID = InviteID.Guid; |
980 | 980 | ||
981 | GridInstantMessage msg = new GridInstantMessage(); | 981 | GridInstantMessage msg = new GridInstantMessage(); |
982 | 982 | ||
983 | msg.imSessionID = inviteUUID; | 983 | msg.imSessionID = inviteUUID; |
984 | 984 | ||
985 | // msg.fromAgentID = remoteClient.AgentId.Guid; | 985 | // msg.fromAgentID = remoteClient.AgentId.Guid; |
986 | msg.fromAgentID = GroupID.Guid; | 986 | msg.fromAgentID = GroupID.Guid; |
987 | msg.toAgentID = InvitedAgentID.Guid; | 987 | msg.toAgentID = InvitedAgentID.Guid; |
988 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 988 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
989 | msg.timestamp = 0; | 989 | msg.timestamp = 0; |
990 | msg.fromAgentName = remoteClient.Name; | 990 | msg.fromAgentName = remoteClient.Name; |
991 | msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.", remoteClient.Name); | 991 | msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.", remoteClient.Name); |
992 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; | 992 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; |
993 | msg.fromGroup = true; | 993 | msg.fromGroup = true; |
994 | msg.offline = (byte)0; | 994 | msg.offline = (byte)0; |
995 | msg.ParentEstateID = 0; | 995 | msg.ParentEstateID = 0; |
996 | msg.Position = Vector3.Zero; | 996 | msg.Position = Vector3.Zero; |
997 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 997 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; |
998 | msg.binaryBucket = new byte[20]; | 998 | msg.binaryBucket = new byte[20]; |
999 | 999 | ||
1000 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success,ToString()); }); | 1000 | m_MsgTransferModule.SendInstantMessage(msg, delegate(bool success) { m_log.DebugFormat("[GROUPS] Message Sent Success: {0}", success,ToString()); }); |
1001 | } | 1001 | } |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | #endregion | 1004 | #endregion |
1005 | 1005 | ||
1006 | void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, GroupMembershipData[] data) | 1006 | void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, GroupMembershipData[] data) |
1007 | { | 1007 | { |
1008 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1008 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1009 | 1009 | ||
1010 | OSDArray AgentData = new OSDArray(1); | 1010 | OSDArray AgentData = new OSDArray(1); |
1011 | OSDMap AgentDataMap = new OSDMap(1); | 1011 | OSDMap AgentDataMap = new OSDMap(1); |
1012 | AgentDataMap.Add("AgentID", OSD.FromUUID(remoteClient.AgentId)); | 1012 | AgentDataMap.Add("AgentID", OSD.FromUUID(remoteClient.AgentId)); |
1013 | AgentData.Add(AgentDataMap); | 1013 | AgentData.Add(AgentDataMap); |
1014 | 1014 | ||
1015 | 1015 | ||
1016 | OSDArray GroupData = new OSDArray(data.Length); | 1016 | OSDArray GroupData = new OSDArray(data.Length); |
1017 | OSDArray NewGroupData = new OSDArray(data.Length); | 1017 | OSDArray NewGroupData = new OSDArray(data.Length); |
1018 | 1018 | ||
1019 | foreach (GroupMembershipData membership in data) | 1019 | foreach (GroupMembershipData membership in data) |
1020 | { | 1020 | { |
1021 | OSDMap GroupDataMap = new OSDMap(6); | 1021 | OSDMap GroupDataMap = new OSDMap(6); |
1022 | OSDMap NewGroupDataMap = new OSDMap(1); | 1022 | OSDMap NewGroupDataMap = new OSDMap(1); |
1023 | 1023 | ||
1024 | GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID)); | 1024 | GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID)); |
1025 | GroupDataMap.Add("GroupPowers", OSD.FromBinary(membership.GroupPowers)); | 1025 | GroupDataMap.Add("GroupPowers", OSD.FromBinary(membership.GroupPowers)); |
1026 | GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices)); | 1026 | GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices)); |
1027 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture)); | 1027 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture)); |
1028 | GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution)); | 1028 | GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution)); |
1029 | GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName)); | 1029 | GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName)); |
1030 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile)); | 1030 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile)); |
1031 | 1031 | ||
1032 | GroupData.Add(GroupDataMap); | 1032 | GroupData.Add(GroupDataMap); |
1033 | NewGroupData.Add(NewGroupDataMap); | 1033 | NewGroupData.Add(NewGroupDataMap); |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | OSDMap llDataStruct = new OSDMap(3); | 1036 | OSDMap llDataStruct = new OSDMap(3); |
1037 | llDataStruct.Add("AgentData", AgentData); | 1037 | llDataStruct.Add("AgentData", AgentData); |
1038 | llDataStruct.Add("GroupData", GroupData); | 1038 | llDataStruct.Add("GroupData", GroupData); |
1039 | llDataStruct.Add("NewGroupData", NewGroupData); | 1039 | llDataStruct.Add("NewGroupData", NewGroupData); |
1040 | 1040 | ||
1041 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 1041 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); |
1042 | 1042 | ||
1043 | if (queue != null) | 1043 | if (queue != null) |
1044 | { | 1044 | { |
1045 | queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct), remoteClient.AgentId); | 1045 | queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct), remoteClient.AgentId); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | } | 1048 | } |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | } | 1051 | } |