Example #1
0
func main() {
	client, err := xmpp.NewClient("talk.google.com", "*****@*****.**", "XXX")

	if err != nil {
		fmt.Printf("Failed due to: %s\n", err)
	} else {
		client.OnAny(func(msg string) {
			log(msg)
		})

		client.OnMessage(func(msg xmpp.Message) {
			log("Got a message from %s to %s: %s\n", msg.From(), msg.To(), msg.Body())
		})

		client.SendChat("*****@*****.**", "Hello world!")

		client.Loop()
	}
}
Example #2
0
func main() {
	client, err := xmpp.NewClient("talk.google.com", "*****@*****.**", "xxx")

	if err != nil {
		fmt.Printf("Failed due to: %s\n", err)
	} else {
		client.OnAny(func(msg string) {
			log(msg)
		})

		client.OnMessage(func(msg xmpp.Message) {
			log("Got a message from %s to %s: %s\n", msg.From(), msg.To(), msg.Body())
		})

		client.SendChat("*****@*****.**", "Hello world!")

		client.Loop()
	}
}