コード例 #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)
	}()
}