diff --git a/OpenMetaverse/AgentManager.cs b/OpenMetaverse/AgentManager.cs index c7ff91ab..77f8538d 100644 --- a/OpenMetaverse/AgentManager.cs +++ b/OpenMetaverse/AgentManager.cs @@ -542,7 +542,7 @@ namespace OpenMetaverse Type imType = this.GetType(); FieldInfo[] fields = imType.GetFields(); foreach (FieldInfo field in fields){ - result += (field.Name + " = " + field.GetValue(this) ); + result += (field.Name + " = " + field.GetValue(this) + " "); } return result; diff --git a/OpenMetaverse/GroupManager.cs b/OpenMetaverse/GroupManager.cs index b23ff1eb..c1ccbcb1 100644 --- a/OpenMetaverse/GroupManager.cs +++ b/OpenMetaverse/GroupManager.cs @@ -66,9 +66,7 @@ namespace OpenMetaverse public string Description; /// Abilities Associated with Role public GroupPowers Powers; - /// - /// Returns the role's title - /// + /// Returns the role's title /// The role's title public override string ToString() { @@ -124,64 +122,19 @@ namespace OpenMetaverse public int Money; /// public int Contribution; - /// + /// The total number of current members this group has public int GroupMembershipCount; - /// + /// The number of roles this group has configured public int GroupRolesCount; - /// - /// Returns the name of the group - /// - /// + /// Returns the name of the group + /// A string containing the name of the group public override string ToString() { return Name; } } - /// - /// Profile of a group - /// - public struct GroupProfile - { - /// - public UUID ID; - /// Key of Group Insignia - public UUID InsigniaID; - /// Key of Group Founder - public UUID FounderID; - /// Key of Group Role for Owners - public UUID OwnerRole; - /// Name of Group - public string Name; - /// Text of Group Charter - public string Charter; - /// - public string MemberTitle; - /// - public bool OpenEnrollment; - /// - public bool ShowInList; - /// - public GroupPowers Powers; - /// - public bool AcceptNotices; - /// - public bool AllowPublish; - /// - public bool MaturePublish; - /// - public int MembershipFee; - /// - public int Money; - /// - public int Contribution; - /// - public int GroupMembershipCount; - /// - public int GroupRolesCount; - } - /// /// A group Vote /// @@ -195,15 +148,20 @@ namespace OpenMetaverse public int NumVotes; } + /// + /// A group proposal + /// public struct GroupProposal { - + /// The Text of the proposal public string VoteText; - + /// The minimum number of members that must vote before proposal passes or failes public int Quorum; - + /// The required ration of yes/no votes required for vote to pass + /// The three options are Simple Majority, 2/3 Majority, and Unanimous + /// TODO: this should be an enum public float Majority; - + /// The duration in days votes are accepted public int Duration; } @@ -252,54 +210,6 @@ namespace OpenMetaverse public string TaxDate; } - /// - /// - /// - public struct GroupAccountDetails - { - /// - public int IntervalDays; - /// - public int CurrentInterval; - /// - public string StartDate; - /// A list of description/amount pairs making up the account - /// history - public List> HistoryItems; - } - - /// - /// - /// - public struct GroupAccountTransactions - { - /// - public int IntervalDays; - /// - public int CurrentInterval; - /// - public string StartDate; - /// List of all the transactions for this group - public List Transactions; - } - - /// - /// A single transaction made by a group - /// - public struct Transaction - { - /// - public string Time; - /// - public string User; - /// - public int Type; - /// - public string Item; - /// - public int Amount; - } - /// /// Struct representing a group notice /// @@ -470,7 +380,7 @@ namespace OpenMetaverse /// Callback for the profile of a group /// /// - public delegate void GroupProfileCallback(GroupProfile group); + public delegate void GroupProfileCallback(Group group); /// /// Callback for the member list of a group /// @@ -499,16 +409,6 @@ namespace OpenMetaverse /// /// /// - /// - public delegate void GroupAccountDetailsCallback(GroupAccountDetails details); - /// - /// - /// - /// - public delegate void GroupAccountTransactionsCallback(GroupAccountTransactions transactions); - /// - /// - /// /// /// /// @@ -532,49 +432,63 @@ namespace OpenMetaverse public delegate void GroupDroppedCallback(UUID groupID); /// - /// Fired when a member of a group is ejected + /// Fired when a member of a group is ejected, + /// Does not provide member information, only + /// group ID and whether it was successful or not /// /// The Group UUID the member was ejected from - /// the Avatars UUID that was ejected /// true of member was successfully ejected - public delegate void GroupMemberEjectedCallback(UUID groupID, UUID memberID, bool success); + public delegate void GroupMemberEjectedCallback(UUID groupID, bool success); #endregion Delegates #region Events - /// + /// Fired when a AgentGroupDataUpdate packet is received, contains a list of + /// groups avatar is currently a member of public event CurrentGroupsCallback OnCurrentGroups; - /// + /// Fired when a UUIDGroupNameReply packer is receiived, + /// contains name of group requested public event GroupNamesCallback OnGroupNames; - /// + /// Fired when a GroupProfileReply packet is received, + /// contains group profile information for requested group. public event GroupProfileCallback OnGroupProfile; - /// + /// Fired when a GroupMembersReply packet is received, + /// contains a list of group members for requested group public event GroupMembersCallback OnGroupMembers; - /// + /// Fired when a GroupRoleDataReply packet is received, + /// contains details on roles for requested group public event GroupRolesCallback OnGroupRoles; - /// + /// Fired when a GroupRoleMembersReply packet is received, + /// Contails group member<>group role mappings public event GroupRolesMembersCallback OnGroupRolesMembers; - /// + /// Fired when a GroupTitlesReply packet is received, + /// sets the active role title for the current Agent public event GroupTitlesCallback OnGroupTitles; - /// + /// Fired when a GroupAccountSummaryReply packet is received, + /// Contains a summary of group financial information public event GroupAccountSummaryCallback OnGroupAccountSummary; - /// - public event GroupAccountDetailsCallback OnGroupAccountDetails; - /// + /// Fired when a CreateGroupReply packet is received, indicates + /// the successful creation of a new group public event GroupCreatedCallback OnGroupCreated; - /// + /// Fired when a JoinGroupReply packet is received, indicates + /// the Avatar has successfully joined a new group either by + /// or by accepting a group join invitation with public event GroupJoinedCallback OnGroupJoined; - /// + /// Fired when a LeaveGroupReply packet is received, indicates + /// the Avatar has successfully left a group + /// public event GroupLeftCallback OnGroupLeft; - /// + /// Fired when a AgentDropGroup packet is received, contains + /// the of the group dropped public event GroupDroppedCallback OnGroupDropped; - /// Fired when a member of a group is ejected + /// Fired when a GroupMemberEjected packet is received, + /// indicates a member of a group has been ejected public event GroupMemberEjectedCallback OnGroupMemberEjected; #endregion Events - + /// A reference to the current instance private GridClient Client; /// A list of all the lists of group members, indexed by the request ID private Dictionary> GroupMembersCaches; @@ -584,10 +498,11 @@ namespace OpenMetaverse private Dictionary>> GroupRolesMembersCaches; /// Caches group name lookups public InternalDictionary GroupName2KeyCache; + /// - /// + /// Group Management Routines, Methods and Packet Handlers /// - /// + /// A reference to the current instance public GroupManager(GridClient client) { Client = client; @@ -607,8 +522,6 @@ namespace OpenMetaverse Client.Network.RegisterCallback(PacketType.GroupActiveProposalItemReply, new NetworkManager.PacketCallback(GroupActiveProposalItemHandler)); Client.Network.RegisterCallback(PacketType.GroupVoteHistoryItemReply, new NetworkManager.PacketCallback(GroupVoteHistoryItemHandler)); Client.Network.RegisterCallback(PacketType.GroupAccountSummaryReply, new NetworkManager.PacketCallback(GroupAccountSummaryHandler)); - Client.Network.RegisterCallback(PacketType.GroupAccountDetailsReply, new NetworkManager.PacketCallback(GroupAccountDetailsHandler)); - Client.Network.RegisterCallback(PacketType.GroupAccountTransactionsReply, new NetworkManager.PacketCallback(GroupAccountTransactionsHandler)); Client.Network.RegisterCallback(PacketType.CreateGroupReply, new NetworkManager.PacketCallback(CreateGroupReplyHandler)); Client.Network.RegisterCallback(PacketType.JoinGroupReply, new NetworkManager.PacketCallback(JoinGroupReplyHandler)); Client.Network.RegisterCallback(PacketType.LeaveGroupReply, new NetworkManager.PacketCallback(LeaveGroupReplyHandler)); @@ -1114,7 +1027,7 @@ namespace OpenMetaverse if (OnGroupProfile != null) { GroupProfileReplyPacket profile = (GroupProfileReplyPacket)packet; - GroupProfile group = new GroupProfile(); + Group group = new Group(); group.ID = profile.GroupData.GroupID; group.AllowPublish = profile.GroupData.AllowPublish; @@ -1316,40 +1229,6 @@ namespace OpenMetaverse } } - private void GroupAccountDetailsHandler(Packet packet, Simulator simulator) - { - if (OnGroupAccountDetails != null) - { - GroupAccountDetailsReplyPacket details = (GroupAccountDetailsReplyPacket)packet; - GroupAccountDetails account = new GroupAccountDetails(); - - account.CurrentInterval = details.MoneyData.CurrentInterval; - account.IntervalDays = details.MoneyData.IntervalDays; - account.StartDate = Helpers.FieldToUTF8String(details.MoneyData.StartDate); - - account.HistoryItems = new List>(); - - foreach (GroupAccountDetailsReplyPacket.HistoryDataBlock block in details.HistoryData) - { - KeyValuePair item = - new KeyValuePair(Helpers.FieldToUTF8String(block.Description), block.Amount); - - account.HistoryItems.Add(item); - } - - try { OnGroupAccountDetails(account); } - catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } - } - } - - private void GroupAccountTransactionsHandler(Packet packet, Simulator simulator) - { - GroupAccountTransactionsReplyPacket reply = (GroupAccountTransactionsReplyPacket)packet; - - Logger.Log("Got a GroupAccountTransactionsReply packet, implement this callback!\n" + - reply.ToString(), Helpers.LogLevel.Error, Client); - } - private void CreateGroupReplyHandler(Packet packet, Simulator simulator) { if (OnGroupCreated != null) @@ -1412,15 +1291,16 @@ namespace OpenMetaverse /// /// The EjectGroupMemberReply packet /// The simulator where the message originated + /// This is a silly packet, it doesn't provide you with the ejectees UUID private void EjectGroupMemberReplyHandler(Packet packet, Simulator simulator) { EjectGroupMemberReplyPacket reply = (EjectGroupMemberReplyPacket)packet; // TODO: On Success remove the member from the cache(s) - + if(OnGroupMemberEjected != null) { - try { OnGroupMemberEjected(reply.GroupData.GroupID, reply.AgentData.AgentID, reply.EjectData.Success); } + try { OnGroupMemberEjected(reply.GroupData.GroupID, reply.EjectData.Success); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } } diff --git a/Programs/examples/groupmanager/frmGroupInfo.cs b/Programs/examples/groupmanager/frmGroupInfo.cs index 36f487e5..628b720d 100644 --- a/Programs/examples/groupmanager/frmGroupInfo.cs +++ b/Programs/examples/groupmanager/frmGroupInfo.cs @@ -15,7 +15,7 @@ namespace groupmanager { Group Group; GridClient Client; - GroupProfile Profile = new GroupProfile(); + Group Profile = new Group(); Dictionary Members = new Dictionary(); Dictionary Titles = new Dictionary(); Dictionary MemberData = new Dictionary(); @@ -68,7 +68,7 @@ namespace groupmanager Client.Avatars.OnAvatarNames -= AvatarNamesCallback; } - private void GroupProfileHandler(GroupProfile profile) + private void GroupProfileHandler(Group profile) { Profile = profile;