public frmGroupInfo(Group group, SecondLife client) { InitializeComponent(); while (!IsHandleCreated) { // Force handle creation IntPtr temp = Handle; } GroupProfileCallback = new GroupManager.GroupProfileCallback(GroupProfileHandler); GroupMembersCallback = new GroupManager.GroupMembersCallback(GroupMembersHandler); GroupTitlesCallback = new GroupManager.GroupTitlesCallback(GroupTitlesHandler); AvatarNamesCallback = new AvatarManager.AvatarNamesCallback(AvatarNamesHandler); ImageReceivedCallback = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived); Group = group; Client = client; // Register the callbacks for this form Client.Assets.OnImageReceived += ImageReceivedCallback; Client.Groups.OnGroupProfile += GroupProfileCallback; Client.Groups.OnGroupMembers += GroupMembersCallback; Client.Groups.OnGroupTitles += GroupTitlesCallback; Client.Avatars.OnAvatarNames += AvatarNamesCallback; // Request the group information Client.Groups.RequestGroupProfile(Group.ID); Client.Groups.RequestGroupMembers(Group.ID); Client.Groups.RequestGroupTitles(Group.ID); }
public frmGroupInfo(Group group, SecondLife client) { InitializeComponent(); while (!IsHandleCreated) { // Force handle creation IntPtr temp = Handle; } Group = group; Client = client; Client.Avatars.OnAvatarNames += new AvatarManager.AvatarNamesCallback(AvatarNamesHandler); // Request the group information Client.Groups.BeginGetGroupProfile(Group.ID, new GroupManager.GroupProfileCallback(GroupProfileHandler)); Client.Groups.BeginGetGroupMembers(Group.ID, new GroupManager.GroupMembersCallback(GroupMembersHandler)); Client.Groups.BeginGetGroupTitles(Group.ID, new GroupManager.GroupTitlesCallback(GroupTitlesHandler)); }
private void GroupDataHandler(Packet packet, Simulator simulator) { if (OnCurrentGroups != null) { AgentGroupDataUpdatePacket update = (AgentGroupDataUpdatePacket)packet; Dictionary<LLUUID, Group> currentGroups = new Dictionary<LLUUID, Group>(); foreach (AgentGroupDataUpdatePacket.GroupDataBlock block in update.GroupData) { Group group = new Group(block.GroupID); group.InsigniaID = block.GroupInsigniaID; group.Name = Helpers.FieldToString(block.GroupName); group.Powers = block.GroupPowers; group.Contribution = block.Contribution; group.AcceptNotices = block.AcceptNotices; currentGroups[block.GroupID] = group; } if (OnCurrentGroups != null) { OnCurrentGroups(currentGroups); } } }
/// <summary> /// Update a group's profile and other information /// </summary> /// <param name="group">Group struct to update</param> public void UpdateGroup(LLUUID id, Group group) { libsecondlife.Packets.UpdateGroupInfoPacket cgrp = new UpdateGroupInfoPacket(); //Fill in agent data cgrp.AgentData = new UpdateGroupInfoPacket.AgentDataBlock(); cgrp.AgentData.AgentID = Client.Self.AgentID; cgrp.AgentData.SessionID = Client.Self.SessionID; //Fill in group data cgrp.GroupData = new UpdateGroupInfoPacket.GroupDataBlock(); cgrp.GroupData.GroupID = id; cgrp.GroupData.AllowPublish = group.AllowPublish; cgrp.GroupData.Charter = Helpers.StringToField(group.Charter); cgrp.GroupData.InsigniaID = group.InsigniaID; cgrp.GroupData.MaturePublish = group.MaturePublish; cgrp.GroupData.MembershipFee = group.MembershipFee; cgrp.GroupData.OpenEnrollment = group.OpenEnrollment; cgrp.GroupData.ShowInList = group.ShowInList; //Send it Client.Network.SendPacket(cgrp); }
private void GroupDataHandler(Packet packet, Simulator simulator) { if (OnCurrentGroups != null) { AgentGroupDataUpdatePacket update = (AgentGroupDataUpdatePacket)packet; Dictionary<LLUUID, Group> currentGroups = new Dictionary<LLUUID, Group>(); foreach (AgentGroupDataUpdatePacket.GroupDataBlock block in update.GroupData) { Group group = new Group(); group.ID = block.GroupID; group.InsigniaID = block.GroupInsigniaID; group.Name = Helpers.FieldToUTF8String(block.GroupName); group.Powers = (GroupPowers)block.GroupPowers; group.Contribution = block.Contribution; group.AcceptNotices = block.AcceptNotices; currentGroups[block.GroupID] = group; if (!GroupName2KeyCache.ContainsKey(block.GroupID)) GroupName2KeyCache.SafeAdd(block.GroupID, Helpers.FieldToUTF8String(block.GroupName)); } try { OnCurrentGroups(currentGroups); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } }