Ejemplo n.º 1
0
        /// <summary>
        /// Get a unique room name from the given server, and create a Room
        /// object for that room with the given nick.  You'll be called back on
        /// "callback" when complete; the Room will be null if there was an error
        /// or timeout.
        ///
        /// Note: the server should implement the feature http://jabber.org/protocol/muc#unique,
        /// or this will return an error.  To work around, just create a room with a Guid for
        /// a name.
        /// </summary>
        /// <param name="server">The server to send the request to</param>
        /// <param name="nick">The nickname desired in the new room</param>
        /// <param name="callback">A callback to be called when the room is created</param>
        /// <param name="state">State object to be passed back when the callback fires</param>
        public void GetUniqueRoom(string server, string nick, RoomStateEvent callback, object state)
        {
            if (server == null)
                throw new ArgumentNullException("server");
            if (nick == null)
                throw new ArgumentNullException("nick");
            if (callback == null)
                throw new ArgumentNullException("callback");

            /*
            <iq from='[email protected]/desktop'
                id='unique1'
                to='macbeth.shakespeare.lit'
                type='get'>
              <unique xmlns='http://jabber.org/protocol/muc#unique'/>
            </iq>
             */
            UniqueIQ iq = new UniqueIQ(m_stream.Document);
            iq.To = server;
            BeginIQ(iq, new IqCB(GotUnique), new UniqueState(nick, callback, state));
        }
Ejemplo n.º 2
0
 public UniqueState(string nick, RoomStateEvent callback, object state)
 {
     this.Nick = nick;
     this.Callback = callback;
     this.State = state;
 }