示例#1
0
        private void channameTextBox_TextChanged(object sender, EventArgs e)
        {
            string path = "";

            ttclient.GetChannelPath(chan.nParentID, ref path);
            path += channameTextBox.Text;
            chanpathTextBox.Text = path;
        }
示例#2
0
        void ttclient_OnCmdUserLoggedIn(User user)
        {
            ListViewItem item = new ListViewItem();

            item.Text = user.nUserID.ToString();
            item.SubItems.Add(user.szNickname);
            item.SubItems.Add(user.szUsername);
            string chanpath = "";

            if (user.nChannelID > 0)
            {
                ttclient.GetChannelPath(user.nChannelID, ref chanpath);
            }
            item.SubItems.Add(chanpath);
            item.SubItems.Add(user.szIPAddress);
            item.SubItems.Add(user.szStatusMsg);
            item.SubItems.Add((user.uUserType & UserType.USERTYPE_ADMIN) == UserType.USERTYPE_ADMIN ? "Admin" : "Default");
            item.SubItems.Add(user.nUserData.ToString());
            item.Tag = user.nUserID;
            listview.Items.Add(item);
        }
示例#3
0
        public UserAccountsDlg(TeamTalkBase tt)
        {
            ttclient     = tt;
            create_cmdid = 0;
            del_cmdid    = 0;

            InitializeComponent();
            this.CenterToScreen();

            listView1.Columns.Add("Username");
            listView1.Columns.Add("Password");
            listView1.Columns.Add("User Type");
            listView1.Columns.Add("UserData");
            listView1.Columns.Add("Note");

            Channel[] channels;
            if (ttclient.GetServerChannels(out channels))
            {
                foreach (Channel chan in channels)
                {
                    string channel = "";
                    //auto-op only works for static channels
                    if (chan.uChannelType.HasFlag(ChannelType.CHANNEL_PERMANENT) &&
                        ttclient.GetChannelPath(chan.nChannelID, ref channel))
                    {
                        availchanListBox.Items.Add(channel);
                    }
                }
            }

            ttclient.OnCmdProcessing  += new TeamTalkBase.CommandProcessing(ttclient_OnCmdProcessing);
            ttclient.OnCmdError       += new TeamTalkBase.CommandError(ttclient_OnCmdError);
            ttclient.OnCmdSuccess     += new TeamTalkBase.CommandSuccess(ttclient_OnCmdSuccess);
            ttclient.OnCmdUserAccount += new TeamTalkBase.ListUserAccount(ttclient_OnCmdUserAccount);

            //hopefully you have less than 100000 accounts
            list_cmdid = ttclient.DoListUserAccounts(0, 100000);
        }
示例#4
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }
            ClearControls();

            string username = listView1.SelectedItems[0].SubItems[0].Text;

            foreach (UserAccount acc in all_accounts)
            {
                if (acc.szUsername == username)
                {
                    usernameTextBox.Text       = acc.szUsername;
                    passwordTextBox.Text       = acc.szPassword;
                    defuserRadioButton.Checked = (acc.uUserType & UserType.USERTYPE_DEFAULT) == UserType.USERTYPE_DEFAULT;
                    adminRadioButton.Checked   = (acc.uUserType & UserType.USERTYPE_ADMIN) == UserType.USERTYPE_ADMIN;
                    userdataTextBox.Text       = acc.nUserData.ToString();
                    noteTextBox.Text           = acc.szNote;
                    initchanTextBox.Text       = acc.szInitChannel;
                    bitrateNumericUpDown.Value = acc.nAudioCodecBpsLimit / 1000;
                    foreach (int id in acc.autoOperatorChannels)
                    {
                        string channel = "";
                        if (ttclient.GetChannelPath(id, ref channel))
                        {
                            selchanListBox.Items.Add(channel);
                        }
                    }


                    UserRight rights = acc.uUserRights;
                    ShowUserRights(rights);
                    break;
                }
            }
        }
