# HG changeset patch # User Chris Jones # Date 1380513278 21600 # Node ID fd4089f717b245f2fb20514fada22fc55680656a # Parent 2d948fcbb5d7b453b21f650807d299d50861e0bc Listen for XMPP connection status changes, and print them out. diff -r 2d948fcbb5d7 -r fd4089f717b2 example/interact.go --- a/example/interact.go Sun Sep 29 21:37:14 2013 -0600 +++ b/example/interact.go Sun Sep 29 21:54:38 2013 -0600 @@ -41,8 +41,14 @@ os.Exit(2) } + stat := make(chan xmpp.Status) + go func() { + for s := range stat { + log.Printf("connection status %d", s) + } + }() tlsConf := tls.Config{InsecureSkipVerify: true} - c, err := xmpp.NewClient(&jid, *pw, tlsConf, nil, xmpp.Presence{}, nil) + c, err := xmpp.NewClient(&jid, *pw, tlsConf, nil, xmpp.Presence{}, stat) if err != nil { log.Fatalf("NewClient(%v): %v", jid, err) }