Thank you kindly, MCortez for a patch that:
The attached patch provides the necessary infrastructure to support security and authentication features of the xmlrpc server. * Read/Write keys for accessing a Group's xmlrpc service. * Requiring user session verification for write operations.0.6.5-rc1
parent
e2327384e0
commit
8944ab910c
|
@ -36,42 +36,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
interface IGroupDataProvider
|
interface IGroupDataProvider
|
||||||
{
|
{
|
||||||
UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID);
|
UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID);
|
||||||
void UpdateGroup(UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
|
void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
|
||||||
GroupRecord GetGroupRecord(UUID GroupID, string GroupName);
|
GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName);
|
||||||
List<DirGroupsReplyData> FindGroups(string search);
|
List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search);
|
||||||
List<GroupMembersData> GetGroupMembers(UUID GroupID);
|
List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID);
|
||||||
|
|
||||||
void AddGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers);
|
void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers);
|
||||||
void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description, string title, ulong powers);
|
void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers);
|
||||||
void RemoveGroupRole(UUID groupID, UUID roleID);
|
void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID);
|
||||||
List<GroupRolesData> GetGroupRoles(UUID GroupID);
|
List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID);
|
||||||
List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID);
|
List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID);
|
||||||
|
|
||||||
void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID);
|
void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID);
|
||||||
void RemoveAgentFromGroup(UUID AgentID, UUID GroupID);
|
void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID);
|
||||||
|
|
||||||
void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID);
|
void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID);
|
||||||
GroupInviteInfo GetAgentToGroupInvite(UUID inviteID);
|
GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID);
|
||||||
void RemoveAgentToGroupInvite(UUID inviteID);
|
void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID);
|
||||||
|
|
||||||
|
|
||||||
void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID);
|
void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID);
|
||||||
void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID);
|
void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID);
|
||||||
List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID);
|
List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID);
|
||||||
|
|
||||||
void SetAgentActiveGroup(UUID AgentID, UUID GroupID);
|
void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID);
|
||||||
GroupMembershipData GetAgentActiveMembership(UUID AgentID);
|
GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID);
|
||||||
|
|
||||||
void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID);
|
void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID);
|
||||||
void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile);
|
void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile);
|
||||||
|
|
||||||
GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID);
|
GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID);
|
||||||
List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID);
|
List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID);
|
||||||
|
|
||||||
void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
|
void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
|
||||||
GroupNoticeInfo GetGroupNotice(UUID noticeID);
|
GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID);
|
||||||
List<GroupNoticeData> GetGroupNotices(UUID GroupID);
|
List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GroupInviteInfo
|
public class GroupInviteInfo
|
||||||
|
@ -82,4 +82,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
public UUID InviteID = UUID.Zero;
|
public UUID InviteID = UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GroupRequestID
|
||||||
|
{
|
||||||
|
public UUID AgentID = UUID.Zero;
|
||||||
|
public string UserServiceURL = string.Empty;
|
||||||
|
public UUID SessionID = UUID.Zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
private bool m_disableKeepAlive = false;
|
private bool m_disableKeepAlive = false;
|
||||||
|
|
||||||
public XmlRpcGroupDataProvider(string serviceURL, bool disableKeepAlive)
|
private string m_groupReadKey = string.Empty;
|
||||||
|
private string m_groupWriteKey = string.Empty;
|
||||||
|
|
||||||
|
public XmlRpcGroupDataProvider(string serviceURL, bool disableKeepAlive, string groupReadKey, string groupWriteKey)
|
||||||
{
|
{
|
||||||
m_serviceURL = serviceURL.Trim();
|
m_serviceURL = serviceURL.Trim();
|
||||||
m_disableKeepAlive = disableKeepAlive;
|
m_disableKeepAlive = disableKeepAlive;
|
||||||
|
@ -71,12 +74,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
throw new Exception("Please specify a valid ServiceURL for XmlRpcGroupDataProvider in OpenSim.ini, [Groups], XmlRpcServiceURL");
|
throw new Exception("Please specify a valid ServiceURL for XmlRpcGroupDataProvider in OpenSim.ini, [Groups], XmlRpcServiceURL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_groupReadKey = groupReadKey;
|
||||||
|
m_groupWriteKey = groupWriteKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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.
|
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UUID CreateGroup(string name, string charter, bool showInList, UUID insigniaID,
|
public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID,
|
||||||
int membershipFee, bool openEnrollment, bool allowPublish,
|
int membershipFee, bool openEnrollment, bool allowPublish,
|
||||||
bool maturePublish, UUID founderID)
|
bool maturePublish, UUID founderID)
|
||||||
{
|
{
|
||||||
|
@ -145,7 +151,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
| GroupPowers.VoteOnProposal;
|
| GroupPowers.VoteOnProposal;
|
||||||
param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();
|
param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.createGroup", param);
|
|
||||||
|
|
||||||
|
|
||||||
|
Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param);
|
||||||
|
|
||||||
if (respData.Contains("error"))
|
if (respData.Contains("error"))
|
||||||
{
|
{
|
||||||
|
@ -157,7 +166,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return UUID.Parse((string)respData["GroupID"]);
|
return UUID.Parse((string)respData["GroupID"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateGroup(UUID groupID, string charter, bool showInList,
|
public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList,
|
||||||
UUID insigniaID, int membershipFee, bool openEnrollment,
|
UUID insigniaID, int membershipFee, bool openEnrollment,
|
||||||
bool allowPublish, bool maturePublish)
|
bool allowPublish, bool maturePublish)
|
||||||
{
|
{
|
||||||
|
@ -171,10 +180,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
param["AllowPublish"] = allowPublish == true ? 1 : 0;
|
param["AllowPublish"] = allowPublish == true ? 1 : 0;
|
||||||
param["MaturePublish"] = maturePublish == true ? 1 : 0;
|
param["MaturePublish"] = maturePublish == true ? 1 : 0;
|
||||||
|
|
||||||
XmlRpcCall("groups.updateGroup", param);
|
XmlRpcCall(requestID, "groups.updateGroup", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddGroupRole(UUID groupID, UUID roleID, string name, string description,
|
public void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description,
|
||||||
string title, ulong powers)
|
string title, ulong powers)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
|
@ -185,19 +194,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
param["Title"] = title;
|
param["Title"] = title;
|
||||||
param["Powers"] = powers.ToString();
|
param["Powers"] = powers.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.addRoleToGroup", param);
|
XmlRpcCall(requestID, "groups.addRoleToGroup", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveGroupRole(UUID groupID, UUID roleID)
|
public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["GroupID"] = groupID.ToString();
|
param["GroupID"] = groupID.ToString();
|
||||||
param["RoleID"] = roleID.ToString();
|
param["RoleID"] = roleID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.removeRoleFromGroup", param);
|
XmlRpcCall(requestID, "groups.removeRoleFromGroup", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateGroupRole(UUID groupID, UUID roleID, string name, string description,
|
public void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description,
|
||||||
string title, ulong powers)
|
string title, ulong powers)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
|
@ -217,10 +226,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
param["Powers"] = powers.ToString();
|
param["Powers"] = powers.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.updateGroupRole", param);
|
XmlRpcCall(requestID, "groups.updateGroupRole", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupRecord GetGroupRecord(UUID GroupID, string GroupName)
|
public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
if (GroupID != UUID.Zero)
|
if (GroupID != UUID.Zero)
|
||||||
|
@ -232,8 +241,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
param["Name"] = GroupName.ToString();
|
param["Name"] = GroupName.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param);
|
||||||
Hashtable respData = XmlRpcCall("groups.getGroup", param);
|
|
||||||
|
|
||||||
if (respData.Contains("error"))
|
if (respData.Contains("error"))
|
||||||
{
|
{
|
||||||
|
@ -241,15 +249,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
return GroupProfileHashtableToGroupRecord(respData);
|
return GroupProfileHashtableToGroupRecord(respData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupProfileData GetMemberGroupProfile(UUID GroupID, UUID AgentID)
|
public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
|
Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param);
|
||||||
Hashtable respData = XmlRpcCall("groups.getGroup", param);
|
|
||||||
|
|
||||||
if (respData.Contains("error"))
|
if (respData.Contains("error"))
|
||||||
{
|
{
|
||||||
|
@ -257,13 +265,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return new GroupProfileData();
|
return new GroupProfileData();
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupMembershipData MemberInfo = GetAgentGroupMembership(AgentID, GroupID);
|
GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID);
|
||||||
GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
|
GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
|
||||||
|
|
||||||
MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
|
MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
|
||||||
MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
|
MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
|
||||||
|
|
||||||
return MemberGroupProfile;
|
return MemberGroupProfile;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
|
private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
|
||||||
|
@ -314,26 +323,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAgentActiveGroup(UUID AgentID, UUID GroupID)
|
public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.setAgentActiveGroup", param);
|
XmlRpcCall(requestID, "groups.setAgentActiveGroup", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAgentActiveGroupRole(UUID AgentID, UUID GroupID, UUID RoleID)
|
public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
param["SelectedRoleID"] = RoleID.ToString();
|
param["SelectedRoleID"] = RoleID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.setAgentGroupInfo", param);
|
XmlRpcCall(requestID, "groups.setAgentGroupInfo", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAgentGroupInfo(UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
|
public void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
|
@ -341,10 +350,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
param["AcceptNotices"] = AcceptNotices ? "1" : "0";
|
param["AcceptNotices"] = AcceptNotices ? "1" : "0";
|
||||||
param["ListInProfile"] = ListInProfile ? "1" : "0";
|
param["ListInProfile"] = ListInProfile ? "1" : "0";
|
||||||
|
|
||||||
XmlRpcCall("groups.setAgentGroupInfo", param);
|
XmlRpcCall(requestID, "groups.setAgentGroupInfo", param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAgentToGroupInvite(UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
|
public void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["InviteID"] = inviteID.ToString();
|
param["InviteID"] = inviteID.ToString();
|
||||||
|
@ -352,15 +362,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
param["RoleID"] = roleID.ToString();
|
param["RoleID"] = roleID.ToString();
|
||||||
param["GroupID"] = groupID.ToString();
|
param["GroupID"] = groupID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.addAgentToGroupInvite", param);
|
XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupInviteInfo GetAgentToGroupInvite(UUID inviteID)
|
public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["InviteID"] = inviteID.ToString();
|
param["InviteID"] = inviteID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getAgentToGroupInvite", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param);
|
||||||
|
|
||||||
if (respData.Contains("error"))
|
if (respData.Contains("error"))
|
||||||
{
|
{
|
||||||
|
@ -376,59 +387,60 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return inviteInfo;
|
return inviteInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAgentToGroupInvite(UUID inviteID)
|
public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["InviteID"] = inviteID.ToString();
|
param["InviteID"] = inviteID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.removeAgentToGroupInvite", param);
|
XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAgentToGroup(UUID AgentID, UUID GroupID, UUID RoleID)
|
public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
param["RoleID"] = RoleID.ToString();
|
param["RoleID"] = RoleID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.addAgentToGroup", param);
|
XmlRpcCall(requestID, "groups.addAgentToGroup", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAgentFromGroup(UUID AgentID, UUID GroupID)
|
public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.removeAgentFromGroup", param);
|
XmlRpcCall(requestID, "groups.removeAgentFromGroup", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAgentToGroupRole(UUID AgentID, UUID GroupID, UUID RoleID)
|
public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
param["RoleID"] = RoleID.ToString();
|
param["RoleID"] = RoleID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.addAgentToGroupRole", param);
|
XmlRpcCall(requestID, "groups.addAgentToGroupRole", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAgentFromGroupRole(UUID AgentID, UUID GroupID, UUID RoleID)
|
public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
param["RoleID"] = RoleID.ToString();
|
param["RoleID"] = RoleID.ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.removeAgentFromGroupRole", param);
|
XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DirGroupsReplyData> FindGroups(string search)
|
|
||||||
|
public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["Search"] = search;
|
param["Search"] = search;
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.findGroups", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param);
|
||||||
|
|
||||||
List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>();
|
List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>();
|
||||||
|
|
||||||
|
@ -450,13 +462,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return findings;
|
return findings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupMembershipData GetAgentGroupMembership(UUID AgentID, UUID GroupID)
|
public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getAgentGroupMembership", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param);
|
||||||
|
|
||||||
if (respData.Contains("error"))
|
if (respData.Contains("error"))
|
||||||
{
|
{
|
||||||
|
@ -468,12 +480,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupMembershipData GetAgentActiveMembership(UUID AgentID)
|
public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getAgentActiveMembership", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param);
|
||||||
|
|
||||||
if (respData.Contains("error"))
|
if (respData.Contains("error"))
|
||||||
{
|
{
|
||||||
|
@ -483,12 +495,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return HashTableToGroupMembershipData(respData);
|
return HashTableToGroupMembershipData(respData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupMembershipData> GetAgentGroupMemberships(UUID AgentID)
|
|
||||||
|
public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getAgentGroupMemberships", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param);
|
||||||
|
|
||||||
List<GroupMembershipData> memberships = new List<GroupMembershipData>();
|
List<GroupMembershipData> memberships = new List<GroupMembershipData>();
|
||||||
|
|
||||||
|
@ -503,13 +516,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return memberships;
|
return memberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupRolesData> GetAgentGroupRoles(UUID AgentID, UUID GroupID)
|
public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["AgentID"] = AgentID.ToString();
|
param["AgentID"] = AgentID.ToString();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getAgentRoles", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param);
|
||||||
|
|
||||||
List<GroupRolesData> Roles = new List<GroupRolesData>();
|
List<GroupRolesData> Roles = new List<GroupRolesData>();
|
||||||
|
|
||||||
|
@ -531,14 +544,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
return Roles;
|
return Roles;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupRolesData> GetGroupRoles(UUID GroupID)
|
public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getGroupRoles", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param);
|
||||||
|
|
||||||
List<GroupRolesData> Roles = new List<GroupRolesData>();
|
List<GroupRolesData> Roles = new List<GroupRolesData>();
|
||||||
|
|
||||||
|
@ -561,6 +576,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
return Roles;
|
return Roles;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
|
private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
|
||||||
|
@ -598,12 +614,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupMembersData> GetGroupMembers(UUID GroupID)
|
public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getGroupMembers", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param);
|
||||||
|
|
||||||
List<GroupMembersData> members = new List<GroupMembersData>();
|
List<GroupMembersData> members = new List<GroupMembersData>();
|
||||||
|
|
||||||
|
@ -628,14 +644,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
return members;
|
return members;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupRoleMembersData> GetGroupRoleMembers(UUID GroupID)
|
public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getGroupRoleMembers", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param);
|
||||||
|
|
||||||
List<GroupRoleMembersData> members = new List<GroupRoleMembersData>();
|
List<GroupRoleMembersData> members = new List<GroupRoleMembersData>();
|
||||||
|
|
||||||
|
@ -651,16 +668,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
members.Add(data);
|
members.Add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupNoticeData> GetGroupNotices(UUID GroupID)
|
public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["GroupID"] = GroupID.ToString();
|
param["GroupID"] = GroupID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getGroupNotices", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param);
|
||||||
|
|
||||||
List<GroupNoticeData> values = new List<GroupNoticeData>();
|
List<GroupNoticeData> values = new List<GroupNoticeData>();
|
||||||
|
|
||||||
|
@ -679,16 +695,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
values.Add(data);
|
values.Add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
|
||||||
|
|
||||||
public GroupNoticeInfo GetGroupNotice(UUID noticeID)
|
}
|
||||||
|
public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["NoticeID"] = noticeID.ToString();
|
param["NoticeID"] = noticeID.ToString();
|
||||||
|
|
||||||
Hashtable respData = XmlRpcCall("groups.getGroupNotice", param);
|
Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param);
|
||||||
|
|
||||||
|
|
||||||
if (respData.Contains("error"))
|
if (respData.Contains("error"))
|
||||||
|
@ -714,8 +729,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
public void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
|
||||||
public void AddGroupNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
|
|
||||||
{
|
{
|
||||||
string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
|
string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
|
||||||
|
|
||||||
|
@ -728,11 +742,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
param["BinaryBucket"] = binBucket;
|
param["BinaryBucket"] = binBucket;
|
||||||
param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString();
|
param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString();
|
||||||
|
|
||||||
XmlRpcCall("groups.addGroupNotice", param);
|
XmlRpcCall(requestID, "groups.addGroupNotice", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable XmlRpcCall(string function, Hashtable param)
|
private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param)
|
||||||
{
|
{
|
||||||
|
if (requestID == null)
|
||||||
|
{
|
||||||
|
requestID = new GroupRequestID();
|
||||||
|
}
|
||||||
|
param.Add("RequestingAgentID", requestID.AgentID.ToString());
|
||||||
|
param.Add("RequestingAgentUserService", requestID.UserServiceURL);
|
||||||
|
param.Add("RequestingSessionID", requestID.SessionID.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
param.Add("ReadKey", m_groupReadKey);
|
||||||
|
param.Add("WriteKey", m_groupWriteKey);
|
||||||
|
|
||||||
|
|
||||||
IList parameters = new ArrayList();
|
IList parameters = new ArrayList();
|
||||||
parameters.Add(param);
|
parameters.Add(param);
|
||||||
|
|
||||||
|
@ -758,9 +785,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
|
m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
|
||||||
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
|
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
|
||||||
|
|
||||||
foreach (KeyValuePair<object, object> kvp in param)
|
|
||||||
|
foreach (string key in param.Keys)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", kvp.Key.ToString(), kvp.Value.ToString());
|
m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Hashtable respData = new Hashtable();
|
Hashtable respData = new Hashtable();
|
||||||
|
@ -817,6 +845,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GroupNoticeInfo
|
public class GroupNoticeInfo
|
||||||
|
|
|
@ -28,8 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Timers;
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
@ -61,6 +60,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
/// XmlRpcMessagingEnabled = true
|
/// XmlRpcMessagingEnabled = true
|
||||||
/// XmlRpcNoticesEnabled = true
|
/// XmlRpcNoticesEnabled = true
|
||||||
/// XmlRpcDebugEnabled = true
|
/// XmlRpcDebugEnabled = true
|
||||||
|
/// XmlRpcServiceReadKey = 1234
|
||||||
|
/// XmlRpcServiceWriteKey = 1234
|
||||||
///
|
///
|
||||||
/// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for
|
/// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for
|
||||||
/// ; a problem discovered on some Windows based region servers. Only disable
|
/// ; a problem discovered on some Windows based region servers. Only disable
|
||||||
|
@ -79,6 +80,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
private IGroupDataProvider m_groupData = null;
|
private IGroupDataProvider m_groupData = null;
|
||||||
|
|
||||||
|
class GroupRequestIDInfo
|
||||||
|
{
|
||||||
|
public GroupRequestID RequestID = new GroupRequestID();
|
||||||
|
public DateTime LastUsedTMStamp = DateTime.MinValue;
|
||||||
|
}
|
||||||
|
private Dictionary<UUID, GroupRequestIDInfo> m_clientRequestIDInfo = new Dictionary<UUID, GroupRequestIDInfo>();
|
||||||
|
private const int m_clientRequestIDFlushTimeOut = 300000; // Every 5 minutes
|
||||||
|
private Timer m_clientRequestIDFlushTimer = new Timer();
|
||||||
|
|
||||||
|
|
||||||
// Configuration settings
|
// Configuration settings
|
||||||
private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php";
|
private const string m_defaultXmlRpcServiceURL = "http://osflotsam.org/xmlrpc.php";
|
||||||
private bool m_groupsEnabled = false;
|
private bool m_groupsEnabled = false;
|
||||||
|
@ -119,12 +130,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL);
|
string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL);
|
||||||
bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);
|
bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);
|
||||||
|
|
||||||
m_groupData = new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive);
|
string ServiceReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
|
||||||
|
string ServiceWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
|
||||||
|
|
||||||
|
m_groupData = new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive, ServiceReadKey, ServiceWriteKey);
|
||||||
m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL);
|
m_log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL);
|
||||||
|
|
||||||
m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true);
|
m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true);
|
||||||
m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true);
|
m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true);
|
||||||
|
|
||||||
|
m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut;
|
||||||
|
m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache;
|
||||||
|
m_clientRequestIDFlushTimer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlushClientRequestIDInfoCache(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
lock (m_clientRequestIDInfo)
|
||||||
|
{
|
||||||
|
TimeSpan cacheTimeout = new TimeSpan(0,0, m_clientRequestIDFlushTimeOut / 1000);
|
||||||
|
UUID[] CurrentKeys = new UUID[m_clientRequestIDInfo.Count];
|
||||||
|
foreach (UUID key in CurrentKeys)
|
||||||
|
{
|
||||||
|
if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout)
|
||||||
|
{
|
||||||
|
m_clientRequestIDInfo.Remove(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,6 +221,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module.");
|
if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down XmlRpcGroups module.");
|
||||||
|
|
||||||
|
m_clientRequestIDFlushTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -219,12 +254,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
// Used for Notices and Group Invites/Accept/Reject
|
// Used for Notices and Group Invites/Accept/Reject
|
||||||
client.OnInstantMessage += OnInstantMessage;
|
client.OnInstantMessage += OnInstantMessage;
|
||||||
|
|
||||||
|
lock (m_clientRequestIDInfo)
|
||||||
|
{
|
||||||
|
if (m_clientRequestIDInfo.ContainsKey(client.AgentId))
|
||||||
|
{
|
||||||
|
// flush any old RequestID information
|
||||||
|
m_clientRequestIDInfo.Remove(client.AgentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
SendAgentGroupDataUpdate(client, client.AgentId);
|
SendAgentGroupDataUpdate(client, client.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
|
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
|
||||||
{
|
{
|
||||||
GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(avatarID).ToArray();
|
GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray();
|
||||||
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
|
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +313,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart);
|
||||||
|
|
||||||
// TODO: This currently ignores pretty much all the query flags including Mature and sort order
|
// TODO: This currently ignores pretty much all the query flags including Mature and sort order
|
||||||
remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(queryText).ToArray());
|
remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -284,7 +327,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
string activeGroupName = string.Empty;
|
string activeGroupName = string.Empty;
|
||||||
ulong activeGroupPowers = (ulong)GroupPowers.None;
|
ulong activeGroupPowers = (ulong)GroupPowers.None;
|
||||||
|
|
||||||
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(dataForAgentID);
|
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetClientGroupRequestID(remoteClient), dataForAgentID);
|
||||||
if (membership != null)
|
if (membership != null)
|
||||||
{
|
{
|
||||||
activeGroupID = membership.GroupID;
|
activeGroupID = membership.GroupID;
|
||||||
|
@ -297,13 +340,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
SendScenePresenceUpdate(dataForAgentID, activeGroupTitle);
|
SendScenePresenceUpdate(dataForAgentID, activeGroupTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remote_client)
|
private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
string GroupName;
|
string GroupName;
|
||||||
|
|
||||||
GroupRecord group = m_groupData.GetGroupRecord(GroupID, null);
|
GroupRecord group = m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), GroupID, null);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
GroupName = group.GroupName;
|
GroupName = group.GroupName;
|
||||||
|
@ -313,7 +356,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
GroupName = "Unknown";
|
GroupName = "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
remote_client.SendGroupNameReply(GroupID, GroupName);
|
remoteClient.SendGroupNameReply(GroupID, GroupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
||||||
|
@ -324,7 +367,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
|
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
|
||||||
{
|
{
|
||||||
UUID inviteID = new UUID(im.imSessionID);
|
UUID inviteID = new UUID(im.imSessionID);
|
||||||
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(inviteID);
|
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID);
|
||||||
|
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID);
|
||||||
|
|
||||||
|
@ -337,7 +380,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice.");
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice.");
|
||||||
|
|
||||||
// and the sessionid is the role
|
// and the sessionid is the role
|
||||||
m_groupData.AddAgentToGroup(inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID);
|
m_groupData.AddAgentToGroup(GetClientGroupRequestID(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID);
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
msg.imSessionID = UUID.Zero.Guid;
|
msg.imSessionID = UUID.Zero.Guid;
|
||||||
|
@ -361,14 +404,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
// TODO: If the inviter is still online, they need an agent dataupdate
|
// TODO: If the inviter is still online, they need an agent dataupdate
|
||||||
// and maybe group membership updates for the invitee
|
// and maybe group membership updates for the invitee
|
||||||
|
|
||||||
m_groupData.RemoveAgentToGroupInvite(inviteID);
|
m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reject
|
// Reject
|
||||||
if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
|
if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice.");
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice.");
|
||||||
m_groupData.RemoveAgentToGroupInvite(inviteID);
|
m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,7 +425,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID GroupID = new UUID(im.toAgentID);
|
UUID GroupID = new UUID(im.toAgentID);
|
||||||
if (m_groupData.GetGroupRecord(GroupID, null) != null)
|
if (m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), GroupID, null) != null)
|
||||||
{
|
{
|
||||||
UUID NoticeID = UUID.Random();
|
UUID NoticeID = UUID.Random();
|
||||||
string Subject = im.message.Substring(0, im.message.IndexOf('|'));
|
string Subject = im.message.Substring(0, im.message.IndexOf('|'));
|
||||||
|
@ -422,14 +465,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
bucket[18] = 0; //dunno
|
bucket[18] = 0; //dunno
|
||||||
}
|
}
|
||||||
|
|
||||||
m_groupData.AddGroupNotice(GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket);
|
m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket);
|
||||||
if (OnNewGroupNotice != null)
|
if (OnNewGroupNotice != null)
|
||||||
{
|
{
|
||||||
OnNewGroupNotice(GroupID, NoticeID);
|
OnNewGroupNotice(GroupID, NoticeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send notice out to everyone that wants notices
|
// Send notice out to everyone that wants notices
|
||||||
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GroupID))
|
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID))
|
||||||
{
|
{
|
||||||
if (member.AcceptNotices)
|
if (member.AcceptNotices)
|
||||||
{
|
{
|
||||||
|
@ -501,14 +544,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
public GroupRecord GetGroupRecord(UUID GroupID)
|
public GroupRecord GetGroupRecord(UUID GroupID)
|
||||||
{
|
{
|
||||||
return m_groupData.GetGroupRecord(GroupID, null);
|
return m_groupData.GetGroupRecord(null, GroupID, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
|
public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
m_groupData.SetAgentActiveGroup(remoteClient.AgentId, groupID);
|
m_groupData.SetAgentActiveGroup(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID);
|
||||||
|
|
||||||
// Changing active group changes title, active powers, all kinds of things
|
// Changing active group changes title, active powers, all kinds of things
|
||||||
// anyone who is in any region that can see this client, should probably be
|
// anyone who is in any region that can see this client, should probably be
|
||||||
|
@ -524,8 +567,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(remoteClient.AgentId, groupID);
|
GroupRequestID grID = GetClientGroupRequestID(remoteClient);
|
||||||
GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(remoteClient.AgentId, groupID);
|
|
||||||
|
List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(grID, remoteClient.AgentId, groupID);
|
||||||
|
GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(grID, remoteClient.AgentId, groupID);
|
||||||
|
|
||||||
List<GroupTitlesData> titles = new List<GroupTitlesData>();
|
List<GroupTitlesData> titles = new List<GroupTitlesData>();
|
||||||
foreach (GroupRolesData role in agentRoles)
|
foreach (GroupRolesData role in agentRoles)
|
||||||
|
@ -548,7 +593,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
List<GroupMembersData> data = m_groupData.GetGroupMembers(groupID);
|
List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID);
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
{
|
{
|
||||||
foreach (GroupMembersData member in data)
|
foreach (GroupMembersData member in data)
|
||||||
|
@ -565,7 +610,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
List<GroupRolesData> data = m_groupData.GetGroupRoles(groupID);
|
List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID);
|
||||||
|
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
{
|
{
|
||||||
|
@ -583,7 +628,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(groupID);
|
List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID);
|
||||||
|
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
{
|
{
|
||||||
|
@ -604,15 +649,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
GroupProfileData profile = new GroupProfileData();
|
GroupProfileData profile = new GroupProfileData();
|
||||||
|
|
||||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(groupID, null);
|
GroupRequestID grID = GetClientGroupRequestID(remoteClient);
|
||||||
|
|
||||||
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), groupID, null);
|
||||||
if (groupInfo != null)
|
if (groupInfo != null)
|
||||||
{
|
{
|
||||||
profile.AllowPublish = groupInfo.AllowPublish;
|
profile.AllowPublish = groupInfo.AllowPublish;
|
||||||
profile.Charter = groupInfo.Charter;
|
profile.Charter = groupInfo.Charter;
|
||||||
profile.FounderID = groupInfo.FounderID;
|
profile.FounderID = groupInfo.FounderID;
|
||||||
profile.GroupID = groupID;
|
profile.GroupID = groupID;
|
||||||
profile.GroupMembershipCount = m_groupData.GetGroupMembers(groupID).Count;
|
profile.GroupMembershipCount = m_groupData.GetGroupMembers(grID, groupID).Count;
|
||||||
profile.GroupRolesCount = m_groupData.GetGroupRoles(groupID).Count;
|
profile.GroupRolesCount = m_groupData.GetGroupRoles(grID, groupID).Count;
|
||||||
profile.InsigniaID = groupInfo.GroupPicture;
|
profile.InsigniaID = groupInfo.GroupPicture;
|
||||||
profile.MaturePublish = groupInfo.MaturePublish;
|
profile.MaturePublish = groupInfo.MaturePublish;
|
||||||
profile.MembershipFee = groupInfo.MembershipFee;
|
profile.MembershipFee = groupInfo.MembershipFee;
|
||||||
|
@ -623,7 +670,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
profile.ShowInList = groupInfo.ShowInList;
|
profile.ShowInList = groupInfo.ShowInList;
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupMembershipData memberInfo = m_groupData.GetAgentGroupMembership(remoteClient.AgentId, groupID);
|
GroupMembershipData memberInfo = m_groupData.GetAgentGroupMembership(grID, remoteClient.AgentId, groupID);
|
||||||
if (memberInfo != null)
|
if (memberInfo != null)
|
||||||
{
|
{
|
||||||
profile.MemberTitle = memberInfo.GroupTitle;
|
profile.MemberTitle = memberInfo.GroupTitle;
|
||||||
|
@ -637,14 +684,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
return m_groupData.GetAgentGroupMemberships(agentID).ToArray();
|
return m_groupData.GetAgentGroupMemberships(null, agentID).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
|
public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
return m_groupData.GetAgentGroupMembership(agentID, groupID);
|
return m_groupData.GetAgentGroupMembership(null, agentID, groupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
|
public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
|
||||||
|
@ -653,7 +700,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
// TODO: Security Check?
|
// TODO: Security Check?
|
||||||
|
|
||||||
m_groupData.UpdateGroup(groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish);
|
m_groupData.UpdateGroup(GetClientGroupRequestID(remoteClient), groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile)
|
public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile)
|
||||||
|
@ -661,20 +708,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
// TODO: Security Check?
|
// TODO: Security Check?
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
m_groupData.SetAgentGroupInfo(remoteClient.AgentId, groupID, acceptNotices, listInProfile);
|
m_groupData.SetAgentGroupInfo(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID, acceptNotices, listInProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
|
public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
if (m_groupData.GetGroupRecord(UUID.Zero, name) != null)
|
GroupRequestID grID = GetClientGroupRequestID(remoteClient);
|
||||||
|
|
||||||
|
if (m_groupData.GetGroupRecord(grID, UUID.Zero, name) != null)
|
||||||
{
|
{
|
||||||
remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
|
remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID groupID = m_groupData.CreateGroup(name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId);
|
UUID groupID = m_groupData.CreateGroup(grID, name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId);
|
||||||
|
|
||||||
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
|
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
|
||||||
|
|
||||||
|
@ -690,7 +739,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
// ToDo: check if agent is a member of group and is allowed to see notices?
|
// ToDo: check if agent is a member of group and is allowed to see notices?
|
||||||
|
|
||||||
return m_groupData.GetGroupNotices(groupID).ToArray();
|
return m_groupData.GetGroupNotices(GetClientGroupRequestID(remoteClient), groupID).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -700,7 +749,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(avatarID);
|
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(null, avatarID);
|
||||||
if (membership != null)
|
if (membership != null)
|
||||||
{
|
{
|
||||||
return membership.GroupTitle;
|
return membership.GroupTitle;
|
||||||
|
@ -715,7 +764,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
m_groupData.SetAgentActiveGroupRole(remoteClient.AgentId, groupID, titleRoleID);
|
m_groupData.SetAgentActiveGroupRole(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID, titleRoleID);
|
||||||
|
|
||||||
// TODO: Not sure what all is needed here, but if the active group role change is for the group
|
// TODO: Not sure what all is needed here, but if the active group role change is for the group
|
||||||
// the client currently has set active, then we need to do a scene presence update too
|
// the client currently has set active, then we need to do a scene presence update too
|
||||||
|
@ -731,20 +780,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
// TODO: Security Checks?
|
// TODO: Security Checks?
|
||||||
|
|
||||||
|
GroupRequestID grID = GetClientGroupRequestID(remoteClient);
|
||||||
|
|
||||||
switch ((OpenMetaverse.GroupRoleUpdate)updateType)
|
switch ((OpenMetaverse.GroupRoleUpdate)updateType)
|
||||||
{
|
{
|
||||||
case OpenMetaverse.GroupRoleUpdate.Create:
|
case OpenMetaverse.GroupRoleUpdate.Create:
|
||||||
m_groupData.AddGroupRole(groupID, UUID.Random(), name, description, title, powers);
|
m_groupData.AddGroupRole(grID, groupID, UUID.Random(), name, description, title, powers);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenMetaverse.GroupRoleUpdate.Delete:
|
case OpenMetaverse.GroupRoleUpdate.Delete:
|
||||||
m_groupData.RemoveGroupRole(groupID, roleID);
|
m_groupData.RemoveGroupRole(grID, groupID, roleID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenMetaverse.GroupRoleUpdate.UpdateAll:
|
case OpenMetaverse.GroupRoleUpdate.UpdateAll:
|
||||||
case OpenMetaverse.GroupRoleUpdate.UpdateData:
|
case OpenMetaverse.GroupRoleUpdate.UpdateData:
|
||||||
case OpenMetaverse.GroupRoleUpdate.UpdatePowers:
|
case OpenMetaverse.GroupRoleUpdate.UpdatePowers:
|
||||||
m_groupData.UpdateGroupRole(groupID, roleID, name, description, title, powers);
|
m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenMetaverse.GroupRoleUpdate.NoUpdate:
|
case OpenMetaverse.GroupRoleUpdate.NoUpdate:
|
||||||
|
@ -763,16 +814,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
// Todo: Security check
|
// Todo: Security check
|
||||||
|
|
||||||
|
GroupRequestID grID = GetClientGroupRequestID(remoteClient);
|
||||||
|
|
||||||
switch (changes)
|
switch (changes)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
// Add
|
// Add
|
||||||
m_groupData.AddAgentToGroupRole(memberID, groupID, roleID);
|
m_groupData.AddAgentToGroupRole(grID, memberID, groupID, roleID);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// Remove
|
// Remove
|
||||||
m_groupData.RemoveAgentFromGroupRole(memberID, groupID, roleID);
|
m_groupData.RemoveAgentFromGroupRole(grID, memberID, groupID, roleID);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -788,12 +841,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
GroupRequestID grID = GetClientGroupRequestID(remoteClient);
|
||||||
|
|
||||||
GroupNoticeInfo data = m_groupData.GetGroupNotice(groupNoticeID);
|
GroupNoticeInfo data = m_groupData.GetGroupNotice(grID, groupNoticeID);
|
||||||
|
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(data.GroupID, null);
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(grID, data.GroupID, null);
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
msg.imSessionID = UUID.Zero.Guid;
|
msg.imSessionID = UUID.Zero.Guid;
|
||||||
|
@ -825,12 +879,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
msg.dialog = dialog;
|
msg.dialog = dialog;
|
||||||
// msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice;
|
// msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice;
|
||||||
msg.fromGroup = true;
|
msg.fromGroup = true;
|
||||||
msg.offline = (byte)0;
|
msg.offline = (byte)1; // Allow this message to be stored for offline use
|
||||||
msg.ParentEstateID = 0;
|
msg.ParentEstateID = 0;
|
||||||
msg.Position = Vector3.Zero;
|
msg.Position = Vector3.Zero;
|
||||||
msg.RegionID = UUID.Zero.Guid;
|
msg.RegionID = UUID.Zero.Guid;
|
||||||
|
|
||||||
GroupNoticeInfo info = m_groupData.GetGroupNotice(groupNoticeID);
|
GroupNoticeInfo info = m_groupData.GetGroupNotice(null, groupNoticeID);
|
||||||
if (info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
msg.fromAgentID = info.GroupID.Guid;
|
msg.fromAgentID = info.GroupID.Guid;
|
||||||
|
@ -865,7 +919,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
// Should check to see if OpenEnrollment, or if there's an outstanding invitation
|
// Should check to see if OpenEnrollment, or if there's an outstanding invitation
|
||||||
m_groupData.AddAgentToGroup(remoteClient.AgentId, groupID, UUID.Zero);
|
m_groupData.AddAgentToGroup(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID, UUID.Zero);
|
||||||
|
|
||||||
remoteClient.SendJoinGroupReply(groupID, true);
|
remoteClient.SendJoinGroupReply(groupID, true);
|
||||||
|
|
||||||
|
@ -877,7 +931,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
m_groupData.RemoveAgentFromGroup(remoteClient.AgentId, groupID);
|
m_groupData.RemoveAgentFromGroup(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID);
|
||||||
|
|
||||||
remoteClient.SendLeaveGroupReply(groupID, true);
|
remoteClient.SendLeaveGroupReply(groupID, true);
|
||||||
|
|
||||||
|
@ -892,12 +946,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
GroupRequestID grID = GetClientGroupRequestID(remoteClient);
|
||||||
|
|
||||||
// Todo: Security check?
|
// Todo: Security check?
|
||||||
m_groupData.RemoveAgentFromGroup(ejecteeID, groupID);
|
m_groupData.RemoveAgentFromGroup(grID, ejecteeID, groupID);
|
||||||
|
|
||||||
remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, groupID, true);
|
remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, groupID, true);
|
||||||
|
|
||||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(groupID, null);
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(grID, groupID, null);
|
||||||
UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(ejecteeID);
|
UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(ejecteeID);
|
||||||
|
|
||||||
if ((groupInfo == null) || (userProfile == null))
|
if ((groupInfo == null) || (userProfile == null))
|
||||||
|
@ -969,7 +1025,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
// Todo: Security check, probably also want to send some kind of notification
|
// Todo: Security check, probably also want to send some kind of notification
|
||||||
UUID InviteID = UUID.Random();
|
UUID InviteID = UUID.Random();
|
||||||
m_groupData.AddAgentToGroupInvite(InviteID, groupID, roleID, invitedAgentID);
|
m_groupData.AddAgentToGroupInvite(GetClientGroupRequestID(remoteClient), InviteID, groupID, roleID, invitedAgentID);
|
||||||
|
|
||||||
if (m_msgTransferModule != null)
|
if (m_msgTransferModule != null)
|
||||||
{
|
{
|
||||||
|
@ -1031,6 +1087,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GroupRequestID GetClientGroupRequestID(IClientAPI client)
|
||||||
|
{
|
||||||
|
lock (m_clientRequestIDInfo)
|
||||||
|
{
|
||||||
|
if (!m_clientRequestIDInfo.ContainsKey(client.AgentId))
|
||||||
|
{
|
||||||
|
GroupRequestIDInfo info = new GroupRequestIDInfo();
|
||||||
|
info.RequestID.AgentID = client.AgentId;
|
||||||
|
info.RequestID.SessionID = client.SessionId;
|
||||||
|
|
||||||
|
UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(client.AgentId);
|
||||||
|
if (userProfile is ForeignUserProfileData)
|
||||||
|
{
|
||||||
|
// They aren't from around here
|
||||||
|
ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile;
|
||||||
|
info.RequestID.UserServiceURL = fupd.UserServerURI;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// They're a local user, use this:
|
||||||
|
info.RequestID.UserServiceURL = m_sceneList[0].CommsManager.NetworkServersInfo.UserURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_clientRequestIDInfo.Add(client.AgentId, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_clientRequestIDInfo[client.AgentId].LastUsedTMStamp = DateTime.Now;
|
||||||
|
}
|
||||||
|
return m_clientRequestIDInfo[client.AgentId].RequestID;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
|
/// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1120,23 +1207,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update remoteClient with group information about dataForAgentID
|
/// Update remoteClient with group information about dataForAgentID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendAgentGroupDataUpdate(IClientAPI client, UUID dataForAgentID)
|
private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, client.Name);
|
if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
|
||||||
|
|
||||||
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
||||||
|
|
||||||
OnAgentDataUpdateRequest(client, dataForAgentID, UUID.Zero);
|
OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero);
|
||||||
|
|
||||||
|
|
||||||
// Need to send a group membership update to the client
|
// Need to send a group membership update to the client
|
||||||
// UDP version doesn't seem to behave nicely
|
// UDP version doesn't seem to behave nicely. But we're going to send it out here
|
||||||
// client.SendGroupMembership(GetMembershipData(client.AgentId));
|
// with an empty group membership to hopefully remove groups being displayed due
|
||||||
|
// to the core Groups Stub
|
||||||
|
remoteClient.SendGroupMembership( new GroupMembershipData[0] );
|
||||||
|
|
||||||
GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(dataForAgentID).ToArray();
|
GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray();
|
||||||
|
|
||||||
SendGroupMembershipInfoViaCaps(client, dataForAgentID, membershipData);
|
SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData);
|
||||||
client.SendAvatarGroupsReply(dataForAgentID, membershipData);
|
remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1245,11 +1245,15 @@
|
||||||
; The XmlRpcGroups implementation can be used against the publically available service
|
; The XmlRpcGroups implementation can be used against the publically available service
|
||||||
; that I have made available for testing. Your group data is not guarenteed safe
|
; that I have made available for testing. Your group data is not guarenteed safe
|
||||||
; or available if you use this service, but it's available now and seems to work.
|
; or available if you use this service, but it's available now and seems to work.
|
||||||
; The PHP code for the service is available for you to deploy to your own server.
|
; The PHP code for the service is available from the Flotsam project for you to deploy
|
||||||
|
; to your own server. The Flotsam project is located at http://code.google.com/p/flotsam/
|
||||||
;
|
;
|
||||||
;Module = XmlRpcGroups
|
;Module = XmlRpcGroups
|
||||||
|
|
||||||
;XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php
|
;XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php
|
||||||
|
;XmlRpcServiceReadKey = 1234
|
||||||
|
;XmlRpcServiceWriteKey = 1234
|
||||||
|
|
||||||
;XmlRpcMessagingEnabled = true
|
;XmlRpcMessagingEnabled = true
|
||||||
;XmlRpcNoticesEnabled = true
|
;XmlRpcNoticesEnabled = true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue