Exemplo n.º 1
0
        void ttserver_OnUserCreateUserAccount(ref ClientErrorMsg lpClientErrorMsg, ref User lpUser, ref UserAccount lpUserAccount)
        {
            String str = String.Format("User {0} is creating useraccount {1}",
            lpUser.szUsername, lpUserAccount.szUsername);
            Console.WriteLine(str);

            switch (lpUser.uUserType)
            {
                case UserType.USERTYPE_ADMIN:

                    // remove existing user account
                    UserAccount ua = new UserAccount();
                    foreach (UserAccount u in useraccounts)
                    {
                        if (u.szUsername.Equals(lpUserAccount.szUsername))
                            ua = u;
                    }
                    useraccounts.Remove(ua);

                    // add user account to list
                    useraccounts.Add(lpUserAccount);

                    lpClientErrorMsg.nErrorNo = (int)ClientError.SUCCESS;
                    break;
                case UserType.USERTYPE_DEFAULT:
                    lpClientErrorMsg.nErrorNo = (int)ClientError.CMDERR_NOT_AUTHORIZED;
                    lpClientErrorMsg.szErrorMsg = "Not allowed!";
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 2
0
        void ttserver_OnUserLogin(ref ClientErrorMsg lpClientErrorMsg, ref User lpUser, ref UserAccount lpUserAccount)
        {
            String str = String.Format("Login attempt from IP {0}, username={1}, password={2}",
                           lpUser.szIPAddress, lpUserAccount.szUsername,
                           lpUserAccount.szPassword);
            Console.WriteLine(str);

            foreach (UserAccount u in useraccounts)
            {
                // validate user account
                if (u.szUsername.Equals(lpUserAccount.szUsername) &&
                   u.szPassword.Equals(lpUserAccount.szPassword))
                {
                    // manually copy every field
                    lpUserAccount.szUsername = u.szUsername;
                    lpUserAccount.szPassword = u.szPassword;
                    lpUserAccount.uUserRights = u.uUserRights;
                    lpUserAccount.uUserType = UserType.USERTYPE_ADMIN;
                    lpClientErrorMsg.nErrorNo = (int)ClientError.SUCCESS;
                    return;
                }
            }

            // login rejected
            lpClientErrorMsg.nErrorNo = (int)ClientError.CMDERR_INVALID_ACCOUNT;
            lpClientErrorMsg.szErrorMsg = "Invalid username or password";
        }
Exemplo n.º 3
0
 /**
  * @brief Get the local client instance's #BearWare.UserAccount.
  *
  * This information can be retrieved after
  * TeamTalk.OnCmdMyselfLoggedIn() event.
  *
  * @param lpUserAccount The local client's user account registered on
  * the server. Note that the @a szPassword field of #BearWare.UserAccount
  * will not be set.
  * @see TeamTalk.DoLogin */
 public bool GetMyUserAccount(ref UserAccount lpUserAccount)
 {
     return TTDLL.TT_GetMyUserAccount(m_ttInst, ref lpUserAccount);
 }
Exemplo n.º 4
0
 void ttclient_OnCmdMyselfLoggedIn(int nMyUserID, UserAccount useraccount)
 {
     AddStatusMessage("Logged on to server successfully");
     string s = String.Format("User account information\r\n" +
         "Username: {0}\r\n" +
         "UserType: {1}\r\n" +
         "UserData: {2}\r\n" +
         "UserRights: {3}\r\n" +
         "Note: {4}\r\n" +
         "Initial Channel: {5}\r\n",
         useraccount.szUsername,
         useraccount.uUserType.ToString(),
         useraccount.nUserData,
         useraccount.uUserRights.ToString(),
         useraccount.szNote,
         useraccount.szInitChannel);
     AddStatusMessage(s);
 }
Exemplo n.º 5
0
 private void MakeUserAccount(string nickname, string username, string password, UserRight userrights)
 {
     TeamTalk ttclient = NewClientInstance();
     Connect(ttclient);
     Login(ttclient, nickname, ADMIN_USERNAME, ADMIN_PASSWORD);
     UserAccount useraccount = new UserAccount();
     useraccount.szUsername = username;
     useraccount.szPassword = password;
     useraccount.uUserRights = userrights;
     useraccount.uUserType = UserType.USERTYPE_DEFAULT;
     Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoNewUserAccount(useraccount), DEF_WAIT));
     Assert.IsTrue(ttclient.Disconnect());
 }
