/// <summary> /// Kick User From Group /// </summary> /// <param name="sender">The User Ask For Kick</param> /// <param name="groupUser">Group User Containing The User To Kick And The Group ID</param> public void Kick(NetUser sender, GroupUser groupUser) { GroupChat chat = sender.GroupChats[groupUser.ID]; if (chat.IsAdmin(sender)) { NetUser recipient = chat[groupUser.User]; SerializableObject <Status> obj = new SerializableObject <Status>(Status.GroupKick, groupUser.ID); recipient.Send(obj); chat.Kick(recipient); recipient.GroupChats.Remove(chat); } else { sender.SendError("Not Admin", false); } }
/// <summary> /// Invite User To Group Chat /// </summary> /// <param name="sender">The User Ask For Invite</param> /// <param name="groupUser">Group User Containing The User To Invite And The Group ID</param> public void Invite(NetUser sender, GroupUser groupUser) { GroupChat chat = sender.GroupChats[groupUser.ID]; if (chat.IsAdmin(sender)) { NetUser recipient = ServerUsers[groupUser.User]; if (!recipient.GroupChats.Contains(groupUser.ID)) { recipient.Send(NewGroup(chat)); chat.Add(recipient); recipient.GroupChats.Add(chat); } else { sender.SendError("Alredy In Group", false); } } else { sender.SendError("Not Admin", false); } }