Пример #1
0
        /// <summary>
        /// 对方同意视频,并初使化视频后,本地也进行视频初使化
        /// </summary>
        /// <param name="msg"></param>
        void ReturnAcceptVideoInitMethod(XMPP.protocol.client.Message msg)
        {
            UserInfo user1;
            UserInfo user2;
            CSS.IM.XMPP.protocol.client.Message res_msg;
            RemotVideoUDPPort = msg.GetTagInt("UDPPort");
            RemotVideoUDPIP = IPAddress.Parse(msg.GetTag("UDPIP"));

            user1 = new UserInfo();
            user1.LocalIP = RemotVideoUDPIP;
            user1.LocalPort = RemotVideoUDPPort;

            avForm.SetRemoteAddress(user1, RemotVideoUDPPort);

            user2 = new UserInfo();
            user2.LocalIP = Program.LocalHostIP;
            user2.LocalPort = ListenBasicUDPPort;

            avForm.SetLocalAddress(user2);

            avForm.iniAV(CSS.IM.Library.AV.VideoSizeModel.W320_H240);

            res_msg = new CSS.IM.XMPP.protocol.client.Message();
            res_msg.Type = MessageType.chat;
            res_msg.To = TO_Jid;
            res_msg.SetTag("m_type", 3);
            XmppConn.Send(res_msg);//告诉对我准备好了

            if (avForm.callSoundPlayer != null)
                avForm.callSoundPlayer.Stop();
        }
Пример #2
0
        /// <summary>
        /// 接收离线文件
        /// </summary>
        /// <param name="msg"></param>
        private void GetFtpFileAMethod(XMPP.protocol.client.Message msg)
        {
            FTPClient ftpClient = new FTPClient(Util.ServerAddress, Util.ftpPath, Util.ftpUser, Util.ftpPswd, Util.ftpPort);
            ftpClient.FtpPath = msg.GetTag("Path");
            ftpClient.GetFileErrorEvent += new FTPClient.GetFileErrorDelegate(ftpClient_GetFileErrorEvent);
            ftpClient.GetFileProgressEvent += new FTPClient.GetFileProgressDelegate(ftpClient_GetFileProgressEvent);
            ftpClient.GetFileSucceedEvent += new FTPClient.GetFileSucceedDelegate(ftpClient_GetFileSucceedEvent);
            ftpClient.ChDir("/" + ftpClient.FtpPath + "/");
            long fileSize = long.Parse(msg.GetTag("Length"));

            FileTransfersItem item = fileTansfersContainer.AddItem(
                        msg.GetTag("MD5"),
                        "接收文件",
                        msg.GetTag("FileName"),
                        Properties.Resources.ReceiveIco,
                        fileSize,
                        FileTransfersItemStyle.FtpGet);

            item.BaseColor = _baseColor;
            item.BorderColor = _borderColor;
            item.ProgressBarBarColor = _progressBarBarColor;
            item.ProgressBarBorderColor = _progressBarBorderColor;
            item.ProgressBarTextColor = _progressBarTextColor;

            RequestSendFileEventArgs requestSendFileEventArgs = new RequestSendFileEventArgs();
            requestSendFileEventArgs.ftpClient = ftpClient;

            ftpClient.fileTransfersItem = item;
            item.Tag = requestSendFileEventArgs;

            item.SaveButtonClick += new EventHandler(ItemSaveButtonClick);
            item.SaveToButtonClick += new EventHandler(ItemSaveToButtonClick);
            item.RefuseButtonClick += new EventHandler(ItemRefuseButtonClick);

            Util.ReceiveFileManagerList.Add(msg.GetTag("MD5"), requestSendFileEventArgs);

            this.Invoke(new RequestSendFilePanel(RequestSendFilePanelMethod));
            this.AppendSystemRtf(string.Format("请求接收离线文件 {0}。", msg.GetTag("FileName")));
        }
Пример #3
0
        /// <summary>
        /// red5视频请求
        /// </summary>
        /// <param name="msg"></param>
        private void Red5AccpetMethod(XMPP.protocol.client.Message msg)
        {
            if (InvokeRequired)
            {
                this.Invoke(Red5AccpetEvent, new object[]{msg});
            }

            if (red5MsgReceive != null)
                if (!red5MsgReceive.IsDisposed)
                    return;

            DialogResult result=MsgBox.Show(this, "CSS&IM", "好友" + NickName + "向您发送视频请求,是否接受!", MessageBoxButtons.YesNo);

            if (result==DialogResult.Yes)
            {
                string serUrl = @"http://"+Program.ServerIP+":7070/redfire/video/redfire_2way.html?me={0}&you={1}&key={2}";
                red5MsgReceive = new Red5Msg();
                red5MsgReceive.FriendName = "正在与[" + msg.GetTag("me").ToString() + "]视频通话中";
                red5MsgReceive.FormClosing += new FormClosingEventHandler(red5MsgReceive_FormClosing);
                red5MsgReceive.Accept(string.Format(serUrl, msg.GetTag("you").ToString(), msg.GetTag("me").ToString(), msg.GetTag("key").ToString()));
                red5MsgReceive.Show();
                this.AppendSystemRtf("开始与" + msg.GetTag("me").ToString() + "进行视频通话");
            }
            else
            {
                CSS.IM.XMPP.protocol.client.Message emsg = new CSS.IM.XMPP.protocol.client.Message();
                emsg.Type = MessageType.chat;
                emsg.To = TO_Jid;
                emsg.SetTag("m_type", 12);
                emsg.SetTag("me", msg.GetTag("me").ToString());
                emsg.SetTag("you", msg.GetTag("you").ToString());
                emsg.SetTag("key", msg.GetTag("key").ToString());
                XmppConn.Send(emsg);
                this.AppendSystemRtf("拒绝了" + msg.GetTag("me").ToString() + "视频通话");
            }
        }
Пример #4
0
        /// <summary>
        /// 对方同意视频,并初使化视频后,本地也进行视频初使化
        /// </summary>
        /// <param name="msg"></param>
        void ReturnAcceptMethod(XMPP.protocol.client.Message msg)
        {
            UserInfo user1;
            UserInfo user2;
            CSS.IM.XMPP.protocol.client.Message res_msg;
            VideoRemotUDPPort = msg.GetTagInt("UDPPort");
            VideoRemotUDPIP = IPAddress.Parse(msg.GetTag("UDPIP"));

            user1 = new UserInfo();
            user1.LocalIP = VideoRemotUDPIP;
            user1.LocalPort = VideoRemotUDPPort;

            avForm.SetRemoteAddress(user1, VideoRemotUDPPort);

            user2 = new UserInfo();
            user2.LocalIP = Program.LocalHostIP;
            user2.LocalPort = int.Parse(LocalVideoUDPPort);

            avForm.SetLocalAddress(user2);

            avForm.iniAV(VideoSizeModel.W320_H240);

            res_msg = new CSS.IM.XMPP.protocol.client.Message();
            res_msg.Type = MessageType.chat;
            res_msg.To = to_Jid;
            res_msg.SetTag("m_type", 3);
            res_msg.Body = "falg";
            _connection.Send(res_msg);//告诉对我准备好了
        }