示例#5
0
        public ChannelDlg(TeamTalkBase tt, ChannelDlgType dlgtype, int channelid, int parentid)
        {
            ttclient     = tt;
            this.dlgtype = dlgtype;

            InitializeComponent();

            if (channelid > 0 && ttclient.GetChannel(channelid, ref chan))
            {
                string path = "";
                ttclient.GetChannelPath(channelid, ref path);
                chanpathTextBox.Text         = path;
                channameTextBox.Text         = chan.szName;
                topicTextBox.Text            = chan.szTopic;
                passwdTextBox.Text           = chan.szPassword;
                maxusersNumericUpDown.Value  = chan.nMaxUsers;
                diskquotaNumericUpDown.Value = chan.nDiskQuota / 1024;
                permchannelCheckBox.Checked  = chan.uChannelType.HasFlag(ChannelType.CHANNEL_PERMANENT);
                singletxCheckBox.Checked     = chan.uChannelType.HasFlag(ChannelType.CHANNEL_SOLO_TRANSMIT);
                classroomCheckBox.Checked    = chan.uChannelType.HasFlag(ChannelType.CHANNEL_CLASSROOM);
                oprecvonlyCheckBox.Checked   = chan.uChannelType.HasFlag(ChannelType.CHANNEL_OPERATOR_RECVONLY);
                novoiceactCheckBox.Checked   = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_VOICEACTIVATION);
                norecordCheckBox.Checked     = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_RECORDING);

                switch (chan.audiocodec.nCodec)
                {
                case Codec.SPEEX_CODEC:
                    tabControl1.SelectedIndex   = (int)CodecTabs.SPEEX_CBR_TAB;
                    speexnbRadioButton.Checked  = chan.audiocodec.speex.nBandmode == 0;
                    speexwbRadioButton.Checked  = chan.audiocodec.speex.nBandmode == 1;
                    speexuwbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 2;
                    speexqualityTrackBar.Value  = chan.audiocodec.speex.nQuality;
                    speexTxInterval.Value       = chan.audiocodec.speex.nTxIntervalMSec;
                    speexstereoCheckBox.Checked = chan.audiocodec.speex.bStereoPlayback;
                    break;

                case Codec.SPEEX_VBR_CODEC:
                    tabControl1.SelectedIndex          = (int)CodecTabs.SPEEX_VBR_TAB;
                    speexvbrnbRadioButton.Checked      = chan.audiocodec.speex_vbr.nBandmode == 0;
                    speexvbrwbRadioButton.Checked      = chan.audiocodec.speex_vbr.nBandmode == 1;
                    speexvbruwbRadioButton.Checked     = chan.audiocodec.speex_vbr.nBandmode == 2;
                    speexvbrqualityTrackBar.Value      = chan.audiocodec.speex_vbr.nQuality;
                    speexvbrbitrateNumericUpDown.Value = chan.audiocodec.speex_vbr.nBitRate;
                    speexvbrmaxbrNumericUpDown.Value   = chan.audiocodec.speex_vbr.nMaxBitRate;
                    speexvbrTxInterval.Value           = chan.audiocodec.speex_vbr.nTxIntervalMSec;
                    speexvbrdtxCheckBox.Checked        = chan.audiocodec.speex_vbr.bDTX;
                    speexvbrstereoCheckBox.Checked     = chan.audiocodec.speex_vbr.bStereoPlayback;
                    break;

                case Codec.OPUS_CODEC:
                    tabControl1.SelectedIndex = (int)CodecTabs.OPUS_TAB;
                    int i = opussamplerateComboBox.FindString(chan.audiocodec.opus.nSampleRate.ToString());
                    if (i < 0)
                    {
                        i = 0;
                    }
                    opussamplerateComboBox.SelectedIndex = i;
                    opuschannelsComboBox.SelectedIndex   = chan.audiocodec.opus.nChannels - 1;
                    switch (chan.audiocodec.opus.nApplication)
                    {
                    case OpusConstants.OPUS_APPLICATION_AUDIO:
                        opusaudioRadioButton.Checked = true;
                        break;

                    case OpusConstants.OPUS_APPLICATION_VOIP:
                        opusvoipRadioButton.Checked = true;
                        break;

                    default:
                        opusvoipRadioButton.Checked = true;
                        break;
                    }
                    opuscomplexityNumericUpDown.Value = chan.audiocodec.opus.nComplexity;
                    opusfecCheckBox.Checked           = chan.audiocodec.opus.bFEC;
                    opusdtxCheckBox.Checked           = chan.audiocodec.opus.bDTX;
                    opusvbrCheckBox.Checked           = chan.audiocodec.opus.bVBR;
                    opusvbrconstraintCheckBox.Checked = chan.audiocodec.opus.bVBRConstraint;
                    opusbitrateNumericUpDown.Value    = chan.audiocodec.opus.nBitRate / 1000;
                    opusTxIntervalNumericUpDown.Value = chan.audiocodec.opus.nTxIntervalMSec;
                    break;
                }

                agcCheckBox.Checked     = chan.audiocfg.bEnableAGC;
                gainlevelTrackBar.Value = chan.audiocfg.nGainLevel;
            }
            else
            {
                string path = "";
                ttclient.GetChannelPath(parentid, ref path);
                chanpathTextBox.Text = path;
                chan.nParentID       = parentid;
            }

            UserType usertype = ttclient.GetMyUserType();

            switch (dlgtype)
            {
            case ChannelDlgType.JOIN_CHANNEL:
                //when joining a channel 'disk quota' and 'max users' are set to server's default values
                diskquotaNumericUpDown.ReadOnly = true;
                maxusersNumericUpDown.ReadOnly  = true;
                goto case ChannelDlgType.CREATE_CHANNEL;

            case ChannelDlgType.CREATE_CHANNEL:
                opussamplerateComboBox.SelectedIndex = 0;
                opuschannelsComboBox.SelectedIndex   = 0;
                opuschannelsComboBox.SelectedIndex   = 0;
                //only admins can change static channel property
                permchannelCheckBox.Enabled     = ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS);
                diskquotaNumericUpDown.ReadOnly = !ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS);
                agcCheckBox.Checked             = true;
                gainlevelTrackBar.Value         = 8000;
                break;

            case ChannelDlgType.UPDATE_CHANNEL:
                break;

            case ChannelDlgType.VIEW_CHANNEL:
                channameTextBox.ReadOnly        = true;
                topicTextBox.ReadOnly           = true;
                passwdTextBox.ReadOnly          = true;
                oppasswdTextBox.ReadOnly        = true;
                maxusersNumericUpDown.ReadOnly  = true;
                diskquotaNumericUpDown.ReadOnly = true;
                permchannelCheckBox.Enabled     = false;
                singletxCheckBox.Enabled        = false;
                classroomCheckBox.Enabled       = false;
                oprecvonlyCheckBox.Enabled      = false;
                novoiceactCheckBox.Enabled      = false;
                norecordCheckBox.Enabled        = false;
                agcCheckBox.Enabled             = false;
                gainlevelTrackBar.Enabled       = false;
                tabControl1.Enabled             = false;
                break;
            }
        }