public MiniFriendControl(XmppClientConnection conn,Jid jid)
        {
            XmppConn = conn;
            MJid = jid;
            NickName = jid.User;

            bgImg = null;

            this.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right)));
            this.BackColor = Color.Transparent;

            if (Environment.OSVersion.Version.Major >= 6)
            {
                f = new Font("微软雅黑", 9F, FontStyle.Regular);
            }
            else
            {
                f = new Font("宋体", 9F, FontStyle.Regular);
            }

            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            try
            {
                VcardIq viq = new VcardIq(IqType.get, new Jid(jid.Bare));
                XmppConn.IqGrabber.SendIq(viq, new IqCB(VcardResult), null, true);
            }
            catch (Exception)
            {

            }
        }
Exemple #2
0
        public ChatForm(Jid jid, XmppClientConnection con, string nickname)
        {
            InitializeComponent();

            _emotion = new EmotionDropdown();
            AcceptInit = new AcceptInitDelegate(AcceptInitMethod);
            ReturnAcceptInit = new ReturnAcceptInitDelegate(ReturnAcceptMethod);
            AcceptOpen = new AcceptOpenDelegate(AcceptOpenMethod);
            FileSendRequestEvent = new FileSendRequestDelegate(onUserFileSendRequest);
            FileSendInitEvent = new FileSendInitDelegate(FileSendInit);

            to_Jid = jid;
            _connection = con;
            _nickname = jid.User;
            this.nikeName.Text = nickname;

            VcardIq viq = new VcardIq(IqType.get, new Jid(jid.Bare));
            packetId = viq.Id;
            _connection.IqGrabber.SendIq(viq, new IqCB(VcardResult), null, true);

            Util.ChatForms.Add(to_Jid.Bare.ToLower(), this);
            nikeName.Text = _nickname;

            con.MessageGrabber.Add(jid, new BareJidComparer(), new MessageCB(MessageCallback), null);
            _emotion.EmotionContainer.ItemClick += new UI.Face.EmotionItemMouseEventHandler(EmotionContainer_ItemClick);

            friendHead.BackgroundImage = ResClass.GetImgRes("Padding4Normal");
            friendHead.Image = ResClass.GetHead("big194");

            rtfSend.AllowDrop = true;

            rtfSend.DragDrop += new DragEventHandler(rtfSend_DragDrop);
            rtfSend.DragEnter += new DragEventHandler(rtfSend_DragEnter);
        }
        public FriendControl(XmppClientConnection conn,Jid jid)
        {
            XmppConn = conn;
            MJid = jid;
            NickName = MJid.User;

            InitializeComponent();
            headImgbak = ResClass.GetImgRes("big194");
            bgImg = null;
            this.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right)));
            this.BackColor = Color.Transparent;

            if (Environment.OSVersion.Version.Major >= 6)
            {
                f = new Font("微软雅黑", 9F, FontStyle.Regular);
            }
            else
            {
                f = new Font("宋体", 9F, FontStyle.Regular);
            }

            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            System.GC.Collect();
        }
        public override void Init(XmppClientConnection con)
        {
            m_XmppClient = con;

            // <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">$Message</auth>
            m_XmppClient.Send(new protocol.sasl.Auth(protocol.sasl.MechanismType.PLAIN, Message()));
        }
 public ChatGroupRoomsForm(Jid args,XmppClientConnection con)
 {
     this.XmppCon = con;
     MJid = args;
     InitializeComponent();
     this.Text = this.Text + MJid.Bare.ToString();
     listItemsAddDelegate = new ListItemsAddDelegate(listItemsAddMedhod);
 }
        public SetInfoForm(XmppClientConnection conn)
        {
            InitializeComponent();
            XmppConn = conn;
            GetVcardResult();

            //VcardIq viq = new VcardIq(IqType.get, null, new Jid(_connection.MyJID.User));
            //_connection.IqGrabber.SendIq(viq, new IqCB(GetVcardResult), null);
        }
