xmpp/xmpp.go
changeset 144 9d7fdb1d2fc1
parent 142 0ff033eed887
child 146 aa9a0ae8f875
equal deleted inserted replaced
143:62166e57800e 144:9d7fdb1d2fc1
    65 	password     string
    65 	password     string
    66 	socket       net.Conn
    66 	socket       net.Conn
    67 	socketSync   sync.WaitGroup
    67 	socketSync   sync.WaitGroup
    68 	saslExpected string
    68 	saslExpected string
    69 	authDone     bool
    69 	authDone     bool
    70 	handlers     chan *stanzaHandler
    70 	handlers     chan *callback
    71 	inputControl chan int
    71 	inputControl chan int
    72 	// Incoming XMPP stanzas from the remote will be published on
    72 	// Incoming XMPP stanzas from the remote will be published on
    73 	// this channel. Information which is used by this library to
    73 	// this channel. Information which is used by this library to
    74 	// set up the XMPP stream will not appear here.
    74 	// set up the XMPP stream will not appear here.
    75 	Recv <-chan Stanza
    75 	Recv <-chan Stanza
   135 	cl := new(Client)
   135 	cl := new(Client)
   136 	cl.Roster = *roster
   136 	cl.Roster = *roster
   137 	cl.password = password
   137 	cl.password = password
   138 	cl.Jid = *jid
   138 	cl.Jid = *jid
   139 	cl.socket = tcp
   139 	cl.socket = tcp
   140 	cl.handlers = make(chan *stanzaHandler, 100)
   140 	cl.handlers = make(chan *callback, 100)
   141 	cl.inputControl = make(chan int)
   141 	cl.inputControl = make(chan int)
   142 	cl.tlsConfig = tlsconf
   142 	cl.tlsConfig = tlsconf
   143 	cl.sendFilterAdd = make(chan Filter)
   143 	cl.sendFilterAdd = make(chan Filter)
   144 	cl.recvFilterAdd = make(chan Filter)
   144 	cl.recvFilterAdd = make(chan Filter)
   145 
   145 
   255 			return false
   255 			return false
   256 		}
   256 		}
   257 		ch <- nil
   257 		ch <- nil
   258 		return false
   258 		return false
   259 	}
   259 	}
   260 	cl.HandleStanza(id, f)
   260 	cl.SetCallback(id, f)
   261 	cl.Send <- iq
   261 	cl.Send <- iq
   262 
   262 
   263 	// Now wait until the callback is called.
   263 	// Now wait until the callback is called.
   264 	if err := <-ch; err != nil {
   264 	if err := <-ch; err != nil {
   265 		return err
   265 		return err