Exemplo n.º 6
0
 /**
  * @brief Issue command to create a new user account on the
  * server.
  *
  * Check out section @ref useradmin to see how the server handles
  * users.
  *
  * Only ::USERTYPE_ADMIN can issue this command.
  *
  * Possible errors:
  * - #ClientError ::CMDERR_NOT_LOGGEDIN
  * - #ClientError ::CMDERR_NOT_AUTHORIZED
  * - #ClientError ::CMDERR_INVALID_USERNAME
  *
  * @param lpUserAccount The properties of the user account to create.
  * @return Returns command ID which will be passed in
  * #OnCmdProcessing event when the server is processing the
  * command. -1 is returned in case of error.
  * @see DoListUserAccounts
  * @see DoDeleteUserAccount
  * @see UserAccount
  * @see UserType */
 public int DoNewUserAccount(UserAccount lpUserAccount)
 {
     return TTDLL.TT_DoNewUserAccount(m_ttInst, ref lpUserAccount);
 }
Exemplo n.º 7
0
        public void TestManyUserAccounts()
        {
            TeamTalk ttclient = NewClientInstance();
            Connect(ttclient);
            Login(ttclient, ADMIN_NICKNAME, ADMIN_USERNAME, ADMIN_PASSWORD);

            UserAccount account = new UserAccount();
            account.szInitChannel = "";
            account.autoOperatorChannels = new int[TeamTalk.TT_CHANNELS_OPERATOR_MAX];
            account.szUsername = "******";
            account.szPassword = "******";
            account.szNote = "the note";
            account.nUserData = 456;
            account.uUserRights = UserRight.USERRIGHT_NONE;
            account.uUserType = UserType.USERTYPE_DEFAULT;

            const int N_ACCOUNT = 20;
            string username = account.szUsername;
            for (int i = 0; i < N_ACCOUNT; i++)
            {
                account.szUsername = username + i;
                Assert.IsTrue(ttclient.DoNewUserAccount(account) > 0);
            }
            ttclient.OnCmdUserAccount += new TeamTalk.ListUserAccount(ttclient_OnCmdUserAccount);
            useraccounts.Clear();
            Assert.IsTrue(WaitCmdComplete(ttclient, ttclient.DoListUserAccounts(0, N_ACCOUNT), 30000));
            Assert.IsTrue(useraccounts.Count >= N_ACCOUNT);
            for (int i = 0; i < N_ACCOUNT; i++)
            {
                Assert.IsTrue(ttclient.DoDeleteUserAccount(username + i) > 0);
            }
            Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoLogout(), 200000));
        }
Exemplo n.º 8
0
 void ttclient_OnCmdUserAccount(UserAccount useraccount)
 {
     useraccounts.Add(useraccount);
 }