Exemple #7
0
        public VcardForm(Jid jid, XmppClientConnection con)
        {
            InitializeComponent();
            _connection = con;
            VcardIq viq = new VcardIq(IqType.get, new Jid(jid.Bare));

            packetId = viq.Id;
            con.IqGrabber.SendIq(viq, new IqCB(VcardResult), null,true);
        }
        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="jid"></param>
        /// <param name="con"></param>
        /// <param name="nickname"></param>
        public ChatGroupFormMsg(Jid jid, XmppClientConnection con, string nickname)
        {
            InitializeComponent();
            friend_list.OpenChatEvent += new ChatGroupListView.delegate_openChat(friend_list_OpenChatEvent);

            TO_Jid = jid;
            XmppConn = con;
            _NickName = jid.User;
            this.nikeName.Text = nickname;

            Util.GroupChatForms.Add(TO_Jid.Bare.ToLower(), this);

            nikeName.Text = "当前所在会议室[" + _NickName + "]";
        }
        public QQListView(XmppClientConnection con)
        {
            _connection = con;
            this.AutoScroll = true;
            this.BackColor = Color.Transparent;
            this.ForeColor = Color.White;
            this.Name = "ListView";
            this.Size = new Size(235, 350);

            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);

            groupList = new ArrayList(5);

            InitGroupMenu();
            InitPanelMenu();
            InitFriendMenu();
        }
        public ChatGroupForm(Jid jid, XmppClientConnection con, string nickname)
        {
            InitializeComponent();
            friend_list.OpenChatEvent += new ChatGroupListView.delegate_openChat(friend_list_OpenChatEvent);
            _emotion = new EmotionDropdown();

            to_Jid = jid;
            _connection = con;
            _nickname = jid.User;
            this.nikeName.Text = nickname;

            Util.GroupChatForms.Add(to_Jid.Bare.ToLower(), this);

            nikeName.Text = "当前所在会议室[" + _nickname + "]";

            _emotion.EmotionContainer.ItemClick += new UI.Face.EmotionItemMouseEventHandler(EmotionContainer_ItemClick);

            friendHead.BackgroundImage = ResClass.GetImgRes("Padding4Normal");
            friendHead.Image = ResClass.GetHead("big199");
        }
        public FindFriendForm(XmppClientConnection con)
        {
            InitializeComponent();

            m_XmppCon = con;

            friend_qcm = new QQContextMenu();
            QQToolStripMenuItem item1 = new QQToolStripMenuItem();
            item1.Text = "加为联系人";
            item1.Click += new EventHandler(item1_Click);
            QQToolStripMenuItem item2 = new QQToolStripMenuItem();
            item2.Text = "名片";
            item2.Click += new EventHandler(item2_Click);
            friend_qcm.Items.AddRange(new ToolStripItem[] { item1, item2 });
            if (!ISSelect)
                this.ContextMenuStrip = friend_qcm;
            // Fill combo with search services
            //foreach (Jid jid in Util.Services.Search)
            //{
            //    //cboServices.Items.Add(jid.Bare);
            //}
        }
        public void AddFriendMessage(Jid jid, XmppClientConnection con, string nickname)
        {
            int UserCount = panel_userList.Controls.Count;

            //如果已经有此联系人的消息就不添加
            if (panel_userList.Controls.ContainsKey("FI" + jid.Bare.ToString()))
                return;

            Friend friend = new Friend();
            friend.NikeName = jid.User;
            friend.Description = "";//心情
            friend.HeadIMG = "big194";
            friend.IsSysHead = true;

            MiniFriendControl firneItem = new MiniFriendControl(con, jid);
            firneItem.FriendInfo = friend;
            firneItem.Height = 28;
            firneItem.Width = 210;
            firneItem.Name = "FI" + jid.Bare;
            firneItem.Location = new Point(0, UserCount * 28);
            firneItem.OpenChat += new MiniFriendControl.OpenChatEventHandler(firneItem_OpenChat);
            panel_userList.Controls.Add(firneItem);
            if (panel_userList.Controls.Count>10)
            {
                panel_userList.AutoScroll = true;
            }
            else
            {
                panel_userList.AutoScroll = false;
                if (UserCount * 28 > panel_userList.Height)
                {
                    oldPanle = panel_userList.Height;
                    panel_userList.Height = UserCount * 28;
                    this.Height = this.Height - oldPanle + panel_userList.Height;

                }
            }
        }
 public PubSubManager(XmppClientConnection con)
 {
     m_connection = con;
 }
 public ChatGroupRoomCrateForm(Jid args, XmppClientConnection con)
 {
     this.XmppCon = con;
     MJid = args;
     InitializeComponent();
 }
        public ChatFromMsg(Jid jid, XmppClientConnection Conn,string nickName)
        {
            InitializeComponent();
            RemotBaseUDPIP = IPAddress.Parse("127.0.0.1");

            AccepVideotInit = new AcceptVideoInitDelegate(AcceptVideoInitMethod);
            ReturnAcceptVideoInit = new ReturnAcceptVideoInitDelegate(ReturnAcceptVideoInitMethod);
            AcceptVideoOpen = new AcceptVideoOpenDelegate(AcceptVideoOpenMethod);
            FileSendRequestEvent = new FileSendRequestDelegate(FileSendRequestMethod);
            FileSendInitEvent = new FileSendInitDelegate(FileSendInitMethod);
            GetFtpFileEvent = new GetFtpFileDelegate(GetFtpFileAMethod);
            Red5AccpetEvent = new Red5AccpetDelegate(Red5AccpetMethod);
            Red5RefuseEvent = new Red5RefuseDelegate(Red5RefuseMethod);

            TO_Jid = jid;
            XmppConn = Conn;
            this._NickName = nickName;
            this.Text = "正在与[" + (nikeName.Text != "" ? nikeName.Text : _NickName) + "]对话";

            VcardIq viq = new VcardIq(IqType.get, new Jid(jid.Bare));
            XmppConn.IqGrabber.SendIq(viq, new IqCB(VcardResult), null, true);

            Util.ChatForms.Add(TO_Jid.Bare, this);
            nikeName.Text = _NickName;

            rtfSend.AllowDrop = true;
            rtfSend.DragDrop += new DragEventHandler(rtfSend_DragDrop);
            rtfSend.DragEnter += new DragEventHandler(rtfSend_DragEnter);

            XmppConn.MessageGrabber.Add(jid, new BareJidComparer(), new MessageCB(MessageCallback), null);

            //用于外部更新截图
            ScreenImageEvent += new ScreenImageDelegate(ChatFromMsg_ScreenImageEvent);
            Util.TO_Jid =TO_Jid;//公布对外的to_jid用于外部插入截图

            //初使化发送文件
            udpSendFile = new UdpSendFile(2);
            //sendFile.Log += new TraFransfersFileLogEventHandler(SendFileLog);
            udpSendFile.FileSendBuffer += new FileSendBufferEventHandler(FileSendBuffer);
            udpSendFile.FileSendAccept += new FileSendEventHandler(FileSendAccept);
            udpSendFile.FileSendRefuse += new FileSendEventHandler(FileSendRefuse);
            udpSendFile.FileSendCancel += new FileSendEventHandler(FileSendCancel);
            udpSendFile.FileSendComplete += new FileSendEventHandler(FileSendComplete);
            udpSendFile.Start();

            //初使化接收文件
            udpReceiveFile = new UdpReceiveFile(2);
            udpReceiveFile.RequestSendFile += new RequestSendFileEventHandler(RequestSendFile);
            udpReceiveFile.FileReceiveBuffer += new FileReceiveBufferEventHandler(FileReceiveBuffer);
            udpReceiveFile.FileReceiveComplete += new FileReceiveEventHandler(FileReceiveComplete);
            udpReceiveFile.FileReceiveCancel += new FileReceiveEventHandler(FileReceiveCancel);
            udpReceiveFile.Start();
        }
 public override void Init(XmppClientConnection con)
 {
     base.XmppClientConnection = con;
     base.XmppClientConnection.Send(new protocol.sasl.Auth(protocol.sasl.MechanismType.DIGEST_MD5));
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="conn"></param>
 public MessageGrabber(XmppClientConnection conn)
 {
     m_connection		= conn;
     conn.OnMessage += new MessageHandler(m_connection_OnMessage);
 }
 public PrivacyManager(XmppClientConnection con)
 {
     m_connection = con;
 }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            XmppConn = null;

            RTBRecord.Dispose();
            RTBRecord = null;

            if (删除记录ToolStripMenuItem!=null)
            {
                删除记录ToolStripMenuItem.Dispose();
                删除记录ToolStripMenuItem = null;
            }

            if (qqContextMenu1!=null)
            {
                qqContextMenu1.Dispose();
                qqContextMenu1 = null;
            }

            if (emotionDropdown!=null)
            {
                emotionDropdown.Dispose();
                emotionDropdown = null;
            }

            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
Exemple #20
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (avForm != null)
                {
                    avForm.AVClose();
                    avForm.Dispose();
                    avForm = null;
                }

            }
            catch (Exception)
            {

            }

            try
            {
                if (ravForm != null)
                {
                    ravForm.AVClose();
                    ravForm.Dispose();
                    ravForm = null;
                }
            }
            catch (Exception)
            {

            }

            try
            {
                sockUDP1.CloseSock();
                sockUDP1.Dispose();
                sockUDP1 = null;
            }
            catch (Exception)
            {

            }

            try
            {
                _emotion.Dispose();
                _emotion = null;
            }
            catch (Exception)
            {

            }

            try
            {
                Util.ChatForms.Remove(to_Jid.Bare.ToLower());
                _connection.MessageGrabber.Remove(to_Jid);
            }
            catch (Exception)
            {

            }

            g.Dispose();
            g = null;
            Bmp.Dispose();
            Bmp = null;

            _connection = null;

            System.GC.Collect();

            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                _connection.MessageGrabber.Remove(to_Jid);
                _connection.PresenceGrabber.Remove(to_Jid);

                MucManager mucManager = new MucManager(_connection);
                mucManager.LeaveRoom(to_Jid, _connection.MyJID.User);
                Util.GroupChatForms.Remove(to_Jid.Bare.ToLower());

            }
            catch (Exception)
            {

            }
            _connection = null;

            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 public void AddFriend(Jid jid, XmppClientConnection XmppConn)
 {
     if (!FriendKey.ContainsKey(jid.Bare))
     {
         GroupFriendControl friend = new GroupFriendControl(XmppConn,jid);
         friend.FCType = FriendContainerType.Small;
         friend.Location = new Point(1, 36 * this.Controls.Count);
         friend.Size = new Size(this.Width - 2, 35);
         friend.OpenChat += new GroupFriendControl.OpenChatEventHandler(friend_OpenChat);
         friend.ShowContextMenu += new GroupFriendControl.ShowContextMenuEventHandler(friend_ShowContextMenu);
         friend.Selecting += new GroupFriendControl.SelectedEventHandler(friend_Selecting);
         Controls.Add(friend);
         this.Height += 36;
         FriendKey.Add(jid.Bare, jid);
     }
     System.GC.Collect();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PresenceGrabber"/> class.
 /// </summary>
 /// <param name="conn">The conn.</param>
 public PresenceGrabber(XmppClientConnection conn)
 {
     m_connection		= conn;
     conn.OnPresence += new PresenceHandler(m_connection_OnPresence);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="con"></param>
 public override void Init(XmppClientConnection con)
 {
     con.Send(new Auth(MechanismType.ANONYMOUS));
 }
 public VcardInfoForm(Jid jid,XmppClientConnection conn)
 {
     InitializeComponent();
     XmppConn = conn;
     TO_Jid = jid;
 }
Exemple #26
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="conn"></param>
 public IqGrabber(XmppClientConnection conn)
 {
     m_connection		= conn;
     conn.OnIq	+= new IqHandler(OnIq);
 }
        public override void Init(XmppClientConnection con)
        {
            base.XmppClientConnection = con;

            DoClientAuth();
        }