예제 #1
0
파일: xmpp.go 프로젝트: ildus/jabber_bot
/*
 * Gets events from jabber connection,
 * if some event is happening and it is message, then it
 * goes to callback defined above
 */
func (client *Client) Listen() {
	client.Channel = make(chan *Event)
	go func() {
		client.listen = true
		for client.listen {
			C.check_xmpp_events(client.ConnInfo.ctx, 100)
		}
		C.close_xmpp_conn(client.ConnInfo)
		close(client.Channel)
		delete(clients, client.Id)
	}()
}
예제 #2
0
파일: xmpp.go 프로젝트: tsparber/jabber_bot
/* Gets events from jabber connection,
if some event is happening and it is message, then it
goes to callback defined above
*/
func (client *Client) Listen() {
	client.Channel = make(chan *Message)
	go func() {
		client.listen = true
		for client.listen {
			C.check_xmpp_events(client.ConnInfo.ctx)
			time.Sleep(50 * time.Millisecond)
		}
		C.close_xmpp_conn(client.ConnInfo)
		close(client.Channel)
	}()
}