Exemplo n.º 9
0
        public void TestUserAccountRights()
        {
            TeamTalk ttclient = NewClientInstance();
            Connect(ttclient);
            Login(ttclient, ADMIN_NICKNAME, ADMIN_USERNAME, ADMIN_PASSWORD);

            TTMessage msg = new TTMessage();
            string BANIPADDR = "192.25.2.1";
            UserAccount account = new UserAccount();
            account.szInitChannel = "";
            account.autoOperatorChannels = new int[TeamTalk.TT_CHANNELS_OPERATOR_MAX];
            account.szUsername = "******";
            account.szPassword = "******";
            account.szNote = "the note";
            account.nUserData = 456;
            account.uUserRights = UserRight.USERRIGHT_NONE;
            account.uUserType = UserType.USERTYPE_DEFAULT;
            account.nAudioCodecBpsLimit = 22000;

            int cmdid = ttclient.DoNewUserAccount(account);
            WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CMD_SUCCESS, DEF_WAIT);

            TeamTalk ttclient2 = NewClientInstance();
            Connect(ttclient2);

            Login(ttclient2, "blah", account.szUsername, account.szPassword);

            UserAccount account2 = new UserAccount();
            Assert.IsTrue(ttclient2.GetMyUserAccount(ref account2), "get account");

            Assert.AreEqual(account.szUsername, account2.szUsername);
            //Assert.AreEqual(account.szPassword, account2.szPassword);
            Assert.AreEqual(account.nUserData, account2.nUserData);
            Assert.AreEqual(account.szInitChannel, account2.szInitChannel);
            Assert.AreEqual(account.szNote, account2.szNote);
            Assert.AreEqual(account.uUserRights, account2.uUserRights);
            Assert.AreEqual(account.uUserType, account2.uUserType);
            Assert.AreEqual(account.nAudioCodecBpsLimit, account2.nAudioCodecBpsLimit);

            CollectionAssert.AreEqual(account.autoOperatorChannels, account2.autoOperatorChannels);

            Channel chan = new Channel();
            chan.nParentID = ttclient2.GetRootChannelID();
            chan.szName = "foobar";

            //USERRIGHT_NONE
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoJoinChannelByID(ttclient2.GetRootChannelID(), ""), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoSendFile(ttclient2.GetMyChannelID(), UPLOADFILE), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoBanUser(ttclient2.GetMyUserID(), 0), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoBanIPAddress(BANIPADDR, 0), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoUnBanUser(BANIPADDR, 0), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoListBans(0, 0, 200), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoNewUserAccount(account), DEF_WAIT));

            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoLeaveChannel(), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoMakeChannel(chan), DEF_WAIT));
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoJoinChannel(chan), DEF_WAIT));
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoLogout(), DEF_WAIT));

            //USERRIGHT_CREATE_TEMPORARY_CHANNEL
            account.uUserRights |= UserRight.USERRIGHT_CREATE_TEMPORARY_CHANNEL;
            Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoNewUserAccount(account), DEF_WAIT));

            Login(ttclient2, "blah", account.szUsername, account.szPassword);
            Assert.IsTrue(ttclient2.GetMyUserAccount(ref account2), "get account");
            Assert.AreEqual(account.uUserRights, account2.uUserRights);
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoJoinChannel(chan), DEF_WAIT));

            chan.szName = "foobar2";
            chan.nChannelID = 0;
            chan.audiocodec.nCodec = Codec.SPEEX_CODEC;
            chan.audiocodec.speex.nBandmode = 1;
            chan.audiocodec.speex.nTxIntervalMSec = 40;
            chan.audiocodec.speex.nQuality = 10;
            chan.audiocodec.speex.bStereoPlayback = false;
            Assert.IsTrue(WaitCmdError(ttclient2, ttclient2.DoJoinChannel(chan), DEF_WAIT));
            chan.audiocodec.speex.nQuality = 2;
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoJoinChannel(chan), DEF_WAIT));

            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoLogout(), DEF_WAIT));

            //USERRIGHT_BAN_USERS
            account.uUserRights |= UserRight.USERRIGHT_BAN_USERS;
            Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoNewUserAccount(account), DEF_WAIT));

            Login(ttclient2, "blah", account.szUsername, account.szPassword);
            Assert.IsTrue(ttclient2.GetMyUserAccount(ref account2), "get account");
            Assert.AreEqual(account.uUserRights, account2.uUserRights);
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoBanUser(ttclient2.GetMyUserID(), 0), DEF_WAIT));
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoBanIPAddress(BANIPADDR, 0), DEF_WAIT));
            ttclient2.OnCmdBannedUser += new TeamTalk.ListBannedUser(ttclient2_OnCmdBannedUser);
            bannedusers.Clear();
            Assert.IsTrue(WaitCmdComplete(ttclient2, ttclient2.DoListBans(0, 0, 200), DEF_WAIT));

            BannedUser b = bannedusers.First<BannedUser>(m => m.szUsername == account2.szUsername);
            Assert.IsTrue(bannedusers.Count(m => m.szIPAddress == BANIPADDR) == 1);

            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoUnBanUser(b.szIPAddress, 0), DEF_WAIT));
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoUnBanUser(BANIPADDR, 0), DEF_WAIT));
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoLogout(), DEF_WAIT));

            //USERRIGHT_UPLOAD_FILES
            account.uUserRights |= UserRight.USERRIGHT_UPLOAD_FILES;
            Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoNewUserAccount(account), DEF_WAIT));

            Login(ttclient2, "blah", account.szUsername, account.szPassword);
            Assert.IsTrue(ttclient2.GetMyUserAccount(ref account2), "get account");
            Assert.AreEqual(account.uUserRights, account2.uUserRights);
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoJoinChannel(chan), DEF_WAIT));
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoSendFile(ttclient2.GetMyChannelID(), UPLOADFILE), 20000));
            Assert.IsTrue(WaitForEvent(ttclient2, ClientEvent.CLIENTEVENT_FILETRANSFER, 20000, ref msg));
            Assert.AreEqual(FileTransferStatus.FILETRANSFER_ACTIVE, ((FileTransfer)msg.DataToObject()).nStatus);
            Assert.IsTrue(WaitForEvent(ttclient2, ClientEvent.CLIENTEVENT_FILETRANSFER, 20000, ref msg));
            Assert.AreEqual(FileTransferStatus.FILETRANSFER_FINISHED, ((FileTransfer)msg.DataToObject()).nStatus);
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoLogout(), DEF_WAIT));

            //USERRIGHT_DOWNLOAD_FILES
            account.uUserRights |= UserRight.USERRIGHT_DOWNLOAD_FILES;
            Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoNewUserAccount(account), DEF_WAIT));

            Login(ttclient2, "blah", account.szUsername, account.szPassword);
            Assert.IsTrue(ttclient2.GetMyUserAccount(ref account2), "get account");
            Assert.AreEqual(account.uUserRights, account2.uUserRights);
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoJoinChannel(chan), DEF_WAIT));
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoSendFile(ttclient2.GetMyChannelID(), UPLOADFILE), 20000));
            Assert.IsTrue(WaitForEvent(ttclient2, ClientEvent.CLIENTEVENT_FILETRANSFER, 20000, ref msg));
            Assert.AreEqual(FileTransferStatus.FILETRANSFER_ACTIVE, ((FileTransfer)msg.DataToObject()).nStatus);
            Assert.IsTrue(WaitForEvent(ttclient2, ClientEvent.CLIENTEVENT_FILETRANSFER, 20000, ref msg));
            Assert.AreEqual(FileTransferStatus.FILETRANSFER_FINISHED, ((FileTransfer)msg.DataToObject()).nStatus);
            RemoteFile[] files;
            Assert.IsTrue(ttclient2.GetChannelFiles(ttclient2.GetMyChannelID(), out files));
            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoRecvFile(files[0].nChannelID, files[0].nFileID, DOWNLOADFILE), 20000));
            Assert.IsTrue(WaitForEvent(ttclient2, ClientEvent.CLIENTEVENT_FILETRANSFER, 20000, ref msg));
            Assert.AreEqual(FileTransferStatus.FILETRANSFER_ACTIVE, ((FileTransfer)msg.DataToObject()).nStatus);
            Assert.IsTrue(WaitForEvent(ttclient2, ClientEvent.CLIENTEVENT_FILETRANSFER, 20000, ref msg));
            Assert.AreEqual(FileTransferStatus.FILETRANSFER_FINISHED, ((FileTransfer)msg.DataToObject()).nStatus);

            Assert.IsTrue(WaitCmdSuccess(ttclient2, ttclient2.DoLogout(), DEF_WAIT));

            //TODO: remaining rights
            //UserRight.USERRIGHT_KICK_USERS
            //UserRight.USERRIGHT_MOVE_USERS
            //UserRight.USERRIGHT_
            //UserRight.USERRIGHT_MODIFY_CHANNELS

            Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoSaveConfig(), DEF_WAIT));

            cmdid = ttclient.DoDeleteUserAccount(account.szUsername);
            Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CMD_SUCCESS, DEF_WAIT));

            cmdid = ttclient.DoDeleteUserAccount("godj3g");
            Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CMD_ERROR, DEF_WAIT));
        }
