void ttclient_OnCmdChannelUpdate(Channel chan) { if ((chan.uChannelType & ChannelType.CHANNEL_CLASSROOM) == ChannelType.CHANNEL_DEFAULT) { return; } TreeNode chanNode = GetChannel(chan.nChannelID); Debug.Assert(chanNode != null); List <TreeNode> users = new List <TreeNode>(); foreach (TreeNode userNode in chanNode.Nodes) { if (userNode.ImageIndex == (int)ImageIndex.USER) { users.Add(userNode); } } foreach (TreeNode userNode in users) { User user = new User(); if (ttclient.GetUser((int)userNode.Tag, ref user)) { userNode.Text = String.Format("{0} [Voice={1}, Video={2}, Desktop={3}, MediaFile={4}]", user.szNickname, chan.GetTransmitStreamTypes(user.nUserID).HasFlag(StreamType.STREAMTYPE_VOICE), chan.GetTransmitStreamTypes(user.nUserID).HasFlag(StreamType.STREAMTYPE_VIDEOCAPTURE), chan.GetTransmitStreamTypes(user.nUserID).HasFlag(StreamType.STREAMTYPE_DESKTOP), chan.GetTransmitStreamTypes(user.nUserID).HasFlag(StreamType.STREAMTYPE_MEDIAFILE_AUDIO | StreamType.STREAMTYPE_MEDIAFILE_VIDEO)); } } }
public void NewMessage(TextMessage msg) { User user = new User(); if (!ttclient.GetUser(msg.nFromUserID, ref user)) { return; } this.Text = "Message - " + user.szNickname; historyTextBox.AppendText("<" + user.szNickname + "> " + msg.szMessage + Environment.NewLine); }
public VideoDlg(TeamTalk tt, int userid) { ttclient = tt; this.userid = userid; InitializeComponent(); this.CenterToScreen(); User user = new User(); if (userid > 0 && ttclient.GetUser(userid, ref user)) { this.Text = "Video - " + user.szNickname; } else { this.Text = "Local Video"; } ttclient.OnUserVideoCapture += new TeamTalk.UserVideoFrame(ttclient_OnUserVideoFrame); }
private void VideoDlg_FormClosing(object sender, FormClosingEventArgs e) { if (this.userid > 0 && unsubscribe_cmdid == 0) { if (MessageBox.Show("Do you wish to stop receiving video from this user?", "Close Video", MessageBoxButtons.YesNo) == DialogResult.Yes) { //we wait for the server to repond to us that we'll no //longer receive video from this user. ttclient.OnCmdProcessing += new TeamTalk.CommandProcessing(ttclient_OnCmdProcessing); //figure out how we're subscribing to video Subscription subtype = Subscription.SUBSCRIBE_NONE; User user = new User(); if (ttclient.GetUser(this.userid, ref user)) { if (user.uLocalSubscriptions.HasFlag(Subscription.SUBSCRIBE_VIDEOCAPTURE)) { subtype = Subscription.SUBSCRIBE_VIDEOCAPTURE; } else if (user.uLocalSubscriptions.HasFlag(Subscription.SUBSCRIBE_INTERCEPT_VIDEOCAPTURE)) { subtype = Subscription.SUBSCRIBE_INTERCEPT_VIDEOCAPTURE; } } //store the command ID we get back from the client instance unsubscribe_cmdid = ttclient.DoUnsubscribe(this.userid, subtype); e.Cancel = true; } else { e.Cancel = true; } } else { ttclient.OnUserVideoCapture -= ttclient_OnUserVideoFrame; } }
void UpdateUser() { User user = new User(); if (ttclient.GetUser(userid, ref user)) { useridTextBox.Text = user.nUserID.ToString(); nicknameTextBox.Text = user.szNickname; usernameTextBox.Text = user.szUsername; statusmodeTextBox.Text = user.nStatusMode.ToString(); statusmsgTextBox.Text = user.szStatusMsg; usertypeTextBox.Text = (user.uUserType & UserType.USERTYPE_ADMIN) == UserType.USERTYPE_ADMIN ? "Admin" : "Default"; versionTextBox.Text = user.uVersion.ToString(); } UserStatistics stats = new UserStatistics(); if (ttclient.GetUserStatistics(userid, ref stats)) { audiolossTextBox.Text = String.Format("{0}/{1}", stats.nVoicePacketsLost, stats.nVoicePacketsRecv + stats.nVoicePacketsLost); videolossTextBox.Text = String.Format("{0}/{1}", stats.nVideoCaptureFramesLost, stats.nVideoCaptureFramesRecv + stats.nVideoCaptureFramesLost); } }