example/interact.go
changeset 178 ccfebbd9f49b
parent 163 3f891f7fe817
equal deleted inserted replaced
177:63f33bb8fa33 178:ccfebbd9f49b
    16 }
    16 }
    17 
    17 
    18 // Demonstrate the API, and allow the user to interact with an XMPP
    18 // Demonstrate the API, and allow the user to interact with an XMPP
    19 // server via the terminal.
    19 // server via the terminal.
    20 func main() {
    20 func main() {
    21 	var jid xmpp.JID
    21 	jidStr := flag.String("jid", "", "JID to log in as")
    22 	flag.Var(&jid, "jid", "JID to log in as")
    22 	pw := flag.String("pw", "", "password")
    23 	var pw *string = flag.String("pw", "", "password")
       
    24 	flag.Parse()
    23 	flag.Parse()
    25 	if jid.Domain == "" || *pw == "" {
    24 	jid := xmpp.JID(*jidStr)
       
    25 	if jid.Domain() == "" || *pw == "" {
    26 		flag.Usage()
    26 		flag.Usage()
    27 		os.Exit(2)
    27 		os.Exit(2)
    28 	}
    28 	}
    29 
    29 
    30 	stat := make(chan xmpp.Status)
    30 	stat := make(chan xmpp.Status)