Exemplo n.º 10
0
        public void TestAdminUserAccount()
        {
            TeamTalk ttclient = NewClientInstance();
            Connect(ttclient);
            Login(ttclient, ADMIN_NICKNAME, ADMIN_USERNAME, ADMIN_PASSWORD);

            UserAccount account = new UserAccount();
            account.szInitChannel = "";
            account.autoOperatorChannels = new int[TeamTalk.TT_CHANNELS_OPERATOR_MAX];
            account.szUsername = "******";
            account.szPassword = "******";
            account.szNote = "the note";
            account.nUserData = 456;
            account.uUserRights = UserRight.USERRIGHT_KICK_USERS;
            account.uUserType = UserType.USERTYPE_ADMIN;

            Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoNewUserAccount(account), DEF_WAIT));

            ttclient.OnCmdUserAccount += new TeamTalk.ListUserAccount(ttclient_OnCmdUserAccount);
            useraccounts.Clear();
            Assert.IsTrue(WaitCmdComplete(ttclient, ttclient.DoListUserAccounts(0, 1000000), DEF_WAIT));

            Assert.IsTrue(useraccounts.Count>0);

            TeamTalk ttclient2 = NewClientInstance();
            Connect(ttclient2);
            Login(ttclient2, GetCurrentMethod(), account.szUsername, account.szPassword);

            UserAccount a = new UserAccount();
            Assert.IsTrue(ttclient2.GetMyUserAccount(ref a));

            foreach (UserRight u in (UserRight[])Enum.GetValues(typeof(UserRight)))
                Assert.IsTrue(a.uUserRights.HasFlag(u));
        }
