Exemple #1
0
        /// <summary>
        /// The add user.
        /// </summary>
        /// <param name="user">
        /// The user.
        /// </param>
        /// <param name="inviteUser">
        /// The invite user.
        /// </param>
        public void AddUser(User user, bool inviteUser = true)
        {
            if (!this.Users.Contains(user))
            {
                this.Users.Add(user);
            }

            if (this.Users.Count > 2 || this.IsGroupChat)
            {
                if (!this.IsGroupChat)
                {
                    this.IsGroupChat = true;
                    string rname = Randomness.RandomRoomName();
                    this.GroupUser = new User(rname + "@conference." + this.client.Host);

                    this.client.MucManager.JoinRoom(this.GroupUser.JidUser, this.client.Me.UserName);
                    this.client.RosterManager.AddRosterItem(this.GroupUser.JidUser, this.GroupUser.UserName);
                }

                if (inviteUser)
                {
                    foreach (var u in this.Users)
                    {
                        if (u != this.client.Me)
                        {
                            this.client.MucManager.Invite(u.JidUser, this.GroupUser.JidUser);
                        }
                    }
                }
            }
            this.FireUpdateList();
        }
Exemple #2
0
        public void AddUser(NewUser user, bool InviteUser = true)
        {
            if (!Users.Contains(user))
            {
                Users.Add(user);
            }
            if (Users.Count > 2 || IsGroupChat)
            {
                if (!IsGroupChat)
                {
                    IsGroupChat = true;
                    var rname = Randomness.RandomRoomName();
                    GroupUser = new NewUser(rname + "@conference." + Skylabs.Lobby.Client.Host);

                    _client.MucManager.JoinRoom(GroupUser.User, _client.Me.User.User);
                    _client.RosterManager.AddRosterItem(GroupUser.User, GroupUser.User.User);
                }
                if (InviteUser)
                {
                    foreach (var u in Users)
                    {
                        if (u != _client.Me)
                        {
                            _client.MucManager.Invite(u.User, GroupUser.User);
                        }
                    }
                }
            }

            if (OnUserListChange != null)
            {
                OnUserListChange.Invoke(this, Users);
            }
        }