examples/interact.go
changeset 69 a38173c1c8b2
parent 68 d693ecc11f29
child 76 caa722ab8a0f
child 100 24231ff0016c
equal deleted inserted replaced
62:6e2eea62ccca 69:a38173c1c8b2
     8 	"cjyar/xmpp"
     8 	"cjyar/xmpp"
     9 	"flag"
     9 	"flag"
    10 	"fmt"
    10 	"fmt"
    11 	"log"
    11 	"log"
    12 	"os"
    12 	"os"
    13 	)
    13 )
    14 
    14 
    15 // Demonstrate the API, and allow the user to interact with an XMPP
    15 // Demonstrate the API, and allow the user to interact with an XMPP
    16 // server via the terminal.
    16 // server via the terminal.
    17 func main() {
    17 func main() {
    18 	var jid xmpp.JID
    18 	var jid xmpp.JID
    26 
    26 
    27 	c, err := xmpp.NewClient(&jid, *pw, nil)
    27 	c, err := xmpp.NewClient(&jid, *pw, nil)
    28 	if err != nil {
    28 	if err != nil {
    29 		log.Fatalf("NewClient(%v): %v", jid, err)
    29 		log.Fatalf("NewClient(%v): %v", jid, err)
    30 	}
    30 	}
    31 	defer c.Close()
    31 	defer close(c.Out)
    32 
    32 
    33 	err = c.StartSession(true, &xmpp.Presence{})
    33 	err = c.StartSession(true, &xmpp.Presence{})
    34 	if err != nil {
    34 	if err != nil {
    35 		log.Fatalf("StartSession: %v", err)
    35 		log.Fatalf("StartSession: %v", err)
    36 	}
    36 	}