Exemple #1
0
        /// <summary>
        /// Start Group Chat
        /// </summary>
        /// <param name="sender">The User Ask To Start Group Chat</param>
        /// <param name="name">The Group Name</param>
        public void Start(NetUser sender, string name)
        {
            GroupChat chat = new GroupChat(sender, name);

            sender.GroupChats.Add(chat);
            sender.Send(NewGroup(chat));
            chat.Add(sender);
            dataBase.AddGroup(name, sender.Email, chat.ID);
        }
Exemple #2
0
        /// <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);
            }
        }