예제 #1
0
        private void createButton_Click(object sender, EventArgs e)
        {
            account_create            = new UserAccount();;
            account_create.szUsername = usernameTextBox.Text;
            account_create.szPassword = passwordTextBox.Text;
            if (adminRadioButton.Checked)
            {
                account_create.uUserType = UserType.USERTYPE_ADMIN;
            }
            else
            {
                account_create.uUserType = UserType.USERTYPE_DEFAULT;
            }

            if (multiloginCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_MULTI_LOGIN;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_MULTI_LOGIN;
            }

            if (viewallCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_VIEW_ALL_USERS;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_VIEW_ALL_USERS;
            }

            if (permchannelsCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_MODIFY_CHANNELS;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_MODIFY_CHANNELS;
            }

            if (tempchanCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_CREATE_TEMPORARY_CHANNEL;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_CREATE_TEMPORARY_CHANNEL;
            }

            if (bcastCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_TEXTMESSAGE_BROADCAST;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_TEXTMESSAGE_BROADCAST;
            }

            if (kickCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_KICK_USERS;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_KICK_USERS;
            }

            if (banCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_BAN_USERS;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_BAN_USERS;
            }

            if (moveuserCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_MOVE_USERS;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_MOVE_USERS;
            }

            if (operatorenableCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_OPERATOR_ENABLE;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_OPERATOR_ENABLE;
            }

            if (uploadCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_UPLOAD_FILES;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_UPLOAD_FILES;
            }

            if (downloadCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_DOWNLOAD_FILES;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_DOWNLOAD_FILES;
            }

            if (srvupdCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_UPDATE_SERVERPROPERTIES;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_UPDATE_SERVERPROPERTIES;
            }

            if (voicetxCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_TRANSMIT_VOICE;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_TRANSMIT_VOICE;
            }

            if (vidcapCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_TRANSMIT_VIDEOCAPTURE;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_TRANSMIT_VIDEOCAPTURE;
            }

            if (audfilesCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_AUDIO;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_AUDIO;
            }

            if (vidfileCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_VIDEO;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_TRANSMIT_MEDIAFILE_VIDEO;
            }

            if (desktopCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_TRANSMIT_DESKTOP;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_TRANSMIT_DESKTOP;
            }

            if (desktopinputCheckBox.Checked)
            {
                account_create.uUserRights |= UserRight.USERRIGHT_TRANSMIT_DESKTOPINPUT;
            }
            else
            {
                account_create.uUserRights &= ~UserRight.USERRIGHT_TRANSMIT_DESKTOPINPUT;
            }

            account_create.szNote              = noteTextBox.Text;
            account_create.nUserData           = int.Parse(userdataTextBox.Text);
            account_create.szInitChannel       = initchanTextBox.Text;
            account_create.nAudioCodecBpsLimit = (int)bitrateNumericUpDown.Value * 1000;

            account_create.autoOperatorChannels = new int[TeamTalk.TT_CHANNELS_OPERATOR_MAX];
            int c = 0;

            //process auto-operator channels
            foreach (string channel in selchanListBox.Items)
            {
                int id = ttclient.GetChannelIDFromPath(channel);
                if (id > 0)
                {
                    account_create.autoOperatorChannels[c++] = id;
                }
            }


            create_cmdid = ttclient.DoNewUserAccount(account_create);
            if (create_cmdid > 0)
            {
                EnableControls(false);
            }
        }