Exemplo n.º 11
0
 void ttclient_OnCmdUserAccount(UserAccount useraccount)
 {
     AddAccount(useraccount);
 }
Exemplo n.º 12
0
        void AddAccount(UserAccount account)
        {
            ListViewItem item = new ListViewItem();
            item.Text = account.szUsername;
            item.SubItems.Add(account.szPassword);
            item.SubItems.Add((account.uUserType & UserType.USERTYPE_ADMIN) == UserType.USERTYPE_ADMIN ? "Admin" : "Default");
            item.SubItems.Add(account.nUserData.ToString());
            item.SubItems.Add(account.szNote);
            listView1.Items.Add(item);

            all_accounts.Add(account);
        }
Exemplo n.º 13
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);
            }
        }
Exemplo n.º 14
0
 void ttclient_OnCmdError(int nCmdID, ClientErrorMsg clienterrormsg)
 {
     //clear create account if unsuccessful
     if (nCmdID == create_cmdid)
     {
         account_create = new UserAccount();
         MessageBox.Show(clienterrormsg.szErrorMsg);
     }
 }
Exemplo n.º 15
0
 static void ttclient_OnCmdMyselfLoggedIn(int nMyUserID, UserAccount useraccount)
 {
     Console.WriteLine("Logged in successfully...");
     Console.WriteLine("Got user ID #" + nMyUserID);
     Debug.Assert(nMyUserID == ttclient.UserID);
 }