示例#1
0
        public void Initial(String pswd)
        {
            Jid jid = to_Jid;
            jid.Resource = _connection.MyJID.User;

            this.Show();
            this.Enabled = false;

            _connection.PresenceGrabber.Add(jid, new PresenceCB(PresenceChatGroupCell), null);
            _connection.MessageGrabber.Add(jid, new BareJidComparer(), new MessageCB(MessageCallback), null);
            Presence spres = new Presence();
            spres.To = jid;
            Muc x = new Muc();
            if (pswd != null)
                x.Password = pswd;
            History hist = new History();
            hist.MaxCharacters = 100;
            x.History = hist;
            spres.AddChild(x);
            _connection.Send(spres);
        }
示例#2
0
        /// <summary>
        /// Join a chatroom
        /// </summary>
        /// <param name="room">jid of the room to join</param>
        /// <param name="nickname">nickname to use in the room</param>
        /// <param name="password">password for password protected chat rooms</param>
        /// <param name="disableHistory">true for joining without chat room history</param>
        public void JoinRoom(Jid room, string nickname, string password, bool disableHistory)
        {
            /*
            <presence
                from='[email protected]/pda'
                to='[email protected]/thirdwitch'>
              <x xmlns='http://jabber.org/protocol/muc'>
                <password>cauldron</password>
              </x>
            </presence>

            join room and request no history
            <presence
                from='[email protected]/pda'
                to='[email protected]/thirdwitch'>
              <x xmlns='http://jabber.org/protocol/muc'>
                <history maxchars='0'/>
              </x>
            </presence>
            */

            Jid to = new Jid(room.ToString());
            to.Resource = nickname;

            Presence pres = new Presence();
            pres.To = to;
            Muc x = new Muc();
            if (password != null)
                x.Password = password;

            if (disableHistory)
            {
                History hist = new History();
                hist.MaxCharacters = 0;
                x.History = hist;
            }

            pres.AddChild(x);

            m_connection.Send(pres);
        }
        /// <summary>
        /// 通验证后要进行聊天室初始化
        /// </summary>
        /// <param name="pswd"></param>
        public void Initial(String pswd)
        {
            friendHead.Image = CSS.IM.UI.Util.ResClass.GetImgRes("big199");

            Jid jid = TO_Jid;
            jid.Resource = XmppConn.MyJID.User;

            this.Show();
            this.Enabled = false;

            XmppConn.PresenceGrabber.Add(jid, new PresenceCB(PresenceChatGroupCell), null);
            XmppConn.MessageGrabber.Add(jid, new CSS.IM.XMPP.Collections.BareJidComparer(), new MessageCB(MessageCallback), null);
            Presence spres = new Presence();
            spres.To = jid;
            Muc x = new Muc();
            if (pswd != null)
                x.Password = pswd;
            History hist = new History();
            hist.MaxCharacters = 100;
            x.History = hist;
            spres.AddChild(x);
            XmppConn.Send(spres);
        }